MaterialX 1.38.2
Public Member Functions | Protected Member Functions | Friends | List of all members
ShaderStage Class Reference

A shader stage, containing the state and resulting source code for the stage. More...

#include <ShaderStage.h>

Public Member Functions

 ShaderStage (const string &name, ConstSyntaxPtr syntax)
 Contructor.
 
const string & getName () const
 Return the stage name.
 
const string & getFunctionName () const
 Return the stage function name.
 
const string & getSourceCode () const
 Return the stage source code.
 
VariableBlockPtr createUniformBlock (const string &name, const string &instance=EMPTY_STRING)
 Create a new uniform variable block.
 
VariableBlockPtr createInputBlock (const string &name, const string &instance=EMPTY_STRING)
 Create a new input variable block.
 
VariableBlockPtr createOutputBlock (const string &name, const string &instance=EMPTY_STRING)
 Create a new output variable block.
 
VariableBlockgetUniformBlock (const string &name)
 Return the uniform variable block with given name.
 
const VariableBlockgetUniformBlock (const string &name) const
 Return the uniform variable block with given name.
 
VariableBlockgetInputBlock (const string &name)
 Return the input variable block with given name.
 
const VariableBlockgetInputBlock (const string &name) const
 Return the input variable block with given name.
 
VariableBlockgetOutputBlock (const string &name)
 Return the output variable block with given name.
 
const VariableBlockgetOutputBlock (const string &name) const
 Return the output variable block with given name.
 
VariableBlockgetConstantBlock ()
 Return the constant variable block.
 
const VariableBlockgetConstantBlock () const
 Return the constant variable block.
 
const VariableBlockMapgetUniformBlocks () const
 Return a map of all uniform blocks.
 
const VariableBlockMapgetInputBlocks () const
 Return a map of all input blocks.
 
const VariableBlockMapgetOutputBlocks () const
 Return a map of all output blocks.
 

Protected Member Functions

void beginScope (Syntax::Punctuation punc=Syntax::CURLY_BRACKETS)
 Start a new scope using the given bracket type.
 
void endScope (bool semicolon=false, bool newline=true)
 End the current scope.
 
void beginLine ()
 Start a new line.
 
void endLine (bool semicolon=true)
 End the current line.
 
void newLine ()
 Add a newline character.
 
void addString (const string &str)
 Add a string.
 
void addLine (const string &str, bool semicolon=true)
 Add a single line of code, optionally appending a semicolon.
 
void addComment (const string &str)
 Add a single line code comment.
 
void addBlock (const string &str, GenContext &context)
 Add a block of code.
 
void addInclude (const string &file, GenContext &context)
 Add the contents of an include file. More...
 
template<typename T >
void addValue (const T &value)
 Add a value.
 
void addFunctionDefinition (const ShaderNode &node, GenContext &context)
 Add the function definition for a node.
 
void setFunctionName (const string &functionName)
 Set stage function name.
 

Friends

class ShaderGenerator
 

Detailed Description

A shader stage, containing the state and resulting source code for the stage.

Member Function Documentation

◆ addInclude()

void addInclude ( const string &  file,
GenContext context 
)
protected

Add the contents of an include file.

Making sure it is only included once for the shader stage.


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