From cc3d383287d4d4f3a1f96f49b70bd6633c594f4c Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 14 Apr 2023 16:07:55 +0100 Subject: [PATCH] Manually check depth bounds test in vulkan pixel history --- renderdoc/driver/vulkan/vk_pixelhistory.cpp | 19 +++++++++++++++++++ util/test/tests/Vulkan/VK_Pixel_History.py | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/renderdoc/driver/vulkan/vk_pixelhistory.cpp b/renderdoc/driver/vulkan/vk_pixelhistory.cpp index 38d7b84c3..b9b4ef2c4 100644 --- a/renderdoc/driver/vulkan/vk_pixelhistory.cpp +++ b/renderdoc/driver/vulkan/vk_pixelhistory.cpp @@ -2077,6 +2077,10 @@ struct TestsFailedCallback : public VulkanPixelHistoryCallback m_pDriver->GetDebugManager()->GetPipelineInfo(pipestate.graphics.pipeline); uint32_t eventFlags = CalculateEventFlags(p, pipestate); m_EventFlags[eid] = eventFlags; + if(pipestate.depthBoundsTestEnable) + m_EventDepthBounds[eid] = {pipestate.mindepth, pipestate.maxdepth}; + else + m_EventDepthBounds[eid] = {}; // TODO: figure out if the shader has early fragments tests turned on, // based on the currently bound fragment shader. @@ -2129,6 +2133,13 @@ struct TestsFailedCallback : public VulkanPixelHistoryCallback RDCERR("Can't find event flags for event %u", eventId); return it->second; } + rdcpair GetEventDepthBounds(uint32_t eventId) + { + auto it = m_EventDepthBounds.find(eventId); + if(it == m_EventDepthBounds.end()) + RDCERR("Can't find event flags for event %u", eventId); + return it->second; + } void FetchOcclusionResults() { @@ -2571,6 +2582,7 @@ private: rdcarray m_Events; // Key is event ID, value is the flags for that event. std::map m_EventFlags; + std::map> m_EventDepthBounds; // Key is a pair std::map, VkPipeline> m_PipeCache; // Key: pair @@ -4131,6 +4143,13 @@ rdcarray VulkanReplay::PixelHistory(rdcarray even if(!passed) history[h].depthTestFailed = true; + + rdcpair depthBounds = tfCb->GetEventDepthBounds(history[h].eventId); + + if((history[h].preMod.depth < depthBounds.first || + history[h].preMod.depth > depthBounds.second) && + depthBounds.second > depthBounds.first) + history[h].depthBoundsFailed = true; } } } diff --git a/util/test/tests/Vulkan/VK_Pixel_History.py b/util/test/tests/Vulkan/VK_Pixel_History.py index 185db9b3f..2a41f8774 100644 --- a/util/test/tests/Vulkan/VK_Pixel_History.py +++ b/util/test/tests/Vulkan/VK_Pixel_History.py @@ -216,7 +216,7 @@ class VK_Pixel_History(rdtest.TestCase): [[event_id, depth_test_eid], [primitive_id, 3], [depth_test_failed, False], [shader_out_col, (0.0, 0.0, 1.0, 2.75)], [shader_out_depth, 0.10], [post_mod_col, (0.0, 0.0, 1.0, 1.0)], [post_mod_depth, 0.10]], - [[event_id, depth_test_eid], [primitive_id, 4], [depth_test_failed, False], + [[event_id, depth_test_eid], [primitive_id, 4], [depth_test_failed, False], [depth_bounds_failed, True], [shader_out_col, (1.0, 1.0, 1.0, 2.75)], [shader_out_depth, 0.05], [post_mod_col, (0.0, 0.0, 1.0, 1.0)], [post_mod_depth, 0.10]], ]