mirror of https://github.com/PCSX2/pcsx2.git
GS/Vulkan: Don't use clear attachments on cleared RT/DS
Redundant.
This commit is contained in:
parent
1677ef3189
commit
1f16adbca7
|
@ -507,25 +507,38 @@ void GSDeviceVK::CopyRect(GSTexture* sTex, GSTexture* dTex, const GSVector4i& r,
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (dTexVK->GetState() == GSTexture::State::Cleared)
|
||||||
{
|
{
|
||||||
// otherwise we need to do an attachment clear
|
// destination is cleared, if it's the same colour and rect, we can just avoid this entirely
|
||||||
const bool depth = (dTexVK->GetType() == GSTexture::Type::DepthStencil);
|
if (dTexVK->IsDepthStencil())
|
||||||
OMSetRenderTargets(depth ? nullptr : dTexVK, depth ? dTexVK : nullptr, dtex_rc, false);
|
{
|
||||||
BeginRenderPassForStretchRect(dTexVK, dtex_rc, GSVector4i(destX, destY, destX + r.width(), destY + r.height()));
|
if (dTexVK->GetClearDepth() == sTexVK->GetClearDepth())
|
||||||
|
return;
|
||||||
// so use an attachment clear
|
}
|
||||||
VkClearAttachment ca;
|
else
|
||||||
ca.aspectMask = depth ? VK_IMAGE_ASPECT_DEPTH_BIT : VK_IMAGE_ASPECT_COLOR_BIT;
|
{
|
||||||
GSVector4::store<false>(ca.clearValue.color.float32, sTexVK->GetClearColor());
|
if ((dTexVK->GetClearColor() == (sTexVK->GetClearColor())).alltrue())
|
||||||
ca.clearValue.depthStencil.depth = sTexVK->GetClearDepth();
|
return;
|
||||||
ca.clearValue.depthStencil.stencil = 0;
|
}
|
||||||
ca.colorAttachment = 0;
|
|
||||||
|
|
||||||
const VkClearRect cr = { {{0, 0}, {static_cast<u32>(r.width()), static_cast<u32>(r.height())}}, 0u, 1u };
|
|
||||||
vkCmdClearAttachments(g_vulkan_context->GetCurrentCommandBuffer(), 1, &ca, 1, &cr);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// otherwise we need to do an attachment clear
|
||||||
|
const bool depth = (dTexVK->GetType() == GSTexture::Type::DepthStencil);
|
||||||
|
OMSetRenderTargets(depth ? nullptr : dTexVK, depth ? dTexVK : nullptr, dtex_rc, false);
|
||||||
|
BeginRenderPassForStretchRect(dTexVK, dtex_rc, GSVector4i(destX, destY, destX + r.width(), destY + r.height()));
|
||||||
|
|
||||||
|
// so use an attachment clear
|
||||||
|
VkClearAttachment ca;
|
||||||
|
ca.aspectMask = depth ? VK_IMAGE_ASPECT_DEPTH_BIT : VK_IMAGE_ASPECT_COLOR_BIT;
|
||||||
|
GSVector4::store<false>(ca.clearValue.color.float32, sTexVK->GetClearColor());
|
||||||
|
ca.clearValue.depthStencil.depth = sTexVK->GetClearDepth();
|
||||||
|
ca.clearValue.depthStencil.stencil = 0;
|
||||||
|
ca.colorAttachment = 0;
|
||||||
|
|
||||||
|
const VkClearRect cr = { {{0, 0}, {static_cast<u32>(r.width()), static_cast<u32>(r.height())}}, 0u, 1u };
|
||||||
|
vkCmdClearAttachments(g_vulkan_context->GetCurrentCommandBuffer(), 1, &ca, 1, &cr);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// commit the clear to the source first, then do normal copy
|
// commit the clear to the source first, then do normal copy
|
||||||
|
|
Loading…
Reference in New Issue