HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RV_ShaderProgramBase Class Referenceabstract

#include <RV_ShaderProgram.h>

+ Inheritance diagram for RV_ShaderProgramBase:

Public Member Functions

 RV_ShaderProgramBase (RV_Instance *inst, RV_VKPipelineLayout *pipe_layout)
 
virtual ~RV_ShaderProgramBase ()
 
void setName (const UT_StringHolder &name)
 Set a descriptive name for the shader. More...
 
const UT_StringHoldername () const
 Descriptive name of the shader. More...
 
virtual RV_ShaderType getShaderType () const =0
 Type of shader - graphics or compute. More...
 
int getMaxSetNumber () const
 The number of descriptor sets in the shader. More...
 
bool hasSet (int set_num) const
 Query if set 'set_num' is used by the shader. More...
 
bool isSetCompatible (const RV_ShaderVariableSet &set) const
 Return true if 'set' is compatable with the set layout in this shader. More...
 
const RV_VKDescriptorSetInfogetSetInfo (int set_num) const
 Query information on set 'set_num'. More...
 
UT_UniquePtr
< RV_ShaderVariableSet
createSet (RV_Instance *inst, int set_num) const
 Create a shader varaible set (descriptor set) for set 'set_num'. More...
 
const RV_VKPipelineLayoutgetLayout () const
 The layout of all sets and inputs of the shader. More...
 
bool hasBinding (const UT_StringRef &name) const
 Query if a binding named 'name' exists. More...
 
const RV_VKDescriptorBindinggetBinding (int set, int binding) const
 Return a binding at index 'binding' for set index 'set'. More...
 
const RV_VKDescriptorBindinggetBinding (const UT_StringRef &name) const
 Return a binding for 'name'. More...
 
const UT_Array< const
RV_VKDescriptorBinding * > & 
getBindingList () const
 Return the list of set bindings. More...
 
bool hasUniform (const UT_StringRef &name) const
 Query if the uniform named 'name' exists. More...
 
const RV_UniformgetUniform (const UT_StringRef &name) const
 Return type, size, and offset information about the uniform. More...
 
const UT_Array< const
RV_Uniform * > & 
getUniformList () const
 Return a list of all uniforms in this shader. More...
 
bool hasPushConstant (const UT_StringRef &name) const
 Query if push constant with 'name' exists. More...
 
const RV_UniformgetPushConstant (const UT_StringRef &name, int *opt_idx) const
 Fetch the push constant 'name' with an optional array index. More...
 
const UT_Array
< RV_VKPushConstantRange > & 
getPushConstantRanges () const
 
virtual void print () const
 Debug print message. More...
 

Static Protected Member Functions

static RV_VKPipelineLayoutloadShaderProgram (RV_Instance *inst, const char *program, const char *extra_defines=nullptr)
 
static RV_VKPipelineLayoutcreateShaderProgram (RV_Instance *inst, RV_VKShader &shader, const char *name=nullptr)
 
static RV_VKPipelineLayoutcreateShaderProgram (RV_Instance *inst, const UT_StringArray &filenames, const char *name=nullptr)
 

Protected Attributes

UT_Array< RV_ShaderInputmyInputs
 
UT_ArrayStringMap< intmyInputTable
 
UT_UniquePtr< const
RV_VKPipelineLayout
myLayout
 
UT_Array< const RV_Uniform * > myUniforms
 
UT_ArrayStringMap< intmyUniformTable
 Mapping of uniform names, to indices in myUniforms. More...
 
UT_Array< const
RV_VKDescriptorBinding * > 
myBindings
 
UT_ArrayStringMap< std::pair
< int, int > > 
myBindingTable
 mapping of binding name to set + binding number More...
 
UT_Array< const RV_Uniform * > myPushConstants
 
UT_ArrayStringMap< intmyPushConstTable
 
UT_StringHolder myName
 
friend RV_Geometry
 
friend RV_ShaderVariableSet
 

Detailed Description

class for shared functionality between different types of shaders: mainly accessing the the pipeline layout. Other shader types can build on extra functionality, e.g. input attributes for Graphics

Definition at line 84 of file RV_ShaderProgram.h.

Constructor & Destructor Documentation

RV_ShaderProgramBase::RV_ShaderProgramBase ( RV_Instance inst,
RV_VKPipelineLayout pipe_layout 
)
virtual RV_ShaderProgramBase::~RV_ShaderProgramBase ( )
virtual

Member Function Documentation

UT_UniquePtr<RV_ShaderVariableSet> RV_ShaderProgramBase::createSet ( RV_Instance inst,
int  set_num 
) const

Create a shader varaible set (descriptor set) for set 'set_num'.

static RV_VKPipelineLayout* RV_ShaderProgramBase::createShaderProgram ( RV_Instance inst,
RV_VKShader shader,
const char *  name = nullptr 
)
staticprotected
static RV_VKPipelineLayout* RV_ShaderProgramBase::createShaderProgram ( RV_Instance inst,
const UT_StringArray filenames,
const char *  name = nullptr 
)
staticprotected
const RV_VKDescriptorBinding* RV_ShaderProgramBase::getBinding ( int  set,
int  binding 
) const

Return a binding at index 'binding' for set index 'set'.

const RV_VKDescriptorBinding* RV_ShaderProgramBase::getBinding ( const UT_StringRef name) const

Return a binding for 'name'.

const UT_Array<const RV_VKDescriptorBinding*>& RV_ShaderProgramBase::getBindingList ( ) const

Return the list of set bindings.

const RV_VKPipelineLayout& RV_ShaderProgramBase::getLayout ( ) const
inline

The layout of all sets and inputs of the shader.

Definition at line 130 of file RV_ShaderProgram.h.

int RV_ShaderProgramBase::getMaxSetNumber ( ) const
inline

The number of descriptor sets in the shader.

Definition at line 102 of file RV_ShaderProgram.h.

const RV_Uniform* RV_ShaderProgramBase::getPushConstant ( const UT_StringRef name,
int opt_idx 
) const

Fetch the push constant 'name' with an optional array index.

const UT_Array<RV_VKPushConstantRange>& RV_ShaderProgramBase::getPushConstantRanges ( ) const
const RV_VKDescriptorSetInfo* RV_ShaderProgramBase::getSetInfo ( int  set_num) const
inline

Query information on set 'set_num'.

Definition at line 116 of file RV_ShaderProgram.h.

virtual RV_ShaderType RV_ShaderProgramBase::getShaderType ( ) const
pure virtual

Type of shader - graphics or compute.

Implemented in RV_ShaderCompute, and RV_ShaderProgram.

const RV_Uniform* RV_ShaderProgramBase::getUniform ( const UT_StringRef name) const

Return type, size, and offset information about the uniform.

const UT_Array<const RV_Uniform*>& RV_ShaderProgramBase::getUniformList ( ) const

Return a list of all uniforms in this shader.

bool RV_ShaderProgramBase::hasBinding ( const UT_StringRef name) const

Query if a binding named 'name' exists.

bool RV_ShaderProgramBase::hasPushConstant ( const UT_StringRef name) const

Query if push constant with 'name' exists.

bool RV_ShaderProgramBase::hasSet ( int  set_num) const
inline

Query if set 'set_num' is used by the shader.

Definition at line 107 of file RV_ShaderProgram.h.

bool RV_ShaderProgramBase::hasUniform ( const UT_StringRef name) const

Query if the uniform named 'name' exists.

bool RV_ShaderProgramBase::isSetCompatible ( const RV_ShaderVariableSet set) const

Return true if 'set' is compatable with the set layout in this shader.

static RV_VKPipelineLayout* RV_ShaderProgramBase::loadShaderProgram ( RV_Instance inst,
const char *  program,
const char *  extra_defines = nullptr 
)
staticprotected
const UT_StringHolder& RV_ShaderProgramBase::name ( void  ) const
inline

Descriptive name of the shader.

Definition at line 93 of file RV_ShaderProgram.h.

virtual void RV_ShaderProgramBase::print ( ) const
inlinevirtual

Debug print message.

Reimplemented in RV_ShaderCompute, and RV_ShaderProgram.

Definition at line 164 of file RV_ShaderProgram.h.

void RV_ShaderProgramBase::setName ( const UT_StringHolder name)
inline

Set a descriptive name for the shader.

Definition at line 91 of file RV_ShaderProgram.h.

Member Data Documentation

UT_Array<const RV_VKDescriptorBinding*> RV_ShaderProgramBase::myBindings
protected

Definition at line 209 of file RV_ShaderProgram.h.

UT_ArrayStringMap<std::pair<int, int> > RV_ShaderProgramBase::myBindingTable
protected

mapping of binding name to set + binding number

Definition at line 211 of file RV_ShaderProgram.h.

UT_Array<RV_ShaderInput> RV_ShaderProgramBase::myInputs
protected

Definition at line 192 of file RV_ShaderProgram.h.

UT_ArrayStringMap<int> RV_ShaderProgramBase::myInputTable
protected

Definition at line 194 of file RV_ShaderProgram.h.

UT_UniquePtr<const RV_VKPipelineLayout> RV_ShaderProgramBase::myLayout
protected

Definition at line 199 of file RV_ShaderProgram.h.

UT_StringHolder RV_ShaderProgramBase::myName
protected

Definition at line 218 of file RV_ShaderProgram.h.

UT_Array<const RV_Uniform*> RV_ShaderProgramBase::myPushConstants
protected

Definition at line 215 of file RV_ShaderProgram.h.

UT_ArrayStringMap<int> RV_ShaderProgramBase::myPushConstTable
protected

Definition at line 216 of file RV_ShaderProgram.h.

UT_Array<const RV_Uniform*> RV_ShaderProgramBase::myUniforms
protected

Definition at line 203 of file RV_ShaderProgram.h.

UT_ArrayStringMap<int> RV_ShaderProgramBase::myUniformTable
protected

Mapping of uniform names, to indices in myUniforms.

Definition at line 205 of file RV_ShaderProgram.h.

friend RV_ShaderProgramBase::RV_Geometry
protected

Definition at line 220 of file RV_ShaderProgram.h.

friend RV_ShaderProgramBase::RV_ShaderVariableSet
protected

Definition at line 221 of file RV_ShaderProgram.h.


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