Skip to content

Commit 0529715

Browse files
GS/DX11: Only optimize out depth for CopyResource.
Fixes recent CopyResource/CopySubresourceRegion regression.
1 parent 2534cb2 commit 0529715

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

pcsx2/GS/Renderers/DX11/GSDevice11.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,15 +1235,14 @@ void GSDevice11::CopyRect(GSTexture* sTex, GSTexture* dTex, const GSVector4i& r,
12351235

12361236
// DX11 doesn't support partial depth copy so we need to
12371237
// either pass a nullptr D3D11_BOX for a full depth copy or use CopyResource instead.
1238-
const bool depth = (sTex->GetType() == GSTexture::Type::DepthStencil);
1239-
// Optimization: Use CopyResource for full texture or depth copies, it's faster than CopySubresourceRegion.
1240-
if (depth || (r.left == 0 && r.top == 0 && r.right == dTex->GetWidth() && r.bottom == dTex->GetHeight()))
1238+
// Optimization: Use CopyResource for depth copies, it's faster than CopySubresourceRegion.
1239+
if (sTex->GetType() == GSTexture::Type::DepthStencil)
12411240
{
12421241
m_ctx->CopyResource(*static_cast<GSTexture11*>(dTex), *static_cast<GSTexture11*>(sTex));
12431242
return;
12441243
}
12451244

1246-
D3D11_BOX box = {static_cast<UINT>(r.left), static_cast<UINT>(r.top), 0U,static_cast<UINT>(r.right), static_cast<UINT>(r.bottom), 1U};
1245+
D3D11_BOX box = {static_cast<UINT>(r.left), static_cast<UINT>(r.top), 0U, static_cast<UINT>(r.right), static_cast<UINT>(r.bottom), 1U};
12471246
m_ctx->CopySubresourceRegion(*static_cast<GSTexture11*>(dTex), 0, destX, destY, 0, *static_cast<GSTexture11*>(sTex), 0, &box);
12481247
}
12491248

pcsx2/GS/Renderers/DX11/GSTexture11.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,8 @@ void GSDownloadTexture11::CopyFromTexture(
245245

246246
// DX11 doesn't support partial depth copy so we need to
247247
// either pass a nullptr D3D11_BOX for a full depth copy or use CopyResource instead.
248-
// Optimization: Use CopyResource for full texture or depth copies, it's faster than CopySubresourceRegion.
249-
if ((m_format == GSTexture::Format::DepthStencil) ||
250-
(src.left == 0 && src.top == 0 && src.right == stex->GetWidth() && src.bottom == stex->GetHeight()))
248+
// Optimization: Use CopyResource for depth copies, it's faster than CopySubresourceRegion.
249+
if (m_format == GSTexture::Format::DepthStencil)
251250
{
252251
GSDevice11::GetInstance()->GetD3DContext()->CopyResource(
253252
m_texture.get(), *static_cast<GSTexture11*>(stex));

0 commit comments

Comments
 (0)