Mandrill 2025.6.0
Loading...
Searching...
No Matches
Layout.h
1#pragma once
2
3#include "Common.h"
4
5#include "Device.h"
6
7namespace Mandrill
8{
9 struct LayoutDesc {
10 uint32_t set;
11 uint32_t binding;
12 VkDescriptorType type;
13 VkShaderStageFlags stage;
14 uint32_t arrayCount;
15
25 MANDRILL_API LayoutDesc(uint32_t set, uint32_t binding, VkDescriptorType type, VkShaderStageFlags stage,
26 uint32_t arrayCount = 0)
27 : set(set), binding(binding), type(type), stage(stage), arrayCount(arrayCount)
28 {
29 }
30 };
31
35 class Layout
36 {
37 public:
38 MANDRILL_NON_COPYABLE(Layout)
39
40
46 MANDRILL_API
47 Layout(ptr<Device> pDevice, const std::vector<LayoutDesc>& desc, VkDescriptorSetLayoutCreateFlags flags = 0);
48
52 MANDRILL_API ~Layout();
53
58 MANDRILL_API const std::vector<VkDescriptorSetLayout>& getDescriptorSetLayouts() const
59 {
60 return mDescriptorSetLayouts;
61 }
62
67 MANDRILL_API const std::vector<VkPushConstantRange>& getPushConstantRanges() const
68 {
69 return mPushConstantRanges;
70 }
71
76 MANDRILL_API void addPushConstantRange(VkPushConstantRange pushConstantRange)
77 {
78 mPushConstantRanges.push_back(pushConstantRange);
79 }
80
81 private:
82 ptr<Device> mpDevice;
83
84 std::vector<VkDescriptorSetLayout> mDescriptorSetLayouts;
85 std::vector<VkPushConstantRange> mPushConstantRanges;
86 };
87} // namespace Mandrill
Layout class that abstracts the handling of descriptor set layouts and push constants in Vulkan.
Definition Layout.h:36
MANDRILL_API void addPushConstantRange(VkPushConstantRange pushConstantRange)
Add a new push constant range.
Definition Layout.h:76
MANDRILL_API const std::vector< VkPushConstantRange > & getPushConstantRanges() const
Get the push constant ranges.
Definition Layout.h:67
MANDRILL_API const std::vector< VkDescriptorSetLayout > & getDescriptorSetLayouts() const
Get the descriptor set layouts.
Definition Layout.h:58
MANDRILL_API ~Layout()
Destructor for layout.
Definition Layout.cpp:47