From 9f5e6a725bb7a2dc6e12e80a47d1ec85d190263a Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 1 Sep 2020 10:38:19 +0100 Subject: [PATCH] Batch calls to UpdateBackgroundRefCache on descriptor copies --- .../vulkan/wrappers/vk_descriptor_funcs.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/renderdoc/driver/vulkan/wrappers/vk_descriptor_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_descriptor_funcs.cpp index 3b0b29a1a..492ecc6d0 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_descriptor_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_descriptor_funcs.cpp @@ -1373,7 +1373,16 @@ void WrappedVulkan::vkUpdateDescriptorSets(VkDevice device, uint32_t writeCount, uint32_t curSrcIdx = pDescriptorCopies[i].srcArrayElement; uint32_t curDstIdx = pDescriptorCopies[i].dstArrayElement; - ids.clear(); + if(setrecord && setrecord != dstrecord) + { + std::sort(ids.begin(), ids.end()); + + setrecord->descInfo->UpdateBackgroundRefCache(ids); + + ids.clear(); + } + + setrecord = dstrecord; for(uint32_t d = 0; d < pDescriptorCopies[i].descriptorCount; d++, curSrcIdx++, curDstIdx++) { @@ -1417,10 +1426,15 @@ void WrappedVulkan::vkUpdateDescriptorSets(VkDevice device, uint32_t writeCount, bind = (*srcbinding)[curSrcIdx]; bind.AddBindRefs(ids, GetResourceManager(), dstrecord, ref); } + } + if(setrecord) + { std::sort(ids.begin(), ids.end()); - dstrecord->descInfo->UpdateBackgroundRefCache(ids); + setrecord->descInfo->UpdateBackgroundRefCache(ids); + setrecord = NULL; + ids.clear(); } } }