HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
9 /// @file
10 /// ESSL shader generator
11 
13 
15 
16 using EsslShaderGeneratorPtr = shared_ptr<class EsslShaderGenerator>;
17 
18 /// @class EsslShaderGenerator
19 /// An ESSL (OpenGL ES Shading Language) shader generator
21 {
22  public:
23  /// Constructor.
25 
26  /// Creator function.
27  /// If a TypeSystem is not provided it will be created internally.
28  /// Optionally pass in an externally created TypeSystem here,
29  /// if you want to keep type descriptions alive after the lifetime
30  /// of the shader generator.
31  static ShaderGeneratorPtr create(TypeSystemPtr typeSystem = nullptr)
32  {
33  return std::make_shared<EsslShaderGenerator>(typeSystem ? typeSystem : TypeSystem::create());
34  }
35 
36  /// Return a unique identifier for the target this generator is for
37  const string& getTarget() const override { return TARGET; }
38 
39  /// Return the version string for the ESSL version this generator is for
40  const string& getVersion() const override { return VERSION; }
41 
42  string getVertexDataPrefix(const VariableBlock& vertexData) const override;
43 
44  /// Unique identifier for this generator target
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;
54 };
55 
57 
58 #endif
static const string VERSION
virtual HwResourceBindingContextPtr getResourceBindingContext(GenContext &context) const
#define MATERIALX_NAMESPACE_BEGIN
Definition: Generated.h:25
static const string TARGET
Unique identifier for this generator target.
static TypeSystemPtr create()
Create a new type system.
const string & getVersion() const override
Return the version string for the ESSL version this generator is for.
shared_ptr< class TypeSystem > TypeSystemPtr
Definition: TypeDesc.h:219
static const string VERSION
Version string for the generator target.
shared_ptr< class HwResourceBindingContext > HwResourceBindingContextPtr
Shared pointer to a HwResourceBindingContext.
static ShaderGeneratorPtr create(TypeSystemPtr typeSystem=nullptr)
virtual void emitDirectives(GenContext &context, ShaderStage &stage) const
virtual void emitUniforms(GenContext &context, ShaderStage &stage) const
static const string TARGET
Unique identifier for this generator target.
virtual void emitInputs(GenContext &context, ShaderStage &stage) const
virtual void emitOutputs(GenContext &context, ShaderStage &stage) const
string getVertexDataPrefix(const VariableBlock &vertexData) const override
Determine the prefix of vertex data variables.
shared_ptr< class EsslShaderGenerator > EsslShaderGeneratorPtr
#define MATERIALX_NAMESPACE_END
Definition: Generated.h:26
shared_ptr< ShaderGenerator > ShaderGeneratorPtr
Shared pointer to a ShaderGenerator.
Definition: Library.h:37
const string & getTarget() const override
Return a unique identifier for the target this generator is for.
#define MX_GENGLSL_API
Definition: Export.h:18