From 8af9aace3cba1615181c075ea48189bfcef477f8 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 11 Jun 2023 02:34:11 +1000 Subject: [PATCH] GS/Vulkan: Fix incorrect push/pop with cleared colclip target --- pcsx2/GS/Renderers/DX12/GSDevice12.cpp | 10 ++++++---- pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp | 9 ++++++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/pcsx2/GS/Renderers/DX12/GSDevice12.cpp b/pcsx2/GS/Renderers/DX12/GSDevice12.cpp index c9dc6edf42..3cdde6d69f 100644 --- a/pcsx2/GS/Renderers/DX12/GSDevice12.cpp +++ b/pcsx2/GS/Renderers/DX12/GSDevice12.cpp @@ -3152,7 +3152,6 @@ void GSDevice12::RenderHW(GSHWDrawConfig& config) { EndRenderPass(); - GL_PUSH_("HDR Render Target Setup"); hdr_rt = static_cast(CreateRenderTarget(rtsize.x, rtsize.y, GSTexture::Format::HDRColor, false)); if (!hdr_rt) { @@ -3168,8 +3167,11 @@ void GSDevice12::RenderHW(GSHWDrawConfig& config) hdr_rt->SetState(GSTexture::State::Cleared); hdr_rt->SetClearColor(draw_rt->GetClearColor()); } - - draw_rt->TransitionToState(D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE); + else if (draw_rt->GetState() == GSTexture::State::Dirty) + { + GL_PUSH_("HDR Render Target Setup"); + draw_rt->TransitionToState(D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE); + } // we're not drawing to the RT, so we can use it as a source if (config.require_one_barrier) @@ -3303,7 +3305,7 @@ void GSDevice12::RenderHW(GSHWDrawConfig& config) // now blit the hdr texture back to the original target if (hdr_rt) { - GL_INS("Blit HDR back to RT"); + GL_PUSH("Blit HDR back to RT"); EndRenderPass(); hdr_rt->TransitionToState(D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE); diff --git a/pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp b/pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp index a8c68190a9..2191b5724f 100644 --- a/pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp +++ b/pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp @@ -3626,13 +3626,13 @@ void GSDeviceVK::RenderHW(GSHWDrawConfig& config) { EndRenderPass(); - GL_PUSH_("HDR Render Target Setup"); hdr_rt = static_cast(CreateRenderTarget(rtsize.x, rtsize.y, GSTexture::Format::HDRColor, false)); if (!hdr_rt) { Console.WriteLn("Failed to allocate HDR render target, aborting draw."); if (date_image) Recycle(date_image); + GL_POP(); return; } @@ -3642,8 +3642,11 @@ void GSDeviceVK::RenderHW(GSHWDrawConfig& config) hdr_rt->SetState(GSTexture::State::Cleared); hdr_rt->SetClearColor(draw_rt->GetClearColor()); } - - draw_rt->TransitionToLayout(GSTextureVK::Layout::ShaderReadOnly); + else if (draw_rt->GetState() == GSTexture::State::Dirty) + { + GL_PUSH_("HDR Render Target Setup"); + draw_rt->TransitionToLayout(GSTextureVK::Layout::ShaderReadOnly); + } // we're not drawing to the RT, so we can use it as a source if (config.require_one_barrier && !m_features.texture_barrier)