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

#include <RV_ShaderProgram.h>

+ Inheritance diagram for RV_ShaderProgram:

Public Member Functions

RV_ShaderType getShaderType () const override
 Type of the shader, Graphics or Compute. More...
 
 ~RV_ShaderProgram () override
 
bool prepareForDraw (RV_Render *r, const RV_VKPipelineStateInfo &pipe_state, const RV_VKPipelineInputInfo &pipe_input)
 Finalize all set bindings in preparation for a draw. More...
 
bool hasAttribute (const UT_StringRef &name) const
 Query if a vertex shader input 'name' exists. More...
 
bool getAttribute (const UT_StringRef &name, int &out_location, RV_GPUType &out_type, int &out_vec_size) const
 Query the information about a vertex shader input. More...
 
const UT_Array< RV_ShaderInput > & getAttributeList () const
 The list of vertex shader inputs (attributes) More...
 
const RV_ShaderInputState & getInputState () const
 The list and state of vertex shader inputs (attributes) More...
 
bool hasTessellationStages () const
 If the program has tessellation. More...
 
void print () const override
 Debug Print function; dump all shader variable sets and inputs/outputs. More...
 
- Public Member Functions inherited from RV_ShaderProgramBase
 RV_ShaderProgramBase (RV_Instance *inst, RV_VKPipelineLayoutPtr pipe_layout)
 
virtual ~RV_ShaderProgramBase ()
 
void setName (const UT_StringHolder &name)
 Set a descriptive name for the shader. More...
 
const UT_StringHolder & name () const
 Descriptive name of the shader. More...
 
const UT_Array< exint > & layoutIds () const
 
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_VKDescriptorSetInfo * getSetInfo (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 variable set (descriptor set) for set 'set_num'. More...
 
const RV_VKPipelineLayout & getLayout () 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_VKDescriptorBinding * getBinding (int set, int binding) const
 Return a binding at index 'binding' for set index 'set'. More...
 
const RV_VKDescriptorBinding * getBinding (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_Uniform * getUniform (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_Uniform * getPushConstant (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
 

Static Public Member Functions

static RV_ShaderProgram * loadShaderProgram (RV_Instance *inst, const char *program, const char *extra_defines=nullptr)
 
static RV_ShaderProgram * createShaderProgram (RV_Instance *inst, RV_VKShader &shader, const char *name=nullptr)
 Create Shader using GLSL to SPIR-V compiler object. More...
 
static RV_ShaderProgram * createShaderProgram (RV_Instance *inst, const UT_StringArray &filenames, const char *name=nullptr)
 Create Shader using list of SPIR-V binary filenames. More...
 
static RV_ShaderProgram * createShaderProgram (RV_Instance *inst, UT_Array< RV_VKShaderModuleInfoPtr > &rv_modules, const char *name=nullptr)
 
static RV_ShaderProgram * createShaderProgram (RV_Instance *inst, RV_VKPipelineLayoutPtr layout)
 

Additional Inherited Members

- Static Protected Member Functions inherited from RV_ShaderProgramBase
static RV_VKPipelineLayoutPtr loadShaderProgram (RV_Instance *inst, const char *program, const char *extra_defines=nullptr)
 
- Protected Attributes inherited from RV_ShaderProgramBase
UT_Array< RV_ShaderInput > myInputs
 
UT_ArrayStringMap< int > myInputTable
 
UT_UniquePtr< const
RV_VKPipelineLayout > 
myLayout
 
UT_SmallArray< exint,
8 *sizeof(exint)> 
mySetLayoutIds
 
UT_Array< const RV_Uniform * > myUniforms
 
UT_ArrayStringMap< int > myUniformTable
 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< int > myPushConstTable
 
UT_StringHolder myName
 
friend RV_Geometry
 
friend RV_ShaderVariableSet
 

Detailed Description

A single graphics shader program that can be bound to the render state Holds pipeline layout and collection of cached pipeline objects

Definition at line 262 of file RV_ShaderProgram.h.

Constructor & Destructor Documentation

RV_ShaderProgram::~RV_ShaderProgram ( )
override

Member Function Documentation

static RV_ShaderProgram* RV_ShaderProgram::createShaderProgram ( RV_Instance *  inst,
RV_VKShader &  shader,
const char *  name = nullptr 
)
static

Create Shader using GLSL to SPIR-V compiler object.

static RV_ShaderProgram* RV_ShaderProgram::createShaderProgram ( RV_Instance *  inst,
const UT_StringArray &  filenames,
const char *  name = nullptr 
)
static

Create Shader using list of SPIR-V binary filenames.

static RV_ShaderProgram* RV_ShaderProgram::createShaderProgram ( RV_Instance *  inst,
UT_Array< RV_VKShaderModuleInfoPtr > &  rv_modules,
const char *  name = nullptr 
)
static
static RV_ShaderProgram* RV_ShaderProgram::createShaderProgram ( RV_Instance *  inst,
RV_VKPipelineLayoutPtr  layout 
)
static
bool RV_ShaderProgram::getAttribute ( const UT_StringRef &  name,
int &  out_location,
RV_GPUType &  out_type,
int &  out_vec_size 
) const

Query the information about a vertex shader input.

const UT_Array<RV_ShaderInput>& RV_ShaderProgram::getAttributeList ( ) const
inline

The list of vertex shader inputs (attributes)

Definition at line 324 of file RV_ShaderProgram.h.

const RV_ShaderInputState& RV_ShaderProgram::getInputState ( ) const
inline

The list and state of vertex shader inputs (attributes)

Definition at line 330 of file RV_ShaderProgram.h.

RV_ShaderType RV_ShaderProgram::getShaderType ( ) const
inlineoverridevirtual

Type of the shader, Graphics or Compute.

Implements RV_ShaderProgramBase.

Definition at line 297 of file RV_ShaderProgram.h.

bool RV_ShaderProgram::hasAttribute ( const UT_StringRef &  name) const

Query if a vertex shader input 'name' exists.

bool RV_ShaderProgram::hasTessellationStages ( ) const

If the program has tessellation.

static RV_ShaderProgram* RV_ShaderProgram::loadShaderProgram ( RV_Instance *  inst,
const char *  program,
const char *  extra_defines = nullptr 
)
static

Create Shader from prog file, using pre-compiled spir-v if found or compiling if no spir-v found, and sources have been copied to hfs NOTE: providing extra defines forces compilation

bool RV_ShaderProgram::prepareForDraw ( RV_Render *  r,
const RV_VKPipelineStateInfo &  pipe_state,
const RV_VKPipelineInputInfo &  pipe_input 
)

Finalize all set bindings in preparation for a draw.

void RV_ShaderProgram::print ( ) const
overridevirtual

Debug Print function; dump all shader variable sets and inputs/outputs.

Reimplemented from RV_ShaderProgramBase.


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