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

A collection of Vulkan UBO, SSBO, and Image shader bindings (descriptor set) More...

#include <RV_ShaderVariableSet.h>

Public Member Functions

 RV_ShaderVariableSet (RV_Instance *inst, const RV_VKDescriptorSetInfo *layout, UT_UniquePtr< RV_VKDescriptorLayout > desc_layout, const UT_StringHolder &name=UT_StringHolder())
 
 ~RV_ShaderVariableSet ()
 
bool hasBinding (const UT_StringRef &name) const
 Returns true if binding named 'name' exists. More...
 
bool hasBinding (uint32_t binding_num) const
 Returns true if binding exists. More...
 
const UT_Array
< RV_VKDescriptorBinding > & 
getBindings () const
 The list of bindings. More...
 
const RV_VKDescriptorBindinggetBinding (uint32_t binding_num) const
 Return a single binding by index. More...
 
RV_VKDescriptorBinding getBinding (const UT_StringRef &name) const
 Return a single binding by name. More...
 
VkDescriptorSet getVkDescriptorSet ()
 The raw Vulkan descriptor set which this set represents. More...
 
RV_VKDescriptorSetgetRVDescriptorSet ()
 
const RV_ResourceIDgetDescriptorSetId () const
 
const RV_VKDescriptorSetInfogetSetInfo () const
 The raw Vulkan descritor set create info. More...
 
const UT_StringHoldergetName () const
 Label for debugging. More...
 
bool getBufferBlock (const UT_StringRef &name, RV_ShaderBlock *&out_block)
 
bool getBufferBlock (const UT_StringRef &name, const RV_ShaderBlock *&) const
 
bool getBufferBlock (int binding_num, RV_ShaderBlock *&out_block)
 
bool getBufferBlock (int binding_num, const RV_ShaderBlock *&out_block) const
 
bool getTexture (const UT_StringRef &name, RV_VKImage *&out_image)
 
bool getTexture (const UT_StringRef &name, const RV_VKImage *&) const
 
bool getTexture (int binding_num, RV_VKImage *&out_image)
 
bool getTexture (int binding_num, const RV_VKImage *&out_image) const
 
bool getBufferView (const UT_StringRef &name, RV_VKBuffer *&out_buffer)
 
bool getBufferView (const UT_StringRef &name, const RV_VKBuffer *&) const
 
bool getBufferView (int binding_num, RV_VKBuffer *&out_buffer)
 
bool getBufferView (int binding_num, const RV_VKBuffer *&out_buffer) const
 
bool getAccelStruct (const UT_StringRef &name, RV_VKAccelerationStructure *&out_as)
 
bool getAccelStruct (const UT_StringRef &name, const RV_VKAccelerationStructure *&out_as) const
 
bool getAccelStruct (int binding_num, RV_VKAccelerationStructure *&out_as)
 
bool getAccelStruct (int binding_num, const RV_VKAccelerationStructure *&out_as) const
 
bool attachBufferBlock (RV_Instance *inst, const UT_StringRef &name, RV_ShaderBlock *buffer_block, int index=0)
 
bool attachBufferBlock (RV_Instance *inst, int binding_num, RV_ShaderBlock *buffer_block, int index=0)
 
bool attachBufferView (RV_Instance *inst, const UT_StringRef &name, RV_VKBuffer *buffer, int index=0)
 
bool attachBufferView (RV_Instance *inst, int binding_num, RV_VKBuffer *buffer, int index=0)
 
bool attachBuffer (RV_Instance *inst, const UT_StringRef &name, RV_VKBuffer *buffer, int index=0)
 
bool attachBuffer (RV_Instance *inst, int binding_num, RV_VKBuffer *buffer, int index=0)
 
bool attachTexture (RV_Instance *inst, const UT_StringRef &name, RV_VKImage *image, RV_VKSampler *opt_sampler, int index=0)
 
bool attachTexture (RV_Instance *inst, int binding_num, RV_VKImage *image, RV_VKSampler *opt_sampler, int index=0)
 
bool attachTexture (RV_Instance *inst, const UT_StringRef &name, RV_VKImage *image, int index=0)
 
bool attachTexture (RV_Instance *inst, int binding_num, RV_VKImage *image, int index=0)
 
bool attachAccelStruct (RV_Instance *inst, const UT_StringRef &name, RV_VKAccelerationStructure *accel_struct, int index=0)
 
bool attachAccelStruct (RV_Instance *inst, int binding_num, RV_VKAccelerationStructure *accel_struct, int index=0)
 
void clearBinding (const UT_StringRef &name)
 Clear a bound UBO, SSBO, buffer view, or texture from binding 'name'. More...
 
void clearBinding (RV_Render *r, const UT_StringRef &name)
 
void clearBinding (int binding_num)
 Clear a bound UBO, SSBO, buffer view, or texture from the binding index. More...
 
void clearBinding (RV_Render *r, int binding_num)
 
void clearExtraBindings ()
 
void commitBindings (RV_Render *r)
 Take any pending bindings and write them to the descriptor set. More...
 
bool validateBinding (RV_Instance *inst, int binding_num)
 
bool validateBinding (RV_Instance *inst, int binding_num) const
 
bool validateBindings (RV_Instance *inst) const
 
void recordBindings (RV_VKCommandBuffer *cb) const
 
bool isReady (RV_Instance *inst) const
 Return true if all bindings have been assigned to the set. More...
 
bool isDirty () const
 Return true if the set has been modified since the last commit. More...
 
bool isCompatibleToBind (const RV_VKDescriptorSetInfo &pipe_layout) const
 
int getSetNumber () const
 Return the binding number of the set that this set was created with. More...
 
int getLayoutID () const
 Return the layout ID of the set that this set was created with. More...
 
void print () const
 Debug dump to stderr all information about the bindings. More...
 

Static Public Member Functions

static UT_UniquePtr
< RV_ShaderVariableSet
create (RV_Instance *inst, const RV_VKDescriptorSetInfo *layout, const RV_ShaderVariableSet *opt_base=nullptr, const UT_StringHolder &name=UT_StringHolder())
 

Friends

class RV_Render
 

Detailed Description

A collection of Vulkan UBO, SSBO, and Image shader bindings (descriptor set)

Definition at line 47 of file RV_ShaderVariableSet.h.

Constructor & Destructor Documentation

RV_ShaderVariableSet::RV_ShaderVariableSet ( RV_Instance inst,
const RV_VKDescriptorSetInfo layout,
UT_UniquePtr< RV_VKDescriptorLayout desc_layout,
const UT_StringHolder name = UT_StringHolder() 
)
RV_ShaderVariableSet::~RV_ShaderVariableSet ( )

Member Function Documentation

bool RV_ShaderVariableSet::attachAccelStruct ( RV_Instance inst,
const UT_StringRef name,
RV_VKAccelerationStructure accel_struct,
int  index = 0 
)

Attach an acceleration structure to this variable set. Returns false if the binding name doesn't exist or the acceleration structure is null

bool RV_ShaderVariableSet::attachAccelStruct ( RV_Instance inst,
int  binding_num,
RV_VKAccelerationStructure accel_struct,
int  index = 0 
)

Attach an acceleration structure to this variable set. Returns false if the binding index doesn't exist or the acceleration structure is null

bool RV_ShaderVariableSet::attachBuffer ( RV_Instance inst,
const UT_StringRef name,
RV_VKBuffer buffer,
int  index = 0 
)

Attach a buffer view (TBO in GL) to this variable set. Returns false if the binding name doesn't exist, the buffer is null, or it isn't compatible with the layout of the binding.

bool RV_ShaderVariableSet::attachBuffer ( RV_Instance inst,
int  binding_num,
RV_VKBuffer buffer,
int  index = 0 
)

Attach a buffer view (TBO in GL) to this variable set. Returns false if the binding index doesn't exist, the buffer is null, or it isn't compatible with the layout of the binding.

bool RV_ShaderVariableSet::attachBufferBlock ( RV_Instance inst,
const UT_StringRef name,
RV_ShaderBlock buffer_block,
int  index = 0 
)

Attach a UBO or SSBO to this variable set. Returns false if the binding name doesn't exist, the block is null, or it isn't compatible with the layout of the binding.

bool RV_ShaderVariableSet::attachBufferBlock ( RV_Instance inst,
int  binding_num,
RV_ShaderBlock buffer_block,
int  index = 0 
)

Attach a UBO or SSBO to this variable set. Returns false if the binding index doesn't exist, the block is null, or it isn't compatible with the layout of the binding.

bool RV_ShaderVariableSet::attachBufferView ( RV_Instance inst,
const UT_StringRef name,
RV_VKBuffer buffer,
int  index = 0 
)

Attach a buffer view (TBO in GL) to this variable set. Returns false if the binding name doesn't exist, the buffer is null, or it isn't compatible with the layout of the binding.

bool RV_ShaderVariableSet::attachBufferView ( RV_Instance inst,
int  binding_num,
RV_VKBuffer buffer,
int  index = 0 
)

Attach a buffer view (TBO in GL) to this variable set. Returns false if the binding index doesn't exist, the buffer is null, or it isn't compatible with the layout of the binding.

bool RV_ShaderVariableSet::attachTexture ( RV_Instance inst,
const UT_StringRef name,
RV_VKImage image,
RV_VKSampler opt_sampler,
int  index = 0 
)

Attach a texture or image to this variable set. Returns false if the binding name doesn't exist, the image is null, or it isn't compatible with the sampler type of the binding.

bool RV_ShaderVariableSet::attachTexture ( RV_Instance inst,
int  binding_num,
RV_VKImage image,
RV_VKSampler opt_sampler,
int  index = 0 
)

Attach a texture or image to this variable set. Returns false if the binding index doesn't exist, the image is null, or it isn't compatible with the sampler type of the binding.

bool RV_ShaderVariableSet::attachTexture ( RV_Instance inst,
const UT_StringRef name,
RV_VKImage image,
int  index = 0 
)

Attach a texture or image to this variable set. Returns false if the binding name doesn't exist, the image is null, or it isn't compatible with the sampler type of the binding.

bool RV_ShaderVariableSet::attachTexture ( RV_Instance inst,
int  binding_num,
RV_VKImage image,
int  index = 0 
)

Attach a texture or image to this variable set. Returns false if the binding index doesn't exist, the image is null, or it isn't compatible with the sampler type of the binding.

void RV_ShaderVariableSet::clearBinding ( const UT_StringRef name)

Clear a bound UBO, SSBO, buffer view, or texture from binding 'name'.

void RV_ShaderVariableSet::clearBinding ( RV_Render r,
const UT_StringRef name 
)
void RV_ShaderVariableSet::clearBinding ( int  binding_num)

Clear a bound UBO, SSBO, buffer view, or texture from the binding index.

void RV_ShaderVariableSet::clearBinding ( RV_Render r,
int  binding_num 
)
void RV_ShaderVariableSet::clearExtraBindings ( )
void RV_ShaderVariableSet::commitBindings ( RV_Render r)

Take any pending bindings and write them to the descriptor set.

static UT_UniquePtr<RV_ShaderVariableSet> RV_ShaderVariableSet::create ( RV_Instance inst,
const RV_VKDescriptorSetInfo layout,
const RV_ShaderVariableSet opt_base = nullptr,
const UT_StringHolder name = UT_StringHolder() 
)
static
bool RV_ShaderVariableSet::getAccelStruct ( const UT_StringRef name,
RV_VKAccelerationStructure *&  out_as 
)

Fetch a bound acceleration structure by the given name (may be null) Return false if the binding doesn't exist or isn't an acceleration structure.

bool RV_ShaderVariableSet::getAccelStruct ( const UT_StringRef name,
const RV_VKAccelerationStructure *&  out_as 
) const

Fetch a bound acceleration structure by the given name (may be null) Return false if the binding doesn't exist or isn't an acceleration structure.

bool RV_ShaderVariableSet::getAccelStruct ( int  binding_num,
RV_VKAccelerationStructure *&  out_as 
)

Fetch a bound acceleration structure by the given index (may be null) Return false if the binding doesn't exist or isn't an acceleration structure.

bool RV_ShaderVariableSet::getAccelStruct ( int  binding_num,
const RV_VKAccelerationStructure *&  out_as 
) const

Fetch a bound acceleration structure by the given index (may be null) Return false if the binding doesn't exist or isn't an acceleration structure.

const RV_VKDescriptorBinding& RV_ShaderVariableSet::getBinding ( uint32_t  binding_num) const

Return a single binding by index.

RV_VKDescriptorBinding RV_ShaderVariableSet::getBinding ( const UT_StringRef name) const

Return a single binding by name.

const UT_Array<RV_VKDescriptorBinding>& RV_ShaderVariableSet::getBindings ( ) const

The list of bindings.

bool RV_ShaderVariableSet::getBufferBlock ( const UT_StringRef name,
RV_ShaderBlock *&  out_block 
)

Fetch a bound UBO or SSBO with the given name (may be null) Return false if the binding doesn't exist or isn't a buffer object.

bool RV_ShaderVariableSet::getBufferBlock ( const UT_StringRef name,
const RV_ShaderBlock *&   
) const

Fetch a bound UBO or SSBO with the given name (may be null) Return false if the binding doesn't exist or isn't a buffer object.

bool RV_ShaderVariableSet::getBufferBlock ( int  binding_num,
RV_ShaderBlock *&  out_block 
)

Fetch a bound UBO or SSBO by index (may be null). Return false if the binding doesn't exist or isn't a buffer object.

bool RV_ShaderVariableSet::getBufferBlock ( int  binding_num,
const RV_ShaderBlock *&  out_block 
) const

Fetch a bound UBO or SSBO by index (may be null). Return false if the binding doesn't exist or isn't a buffer object.

bool RV_ShaderVariableSet::getBufferView ( const UT_StringRef name,
RV_VKBuffer *&  out_buffer 
)

Fetch a bound buffer view (TBO in GL) by the given name (may be null) Return false if the binding doesn't exist or isn't a buffer view.

bool RV_ShaderVariableSet::getBufferView ( const UT_StringRef name,
const RV_VKBuffer *&   
) const

Fetch a bound buffer view (TBO in GL) by the given name (may be null) Return false if the binding doesn't exist or isn't a buffer view.

bool RV_ShaderVariableSet::getBufferView ( int  binding_num,
RV_VKBuffer *&  out_buffer 
)

Fetch a bound buffer view (TBO in GL) by index (may be null) Return false if the binding doesn't exist or isn't a buffer view.

bool RV_ShaderVariableSet::getBufferView ( int  binding_num,
const RV_VKBuffer *&  out_buffer 
) const

Fetch a bound buffer view (TBO in GL) by index (may be null) Return false if the binding doesn't exist or isn't a buffer view.

const RV_ResourceID& RV_ShaderVariableSet::getDescriptorSetId ( ) const
int RV_ShaderVariableSet::getLayoutID ( ) const
inline

Return the layout ID of the set that this set was created with.

Definition at line 305 of file RV_ShaderVariableSet.h.

const UT_StringHolder& RV_ShaderVariableSet::getName ( ) const
inline

Label for debugging.

Definition at line 93 of file RV_ShaderVariableSet.h.

RV_VKDescriptorSet* RV_ShaderVariableSet::getRVDescriptorSet ( )
inline

Definition at line 83 of file RV_ShaderVariableSet.h.

const RV_VKDescriptorSetInfo& RV_ShaderVariableSet::getSetInfo ( ) const
inline

The raw Vulkan descritor set create info.

Definition at line 89 of file RV_ShaderVariableSet.h.

int RV_ShaderVariableSet::getSetNumber ( ) const
inline

Return the binding number of the set that this set was created with.

Definition at line 301 of file RV_ShaderVariableSet.h.

bool RV_ShaderVariableSet::getTexture ( const UT_StringRef name,
RV_VKImage *&  out_image 
)

Fetch a bound texture with the given name (may be null) Return false if the binding doesn't exist or isn't a texture.

bool RV_ShaderVariableSet::getTexture ( const UT_StringRef name,
const RV_VKImage *&   
) const

Fetch a bound texture with the given name (may be null) Return false if the binding doesn't exist or isn't a texture.

bool RV_ShaderVariableSet::getTexture ( int  binding_num,
RV_VKImage *&  out_image 
)

Fetch a bound texture by index (may be null) Return false if the binding doesn't exist or isn't a texture.

bool RV_ShaderVariableSet::getTexture ( int  binding_num,
const RV_VKImage *&  out_image 
) const

Fetch a bound texture by index (may be null) Return false if the binding doesn't exist or isn't a texture.

VkDescriptorSet RV_ShaderVariableSet::getVkDescriptorSet ( )

The raw Vulkan descriptor set which this set represents.

bool RV_ShaderVariableSet::hasBinding ( const UT_StringRef name) const

Returns true if binding named 'name' exists.

bool RV_ShaderVariableSet::hasBinding ( uint32_t  binding_num) const
inline

Returns true if binding exists.

Definition at line 67 of file RV_ShaderVariableSet.h.

bool RV_ShaderVariableSet::isCompatibleToBind ( const RV_VKDescriptorSetInfo pipe_layout) const
inline

Return if this variable set is compatible with the given pipeline binding layout of the shader.

Definition at line 296 of file RV_ShaderVariableSet.h.

bool RV_ShaderVariableSet::isDirty ( ) const
inline

Return true if the set has been modified since the last commit.

Definition at line 286 of file RV_ShaderVariableSet.h.

bool RV_ShaderVariableSet::isReady ( RV_Instance inst) const

Return true if all bindings have been assigned to the set.

void RV_ShaderVariableSet::print ( ) const

Debug dump to stderr all information about the bindings.

void RV_ShaderVariableSet::recordBindings ( RV_VKCommandBuffer cb) const
bool RV_ShaderVariableSet::validateBinding ( RV_Instance inst,
int  binding_num 
)
bool RV_ShaderVariableSet::validateBinding ( RV_Instance inst,
int  binding_num 
) const
bool RV_ShaderVariableSet::validateBindings ( RV_Instance inst) const

Friends And Related Function Documentation

friend class RV_Render
friend

Definition at line 315 of file RV_ShaderVariableSet.h.


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