1#ifndef VULKAN_DESCRIPTORSET
2#define VULKAN_DESCRIPTORSET
4#include <vulkan/vulkan.h>
25 template<std::derived_from<Vulkan::Set> S>
39 VkDescriptorSetAllocateInfo allocInfo{};
40 allocInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO;
41 allocInfo.descriptorPool = +descriptorPool;
42 allocInfo.descriptorSetCount = 1;
43 allocInfo.pSetLayouts = &+set;
45 if (VkResult result = vkAllocateDescriptorSets(+virtualGpu, &allocInfo, &descriptorSet); result != VK_SUCCESS) {
51 std::vector<DescriptorSetBindingCreationInfo> descriptorsInfo;
52 for (
int i = 0; i < set.getAmountOfBindings(); ++i) {
53 descriptorsInfo.push_back(set.getBindingInfo(i).generateDescriptorSetBindingInfo(descriptorSet));
56 std::vector<VkWriteDescriptorSet> rawDescriptorsInfo;
57 for (
const auto& descriptorInfo : descriptorsInfo) {
58 rawDescriptorsInfo.push_back(+descriptorInfo);
61 vkUpdateDescriptorSets(+virtualGpu, rawDescriptorsInfo.size(), rawDescriptorsInfo.data(), 0,
nullptr);
79 VkDescriptorSet descriptorSet;
A DescriptorSet is an object which holds the handles (pointers) to the bindings (variables) in a spec...
Definition: DescriptorSet.h:26
const VkDescriptorSet & operator+() const
Definition: DescriptorSet.h:65
DescriptorSet(const LogicalDevice &virtualGpu, const DescriptorSetPool &descriptorPool, const S &set)
Builds a DescriptorSet by following the information of the passed-in set.
Definition: DescriptorSet.h:37
const S & getSet() const
Returns the underlying set of this descriptor set.
Definition: DescriptorSet.h:73
Class used to allocate DescriptorSet(s).
Definition: DescriptorSetPool.h:16
A logical device is an abstraction of the physical GPU which we can mainly use to send commands.
Definition: LogicalDevice.h:15
Generic runtime exception thrown by Vulkan-related functions.
Definition: VulkanException.h:13
Types of queue families.
Definition: Animations.h:17