vengine  0.0.1
3D graphics engine
Loading...
Searching...
No Matches
SetLayout.hpp
Go to the documentation of this file.
1///
2/// @file SetLayout.hpp
3/// @brief This file contains the DescriptorSetLayout class
4/// @namespace ven
5///
6
7#pragma once
8
9#include <memory>
10#include <unordered_map>
11
13
14namespace ven {
15
16 ///
17 /// @class DescriptorSetLayout
18 /// @brief Class for descriptor set layout
19 /// @namespace ven
20 ///
22
23 public:
24
25 class Builder {
26
27 public:
28
29 explicit Builder(Device &device) : m_device{device} {}
30
31 Builder &addBinding(uint32_t binding, VkDescriptorType descriptorType, VkShaderStageFlags stageFlags, uint32_t count = 1);
32 std::unique_ptr<DescriptorSetLayout> build() const { return std::make_unique<DescriptorSetLayout>(m_device, m_bindings); }
33
34 private:
35
37 std::unordered_map<uint32_t, VkDescriptorSetLayoutBinding> m_bindings;
38
39 }; // class Builder
40
41 DescriptorSetLayout(Device &device, const std::unordered_map<uint32_t, VkDescriptorSetLayoutBinding>& bindings);
42 ~DescriptorSetLayout() { vkDestroyDescriptorSetLayout(m_device.device(), m_descriptorSetLayout, nullptr); }
43
48
49 VkDescriptorSetLayout getDescriptorSetLayout() const { return m_descriptorSetLayout; }
50
51 private:
52
54 VkDescriptorSetLayout m_descriptorSetLayout;
55 std::unordered_map<uint32_t, VkDescriptorSetLayoutBinding> m_bindings;
56
57 friend class DescriptorWriter;
58
59 }; // class DescriptorSetLayout
60
61} // namespace ven
This file contains the Device class.
std::unordered_map< uint32_t, VkDescriptorSetLayoutBinding > m_bindings
Definition SetLayout.hpp:37
Builder & addBinding(uint32_t binding, VkDescriptorType descriptorType, VkShaderStageFlags stageFlags, uint32_t count=1)
Definition setLayout.cpp:5
std::unique_ptr< DescriptorSetLayout > build() const
Definition SetLayout.hpp:32
Class for descriptor set layout.
Definition SetLayout.hpp:21
DescriptorSetLayout(const DescriptorSetLayout &)=delete
DescriptorSetLayout(DescriptorSetLayout &&)=delete
DescriptorSetLayout & operator=(DescriptorSetLayout &&)=delete
std::unordered_map< uint32_t, VkDescriptorSetLayoutBinding > m_bindings
Definition SetLayout.hpp:55
DescriptorSetLayout & operator=(const DescriptorSetLayout &)=delete
DescriptorSetLayout(Device &device, const std::unordered_map< uint32_t, VkDescriptorSetLayoutBinding > &bindings)
Definition setLayout.cpp:17
VkDescriptorSetLayout m_descriptorSetLayout
Definition SetLayout.hpp:54
VkDescriptorSetLayout getDescriptorSetLayout() const
Definition SetLayout.hpp:49
Class for descriptor writer.
Definition Writer.hpp:19
Class for device.
Definition Device.hpp:35
VkDevice device() const
Definition Device.hpp:54