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 char *name=nullptr)
 
 ~RV_ShaderVariableSet ()
 
bool hasBinding (const UT_StringRef &name) const
 Returns true if binding named 'name' 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...
 
const RV_VKDescriptorSetInfogetSetInfo () const
 The raw Vulkan descritor set create info. 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 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 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)
 
void clearBinding (RV_Render *inst, const UT_StringRef &name)
 Clear a bound UBO, SSBO, buffer view, or texture from binding 'name'. More...
 
void clearBinding (RV_Render *inst, int binding_num)
 Clear a bound UBO, SSBO, buffer view, or texture from the binding index. More...
 
void commitBindings (RV_Instance *inst, RV_VKCommandBuffer *cb)
 Take any pending bindings and write them to the descriptor set. More...
 
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...
 
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 char *name=nullptr)
 

Friends

class RV_Render
 

Detailed Description

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

Definition at line 49 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 char *  name = nullptr 
)
RV_ShaderVariableSet::~RV_ShaderVariableSet ( )

Member Function Documentation

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,
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 ( RV_Render inst,
const UT_StringRef name 
)

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

void RV_ShaderVariableSet::clearBinding ( RV_Render inst,
int  binding_num 
)

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

void RV_ShaderVariableSet::commitBindings ( RV_Instance inst,
RV_VKCommandBuffer cb 
)

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 char *  name = nullptr 
)
static
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_VKDescriptorSetInfo& RV_ShaderVariableSet::getSetInfo ( ) const
inline

The raw Vulkan descritor set create info.

Definition at line 77 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 205 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::isCompatibleToBind ( const RV_VKDescriptorSetInfo pipe_layout) const

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

bool RV_ShaderVariableSet::isDirty ( ) const
inline

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

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.

Friends And Related Function Documentation

friend class RV_Render
friend

Definition at line 215 of file RV_ShaderVariableSet.h.


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