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)
102 int* opt_idx =
nullptr);
112 int* opt_idx =
nullptr);
116 int* opt_idx =
nullptr);
120 int* opt_idx =
nullptr);
126 int* opt_idx =
nullptr);
133 int* opt_idx =
nullptr);
139 int* opt_idx =
nullptr);
146 int* opt_idx =
nullptr);
152 int* opt_idx =
nullptr);
162 int* opt_idx =
nullptr);
169 int* opt_idx =
nullptr);
176 int* opt_idx =
nullptr);
182 int* opt_idx =
nullptr);
187 int* opt_idx =
nullptr);
192 int* opt_idx =
nullptr);
198 int* opt_idx =
nullptr);
204 int* opt_idx =
nullptr);
209 int* opt_idx =
nullptr);
215 int* opt_idx =
nullptr);
221 int* opt_idx =
nullptr);
226 int* opt_idx =
nullptr);
232 int* opt_idx =
nullptr);
237 int* opt_idx =
nullptr);
243 int* opt_idx =
nullptr);
249 int* opt_idx =
nullptr);
255 int* opt_idx =
nullptr);
261 int* opt_idx =
nullptr);
266 int* opt_idx)
const = 0;
271 virtual void copyToBuffer(
280 virtual void copyToBufferStride(
314 const char*
name =
nullptr,
315 uint32_t array_size = 0);
394 void printMemberValue(
399 void printMemberList(
401 int indent,
int base_offset,
413 const char*
name)
override;
424 const char*
name)
override;
430 const char *instance_name,
432 uint32_t array_length,
469 int array_index = 0);
511 const char*
name)
override;
516 void copyToBufferStride(
522 const char*
name)
override;
524 bool myDirtyFlag =
true;
virtual const RV_Uniform * getUniform(const UT_StringRef &name, int *opt_idx) const =0
bool bindUniform(const UT_StringRef &name, RV_UniformType type, const void *data, exint data_size, int array_index=0, int *opt_idx=nullptr)
Set the value of the uniform 'name' with a block of memory.
Helper tie-in class for binding functions for UBOs and SSBOs.
constexpr span< ElementType, Extent > make_span(span< ElementType, Extent > s) noexcept
~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)
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
bool downloadArray(RV_Render *r, T &data, exint offset=0)
GLuint const GLchar * name
virtual ~RV_ShaderBindFuncs()
Handle to the main interface of Vulkan.
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