forked from AcademySoftwareFoundation/MaterialX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
VkResourceBindingContext.h
57 lines (41 loc) · 1.85 KB
/
VkResourceBindingContext.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//
// TM & (c) 2022 Lucasfilm Entertainment Company Ltd. and Lucasfilm Ltd.
// All rights reserved. See LICENSE.txt for license.
//
#ifndef MATERIALX_VKRESOURCEBINDING_H
#define MATERIALX_VKRESOURCEBINDING_H
/// @file
/// Vulkan GLSL resource binding context
#include <MaterialXGenGlsl/Export.h>
#include <MaterialXGenShader/HwShaderGenerator.h>
MATERIALX_NAMESPACE_BEGIN
/// Shared pointer to a VkResourceBindingContext
using VkResourceBindingContextPtr = shared_ptr<class VkResourceBindingContext>;
/// @class VkResourceBindingContext
/// Class representing a resource binding for Vulkan Glsl shader resources.
class MX_GENGLSL_API VkResourceBindingContext : public HwResourceBindingContext
{
public:
VkResourceBindingContext(size_t uniformBindingLocation);
static VkResourceBindingContextPtr create(size_t uniformBindingLocation = 0)
{
return std::make_shared<VkResourceBindingContext>(uniformBindingLocation);
}
// Initialize the context before generation starts.
void initialize() override;
// Emit directives for stage
void emitDirectives(GenContext& context, ShaderStage& stage) override;
// Emit uniforms with binding information
void emitResourceBindings(GenContext& context, const VariableBlock& uniforms, ShaderStage& stage) override;
// Emit structured uniforms with binding information and align members where possible
void emitStructuredResourceBindings(GenContext& context, const VariableBlock& uniforms,
ShaderStage& stage, const std::string& structInstanceName,
const std::string& arraySuffix) override;
protected:
// Binding location for uniform blocks
size_t _hwUniformBindLocation = 0;
// Initial value of uniform binding location
size_t _hwInitUniformBindLocation = 0;
};
MATERIALX_NAMESPACE_END
#endif