From 037f05f3b44fddf9bd218690daf77a30fca236ec Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 30 Aug 2021 17:09:04 +0100 Subject: [PATCH] Fetch vulkan shader printf messages from a pristine replayed state * For draws/dispatches that aren't pure - i.e. modify state that they read from - we need to be sure we don't replay the action before running it to fetch feedback. For that reason we need to replay up to the action first, then fetch feedback. --- renderdoc/driver/vulkan/vk_shader_feedback.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/renderdoc/driver/vulkan/vk_shader_feedback.cpp b/renderdoc/driver/vulkan/vk_shader_feedback.cpp index 71365f4b1..2bda2fcad 100644 --- a/renderdoc/driver/vulkan/vk_shader_feedback.cpp +++ b/renderdoc/driver/vulkan/vk_shader_feedback.cpp @@ -1439,8 +1439,12 @@ void VulkanReplay::FetchShaderFeedback(uint32_t eventId) } } + // replay from the start without this action, as we want a clean state to do printfs from. + m_pDriver->ReplayLog(0, eventId, eReplay_WithoutDraw); + // we go through the driver for all these creations since they need to be properly - // registered in order to be put in the partial replay state + // registered in order to be put in the partial replay state. Our patched shader is valid so we + // don't need to replay after doing the feedback execute VkResult vkr = VK_SUCCESS; VkDevice dev = m_Device; @@ -1893,9 +1897,6 @@ void VulkanReplay::FetchShaderFeedback(uint32_t eventId) for(size_t i = 0; i < ARRAY_COUNT(modules); i++) if(modules[i] != VK_NULL_HANDLE) m_pDriver->vkDestroyShaderModule(dev, modules[i], NULL); - - // replay from the start as we may have corrupted state while fetching the above feedback. - m_pDriver->ReplayLog(0, eventId, eReplay_Full); } #if ENABLED(ENABLE_UNIT_TESTS)