diff --git a/src/dxvk/dxvk_context.cpp b/src/dxvk/dxvk_context.cpp index c793df22f..67e39e009 100644 --- a/src/dxvk/dxvk_context.cpp +++ b/src/dxvk/dxvk_context.cpp @@ -1856,7 +1856,7 @@ namespace dxvk { VkImageAspectFlags clearAspects, VkClearValue clearValue) { for (auto& entry : m_deferredClears) { - if (entry.imageView == imageView) { + if (entry.imageView->checkSubresourceMatch(imageView)) { entry.discardAspects &= ~clearAspects; entry.clearAspects |= clearAspects; @@ -1882,7 +1882,7 @@ namespace dxvk { const Rc& imageView, VkImageAspectFlags discardAspects) { for (auto& entry : m_deferredClears) { - if (entry.imageView == imageView) { + if (entry.imageView->checkSubresourceMatch(imageView)) { entry.discardAspects |= discardAspects; entry.clearAspects &= ~discardAspects; return; diff --git a/src/dxvk/dxvk_image.h b/src/dxvk/dxvk_image.h index b04fd6022..cb1810129 100644 --- a/src/dxvk/dxvk_image.h +++ b/src/dxvk/dxvk_image.h @@ -469,6 +469,21 @@ namespace dxvk { return result; } + /** + * \brief Checks whether this view matches another + * + * \param [in] view The other view to check + * \returns \c true if the two views have the same subresources + */ + bool checkSubresourceMatch(const Rc& view) const { + if (this == view.ptr()) + return true; + + return this->image() == view->image() + && this->subresources() == view->subresources() + && this->info().type == view->info().type; + } + /** * \brief Checks whether this view overlaps with another one *