From 9bdc491cb70785be448f179ac2414f4f38be05e2 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Mon, 1 Mar 2021 16:47:47 +0100 Subject: [PATCH] [dxvk] Fix potential iterator invalidation in deferClear/Discard flushClears clears the deferred clear list, so we need to break out of the loop on that code path. --- src/dxvk/dxvk_context.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/dxvk/dxvk_context.cpp b/src/dxvk/dxvk_context.cpp index dec2100c1..b12ea8e83 100644 --- a/src/dxvk/dxvk_context.cpp +++ b/src/dxvk/dxvk_context.cpp @@ -1868,8 +1868,10 @@ namespace dxvk { entry.clearValue.depthStencil.stencil = clearValue.depthStencil.stencil; return; - } else if (entry.imageView->checkSubresourceOverlap(imageView)) + } else if (entry.imageView->checkSubresourceOverlap(imageView)) { this->flushClears(false); + break; + } } m_deferredClears.push_back({ imageView, 0, clearAspects, clearValue }); @@ -1884,8 +1886,10 @@ namespace dxvk { entry.discardAspects |= discardAspects; entry.clearAspects &= ~discardAspects; return; - } else if (entry.imageView->checkSubresourceOverlap(imageView)) + } else if (entry.imageView->checkSubresourceOverlap(imageView)) { this->flushClears(false); + break; + } } m_deferredClears.push_back({ imageView, discardAspects });