GS/Vulkan: Discard instead of clear for PrimID setup fill

This commit is contained in:
Connor McLaughlin 2022-09-07 17:17:12 +10:00 committed by refractionpcsx2
parent 81c0e000e7
commit 16a33e42e2
1 changed files with 4 additions and 5 deletions
pcsx2/GS/Renderers/Vulkan

View File

@ -1482,7 +1482,7 @@ bool GSDeviceVK::CompileConvertPipelines()
m_date_image_setup_render_passes[ds][clear] = m_date_image_setup_render_passes[ds][clear] =
g_vulkan_context->GetRenderPass(LookupNativeFormat(GSTexture::Format::PrimID), g_vulkan_context->GetRenderPass(LookupNativeFormat(GSTexture::Format::PrimID),
ds ? LookupNativeFormat(GSTexture::Format::DepthStencil) : VK_FORMAT_UNDEFINED, ds ? LookupNativeFormat(GSTexture::Format::DepthStencil) : VK_FORMAT_UNDEFINED,
VK_ATTACHMENT_LOAD_OP_CLEAR, VK_ATTACHMENT_STORE_OP_STORE, VK_ATTACHMENT_LOAD_OP_DONT_CARE, VK_ATTACHMENT_STORE_OP_STORE,
ds ? (clear ? VK_ATTACHMENT_LOAD_OP_CLEAR : VK_ATTACHMENT_LOAD_OP_LOAD) : VK_ATTACHMENT_LOAD_OP_DONT_CARE, ds ? (clear ? VK_ATTACHMENT_LOAD_OP_CLEAR : VK_ATTACHMENT_LOAD_OP_LOAD) : VK_ATTACHMENT_LOAD_OP_DONT_CARE,
ds ? VK_ATTACHMENT_STORE_OP_STORE : VK_ATTACHMENT_STORE_OP_DONT_CARE); ds ? VK_ATTACHMENT_STORE_OP_STORE : VK_ATTACHMENT_STORE_OP_DONT_CARE);
} }
@ -1501,7 +1501,7 @@ bool GSDeviceVK::CompileConvertPipelines()
gpb.SetNoDepthTestState(); gpb.SetNoDepthTestState();
gpb.SetNoStencilState(); gpb.SetNoStencilState();
gpb.ClearBlendAttachments(); gpb.ClearBlendAttachments();
gpb.SetBlendAttachment(0, true, VK_BLEND_FACTOR_ONE, VK_BLEND_FACTOR_ZERO, VK_BLEND_OP_MIN, gpb.SetBlendAttachment(0, false, VK_BLEND_FACTOR_ONE, VK_BLEND_FACTOR_ZERO, VK_BLEND_OP_ADD,
VK_BLEND_FACTOR_ZERO, VK_BLEND_FACTOR_ZERO, VK_BLEND_OP_ADD, VK_COLOR_COMPONENT_R_BIT); VK_BLEND_FACTOR_ZERO, VK_BLEND_FACTOR_ZERO, VK_BLEND_OP_ADD, VK_COLOR_COMPONENT_R_BIT);
for (u32 ds = 0; ds < 2; ds++) for (u32 ds = 0; ds < 2; ds++)
@ -2798,17 +2798,16 @@ GSTextureVK* GSDeviceVK::SetupPrimitiveTrackingDATE(GSHWDrawConfig& config)
const VkAttachmentLoadOp ds_load_op = GetLoadOpForTexture(static_cast<GSTextureVK*>(config.ds)); const VkAttachmentLoadOp ds_load_op = GetLoadOpForTexture(static_cast<GSTextureVK*>(config.ds));
const u32 ds = (config.ds ? 1 : 0); const u32 ds = (config.ds ? 1 : 0);
VkClearValue cv[2] = {};
cv[0].color.float32[0] = static_cast<float>(std::numeric_limits<int>::max());
if (ds_load_op == VK_ATTACHMENT_LOAD_OP_CLEAR) if (ds_load_op == VK_ATTACHMENT_LOAD_OP_CLEAR)
{ {
VkClearValue cv[2] = {};
cv[1].depthStencil.depth = static_cast<GSTextureVK*>(config.ds)->GetClearDepth(); cv[1].depthStencil.depth = static_cast<GSTextureVK*>(config.ds)->GetClearDepth();
cv[1].depthStencil.stencil = 1; cv[1].depthStencil.stencil = 1;
BeginClearRenderPass(m_date_image_setup_render_passes[ds][1], GSVector4i(0, 0, rtsize.x, rtsize.y), cv, 2); BeginClearRenderPass(m_date_image_setup_render_passes[ds][1], GSVector4i(0, 0, rtsize.x, rtsize.y), cv, 2);
} }
else else
{ {
BeginClearRenderPass(m_date_image_setup_render_passes[ds][0], config.drawarea, cv, 1); BeginRenderPass(m_date_image_setup_render_passes[ds][0], config.drawarea);
} }
// draw the quad to prefill the image // draw the quad to prefill the image