MaterialX 1.39.4
Loading...
Searching...
No Matches
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
11
15
16MATERIALX_NAMESPACE_BEGIN
17
18using WgslShaderGeneratorPtr = shared_ptr<class WgslShaderGenerator>;
19
22class MX_GENGLSL_API WgslShaderGenerator : public VkShaderGenerator
23{
24 public:
26 WgslShaderGenerator(TypeSystemPtr typeSystem);
27
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
50MATERIALX_NAMESPACE_END
51
52#endif
Context classes for shader generation.
shared_ptr< ShaderGenerator > ShaderGeneratorPtr
Shared pointer to a ShaderGenerator.
Definition Library.h:37
Vulkan GLSL shader generator.
Vulkan GLSL resource binding context for WGSL.
A context class for shader generation.
Definition GenContext.h:30
An input on a ShaderNode.
Definition ShaderNode.h:264
A shader stage, containing the state and resulting source code for the stage.
Definition ShaderStage.h:141
static TypeSystemPtr create()
Create a new type system.
VkShaderGenerator(TypeSystemPtr typeSystem)
Constructor.
static ShaderGeneratorPtr create(TypeSystemPtr typeSystem=nullptr)
Creator function.
Definition WgslShaderGenerator.h:33
void emitInput(const ShaderInput *input, GenContext &context, ShaderStage &stage) const override
Emit the connected variable name for an input, or constant value if the port is not connected.
WgslShaderGenerator(TypeSystemPtr typeSystem)
Constructor.