MaterialX 1.39.3
Loading...
Searching...
No Matches
EsslShaderGenerator.h
Go to the documentation of this file.
1//
2// Copyright Contributors to the MaterialX Project
3// SPDX-License-Identifier: Apache-2.0
4//
5
6#ifndef MATERIALX_ESSLSHADERGENERATOR_H
7#define MATERIALX_ESSLSHADERGENERATOR_H
8
11
13
14MATERIALX_NAMESPACE_BEGIN
15
16using EsslShaderGeneratorPtr = shared_ptr<class EsslShaderGenerator>;
17
20class MX_GENGLSL_API EsslShaderGenerator : public GlslShaderGenerator
21{
22 public:
24 EsslShaderGenerator(TypeSystemPtr typeSystem);
25
31 static ShaderGeneratorPtr create(TypeSystemPtr typeSystem = nullptr)
32 {
33 return std::make_shared<EsslShaderGenerator>(typeSystem ? typeSystem : TypeSystem::create());
34 }
35
37 const string& getTarget() const override { return TARGET; }
38
40 const string& getVersion() const override { return VERSION; }
41
42 string getVertexDataPrefix(const VariableBlock& vertexData) const override;
43
45 static const string TARGET;
46 static const string VERSION;
47
48 protected:
49 void emitDirectives(GenContext& context, ShaderStage& stage) const override;
50 void emitUniforms(GenContext& context, ShaderStage& stage) const override;
51 void emitInputs(GenContext& context, ShaderStage& stage) const override;
52 void emitOutputs(GenContext& context, ShaderStage& stage) const override;
53 HwResourceBindingContextPtr getResourceBindingContext(GenContext& context) const override;
54};
55
56MATERIALX_NAMESPACE_END
57
58#endif
GLSL shader generator.
shared_ptr< class HwResourceBindingContext > HwResourceBindingContextPtr
Shared pointer to a HwResourceBindingContext.
Definition HwShaderGenerator.h:244
shared_ptr< ShaderGenerator > ShaderGeneratorPtr
Shared pointer to a ShaderGenerator.
Definition Library.h:37
EsslShaderGenerator(TypeSystemPtr typeSystem)
Constructor.
const string & getTarget() const override
Return a unique identifier for the target this generator is for.
Definition EsslShaderGenerator.h:37
static ShaderGeneratorPtr create(TypeSystemPtr typeSystem=nullptr)
Creator function.
Definition EsslShaderGenerator.h:31
static const string TARGET
Unique identifier for this generator target.
Definition EsslShaderGenerator.h:45
const string & getVersion() const override
Return the version string for the ESSL version this generator is for.
Definition EsslShaderGenerator.h:40
string getVertexDataPrefix(const VariableBlock &vertexData) const override
Determine the prefix of vertex data variables.
A context class for shader generation.
Definition GenContext.h:30
GlslShaderGenerator(TypeSystemPtr typeSystem)
Constructor.
A shader stage, containing the state and resulting source code for the stage.
Definition ShaderStage.h:139
static TypeSystemPtr create()
Create a new type system.
A block of variables in a shader stage.
Definition ShaderStage.h:61