MaterialX 1.39.3
Loading...
Searching...
No Matches
VkShaderGenerator.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_VKSHADERGENERATOR_H
7#define MATERIALX_VKSHADERGENERATOR_H
8
11
14
15MATERIALX_NAMESPACE_BEGIN
16
17using VkShaderGeneratorPtr = shared_ptr<class VkShaderGenerator>;
18
21class MX_GENGLSL_API VkShaderGenerator : public GlslShaderGenerator
22{
23 public:
25 VkShaderGenerator(TypeSystemPtr typeSystem);
26
32 static ShaderGeneratorPtr create(TypeSystemPtr typeSystem = nullptr)
33 {
34 return std::make_shared<VkShaderGenerator>(typeSystem ? typeSystem : TypeSystem::create());
35 }
36
38 const string& getTarget() const override { return TARGET; }
39
41 const string& getVersion() const override { return VERSION; }
42
43 string getVertexDataPrefix(const VariableBlock& vertexData) const override;
44
46 static const string TARGET;
47 static const string VERSION;
48
49 // Emit directives for stage
50 void emitDirectives(GenContext& context, ShaderStage& stage) const override;
51
52 void emitInputs(GenContext& context, ShaderStage& stage) const override;
53
54 void emitOutputs(GenContext& context, ShaderStage& stage) const override;
55
56 protected:
57 HwResourceBindingContextPtr getResourceBindingContext(GenContext&) const override;
58
59 VkResourceBindingContextPtr _resourceBindingCtx = nullptr;
60};
61
62MATERIALX_NAMESPACE_END
63
64#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
Vulkan GLSL resource binding context.
shared_ptr< class VkResourceBindingContext > VkResourceBindingContextPtr
Shared pointer to a VkResourceBindingContext.
Definition VkResourceBindingContext.h:19
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
const string & getTarget() const override
Return a unique identifier for the target this generator is for.
Definition VkShaderGenerator.h:38
static ShaderGeneratorPtr create(TypeSystemPtr typeSystem=nullptr)
Creator function.
Definition VkShaderGenerator.h:32
static const string TARGET
Unique identifier for this generator target.
Definition VkShaderGenerator.h:46
const string & getVersion() const override
Return the version string for the GLSL version this generator is for.
Definition VkShaderGenerator.h:41
string getVertexDataPrefix(const VariableBlock &vertexData) const override
Determine the prefix of vertex data variables.
VkShaderGenerator(TypeSystemPtr typeSystem)
Constructor.