96 template<std::same_as<std::pair<VkShaderStageFlagBits, VkDescriptorType>>... ShaderStages>
99 std::vector<VkDescriptorSetLayoutBinding> bindings;
101 ([&bindings, &counter](std::pair<VkShaderStageFlagBits, VkDescriptorType> shaderStage) {
102 VkDescriptorSetLayoutBinding binding{};
103 binding.binding = counter;
104 binding.descriptorCount = 1;
105 binding.descriptorType = shaderStage.second;
106 binding.pImmutableSamplers =
nullptr;
107 binding.stageFlags = shaderStage.first;
108 bindings.push_back(binding);
110 }(shaderStages), ...);
113 VkDescriptorSetLayoutCreateInfo layoutInfo{};
114 layoutInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
115 layoutInfo.bindingCount = bindings.size();
116 layoutInfo.pBindings = bindings.data();
119 throw VulkanException(
"Failed to create descriptor set layout!", result);
Definition: DescriptorSetBindingCreationInfo.h:10
A logical device is an abstraction of the physical GPU which we can mainly use to send commands.
Definition: LogicalDevice.h:15
A Set is a set of bindings which can be read by the shader.
Definition: Set.h:21
const BindingInfo & getBindingInfo(int i) const
Returns the size, offset and buffer of the binding number i of this set.
Definition: Set.h:75
void createDescriptorSetLayout(ShaderStages... shaderStages)
Definition: Set.h:97
const std::vector< std::unique_ptr< BindingInfo > > & getBindingsInfo() const
Returns the size, offset and buffer of each binding in this set.
Definition: Set.h:67
Set & operator=(Set &&)=delete
Set & operator=(const Set &)=delete
VkDescriptorSetLayout descriptorSetLayout
Definition: Set.h:125
int getAmountOfBindings() const
Returns the number of bindings in this set.
Definition: Set.h:59
const LogicalDevice & virtualGpu
Definition: Set.h:127
Set(const LogicalDevice &virtualGpu)
Definition: Set.h:83
std::vector< std::unique_ptr< BindingInfo > > bindingsInfo
Definition: Set.h:126
const VkDescriptorSetLayout & operator+() const
Returns the underlying VkDescriptorSetLayout object.
Definition: Set.h:29
~Set()
Definition: Set.h:90
Generic runtime exception thrown by Vulkan-related functions.
Definition: VulkanException.h:13
Types of queue families.
Definition: Animations.h:17
A struct containing all of the information of a specific binding. This class must be the base of othe...
Definition: Set.h:37
unsigned int binding
The binding index.
Definition: Set.h:50
virtual DescriptorSetBindingCreationInfo generateDescriptorSetBindingInfo(const VkDescriptorSet &descriptorSet) const =0
Creates the struct for this binding used to create the descriptor set.