summaryrefslogtreecommitdiff
path: root/engine/xe_descriptors.cpp
diff options
context:
space:
mode:
authorTyler Murphy <tylermurphy534@gmail.com>2022-09-29 15:20:36 -0400
committerTyler Murphy <tylermurphy534@gmail.com>2022-09-29 15:20:36 -0400
commit6afc6389026ca6b510f11ff9a20b6cfed6af4cf0 (patch)
tree943bbf8d0a00e5fa9682effd1aa64af146faef83 /engine/xe_descriptors.cpp
parentundo last commit (diff)
downloadminecraftvulkan-6afc6389026ca6b510f11ff9a20b6cfed6af4cf0.tar.gz
minecraftvulkan-6afc6389026ca6b510f11ff9a20b6cfed6af4cf0.tar.bz2
minecraftvulkan-6afc6389026ca6b510f11ff9a20b6cfed6af4cf0.zip
temporray descriptor pool memory patch
Diffstat (limited to 'engine/xe_descriptors.cpp')
-rw-r--r--engine/xe_descriptors.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/engine/xe_descriptors.cpp b/engine/xe_descriptors.cpp
index 00e627a..2625222 100644
--- a/engine/xe_descriptors.cpp
+++ b/engine/xe_descriptors.cpp
@@ -104,7 +104,11 @@ bool DescriptorPool::allocateDescriptor(
allocInfo.pSetLayouts = &descriptorSetLayout;
allocInfo.descriptorSetCount = 1;
- if (vkAllocateDescriptorSets(xeDevice.device(), &allocInfo, &descriptor) != VK_SUCCESS) {
+ VkResult result = vkAllocateDescriptorSets(xeDevice.device(), &allocInfo, &descriptor);
+ if (result != VK_SUCCESS) {
+ if(result == VK_ERROR_OUT_OF_POOL_MEMORY) {
+ std::cout << "[ERROR] failed to allocate descriptor set, descriptor pool out of memory" << "\n";
+ }
return false;
}
return true;
@@ -173,15 +177,18 @@ DescriptorWriter &DescriptorWriter::writeImageArray(
auto &bindingDescription = setLayout.bindings[binding];
- VkWriteDescriptorSet write{};
- write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
- write.descriptorType = bindingDescription.descriptorType;
- write.dstBinding = binding;
- write.dstArrayElement = 0;
- write.pImageInfo = imageInfos->data();
- write.descriptorCount = imageInfos->size();
+ for(auto &imageInfo : *imageInfos) {
+ VkWriteDescriptorSet write{};
+ write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
+ write.descriptorType = bindingDescription.descriptorType;
+ write.dstBinding = binding;
+ write.dstArrayElement = 0;
+ write.pImageInfo = imageInfos->data();
+ write.descriptorCount = imageInfos->size();
+ write.pBufferInfo = 0;
- writes.push_back(write);
+ writes.push_back(write);
+ }
return *this;
}