HDK
|
#include <GenContext.h>
Public Member Functions | |
GenContext (ShaderGeneratorPtr sg) | |
Constructor. More... | |
ShaderGenerator & | getShaderGenerator () |
Return shader generatior. More... | |
GenOptions & | getOptions () |
Return shader generation options. More... | |
const GenOptions & | getOptions () const |
Return shader generation options. More... | |
TypeDesc | getTypeDesc (const string &name) const |
Return a TypeDesc for the given type name. More... | |
void | registerSourceCodeSearchPath (const FilePath &path) |
void | registerSourceCodeSearchPath (const FileSearchPath &path) |
FilePath | resolveSourceFile (const FilePath &filename, const FilePath &localPath) const |
void | addReservedWords (const StringSet &names) |
const StringSet & | getReservedWords () const |
void | addNodeImplementation (const string &name, ShaderNodeImplPtr impl) |
Cache a shader node implementation. More... | |
ShaderNodeImplPtr | findNodeImplementation (const string &name) const |
void | getNodeImplementationNames (StringSet &names) |
Get the names of all cached node implementations. More... | |
void | clearNodeImplementations () |
Clear all cached shader node implementation. More... | |
void | pushParentNode (ConstNodePtr node) |
Push a parent node onto the stack. More... | |
void | popParentNode () |
Pop the current parent node from the stack. More... | |
const vector< ConstNodePtr > & | getParentNodes () |
Return the current stack of parent nodes. More... | |
void | pushUserData (const string &name, GenUserDataPtr data) |
void | popUserData (const string &name) |
Remove user data from the context. More... | |
void | clearUserData () |
Clear all user data from the context. More... | |
template<class T > | |
std::shared_ptr< T > | getUserData (const string &name) |
void | addInputSuffix (const ShaderInput *input, const string &suffix) |
void | removeInputSuffix (const ShaderInput *input) |
void | getInputSuffix (const ShaderInput *input, string &suffix) const |
void | addOutputSuffix (const ShaderOutput *output, const string &suffix) |
void | removeOutputSuffix (const ShaderOutput *output) |
void | getOutputSuffix (const ShaderOutput *output, string &suffix) const |
void | setApplicationVariableHandler (ApplicationVariableHandler handler) |
Set handler for application variables. More... | |
ApplicationVariableHandler | getApplicationVariableHandler () const |
Get handler for application variables. More... | |
Protected Member Functions | |
GenContext ()=delete | |
Protected Attributes | |
ShaderGeneratorPtr | _sg |
GenOptions | _options |
FileSearchPath | _sourceCodeSearchPath |
StringSet | _reservedWords |
std::unordered_map< string, ShaderNodeImplPtr > | _nodeImpls |
std::unordered_map< string, vector< GenUserDataPtr > > | _userData |
std::unordered_map< const ShaderInput *, string > | _inputSuffix |
std::unordered_map< const ShaderOutput *, string > | _outputSuffix |
vector< ConstNodePtr > | _parentNodes |
ApplicationVariableHandler | _applicationVariableHandler |
A context class for shader generation. Used for thread local storage of data needed during shader generation.
Definition at line 29 of file GenContext.h.
GenContext::GenContext | ( | ShaderGeneratorPtr | sg | ) |
Constructor.
|
protecteddelete |
void GenContext::addInputSuffix | ( | const ShaderInput * | input, |
const string & | suffix | ||
) |
Add an input suffix to be used for the input in this context.
input | Node input |
suffix | Suffix string |
void GenContext::addNodeImplementation | ( | const string & | name, |
ShaderNodeImplPtr | impl | ||
) |
Cache a shader node implementation.
void GenContext::addOutputSuffix | ( | const ShaderOutput * | output, |
const string & | suffix | ||
) |
Add an output suffix to be used for the output in this context.
output | Node output |
suffix | Suffix string |
Add reserved words that should not be used as identifiers during code generation.
Definition at line 87 of file GenContext.h.
void GenContext::clearNodeImplementations | ( | ) |
Clear all cached shader node implementation.
void GenContext::clearUserData | ( | ) |
Clear all user data from the context.
ShaderNodeImplPtr GenContext::findNodeImplementation | ( | const string & | name | ) | const |
Find and return a cached shader node implementation, or return nullptr if no implementation is found.
|
inline |
Get handler for application variables.
Definition at line 202 of file GenContext.h.
void GenContext::getInputSuffix | ( | const ShaderInput * | input, |
string & | suffix | ||
) | const |
Get an input suffix to be used for the input in this context.
input | Node input |
suffix | Suffix string returned. Is empty if not found. |
Get the names of all cached node implementations.
|
inline |
Return shader generation options.
Definition at line 42 of file GenContext.h.
|
inline |
Return shader generation options.
Definition at line 48 of file GenContext.h.
void GenContext::getOutputSuffix | ( | const ShaderOutput * | output, |
string & | suffix | ||
) | const |
Get an output suffix to be used for the output in this context.
output | Node output |
suffix | Suffix string returned. Is empty if not found. |
|
inline |
Return the current stack of parent nodes.
Definition at line 125 of file GenContext.h.
|
inline |
Return the set of reserved words that should not be used as identifiers during code generation.
Definition at line 94 of file GenContext.h.
|
inline |
Return shader generatior.
Definition at line 36 of file GenContext.h.
Return a TypeDesc for the given type name.
Definition at line 54 of file GenContext.h.
Return user data with given name, or nullptr if no data is found.
Definition at line 161 of file GenContext.h.
|
inline |
Pop the current parent node from the stack.
Definition at line 119 of file GenContext.h.
Remove user data from the context.
Definition at line 146 of file GenContext.h.
|
inline |
Push a parent node onto the stack.
Definition at line 113 of file GenContext.h.
|
inline |
Add user data to the context to make it available during shader generator.
Definition at line 132 of file GenContext.h.
Register a user search path for finding source code during code generation.
Definition at line 61 of file GenContext.h.
|
inline |
Register a user search path for finding source code during code generation.
Definition at line 68 of file GenContext.h.
void GenContext::removeInputSuffix | ( | const ShaderInput * | input | ) |
Remove an input suffix to be used for the input in this context.
input | Node input |
void GenContext::removeOutputSuffix | ( | const ShaderOutput * | output | ) |
Remove an output suffix to be used for the output in this context.
output | Node output |
|
inline |
Resolve a source code filename, first checking the given local path then checking any file paths registered by the user.
Definition at line 75 of file GenContext.h.
|
inline |
Set handler for application variables.
Definition at line 196 of file GenContext.h.
|
protected |
Definition at line 222 of file GenContext.h.
|
protected |
Definition at line 217 of file GenContext.h.
|
protected |
Definition at line 215 of file GenContext.h.
|
protected |
Definition at line 211 of file GenContext.h.
|
protected |
Definition at line 218 of file GenContext.h.
|
protected |
Definition at line 220 of file GenContext.h.
|
protected |
Definition at line 213 of file GenContext.h.
|
protected |
Definition at line 210 of file GenContext.h.
|
protected |
Definition at line 212 of file GenContext.h.
|
protected |
Definition at line 216 of file GenContext.h.