6#ifndef MATERIALX_OSLSHADERGENERATOR_H
7#define MATERIALX_OSLSHADERGENERATOR_H
16MATERIALX_NAMESPACE_BEGIN
18using OslShaderGeneratorPtr = shared_ptr<class OslShaderGenerator>;
31 const string&
getTarget()
const override {
return TARGET; }
71extern MX_GENOSL_API
const string UNIFORMS;
72extern MX_GENOSL_API
const string INPUTS;
73extern MX_GENOSL_API
const string OUTPUTS;
77MATERIALX_NAMESPACE_END
shared_ptr< Document > DocumentPtr
A shared pointer to a Document.
Definition: Document.h:22
shared_ptr< Element > ElementPtr
A shared pointer to an Element.
Definition: Element.h:31
Macros for declaring imported and exported symbols.
shared_ptr< Shader > ShaderPtr
Shared pointer to a Shader.
Definition: Library.h:34
shared_ptr< ShaderGenerator > ShaderGeneratorPtr
Shared pointer to a ShaderGenerator.
Definition: Library.h:38
Base shader generator class.
A context class for shader generation.
Definition: GenContext.h:31
Base class for OSL (Open Shading Language) shader generators.
Definition: OslShaderGenerator.h:24
const string & getTarget() const override
Return a unique identifier for the target this generator is for.
Definition: OslShaderGenerator.h:31
void registerShaderMetadata(const DocumentPtr &doc, GenContext &context) const override
Register metadata that should be exported to the generated shaders.
void emitFunctionBodyBegin(const ShaderNode &node, GenContext &context, ShaderStage &stage, Syntax::Punctuation punc=Syntax::CURLY_BRACKETS) const override
Emit code for starting a new function body.
virtual void emitShaderOutputs(const VariableBlock &inputs, ShaderStage &stage) const
Emit a block of shader outputs.
static const string TARGET
Unique identifier for this generator target.
Definition: OslShaderGenerator.h:45
ShaderPtr generate(const string &name, ElementPtr element, GenContext &context) const override
Generate a shader starting from the given element, translating the element and all dependencies upstr...
virtual ShaderPtr createShader(const string &name, ElementPtr element, GenContext &context) const
Create and initialize a new OSL shader for shader generation.
virtual void emitLibraryIncludes(ShaderStage &stage, GenContext &context) const
Emit include headers needed by the generated shader code.
virtual void emitShaderInputs(const VariableBlock &inputs, ShaderStage &stage) const
Emit a block of shader inputs.
void emitFunctionCalls(const ShaderGraph &graph, GenContext &context, ShaderStage &stage, uint32_t classification=0u) const override
Add all function calls for a graph.
virtual void emitMetadata(const ShaderPort *port, ShaderStage &stage) const
Emit metadata for a shader parameter.
Base class for shader generators All third-party shader generators should derive from this class.
Definition: ShaderGenerator.h:31
Class representing a graph (DAG) for shader generation.
Definition: ShaderGraph.h:44
Class representing a node in the shader generation DAG.
Definition: ShaderNode.h:320
An input or output port on a ShaderNode.
Definition: ShaderNode.h:123
A shader stage, containing the state and resulting source code for the stage.
Definition: ShaderStage.h:139
Punctuation
Punctuation types.
Definition: Syntax.h:45
A block of variables in a shader stage.
Definition: ShaderStage.h:61