From ba7096c9fab6ae82065bdbb1d559319acf5af743 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sat, 11 May 2024 01:48:07 +1000 Subject: [PATCH] GS/Vulkan: Always issue first barrier on RDNA3 It turns out *not* doing this causes GPU resets on RDNA3, specifically Windows drivers. Despite the layout changing enforcing the execution dependency between previous draws and the first input attachment read, it still wants the region/fragment-local barrier... --- pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp | 7 ++++++- pcsx2/GS/Renderers/Vulkan/GSDeviceVK.h | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp b/pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp index 6625f35d32..884258a8d4 100644 --- a/pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp +++ b/pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp @@ -5750,8 +5750,13 @@ void GSDeviceVK::RenderHW(GSHWDrawConfig& config) // We don't need the very first barrier if this is the first draw after switching to feedback loop, // because the layout change in itself enforces the execution dependency. HDR needs a barrier between // setup and the first draw to read it. TODO: Make HDR use subpasses instead. + + // However, it turns out *not* doing this causes GPU resets on RDNA3, specifically Windows drivers. + // Despite the layout changing enforcing the execution dependency between previous draws and the first + // input attachment read, it still wants the region/fragment-local barrier... + const bool skip_first_barrier = - (draw_rt && draw_rt->GetLayout() != GSTextureVK::Layout::FeedbackLoop && !pipe.ps.hdr); + (draw_rt && draw_rt->GetLayout() != GSTextureVK::Layout::FeedbackLoop && !pipe.ps.hdr && !IsDeviceAMD()); OMSetRenderTargets(draw_rt, draw_ds, config.scissor, static_cast(pipe.feedback_loop_flags)); if (pipe.IsRTFeedbackLoop()) diff --git a/pcsx2/GS/Renderers/Vulkan/GSDeviceVK.h b/pcsx2/GS/Renderers/Vulkan/GSDeviceVK.h index 8bfe12277f..0f7871a360 100644 --- a/pcsx2/GS/Renderers/Vulkan/GSDeviceVK.h +++ b/pcsx2/GS/Renderers/Vulkan/GSDeviceVK.h @@ -68,6 +68,9 @@ public: /// Returns true if running on an NVIDIA GPU. __fi bool IsDeviceNVIDIA() const { return (m_device_properties.vendorID == 0x10DE); } + /// Returns true if running on an AMD GPU. + __fi bool IsDeviceAMD() const { return (m_device_properties.vendorID == 0x1002); } + // Creates a simple render pass. VkRenderPass GetRenderPass(VkFormat color_format, VkFormat depth_format, VkAttachmentLoadOp color_load_op = VK_ATTACHMENT_LOAD_OP_LOAD,