From 3025cf66c6de7949bb55115ec54ac59fef1bedda Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 22 Feb 2021 11:24:43 +0000 Subject: [PATCH] Force shader feedback before clear-before-draw overlay on vulkan * The shader feedback itself will potentially trigger a replay. If this happens after the overlay is processed when fetching the pipeline state it will undo the clear-before. To workaround this without a huge and unnecessary refactor, we just triggere the shader feedback cache before doing a clear-before overlay. The amount of work is the same it just happens in a different place. --- renderdoc/driver/vulkan/vk_overlay.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/renderdoc/driver/vulkan/vk_overlay.cpp b/renderdoc/driver/vulkan/vk_overlay.cpp index 72604f041..5623619a9 100644 --- a/renderdoc/driver/vulkan/vk_overlay.cpp +++ b/renderdoc/driver/vulkan/vk_overlay.cpp @@ -1893,6 +1893,14 @@ ResourceId VulkanReplay::RenderOverlay(ResourceId texid, FloatVector clearCol, D size_t startEvent = 0; + // this is a bit of a hack, but it's the simplest fix without refactoring the ClearBefore.. + // overlay to copy the result off into the overlay texture (which has its own issues with + // alpha channels since the overlay expects to be blended). If we are selecting a new event + // with ClearBeforeDraw enabled then we do this here, and then later the pipeline is fetched + // and that triggers the bindless feedback - which will reset the state and undo our clear. If + // we force it to be cached here then it won't mess things up later. + FetchShaderFeedback(eventId); + // if we're ClearBeforePass the first event will be a vkBeginRenderPass. // if there are any other events, we need to play up to right before them // so that we have all the render state set up to do