Vulkan: Read out of bound when using many resources

Internally the image and texture resources where kept in a vector
where the elements were referenced. When using more than 16 images
this vector is reallocated and previous references become invalid.

This is a quick fix and should be changed with something more
stable.

Pull Request: https://projects.blender.org/blender/blender/pulls/123656
This commit is contained in:
Jeroen Bakker
2024-06-24 11:50:38 +02:00
parent 8d8a57332a
commit 34a679d19f

View File

@@ -138,6 +138,8 @@ void VKDescriptorSetTracker::update(VKContext &context)
BLI_assert(vk_descriptor_set != VK_NULL_HANDLE);
debug::object_label(vk_descriptor_set, shader.name_get());
/* TODO: should be replaced by a better system. The buffer_infos and image_infos can be
* reallocated, making previous references invalid. */
Vector<VkDescriptorBufferInfo> buffer_infos;
buffer_infos.reserve(16);
Vector<VkWriteDescriptorSet> descriptor_writes;
@@ -176,7 +178,7 @@ void VKDescriptorSetTracker::update(VKContext &context)
}
Vector<VkDescriptorImageInfo> image_infos;
image_infos.reserve(16);
image_infos.reserve(32);
for (const Binding &binding : bindings_) {
if (!binding.is_image()) {
continue;