15 std::vector<API::DescriptorSet> descriptorSets(1);
16 if (!
build(descriptorSets, returnResult)) {
19 instance = std::move(descriptorSets[0]);
24 std::vector<API::DescriptorSet> descriptorSets(1);
25 return build(descriptorSets, returnResult) ? std::make_unique<API::DescriptorSet>(std::move(descriptorSets[0])) :
nullptr;
30 const VkDescriptorSetAllocateInfo allocateInfo{
31 VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO,
34 static_cast<uint32_t>(descriptorSets.size()),
38 std::vector<VkDescriptorSet> vkDescriptorSets(descriptorSets.size());
41 VkResult result = vkAllocateDescriptorSets(static_cast<VkDevice>(
_device), &allocateInfo, vkDescriptorSets.data());
44 *returnResult = result;
47 if (result != VK_SUCCESS) {
51 for (uint32_t i = 0; i < descriptorSets.size(); ++i) {
58 std::vector<std::unique_ptr<API::DescriptorSet>>
DescriptorSet::build(uint32_t count, VkResult* returnResult) {
60 std::vector<API::DescriptorSet> descriptorSets(count);
61 std::vector<std::unique_ptr<API::DescriptorSet>> outDescriptorSets(count);
64 if (!
build(descriptorSets, returnResult)) {
69 for (uint32_t i = 0; i < count; ++i) {
70 outDescriptorSets[i] = std::make_unique<API::DescriptorSet>(std::move(descriptorSets[i]));
73 return outDescriptorSets;
const API::DescriptorPool & _descriptorPool
const API::Device & _device
std::vector< VkDescriptorSetLayout > _descriptorSetLayouts
API::DescriptorPool descriptorPool
bool build(API::DescriptorSet &instance, VkResult *returnResult=nullptr)
DescriptorSet(const API::Device &device, const API::DescriptorPool &descriptorPool)