GS/DX11: Only optimize out depth for CopyResource.
Some checks are pending
🐧 Linux Builds / AppImage (push) Waiting to run
🐧 Linux Builds / Flatpak (push) Waiting to run
🍎 MacOS Builds / Defaults (push) Waiting to run
🖥️ Windows Builds / Lint VS Project Files (push) Waiting to run
🖥️ Windows Builds / SSE4 (push) Blocked by required conditions
🖥️ Windows Builds / AVX2 (push) Blocked by required conditions
🖥️ Windows Builds / CMake (push) Waiting to run

Fixes recent CopyResource/CopySubresourceRegion regression.
This commit is contained in:
lightningterror 2025-08-26 17:44:43 +02:00
parent 2534cb2c9d
commit 0529715640
2 changed files with 5 additions and 7 deletions

View File

@ -1235,15 +1235,14 @@ void GSDevice11::CopyRect(GSTexture* sTex, GSTexture* dTex, const GSVector4i& r,
// DX11 doesn't support partial depth copy so we need to
// either pass a nullptr D3D11_BOX for a full depth copy or use CopyResource instead.
const bool depth = (sTex->GetType() == GSTexture::Type::DepthStencil);
// Optimization: Use CopyResource for full texture or depth copies, it's faster than CopySubresourceRegion.
if (depth || (r.left == 0 && r.top == 0 && r.right == dTex->GetWidth() && r.bottom == dTex->GetHeight()))
// Optimization: Use CopyResource for depth copies, it's faster than CopySubresourceRegion.
if (sTex->GetType() == GSTexture::Type::DepthStencil)
{
m_ctx->CopyResource(*static_cast<GSTexture11*>(dTex), *static_cast<GSTexture11*>(sTex));
return;
}
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};
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};
m_ctx->CopySubresourceRegion(*static_cast<GSTexture11*>(dTex), 0, destX, destY, 0, *static_cast<GSTexture11*>(sTex), 0, &box);
}

View File

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