From 72874e21d31b8901e8b5d49620e64c939aee8025 Mon Sep 17 00:00:00 2001 From: Brett Lawson Date: Tue, 23 Oct 2018 00:26:42 -0700 Subject: [PATCH] Fixed renderdoc crash due to bindings which are not tightly packed In the case where bindings are not tightly packed 1:1 with the attributes, the bindings weren't being resolved first. --- renderdoc/driver/vulkan/vk_postvs.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/renderdoc/driver/vulkan/vk_postvs.cpp b/renderdoc/driver/vulkan/vk_postvs.cpp index be331e3d1..5e7dcddb4 100644 --- a/renderdoc/driver/vulkan/vk_postvs.cpp +++ b/renderdoc/driver/vulkan/vk_postvs.cpp @@ -1811,7 +1811,8 @@ void VulkanReplay::FetchVSOut(uint32_t eventId) for(uint32_t vb = 0; vb < vi->vertexBindingDescriptionCount; vb++) { - VkDeviceSize offs = state.vbuffers[vb].offs; + uint32_t binding = vi->pVertexBindingDescriptions[vb].binding; + VkDeviceSize offs = state.vbuffers[binding].offs; uint64_t len = 0; if(vi->pVertexBindingDescriptions[vb].inputRate == VK_VERTEX_INPUT_RATE_INSTANCE) @@ -1827,10 +1828,10 @@ void VulkanReplay::FetchVSOut(uint32_t eventId) offs += drawcall->vertexOffset * vi->pVertexBindingDescriptions[vb].stride; } - if(state.vbuffers[vb].buf != ResourceId()) + if(state.vbuffers[binding].buf != ResourceId()) { origVBs.push_back(bytebuf()); - GetBufferData(state.vbuffers[vb].buf, offs, len, origVBs.back()); + GetBufferData(state.vbuffers[binding].buf, offs, len, origVBs.back()); } }