6#ifndef MATERIALX_SHADER_H
7#define MATERIALX_SHADER_H
43 const string&
getName()
const {
return _name; }
55 bool hasStage(
const string& name);
61 const ShaderStage& getStage(
const string& name)
const;
66 return _attributeMap.count(attrib) != 0;
73 auto it = _attributeMap.find(attrib);
74 return it != _attributeMap.end() ? it->second :
nullptr;
80 _attributeMap[attrib] = value;
86 _attributeMap[attrib] = Value::createValue<bool>(
true);
99 const string&
getSourceCode(
const string& stage = Stage::PIXEL)
const {
return getStage(stage).getSourceCode(); }
107 std::unordered_map<string, ShaderStagePtr> _stagesMap;
108 vector<ShaderStage*> _stages;
109 std::unordered_map<string, ValuePtr> _attributeMap;
Shader generation options class.
Macros for declaring imported and exported symbols.
shared_ptr< ShaderStage > ShaderStagePtr
Shared pointer to a ShaderStage.
Definition: Library.h:36
shared_ptr< class ShaderGraph > ShaderGraphPtr
A shared pointer to a shader graph.
Definition: ShaderGraph.h:40
Class related to holding information for shader stages.
shared_ptr< const Syntax > ConstSyntaxPtr
Shared pointer to a constant Syntax.
Definition: Syntax.h:28
shared_ptr< Value > ValuePtr
A shared pointer to a Value.
Definition: Value.h:30
Base class for shader generators All third-party shader generators should derive from this class.
Definition: ShaderGenerator.h:30
Class representing a graph (DAG) for shader generation.
Definition: ShaderGraph.h:45
Class containing all data needed during shader generation.
Definition: Shader.h:34
void setAttribute(const string &attrib)
Set a flag attribute on the shader.
Definition: Shader.h:84
const ShaderGraph & getGraph() const
Return the shader graph.
Definition: Shader.h:90
size_t numStages() const
Return the number of shader stages for this shader.
Definition: Shader.h:46
bool hasClassification(unsigned int c) const
Return true if this shader matches the given classification.
Definition: Shader.h:96
const string & getName() const
Return the shader name.
Definition: Shader.h:43
virtual ~Shader()
Destructor.
Definition: Shader.h:40
void setAttribute(const string &attrib, ValuePtr value)
Set a value attribute on the shader.
Definition: Shader.h:78
const string & getSourceCode(const string &stage=Stage::PIXEL) const
Return the final shader source code for a given shader stage.
Definition: Shader.h:99
ShaderGraph & getGraph()
Return the shader graph.
Definition: Shader.h:93
ValuePtr getAttribute(const string &attrib) const
Return the value for a named attribute, or nullptr if no such attribute is found.
Definition: Shader.h:71
bool hasAttribute(const string &attrib) const
Return true if the shader has a given named attribute.
Definition: Shader.h:64
A shader stage, containing the state and resulting source code for the stage.
Definition: ShaderStage.h:124