GS/Vulkan: Use attachment clear for ONE stencil

66% faster in Persona 3 in DATE-heavy scenes.
This commit is contained in:
Stenzek 2024-03-01 16:44:40 +10:00 committed by Connor McLaughlin
parent b9a7143dee
commit 0ae3cbf4d6
1 changed files with 10 additions and 2 deletions

View File

@ -5683,9 +5683,9 @@ void GSDeviceVK::RenderHW(GSHWDrawConfig& config)
} }
// render pass restart optimizations // render pass restart optimizations
if (hdr_rt || DATE_rp == DATE_RENDER_PASS_STENCIL_ONE) if (hdr_rt)
{ {
// DATE/HDR require clearing/blitting respectively. // HDR requires blitting.
EndRenderPass(); EndRenderPass();
} }
else if (InRenderPass() && (m_current_render_target == draw_rt || m_current_depth_target == draw_ds)) else if (InRenderPass() && (m_current_render_target == draw_rt || m_current_depth_target == draw_ds))
@ -5755,6 +5755,14 @@ void GSDeviceVK::RenderHW(GSHWDrawConfig& config)
BeginRenderPass(rp, render_area); BeginRenderPass(rp, render_area);
} }
} }
else if (DATE_rp == DATE_RENDER_PASS_STENCIL_ONE)
{
const VkClearAttachment ca = {VK_IMAGE_ASPECT_STENCIL_BIT, 0u, {.depthStencil = {0.0f, 1u}}};
const VkClearRect rc = {{{config.drawarea.left, config.drawarea.top},
{static_cast<u32>(config.drawarea.width()), static_cast<u32>(config.drawarea.height())}},
0u, 1u};
vkCmdClearAttachments(m_current_command_buffer, 1, &ca, 1, &rc);
}
// rt -> hdr blit if enabled // rt -> hdr blit if enabled
if (hdr_rt && config.rt->GetState() == GSTexture::State::Dirty) if (hdr_rt && config.rt->GetState() == GSTexture::State::Dirty)