From 8a4beefd3a7201411240e2b5aa7bee2b164b00c6 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sat, 6 Mar 2021 02:37:02 +0100 Subject: [PATCH] [dxvk] Store new image view when deferring clear/discard with matching subresources Otherwise, if the view used for the second clear has a different format than the first one, we'll end up clearing to the wrong colur. Assumes that images with more than one aspect never have views with mismatching formats. Also potentially improves logic around render pass clears depending on usage patterns. --- src/dxvk/dxvk_context.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/dxvk/dxvk_context.cpp b/src/dxvk/dxvk_context.cpp index 65c9b6a43..67d3c826c 100644 --- a/src/dxvk/dxvk_context.cpp +++ b/src/dxvk/dxvk_context.cpp @@ -1857,6 +1857,7 @@ namespace dxvk { VkClearValue clearValue) { for (auto& entry : m_deferredClears) { if (entry.imageView->checkSubresourceMatch(imageView)) { + entry.imageView = imageView; entry.discardAspects &= ~clearAspects; entry.clearAspects |= clearAspects; @@ -1883,6 +1884,7 @@ namespace dxvk { VkImageAspectFlags discardAspects) { for (auto& entry : m_deferredClears) { if (entry.imageView->checkSubresourceMatch(imageView)) { + entry.imageView = imageView; entry.discardAspects |= discardAspects; entry.clearAspects &= ~discardAspects; return;