From 79d22a8d77229ed80d75d383bf39e9d18c8cecf5 Mon Sep 17 00:00:00 2001 From: lightningterror <18107717+lightningterror@users.noreply.github.com> Date: Tue, 27 May 2025 04:06:59 +0200 Subject: [PATCH] GS/HW: Add/adjust logs for failed texture creation. --- pcsx2/GS/Renderers/DX11/GSDevice11.cpp | 11 +++++++++++ pcsx2/GS/Renderers/DX12/GSDevice12.cpp | 10 +++++++--- pcsx2/GS/Renderers/OpenGL/GSDeviceOGL.cpp | 11 +++++++++++ pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp | 8 +++++--- 4 files changed, 34 insertions(+), 6 deletions(-) diff --git a/pcsx2/GS/Renderers/DX11/GSDevice11.cpp b/pcsx2/GS/Renderers/DX11/GSDevice11.cpp index 8a368ddf51..f5435048a1 100644 --- a/pcsx2/GS/Renderers/DX11/GSDevice11.cpp +++ b/pcsx2/GS/Renderers/DX11/GSDevice11.cpp @@ -2509,7 +2509,10 @@ void GSDevice11::RenderHW(GSHWDrawConfig& config) colclip_rt = CreateRenderTarget(rtsize.x, rtsize.y, GSTexture::Format::ColorClip); if (!colclip_rt) + { + Console.Warning("D3D11: Failed to allocate ColorClip render target, aborting draw."); return; + } g_gs_device->SetColorClipTexture(colclip_rt); @@ -2525,7 +2528,10 @@ void GSDevice11::RenderHW(GSHWDrawConfig& config) { primid_tex = CreateRenderTarget(rtsize.x, rtsize.y, GSTexture::Format::PrimID, false); if (!primid_tex) + { + Console.WriteLn("D3D11: Failed to allocate DATE image, aborting draw."); return; + } StretchRect(colclip_rt ? colclip_rt : config.rt, GSVector4(config.drawarea) / GSVector4(rtsize).xyxy(), primid_tex, GSVector4(config.drawarea), m_date.primid_init_ps[static_cast(config.datm)].get(), nullptr, false); @@ -2616,6 +2622,9 @@ void GSDevice11::RenderHW(GSHWDrawConfig& config) if (config.tex && config.tex == config.rt) PSSetShaderResource(0, draw_rt_clone); } + else + Console.Warning("D3D11: Failed to allocate temp texture for RT copy."); + } GSTexture* draw_ds_clone = nullptr; @@ -2629,6 +2638,8 @@ void GSDevice11::RenderHW(GSHWDrawConfig& config) CopyRect(config.ds, draw_ds_clone, config.drawarea, config.drawarea.left, config.drawarea.top); PSSetShaderResource(0, draw_ds_clone); } + else + Console.Warning("D3D11: Failed to allocate temp texture for DS copy."); } SetupVS(config.vs, &config.cb_vs); diff --git a/pcsx2/GS/Renderers/DX12/GSDevice12.cpp b/pcsx2/GS/Renderers/DX12/GSDevice12.cpp index 138fbb60e5..696516f4c2 100644 --- a/pcsx2/GS/Renderers/DX12/GSDevice12.cpp +++ b/pcsx2/GS/Renderers/DX12/GSDevice12.cpp @@ -3917,7 +3917,7 @@ void GSDevice12::RenderHW(GSHWDrawConfig& config) { EndRenderPass(); - GL_PUSH("Copy RT to temp texture {%d,%d %dx%d}", config.drawarea.left, config.drawarea.top, + GL_PUSH("D3D12: Copy RT to temp texture {%d,%d %dx%d}", config.drawarea.left, config.drawarea.top, config.drawarea.width(), config.drawarea.height()); draw_rt_clone->SetState(GSTexture::State::Invalidated); @@ -3927,6 +3927,8 @@ void GSDevice12::RenderHW(GSHWDrawConfig& config) if (config.tex && config.tex == config.rt) PSSetShaderResource(0, draw_rt_clone, true); } + else + Console.Warning("D3D12: Failed to allocate temp texture for RT copy."); } if (config.tex && config.tex == config.ds) @@ -3937,13 +3939,15 @@ void GSDevice12::RenderHW(GSHWDrawConfig& config) { EndRenderPass(); - GL_PUSH("Copy DS to temp texture {%d,%d %dx%d}", config.drawarea.left, config.drawarea.top, + GL_PUSH("D3D12: Copy DS to temp texture {%d,%d %dx%d}", config.drawarea.left, config.drawarea.top, config.drawarea.width(), config.drawarea.height()); draw_ds_clone->SetState(GSTexture::State::Invalidated); CopyRect(config.ds, draw_ds_clone, config.drawarea, config.drawarea.left, config.drawarea.top); PSSetShaderResource(0, draw_ds_clone, true); } + else + Console.Warning("D3D12: Failed to allocate temp texture for DS copy."); } // Switch to colclip target for colclip hw rendering @@ -3958,7 +3962,7 @@ void GSDevice12::RenderHW(GSHWDrawConfig& config) colclip_rt = static_cast(CreateRenderTarget(rtsize.x, rtsize.y, GSTexture::Format::ColorClip, false)); if (!colclip_rt) { - Console.WriteLn("D3D12: Failed to allocate ColorClip render target, aborting draw."); + Console.Warning("D3D12: Failed to allocate ColorClip render target, aborting draw."); if (date_image) Recycle(date_image); diff --git a/pcsx2/GS/Renderers/OpenGL/GSDeviceOGL.cpp b/pcsx2/GS/Renderers/OpenGL/GSDeviceOGL.cpp index c25248df31..f065f81c5c 100644 --- a/pcsx2/GS/Renderers/OpenGL/GSDeviceOGL.cpp +++ b/pcsx2/GS/Renderers/OpenGL/GSDeviceOGL.cpp @@ -2446,7 +2446,11 @@ void GSDeviceOGL::RenderHW(GSHWDrawConfig& config) colclip_rt = CreateRenderTarget(rtsize.x, rtsize.y, GSTexture::Format::ColorClip, false); if (!colclip_rt) + { + Console.Warning("GL: Failed to allocate ColorClip render target, aborting draw."); + return; + } OMSetRenderTargets(colclip_rt, config.ds, nullptr); @@ -2467,6 +2471,11 @@ void GSDeviceOGL::RenderHW(GSHWDrawConfig& config) break; // No setup case GSHWDrawConfig::DestinationAlphaMode::PrimIDTracking: primid_texture = InitPrimDateTexture(colclip_rt ? colclip_rt : config.rt, config.drawarea, config.datm); + if (!primid_texture) + { + Console.WriteLn("GL: Failed to allocate DATE image, aborting draw."); + return; + } break; case GSHWDrawConfig::DestinationAlphaMode::StencilOne: if (m_features.texture_barrier) @@ -2503,6 +2512,8 @@ void GSDeviceOGL::RenderHW(GSHWDrawConfig& config) config.drawarea.width(), config.drawarea.height()); CopyRect(colclip_rt ? colclip_rt : config.rt, draw_rt_clone, config.drawarea, config.drawarea.left, config.drawarea.top); } + else + Console.Warning("GL: Failed to allocate temp texture for RT copy."); } IASetVertexBuffer(config.verts, config.nverts); diff --git a/pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp b/pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp index 762f65ed5e..661b47a9b9 100644 --- a/pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp +++ b/pcsx2/GS/Renderers/Vulkan/GSDeviceVK.cpp @@ -5625,7 +5625,7 @@ void GSDeviceVK::RenderHW(GSHWDrawConfig& config) date_image = SetupPrimitiveTrackingDATE(config); if (!date_image) { - Console.WriteLn("Failed to allocate DATE image, aborting draw."); + Console.WriteLn("VK: Failed to allocate DATE image, aborting draw."); return; } @@ -5726,12 +5726,14 @@ void GSDeviceVK::RenderHW(GSHWDrawConfig& config) { EndRenderPass(); - GL_PUSH("Copy RT to temp texture for fbmask {%d,%d %dx%d}", config.drawarea.left, config.drawarea.top, + GL_PUSH("VK: Copy RT to temp texture for fbmask {%d,%d %dx%d}", config.drawarea.left, config.drawarea.top, config.drawarea.width(), config.drawarea.height()); CopyRect(draw_rt, draw_rt_clone, config.drawarea, config.drawarea.left, config.drawarea.top); PSSetShaderResource(2, draw_rt_clone, true); } + else + Console.Warning("VK: Failed to allocate temp texture for RT copy."); } // Switch to colclip target for colclip hw rendering @@ -5744,7 +5746,7 @@ void GSDeviceVK::RenderHW(GSHWDrawConfig& config) colclip_rt = static_cast(CreateRenderTarget(rtsize.x, rtsize.y, GSTexture::Format::ColorClip, false)); if (!colclip_rt) { - Console.WriteLn("Failed to allocate ColorClip render target, aborting draw."); + Console.Warning("VK: Failed to allocate ColorClip render target, aborting draw."); if (date_image) Recycle(date_image);