From 95c45c985e45f9672a90db1b0c74501798f719e2 Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 21 Dec 2022 23:03:27 +0000 Subject: [PATCH] Fix handling of descriptor copy&patching during replay --- renderdoc/driver/vulkan/vk_info.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/renderdoc/driver/vulkan/vk_info.cpp b/renderdoc/driver/vulkan/vk_info.cpp index 452c541be..ff7d5f467 100644 --- a/renderdoc/driver/vulkan/vk_info.cpp +++ b/renderdoc/driver/vulkan/vk_info.cpp @@ -660,6 +660,13 @@ bool CreateDescriptorWritesForSlotData(WrappedVulkan *vk, rdcarrayHasLiveResource(resId)) + resId = rm->GetLiveID(resId); + ResourceId sampId = slots[slot].sampler; + if(rm->HasLiveResource(resId)) + sampId = rm->GetLiveID(sampId); + switch(descType) { case VK_DESCRIPTOR_TYPE_SAMPLER: @@ -668,15 +675,15 @@ bool CreateDescriptorWritesForSlotData(WrappedVulkan *vk, rdcarrayHasLiveResource(slots[slot].resource)) - writeImage[arrayIdx].imageView = rm->GetLiveHandle(slots[slot].resource); + if(descType != VK_DESCRIPTOR_TYPE_SAMPLER && rm->HasCurrentResource(resId)) + writeImage[arrayIdx].imageView = rm->GetCurrentHandle(resId); else writeImage[arrayIdx].imageView = VK_NULL_HANDLE; if((descType == VK_DESCRIPTOR_TYPE_SAMPLER || descType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER) && - rm->HasLiveResource(slots[slot].sampler)) - writeImage[arrayIdx].sampler = rm->GetLiveHandle(slots[slot].sampler); + rm->HasCurrentResource(slots[slot].sampler)) + writeImage[arrayIdx].sampler = rm->GetCurrentHandle(slots[slot].sampler); else writeImage[arrayIdx].sampler = VK_NULL_HANDLE; @@ -698,8 +705,8 @@ bool CreateDescriptorWritesForSlotData(WrappedVulkan *vk, rdcarrayHasLiveResource(slots[slot].resource)) - writeTexelBuffer[arrayIdx] = rm->GetLiveHandle(slots[slot].resource); + if(rm->HasCurrentResource(slots[slot].resource)) + writeTexelBuffer[arrayIdx] = rm->GetCurrentHandle(slots[slot].resource); else writeTexelBuffer[arrayIdx] = VK_NULL_HANDLE; @@ -711,8 +718,8 @@ bool CreateDescriptorWritesForSlotData(WrappedVulkan *vk, rdcarrayHasLiveResource(slots[slot].resource)) - writeBuffer[arrayIdx].buffer = rm->GetLiveHandle(slots[slot].resource); + if(rm->HasCurrentResource(slots[slot].resource)) + writeBuffer[arrayIdx].buffer = rm->GetCurrentHandle(slots[slot].resource); else writeBuffer[arrayIdx].buffer = VK_NULL_HANDLE; writeBuffer[arrayIdx].offset = slots[slot].offset;