6 #ifndef MATERIALX_MSLSHADERGENERATOR_H
7 #define MATERIALX_MSLSHADERGENERATOR_H
16 #define TEXTURE_NAME(t) ((t) + "_tex")
17 #define SAMPLER_NAME(t) ((t) + "_sampler")
38 return std::make_shared<MslShaderGenerator>(typeSystem ? typeSystem :
TypeSystem::create());
46 const string&
getTarget()
const override {
return TARGET; }
49 virtual const string&
getVersion()
const {
return VERSION; }
53 bool assignValue =
true)
const override;
81 virtual void MetalizeGeneratedShader(
ShaderStage& shaderStage)
const;
83 void emitConstantBufferDeclarations(
GenContext& context,
89 EMIT_GLOBAL_SCOPE_CONTEXT_ENTRY_FUNCTION_RESOURCES = 0,
90 EMIT_GLOBAL_SCOPE_CONTEXT_MEMBER_INIT = 1,
91 EMIT_GLOBAL_SCOPE_CONTEXT_MEMBER_DECL = 2,
92 EMIT_GLOBAL_SCOPE_CONTEXT_CONSTRUCTOR_ARGS = 3,
93 EMIT_GLOBAL_SCOPE_CONTEXT_CONSTRUCTOR_INIT = 4
97 EmitGlobalScopeContext situation,
99 bool needsLightData)
const;
109 virtual bool requiresLighting(
const ShaderGraph& graph)
const;
131 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.
static TypeSystemPtr create()
Create a new type system.
shared_ptr< class TypeSystem > TypeSystemPtr
shared_ptr< class HwResourceBindingContext > HwResourceBindingContextPtr
Shared pointer to a HwResourceBindingContext.
GLint GLint GLsizei GLint GLenum GLenum type
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.
static ShaderGeneratorPtr create(TypeSystemPtr typeSystem=nullptr)
shared_ptr< Shader > ShaderPtr
Shared pointer to a Shader.
shared_ptr< Element > ElementPtr
A shared pointer to an Element.
#define MATERIALX_NAMESPACE_END
static void toVec4(const TypeDesc *type, string &variable)
static const string TARGET
Unique identifier for this generator target.
shared_ptr< ShaderGenerator > ShaderGeneratorPtr
Shared pointer to a ShaderGenerator.
virtual ShaderPtr generate(const string &, ElementPtr, GenContext &) const
shared_ptr< class MslShaderGenerator > MslShaderGeneratorPtr