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_Instance *inst, RV_VKCommandBuffer *cb, 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_ShaderInputStategetInputState () const
 The list and state of vertex shader inputs (attributes) 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_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...
 
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
 

Static Public Member Functions

static RV_ShaderProgramloadShaderProgram (RV_Instance *inst, const char *program, const char *extra_defines=nullptr)
 
static RV_ShaderProgramcreateShaderProgram (RV_Instance *inst, RV_VKShader &shader, const char *name=nullptr)
 Create Shader using GLSL to SPIR-V compiler object. More...
 
static RV_ShaderProgramcreateShaderProgram (RV_Instance *inst, const UT_StringArray &filenames, const char *name=nullptr)
 Create Shader using list of SPIR-V binary filenames. More...
 
static RV_ShaderProgramcreateShaderProgram (RV_Instance *inst, UT_Array< UT_UniquePtr< RV_VKShaderModule >> &rv_modules, const char *name=nullptr)
 

Additional Inherited Members

- Static Protected Member Functions inherited from RV_ShaderProgramBase
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 inherited from RV_ShaderProgramBase
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

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 253 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< UT_UniquePtr< RV_VKShaderModule >> &  rv_modules,
const char *  name = nullptr 
)
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 311 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 317 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 283 of file RV_ShaderProgram.h.

bool RV_ShaderProgram::hasAttribute ( const UT_StringRef name) const

Query if a vertex shader input 'name' exists.

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_Instance inst,
RV_VKCommandBuffer cb,
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: