13 #ifndef RV_ShaderBlock_h
14 #define RV_ShaderBlock_h
49 struct UniformLocation
52 UniformLocation(
const char*
name)
53 : owned_stringref(name), name(&owned_stringref)
62 UniformLocation(
int idx)
63 : owned_idx(idx), idx(&owned_idx)
68 UniformLocation(
const char*
name,
int* idx)
69 : owned_stringref(name), name(&owned_stringref), idx(idx)
73 : name(&name), idx(idx)
103 int* opt_idx =
nullptr);
113 int* opt_idx =
nullptr);
117 int* opt_idx =
nullptr);
121 int* opt_idx =
nullptr);
127 int* opt_idx =
nullptr);
134 int* opt_idx =
nullptr);
140 int* opt_idx =
nullptr);
147 int* opt_idx =
nullptr);
153 int* opt_idx =
nullptr);
163 int* opt_idx =
nullptr);
170 int* opt_idx =
nullptr);
177 int* opt_idx =
nullptr);
183 int* opt_idx =
nullptr);
188 int* opt_idx =
nullptr);
193 int* opt_idx =
nullptr);
199 int* opt_idx =
nullptr);
205 int* opt_idx =
nullptr);
210 int* opt_idx =
nullptr);
216 int* opt_idx =
nullptr);
222 int* opt_idx =
nullptr);
227 int* opt_idx =
nullptr);
233 int* opt_idx =
nullptr);
238 int* opt_idx =
nullptr);
244 int* opt_idx =
nullptr);
250 int* opt_idx =
nullptr);
256 int* opt_idx =
nullptr);
262 int* opt_idx =
nullptr);
272 virtual void copyToBuffer(
281 virtual void copyToBufferStride(
315 const char*
name =
nullptr,
316 uint32_t array_size = 0);
322 const char*
name =
nullptr,
323 uint32_t array_size = 0,
324 bool cpu_mapped =
false);
349 exint getSize()
const;
414 void printMemberValue(
419 void printMemberList(
421 int indent,
int base_offset,
432 const char*
name)
override;
443 const char*
name)
override;
449 const char *instance_name,
452 uint32_t array_length,
463 int myBindingNum = -1;
489 int array_index = 0);
531 const char*
name)
override;
536 void copyToBufferStride(
542 const char*
name)
override;
544 bool myDirtyFlag =
true;
Helper tie-in class for binding functions for UBOs and SSBOs.
constexpr span< ElementType, Extent > make_span(span< ElementType, Extent > s) noexcept
UT_UniquePtr< RV_VKBuffer > RV_VKBufferPtr
~RV_PushConstants() override
void forceDirty()
Force the block to be re-uploaded to the GPU, even if not dirtied.
friend RV_ShaderBindFuncs
const void * getCPUBuffer()
unsigned long long uint64
RV_VKBuffer * getBufferObject()
Return the buffer object that backs this UBO or SSBO.
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
bool uploadArray(RV_Render *r, const T &data, exint offset=0)
int getArrayOffset() const
Offset in buffer of variably sized arrays for SSBOs.
bool fillBuffer(const void *data, int offset=0, int size=0)
bool bindUniform(const UT_StringRef &name, RV_UniformType type, const void *data, exint data_size, int array_index=0, int array_range=1, int *opt_idx=nullptr)
Set the value of the uniform 'name' with a block of memory.
virtual void copyToBuffer(const void *data, int size, int offset, const char *name)=0
Copy array of data into the CPU buffer.
int getArrayLength() const
Array length of variably sized arrays for SSBOs.
RV_PushConstants(RV_Render *r)
GLint GLenum GLboolean GLsizei stride
virtual const RV_Uniform * getUniform(const UT_StringRef &name, int *opt_idx)=0
bool downloadArray(RV_Render *r, T &data, exint offset=0)
GLuint const GLchar * name
virtual ~RV_ShaderBindFuncs()
Handle to the main interface of Vulkan.
int getBindingNum() const
get the binding location of the binding used to create this block
virtual void copyToBufferStride(const void *data, int len, int size, int stride, int offset, const char *name)=0
constexpr size_type size_bytes() const noexcept
bool upload(RV_Render *r)
Write all bound values to the push constant memory.
bool isDirty() const
Whether this block requires uploading to the GPU.
FMT_INLINE void print(format_string< T...> fmt, T &&...args)
constexpr pointer data() const noexcept
UT_Array< int > myBuiltinArrayIdxToLocalIdx