Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
LayoutBindingsBuilder.cpp
Go to the documentation of this file.
2
5
6namespace EngineCore {
7 LayoutBindingsBuilder & LayoutBindingsBuilder::addUniformBuffer(uint32_t binding, VkShaderStageFlags stageFlags) {
8 bindings.push_back({
9 .binding = binding,
10 .descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
11 .descriptorCount = 1u,
12 .stageFlags = stageFlags,
13 .pImmutableSamplers = nullptr,
14 });
15 flags.push_back(0);
16 return *this;
17 }
18
19 LayoutBindingsBuilder & LayoutBindingsBuilder::addStorageBuffer(uint32_t binding, VkShaderStageFlags stageFlags) {
20 bindings.push_back({
21 .binding = binding,
22 .descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
23 .descriptorCount = 1,
24 .stageFlags = stageFlags,
25 .pImmutableSamplers = nullptr,
26 });
27 flags.push_back(0);
28 return *this;
29 }
30
31 LayoutBindingsBuilder & LayoutBindingsBuilder::addTextureBuffer(uint32_t binding, VkShaderStageFlags stageFlags) {
32 bindings.push_back({
33 .binding = binding,
34 .descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
35 .descriptorCount = MAX_TEXTURE_COUNT,
36 .stageFlags = stageFlags,
37 .pImmutableSamplers = nullptr,
38 });
39 flags.push_back(VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT | VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT);
40 return *this;
41 }
42
46}
constexpr uint32_t MAX_TEXTURE_COUNT
Definition Settings.h:35
std::vector< VkDescriptorBindingFlags > flags
LayoutBindingsBuilder & addTextureBuffer(uint32_t binding, VkShaderStageFlags stageFlags)
Adds a texture buffer for binding.
LayoutBindingsBuilder & addUniformBuffer(uint32_t binding, VkShaderStageFlags stageFlags)
Adds a uniform buffer for binding.
void build()
Decorative. Finishes the nodiscard chain of added buffers.
std::vector< VkDescriptorSetLayoutBinding > bindings
LayoutBindingsBuilder & addStorageBuffer(uint32_t binding, VkShaderStageFlags stageFlags)
Adds a storage buffer to for binding.
Log category system implementation.