From a6fed120ace135de20c7d57d0ba65cd6dc4d4acb Mon Sep 17 00:00:00 2001 From: Jake Turner Date: Thu, 27 Jul 2023 12:58:06 +0100 Subject: [PATCH] Vulkan PostVS ignore primmitive restart indexes when restart is active Compute primitive restart using VulkanRenderState not pipeline, to account for dynamic state. Ignore primitive restart indexes, handles primitive restart indexes being used when there are no active vertex buffer bindings --- renderdoc/driver/vulkan/vk_postvs.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/renderdoc/driver/vulkan/vk_postvs.cpp b/renderdoc/driver/vulkan/vk_postvs.cpp index a4010ac15..bbd2a2487 100644 --- a/renderdoc/driver/vulkan/vk_postvs.cpp +++ b/renderdoc/driver/vulkan/vk_postvs.cpp @@ -1749,7 +1749,7 @@ void VulkanReplay::FetchVSOut(uint32_t eventId, VulkanRenderState &state) if(action->flags & ActionFlags::Indexed) { - const bool restart = pipeCreateInfo.pInputAssemblyState->primitiveRestartEnable == VK_TRUE; + const bool restart = state.primRestartEnable != VK_FALSE; bytebuf idxdata; rdcarray indices; uint8_t *idx8 = NULL; @@ -1838,6 +1838,10 @@ void VulkanReplay::FetchVSOut(uint32_t eventId, VulkanRenderState &state) // buffers which is generally much more reasonable i32 = RDCMIN(maxIdx, i32); + // ignore primitive restart indices + if(restart && i32 == (0xffffffff >> ((4 - idxsize) * 8))) + continue; + auto it = std::lower_bound(indices.begin(), indices.end(), i32); if(it != indices.end() && *it == i32)