6#ifndef MATERIALX_SLANGSHADERGENERATOR_H
7#define MATERIALX_SLANGSHADERGENERATOR_H
14#include <MaterialXGenHw/HwShaderGenerator.h>
16MATERIALX_NAMESPACE_BEGIN
18using SlangShaderGeneratorPtr = shared_ptr<class SlangShaderGenerator>;
35 return std::make_shared<SlangShaderGenerator>(typeSystem ? typeSystem :
TypeSystem::create());
50 bool assignValue =
true)
const override;
86 static void toVec4(
TypeDesc type,
string& variable);
87 [[deprecated]]
static void toVec4(
const TypeDesc* type,
string& variable) { toVec4(*type, variable); }
89 void SlangSyntaxFromGlsl(
ShaderStage& shaderStage)
const;
95MATERIALX_NAMESPACE_END
shared_ptr< Element > ElementPtr
A shared pointer to an Element.
Definition Element.h:31
shared_ptr< Shader > ShaderPtr
Shared pointer to a Shader.
Definition Library.h:33
shared_ptr< ShaderGenerator > ShaderGeneratorPtr
Shared pointer to a ShaderGenerator.
Definition Library.h:37
Macros for declaring imported and exported symbols.
A context class for shader generation.
Definition GenContext.h:30
Class representing a graph (DAG) for shader generation.
Definition ShaderGraph.h:45
An input or output port on a ShaderNode.
Definition ShaderNode.h:124
A shader stage, containing the state and resulting source code for the stage.
Definition ShaderStage.h:145
const string & getTarget() const override
Return a unique identifier for the target this generator is for.
Definition SlangShaderGenerator.h:43
virtual void emitLightFunctionDefinitions(const ShaderGraph &graph, GenContext &context, ShaderStage &stage) const
Emit function definitions for lighting code.
virtual const string & getVersion() const
Return the version string for the Slang version this generator is for.
Definition SlangShaderGenerator.h:46
static ShaderGeneratorPtr create(TypeSystemPtr typeSystem=nullptr)
Creator function.
Definition SlangShaderGenerator.h:33
SlangShaderGenerator(TypeSystemPtr typeSystem)
Constructor.
vector< ShaderNodePtr > _lightSamplingNodes
Nodes used internally for light sampling.
Definition SlangShaderGenerator.h:92
static const string TARGET
Unique identifier for this generator target.
Definition SlangShaderGenerator.h:57
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...
void emitVariableDeclaration(const ShaderPort *variable, const string &qualifier, GenContext &context, ShaderStage &stage, bool assignValue=true) const override
Emit a shader variable.
virtual bool requiresLighting(const ShaderGraph &graph) const override
Logic to indicate whether code to support direct lighting should be emitted.
virtual void emitSpecularEnvironment(GenContext &context, ShaderStage &stage) const
Emit specular environment lookup code.
string getVertexDataPrefix(const VariableBlock &vertexData) const override
Determine the prefix of vertex data variables.
virtual void emitTransmissionRender(GenContext &context, ShaderStage &stage) const
Emit transmission rendering code.
static const string VERSION
Version string for the generator target.
Definition SlangShaderGenerator.h:60
A type descriptor for MaterialX data types.
Definition TypeDesc.h:40
static TypeSystemPtr create()
Create a new type system.
A block of variables in a shader stage.
Definition ShaderStage.h:67