diff --git a/src/d3d9/d3d9_common_texture.h b/src/d3d9/d3d9_common_texture.h index f9acf4705..3767184bc 100644 --- a/src/d3d9/d3d9_common_texture.h +++ b/src/d3d9/d3d9_common_texture.h @@ -308,6 +308,8 @@ namespace dxvk { bool GetLocked(UINT Subresource) const { return m_locked.get(Subresource); } + bool IsAnySubresourceLocked() const { return m_locked.any(); } + void SetWrittenByGPU(UINT Subresource, bool value) { m_wasWrittenByGPU.set(Subresource, value); } bool WasWrittenByGPU(UINT Subresource) const { return m_wasWrittenByGPU.get(Subresource); } diff --git a/src/d3d9/d3d9_device.cpp b/src/d3d9/d3d9_device.cpp index 8a7680c43..2ed44fcfa 100644 --- a/src/d3d9/d3d9_device.cpp +++ b/src/d3d9/d3d9_device.cpp @@ -4224,7 +4224,7 @@ namespace dxvk { } } - if (pResource->IsManaged() && !m_d3d9Options.evictManagedOnUnlock && !readOnly) { + if (managed && !m_d3d9Options.evictManagedOnUnlock && !readOnly) { pResource->SetNeedsUpload(Subresource, true); for (uint32_t tex = m_activeTextures; tex; tex &= tex - 1) { @@ -4276,7 +4276,7 @@ namespace dxvk { if (shouldFlush) { this->FlushImage(pResource, Subresource); - if (pResource->IsManaged()) + if (!pResource->IsAnySubresourceLocked()) pResource->ClearDirtyBoxes(); } diff --git a/src/util/util_bit.h b/src/util/util_bit.h index 7d6e22df0..7008bacaf 100644 --- a/src/util/util_bit.h +++ b/src/util/util_bit.h @@ -242,7 +242,7 @@ namespace dxvk::bit { m_dwords[i] = 0; } - constexpr bool any() { + constexpr bool any() const { for (size_t i = 0; i < Dwords; i++) { if (m_dwords[i] != 0) return true;