From 2714cb952d740eb641588a54af8d21ade5a501e3 Mon Sep 17 00:00:00 2001 From: Robin Kertels Date: Mon, 13 Jul 2020 12:06:22 +0200 Subject: [PATCH] [d3d9] Extend dirty tracking to render targets Ensures we copy a dynamic default pool texture to its mapping buffer after the device renders to it. --- src/d3d9/d3d9_device.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/d3d9/d3d9_device.cpp b/src/d3d9/d3d9_device.cpp index cabf79fb3..b980d3062 100644 --- a/src/d3d9/d3d9_device.cpp +++ b/src/d3d9/d3d9_device.cpp @@ -1191,6 +1191,8 @@ namespace dxvk { if (texInfo->IsAutomaticMip()) texInfo->SetNeedsMipGen(true); + + texInfo->SetDirty(rt->GetSubresource(), true); } if (originalAlphaSwizzleRTs != m_alphaSwizzleRTs) @@ -4024,6 +4026,8 @@ namespace dxvk { } } else { + physSlice = mappedBuffer->getSliceHandle(); + if (unlikely(dirty)) { Rc resourceImage = pResource->GetImage(); @@ -4089,19 +4093,15 @@ namespace dxvk { cPackedFormat); } }); - } - physSlice = mappedBuffer->getSliceHandle(); - - // If we are a new alloc, and we weren't dirty - // that means that we are a newly initialized - // texture, and hence can just memset -> 0 and - // avoid a wait here. - if (alloced && !dirty) - std::memset(physSlice.mapPtr, 0, physSlice.length); - else { if (!WaitForResource(mappedBuffer, Flags)) return D3DERR_WASSTILLDRAWING; + } else if (alloced) { + // If we are a new alloc, and we weren't dirty + // that means that we are a newly initialized + // texture, and hence can just memset -> 0 and + // avoid a wait here. + std::memset(physSlice.mapPtr, 0, physSlice.length); } }