6 #ifndef MATERIALX_MSLSHADERGENERATOR_H
7 #define MATERIALX_MSLSHADERGENERATOR_H
16 #define TEXTURE_NAME(t) ((t) + "_tex")
17 #define SAMPLER_NAME(t) ((t) + "_sampler")
37 const string&
getTarget()
const override {
return TARGET; }
40 virtual const string&
getVersion()
const {
return VERSION; }
44 bool assignValue =
true)
const override;
72 virtual void MetalizeGeneratedShader(
ShaderStage& shaderStage)
const;
74 void emitConstantBufferDeclarations(
GenContext& context,
80 EMIT_GLOBAL_SCOPE_CONTEXT_ENTRY_FUNCTION_RESOURCES = 0,
81 EMIT_GLOBAL_SCOPE_CONTEXT_MEMBER_INIT = 1,
82 EMIT_GLOBAL_SCOPE_CONTEXT_MEMBER_DECL = 2,
83 EMIT_GLOBAL_SCOPE_CONTEXT_CONSTRUCTOR_ARGS = 3,
84 EMIT_GLOBAL_SCOPE_CONTEXT_CONSTRUCTOR_INIT = 4
88 EmitGlobalScopeContext situation,
90 bool needsLightData)
const;
100 virtual bool requiresLighting(
const ShaderGraph& graph)
const;
111 static void toVec4(
const TypeDesc*
type,
string& variable);
121 const string&
getTarget()
const override;
shared_ptr< ShaderNodeImpl > ShaderNodeImplPtr
Shared pointer to a ShaderNodeImpl.
#define MATERIALX_NAMESPACE_BEGIN
virtual void emitVariableDeclaration(const ShaderPort *variable, const string &qualifier, GenContext &context, ShaderStage &stage, bool assignValue=true) const
static const string VERSION
Version string for the generator target.
shared_ptr< class HwResourceBindingContext > HwResourceBindingContextPtr
Shared pointer to a HwResourceBindingContext.
virtual string getVertexDataPrefix(const VariableBlock &vertexData) const =0
Determine the prefix of vertex data variables.
virtual ShaderNodeImplPtr getImplementation(const NodeDef &nodedef, GenContext &context) const
Return a registered shader node implementation for the given nodedef.
virtual const string & getTarget() const
Base class for common MSL node implementations.
virtual const string & getVersion() const
Return the version string for the MSL version this generator is for.
const string & getTarget() const override
Return a unique identifier for the target this generator is for.
GLuint const GLchar * name
vector< ShaderNodePtr > _lightSamplingNodes
Nodes used internally for light sampling.
shared_ptr< Shader > ShaderPtr
Shared pointer to a Shader.
shared_ptr< Element > ElementPtr
A shared pointer to an Element.
#define MATERIALX_NAMESPACE_END
static const string TARGET
Unique identifier for this generator target.
shared_ptr< ShaderGenerator > ShaderGeneratorPtr
Shared pointer to a ShaderGenerator.
static ShaderGeneratorPtr create()
virtual ShaderPtr generate(const string &, ElementPtr, GenContext &) const
shared_ptr< class MslShaderGenerator > MslShaderGeneratorPtr