1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-03-14 22:29:15 +01:00

[dxvk] Always prepare images not bound to the current FB when clearing

Fixes a potential bug when clearing a render target after the
last render pass using it gets suspended.

Also, for some reason we were checking for <1 instead of <0.
This commit is contained in:
Philip Rebohle 2021-02-14 03:25:38 +01:00 committed by Philip Rebohle
parent 594d09ae3a
commit 95676bf1e6

View File

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