HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RV_ShaderBlock Class Reference

#include <RV_ShaderBlock.h>

+ Inheritance diagram for RV_ShaderBlock:

Public Member Functions

 ~RV_ShaderBlock () override
 
RV_VKBuffergetBufferObject ()
 Return the buffer object that backs this UBO or SSBO. More...
 
const voidgetCPUBuffer ()
 
bool uploadBuffer (RV_Render *r)
 
void downloadBuffer (RV_Render *r)
 
bool isDirty () const
 
bool isCompatible (const RV_VKDescriptorBinding &binding) const
 compare whether this block is compatible with a shader's binding More...
 
bool fillBuffer (const void *data, int offset=0, int size=0)
 
int getArrayLength () const
 Array length of variably sized arrays for SSBOs. More...
 
int getArrayOffset () const
 Offset in buffer of variably sized arrays for SSBOs. More...
 
bool uploadArray (RV_Render *r, const void *data, exint size, exint offset=0)
 Copy a bunch of bytes to the variable array component of the SSBO. More...
 
bool downloadArray (RV_Render *r, void *data, exint size, exint offset=0)
 Download bytes from the buffer variable array component of the SSBO. More...
 
template<typename T >
bool uploadArray (RV_Render *r, const T &data, exint offset=0)
 
template<typename T >
bool downloadArray (RV_Render *r, T &data, exint offset=0)
 
void print (RV_ShaderProgram *opt_shr=nullptr) const
 
bool bindUniform (int idx, RV_UniformType type, const void *data, exint data_size, int array_index=0)
 
- Public Member Functions inherited from RV_ShaderBindFuncs
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. More...
 
bool bindInt (const UT_StringRef &name, int v, int array_index=0, int *opt_idx=nullptr)
 
bool bindFloat (const UT_StringRef &name, fpreal32 v, int array_index=0, int *opt_idx=nullptr)
 Bind a single float value. More...
 
bool bindDouble (const UT_StringRef &name, fpreal64 v, int array_index=0, int *opt_idx=nullptr)
 Bind a single double value. GPU must support native FP64 values. More...
 
bool bindUint64 (const UT_StringRef &name, uint64 v, int array_index=0, int *opt_idx=nullptr)
 
bool bindInts (const UT_StringRef &name, const int *valarray, int array_size, int array_index=0, int *opt_idx=nullptr)
 Set values for a fixed-length integer array. More...
 
bool bindFloats (const UT_StringRef &name, const fpreal32 *valarray, int array_size, int array_index=0, int *opt_idx=nullptr)
 Set values for a fixed-length float array. More...
 
bool bindDoubles (const UT_StringRef &name, const fpreal64 *valarray, int array_size, int array_index=0, int *opt_idx=nullptr)
 Set values for a fixed-length double array. More...
 
bool bindUint64s (const UT_StringRef &name, const uint64 *valarray, int array_size, int array_index=0, int *opt_idx=nullptr)
 Set values for a uint64 handle array. More...
 
bool bindIntVector3 (const UT_StringRef &name, const int *valarray, int array_size, int array_index=0, int *opt_idx=nullptr)
 bind a series of ivec3s, using std140 packing (padded to ivec4) More...
 
bool bindVector3 (const UT_StringRef &name, const fpreal32 *valarray, int array_size, int array_index=0, int *opt_idx=nullptr)
 bind a series of vec3s, using std140 packing (padded to ivec4) More...
 
bool bindDVector3 (const UT_StringRef &name, const fpreal64 *valarray, int array_size, int array_index=0, int *opt_idx=nullptr)
 bind a series of dvec3s, using std140 packing (padded to ivec4) More...
 
bool bindVector (const UT_StringRef &name, const UT_Vector2F &v, int array_index=0, int *opt_idx=nullptr)
 Bind a single vec2 uniform value. More...
 
bool bindVector (const UT_StringRef &name, const UT_Vector3F &v, int array_index=0, int *opt_idx=nullptr)
 Bind a single vec3 uniform value. More...
 
bool bindVector (const UT_StringRef &name, const UT_Vector4F &v, int array_index=0, int *opt_idx=nullptr)
 Bind a single vec4 uniform value. More...
 
bool bindVector (const UT_StringRef &name, const UT_Vector2D &v, int array_index=0, int *opt_idx=nullptr)
 Bind a single dvec2 uniform value. More...
 
bool bindVector (const UT_StringRef &name, const UT_Vector3D &v, int array_index=0, int *opt_idx=nullptr)
 Set a single dvec3 uniform value. More...
 
bool bindVector (const UT_StringRef &name, const UT_Vector4D &v, int array_index=0, int *opt_idx=nullptr)
 Set a single dvec4 uniform value. More...
 
bool bindVector (const UT_StringRef &name, const UT_Vector2i &v, int array_index=0, int *opt_idx=nullptr)
 Bind a single ivec2 uniform value. More...
 
bool bindVector (const UT_StringRef &name, const UT_Vector3i &v, int array_index=0, int *opt_idx=nullptr)
 Set a single ivec3 uniform value. More...
 
bool bindVector (const UT_StringRef &name, const UT_Vector4i &v, int array_index=0, int *opt_idx=nullptr)
 Set a single ivec4 uniform value. More...
 
bool bindMatrix (const UT_StringRef &name, const UT_Matrix2F &m, int array_index=0, int *opt_idx=nullptr)
 Set a single 2x2 matrix value. More...
 
bool bindMatrix (const UT_StringRef &name, const UT_Matrix3F &m, int array_index=0, int *opt_idx=nullptr)
 Set a single 3x3 matrix value. More...
 
bool bindMatrix (const UT_StringRef &name, const UT_Matrix4F &m, int array_index=0, int *opt_idx=nullptr)
 Set a single 4x4 matrix value. More...
 
bool bindMatrix (const UT_StringRef &name, const UT_Matrix2D &m, int array_index=0, int *opt_idx=nullptr)
 Set a single 2x2 matrix value (dmat2). More...
 
bool bindMatrix (const UT_StringRef &name, const UT_Matrix3D &m, int array_index=0, int *opt_idx=nullptr)
 Set a single 3x3 matrix value (dmat3). More...
 
bool bindMatrix (const UT_StringRef &name, const UT_Matrix4D &m, int array_index=0, int *opt_idx=nullptr)
 Set a single 4x4 matrix value (dmat4). More...
 

Static Public Member Functions

static RV_ShaderBlockcreate (RV_Instance *inst, const RV_VKDescriptorBinding &binding_layout, const char *name=nullptr, uint32_t array_size=0)
 Create the shader block (either a UBO or SSBO) for the binding in a set. More...
 

Public Attributes

friend RV_ShaderBindFuncs
 
UT_Array< intmyBuiltinArrayIdxToLocalIdx
 
friend GR_Uniforms
 

Additional Inherited Members

- Protected Member Functions inherited from RV_ShaderBindFuncs
 RV_ShaderBindFuncs ()
 
virtual ~RV_ShaderBindFuncs ()
 

Detailed Description

Definition at line 305 of file RV_ShaderBlock.h.

Constructor & Destructor Documentation

RV_ShaderBlock::~RV_ShaderBlock ( )
override

Member Function Documentation

bool RV_ShaderBlock::bindUniform ( int  idx,
RV_UniformType  type,
const void data,
exint  data_size,
int  array_index = 0 
)
static RV_ShaderBlock* RV_ShaderBlock::create ( RV_Instance inst,
const RV_VKDescriptorBinding binding_layout,
const char *  name = nullptr,
uint32_t  array_size = 0 
)
static

Create the shader block (either a UBO or SSBO) for the binding in a set.

bool RV_ShaderBlock::downloadArray ( RV_Render r,
void data,
exint  size,
exint  offset = 0 
)

Download bytes from the buffer variable array component of the SSBO.

template<typename T >
bool RV_ShaderBlock::downloadArray ( RV_Render r,
T data,
exint  offset = 0 
)
inline

Download bytes from the buffer variable array component of the SSBO where data can be any type used to construct a span

Definition at line 378 of file RV_ShaderBlock.h.

void RV_ShaderBlock::downloadBuffer ( RV_Render r)

Fetches the contents of the GL buffer into the main mem block contained by this class.

bool RV_ShaderBlock::fillBuffer ( const void data,
int  offset = 0,
int  size = 0 
)

Copy a bunch of bytes to the buffer. If size=0, it assumes the full buffer size (or remaining size if ofset!=-0)

int RV_ShaderBlock::getArrayLength ( ) const
inline

Array length of variably sized arrays for SSBOs.

Definition at line 346 of file RV_ShaderBlock.h.

int RV_ShaderBlock::getArrayOffset ( ) const
inline

Offset in buffer of variably sized arrays for SSBOs.

Definition at line 349 of file RV_ShaderBlock.h.

RV_VKBuffer* RV_ShaderBlock::getBufferObject ( )
inline

Return the buffer object that backs this UBO or SSBO.

Definition at line 320 of file RV_ShaderBlock.h.

const void* RV_ShaderBlock::getCPUBuffer ( )
inline

Return the ptr to the CPU copy of buffer data, which must be downloaded with downloadBuffer to see the most recent value

Definition at line 324 of file RV_ShaderBlock.h.

bool RV_ShaderBlock::isCompatible ( const RV_VKDescriptorBinding binding) const

compare whether this block is compatible with a shader's binding

bool RV_ShaderBlock::isDirty ( ) const
inline

Definition at line 335 of file RV_ShaderBlock.h.

void RV_ShaderBlock::print ( RV_ShaderProgram opt_shr = nullptr) const
bool RV_ShaderBlock::uploadArray ( RV_Render r,
const void data,
exint  size,
exint  offset = 0 
)

Copy a bunch of bytes to the variable array component of the SSBO.

template<typename T >
bool RV_ShaderBlock::uploadArray ( RV_Render r,
const T data,
exint  offset = 0 
)
inline

Copy a bunch of bytes to the variable array component of the SSBO where data can be any type used to construct a span

Definition at line 366 of file RV_ShaderBlock.h.

bool RV_ShaderBlock::uploadBuffer ( RV_Render r)

commits any changes to the buffer object, creating the buffer object if required.

Member Data Documentation

friend RV_ShaderBlock::GR_Uniforms

Definition at line 475 of file RV_ShaderBlock.h.

UT_Array<int> RV_ShaderBlock::myBuiltinArrayIdxToLocalIdx

Definition at line 474 of file RV_ShaderBlock.h.

friend RV_ShaderBlock::RV_ShaderBindFuncs

Definition at line 308 of file RV_ShaderBlock.h.


The documentation for this class was generated from the following file: