HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VkResourceBindingContext.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_VKRESOURCEBINDING_H
7 #define MATERIALX_VKRESOURCEBINDING_H
8 
9 /// @file
10 /// Vulkan GLSL resource binding context
11 
13 
15 
17 
18 /// Shared pointer to a VkResourceBindingContext
19 using VkResourceBindingContextPtr = shared_ptr<class VkResourceBindingContext>;
20 
21 /// @class VkResourceBindingContext
22 /// Class representing a resource binding for Vulkan Glsl shader resources.
24 {
25  public:
26  VkResourceBindingContext(size_t uniformBindingLocation);
27 
28  static VkResourceBindingContextPtr create(size_t uniformBindingLocation = 0)
29  {
30  return std::make_shared<VkResourceBindingContext>(uniformBindingLocation);
31  }
32 
33  // Initialize the context before generation starts.
34  void initialize() override;
35 
36  // Emit directives for stage
37  void emitDirectives(GenContext& context, ShaderStage& stage) override;
38 
39  // Emit uniforms with binding information
40  void emitResourceBindings(GenContext& context, const VariableBlock& uniforms, ShaderStage& stage) override;
41 
42  // Emit structured uniforms with binding information and align members where possible
43  void emitStructuredResourceBindings(GenContext& context, const VariableBlock& uniforms,
44  ShaderStage& stage, const std::string& structInstanceName,
45  const std::string& arraySuffix) override;
46 
47  protected:
48  // Binding location for uniform blocks
49  size_t _hwUniformBindLocation = 0;
50 
51  // Initial value of uniform binding location
52  size_t _hwInitUniformBindLocation = 0;
53 };
54 
56 
57 #endif
static VkResourceBindingContextPtr create(size_t uniformBindingLocation=0)
virtual void initialize()=0
#define MATERIALX_NAMESPACE_BEGIN
Definition: Generated.h:25
GLsizei const GLchar *const * string
Definition: glcorearb.h:814
virtual void emitDirectives(GenContext &context, ShaderStage &stage)=0
virtual void emitResourceBindings(GenContext &context, const VariableBlock &uniforms, ShaderStage &stage)=0
shared_ptr< class VkResourceBindingContext > VkResourceBindingContextPtr
Shared pointer to a VkResourceBindingContext.
virtual void emitStructuredResourceBindings(GenContext &context, const VariableBlock &uniforms, ShaderStage &stage, const std::string &structInstanceName, const std::string &arraySuffix=EMPTY_STRING)=0
#define MATERIALX_NAMESPACE_END
Definition: Generated.h:26
#define MX_GENGLSL_API
Definition: Export.h:18