GS/Vulkan: Don't use clear attachments on cleared RT/DS

Redundant.
This commit is contained in:
Connor McLaughlin 2022-07-31 12:58:48 +10:00 committed by refractionpcsx2
parent 1677ef3189
commit 1f16adbca7
1 changed files with 30 additions and 17 deletions

View File

@ -507,8 +507,22 @@ void GSDeviceVK::CopyRect(GSTexture* sTex, GSTexture* dTex, const GSVector4i& r,
return; return;
} }
if (dTexVK->GetState() == GSTexture::State::Cleared)
{
// destination is cleared, if it's the same colour and rect, we can just avoid this entirely
if (dTexVK->IsDepthStencil())
{
if (dTexVK->GetClearDepth() == sTexVK->GetClearDepth())
return;
}
else else
{ {
if ((dTexVK->GetClearColor() == (sTexVK->GetClearColor())).alltrue())
return;
}
}
// otherwise we need to do an attachment clear // otherwise we need to do an attachment clear
const bool depth = (dTexVK->GetType() == GSTexture::Type::DepthStencil); const bool depth = (dTexVK->GetType() == GSTexture::Type::DepthStencil);
OMSetRenderTargets(depth ? nullptr : dTexVK, depth ? dTexVK : nullptr, dtex_rc, false); OMSetRenderTargets(depth ? nullptr : dTexVK, depth ? dTexVK : nullptr, dtex_rc, false);
@ -526,7 +540,6 @@ void GSDeviceVK::CopyRect(GSTexture* sTex, GSTexture* dTex, const GSVector4i& r,
vkCmdClearAttachments(g_vulkan_context->GetCurrentCommandBuffer(), 1, &ca, 1, &cr); vkCmdClearAttachments(g_vulkan_context->GetCurrentCommandBuffer(), 1, &ca, 1, &cr);
return; return;
} }
}
// commit the clear to the source first, then do normal copy // commit the clear to the source first, then do normal copy
sTexVK->CommitClear(); sTexVK->CommitClear();