13 #ifndef RV_ShaderBlock_h
14 #define RV_ShaderBlock_h
48 struct UniformLocation
51 UniformLocation(
const char*
name)
52 : owned_stringref(name), name(&owned_stringref)
61 UniformLocation(
int idx)
62 : owned_idx(idx), idx(&owned_idx)
67 UniformLocation(
const char*
name,
int* idx)
68 : owned_stringref(name), name(&owned_stringref), idx(idx)
72 : name(&name), idx(idx)
105 int* opt_idx =
nullptr);
115 int* opt_idx =
nullptr);
119 int* opt_idx =
nullptr);
123 int* opt_idx =
nullptr);
129 int* opt_idx =
nullptr);
136 int* opt_idx =
nullptr);
142 int* opt_idx =
nullptr);
149 int* opt_idx =
nullptr);
155 int* opt_idx =
nullptr);
165 int* opt_idx =
nullptr);
172 int* opt_idx =
nullptr);
179 int* opt_idx =
nullptr);
185 int* opt_idx =
nullptr);
190 int* opt_idx =
nullptr);
195 int* opt_idx =
nullptr);
201 int* opt_idx =
nullptr);
207 int* opt_idx =
nullptr);
212 int* opt_idx =
nullptr);
218 int* opt_idx =
nullptr);
224 int* opt_idx =
nullptr);
229 int* opt_idx =
nullptr);
235 int* opt_idx =
nullptr);
240 int* opt_idx =
nullptr);
246 int* opt_idx =
nullptr);
252 int* opt_idx =
nullptr);
258 int* opt_idx =
nullptr);
264 int* opt_idx =
nullptr);
272 static void printMemberValue(
275 int base_offset,
int fixed_size,
void *data,
277 static void printMemberList(
279 int indent,
int base_offset,
int array_length,
int fixed_size,
285 virtual void copyToBuffer(
294 virtual void copyToBufferStride(
324 const char*
name =
nullptr,
325 uint32_t array_size = 0);
331 const char*
name =
nullptr,
332 uint32_t array_size = 0,
333 bool cpu_mapped =
false);
358 exint getSize()
const;
430 const char*
name)
override;
441 const char*
name)
override;
447 const char *instance_name,
450 uint32_t array_length,
461 int myBindingNum = -1;
487 int array_index = 0);
531 const char*
name)
override;
536 void copyToBufferStride(
542 const char*
name)
override;
544 bool myDirtyFlag =
true;
void print(RV_ShaderProgramBase *sh) const
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.
GLint GLint GLsizei GLint GLenum GLenum type
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
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
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
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