From b7e17646a3a23f0da9076f3a4abec07d227ebde9 Mon Sep 17 00:00:00 2001 From: lightningterror <18107717+lightningterror@users.noreply.github.com> Date: Tue, 7 Oct 2025 17:25:18 +0200 Subject: [PATCH] GS/DX12: Backport dx11 full rt copy optimizations. We are copying the whole RT so just call CopyResource instead of CopyTextureRegion which will be faster. --- pcsx2/GS/Renderers/DX12/GSDevice12.cpp | 15 ++++++++++++--- pcsx2/GS/Renderers/HW/GSRendererHW.cpp | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/pcsx2/GS/Renderers/DX12/GSDevice12.cpp b/pcsx2/GS/Renderers/DX12/GSDevice12.cpp index 316336a69e..c48e9140f0 100644 --- a/pcsx2/GS/Renderers/DX12/GSDevice12.cpp +++ b/pcsx2/GS/Renderers/DX12/GSDevice12.cpp @@ -1409,9 +1409,18 @@ void GSDevice12::CopyRect(GSTexture* sTex, GSTexture* dTex, const GSVector4i& r, dstloc.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX; dstloc.SubresourceIndex = 0; - const D3D12_BOX srcbox{static_cast(r.left), static_cast(r.top), 0u, static_cast(r.right), - static_cast(r.bottom), 1u}; - GetCommandList()->CopyTextureRegion(&dstloc, destX, destY, 0, &srcloc, &srcbox); + const GSVector4i src_rect(0, 0, sTex->GetWidth(), sTex->GetHeight()); + const bool full_rt_copy = destX == 0 && destY == 0 && r.eq(src_rect) && src_rect.eq(dst_rect); + if (full_rt_copy) + { + GetCommandList()->CopyResource(dTex12->GetResource(), sTex12->GetResource()); + } + else + { + const D3D12_BOX srcbox{static_cast(r.left), static_cast(r.top), 0u, static_cast(r.right), + static_cast(r.bottom), 1u}; + GetCommandList()->CopyTextureRegion(&dstloc, destX, destY, 0, &srcloc, &srcbox); + } dTex12->SetState(GSTexture::State::Dirty); } diff --git a/pcsx2/GS/Renderers/HW/GSRendererHW.cpp b/pcsx2/GS/Renderers/HW/GSRendererHW.cpp index ae598e173c..9d7a8cf63e 100644 --- a/pcsx2/GS/Renderers/HW/GSRendererHW.cpp +++ b/pcsx2/GS/Renderers/HW/GSRendererHW.cpp @@ -1802,7 +1802,7 @@ void GSRendererHW::HandleManualDeswizzle() // we're gonna have to get creative and swap around the quandrants, but that's a TODO. GSVertex* v = &m_vertex.buff[0]; - // Check for page quadrant and compare it to the quadrant from the verts, if it doesn't match then we need to do correction. + // Check for page quadrant and compare it to the quadrant from the verts, if it does match then we need to do correction. const GSVector2i page_quadrant = GSLocalMemory::m_psm[m_cached_ctx.FRAME.PSM].pgs / 2; if (PRIM->FST)