1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-02 01:24:11 +01:00

[dxvk] Suspend render pass for certain render target clears

This commit is contained in:
Philip Rebohle 2021-02-10 16:59:06 +01:00
parent d7db413cac
commit 96dfac7fea
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 19 additions and 2 deletions

View File

@ -561,8 +561,16 @@ namespace dxvk {
if (m_state.om.framebuffer->isFullSize(imageView) && this->checkFramebufferBarrier().isClear()) if (m_state.om.framebuffer->isFullSize(imageView) && this->checkFramebufferBarrier().isClear())
attachmentIndex = m_state.om.framebuffer->findAttachment(imageView); attachmentIndex = m_state.om.framebuffer->findAttachment(imageView);
if (attachmentIndex < 1) // Suspend works here because we'll end up with one of these scenarios:
this->spillRenderPass(); // 1) The render pass gets ended for good, in which case we emit barriers
// 2) The clear gets folded into render pass ops, so the layout is correct
// 3) The clear gets executed separately, in which case updateFramebuffer
// will indirectly emit barriers for the given render target.
// If there is overlap, we need to explicitly transition affected attachments.
if (attachmentIndex < 1) {
this->spillRenderPass(true);
this->prepareImage(m_execBarriers, imageView->image(), imageView->subresources());
}
} }
if (m_flags.test(DxvkContextFlag::GpRenderPassBound)) if (m_flags.test(DxvkContextFlag::GpRenderPassBound))

View File

@ -58,6 +58,15 @@ namespace dxvk::vk {
return subres; return subres;
} }
inline bool checkSubresourceRangeOverlap(
const VkImageSubresourceRange& a,
const VkImageSubresourceRange& b) {
return a.baseMipLevel < b.baseMipLevel + b.levelCount
&& a.baseMipLevel + a.levelCount > b.baseMipLevel
&& a.baseArrayLayer < b.baseArrayLayer + b.layerCount
&& a.baseArrayLayer + a.layerCount > b.baseArrayLayer;
}
} }