HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
WgslShaderGenerator.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_WGSLSHADERGENERATOR_H
7 #define MATERIALX_WGSLSHADERGENERATOR_H
8 
9 /// @file
10 /// Vulkan GLSL shader generator flavor for WGSL
11 
15 
17 
18 using WgslShaderGeneratorPtr = shared_ptr<class WgslShaderGenerator>;
19 
20 /// @class WgslShaderGenerator
21 /// WGSL Flavor of Vulkan GLSL shader generator
23 {
24  public:
25  /// Constructor.
27 
28  /// Creator function.
29  /// If a TypeSystem is not provided it will be created internally.
30  /// Optionally pass in an externally created TypeSystem here,
31  /// if you want to keep type descriptions alive after the lifetime
32  /// of the shader generator.
33  static ShaderGeneratorPtr create(TypeSystemPtr typeSystem = nullptr)
34  {
35  return std::make_shared<WgslShaderGenerator>(typeSystem ? typeSystem : TypeSystem::create());
36  }
37 
38  void emitDirectives(GenContext& context, ShaderStage& stage) const override;
39 
40  const string& getLightDataTypevarString() const override { return LIGHTDATA_TYPEVAR_STRING; }
41 
42  void emitFunctionDefinitionParameter(const ShaderPort* shaderPort, bool isOutput, GenContext& context, ShaderStage& stage) const override;
43 
44  void emitInput(const ShaderInput* input, GenContext& context, ShaderStage& stage) const override;
45 
46  protected:
47  static const string LIGHTDATA_TYPEVAR_STRING;
48 };
49 
51 
52 #endif
#define MATERIALX_NAMESPACE_BEGIN
Definition: Generated.h:25
static TypeSystemPtr create()
Create a new type system.
virtual void emitInput(const ShaderInput *input, GenContext &context, ShaderStage &stage) const
shared_ptr< class TypeSystem > TypeSystemPtr
Definition: TypeDesc.h:219
static const string LIGHTDATA_TYPEVAR_STRING
const string & getLightDataTypevarString() const override
void emitDirectives(GenContext &context, ShaderStage &stage) const override
shared_ptr< class WgslShaderGenerator > WgslShaderGeneratorPtr
#define MATERIALX_NAMESPACE_END
Definition: Generated.h:26
static const string LIGHTDATA_TYPEVAR_STRING
virtual void emitFunctionDefinitionParameter(const ShaderPort *shaderPort, bool isOutput, GenContext &context, ShaderStage &stage) const
shared_ptr< ShaderGenerator > ShaderGeneratorPtr
Shared pointer to a ShaderGenerator.
Definition: Library.h:37
static ShaderGeneratorPtr create(TypeSystemPtr typeSystem=nullptr)
#define MX_GENGLSL_API
Definition: Export.h:18