MaterialX 1.38.7
Loading...
Searching...
No Matches
ShaderStage Class Reference

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

#include <ShaderStage.h>

Classes

struct  Scope
 

Public Types

using FunctionCallId = std::pair< const ShaderNode *, int >
 

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.
 
void setSourceCode (const string &code)
 Set the stage source code.
 
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.
 
const StringSetgetIncludes () const
 Return a set of all include files.
 
const StringSetgetSourceDependencies () const
 Return a set of all source dependencies.
 
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, const FilePath &sourceFilename, GenContext &context)
 Add a block of code.
 
void addInclude (const FilePath &includeFilename, const FilePath &sourceFilename, GenContext &context)
 Add the contents of an include file if not already present.
 
void addSourceDependency (const FilePath &file)
 Add a source file dependency for dependency tracking purposes.
 
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's implementation.
 
void addFunctionCall (const ShaderNode &node, GenContext &context)
 Add the function call for the given node.
 
bool isEmitted (const ShaderNode &node, GenContext &context) const
 Return true if the function for the given node has been emitted in the current scope.
 
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.


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