diff --git a/src/d3d11/d3d11_context_imm.cpp b/src/d3d11/d3d11_context_imm.cpp index 711a0f84..b1499f47 100644 --- a/src/d3d11/d3d11_context_imm.cpp +++ b/src/d3d11/d3d11_context_imm.cpp @@ -521,16 +521,24 @@ namespace dxvk { // Wait for the any pending D3D11 command to be executed // on the CS thread so that we can determine whether the // resource is currently in use or not. - Flush(); + FlushCsChunk(); SynchronizeCsThread(); if (Resource->isInUse()) { - if (MapFlags & D3D11_MAP_FLAG_DO_NOT_WAIT) + if (MapFlags & D3D11_MAP_FLAG_DO_NOT_WAIT) { + // We don't have to wait, but misbehaving games may + // still try to spin on `Map` until the resource is + // idle, so we should flush pending commands + FlushImplicit(); return false; - - // TODO implement properly in DxvkDevice - while (Resource->isInUse()) - dxvk::this_thread::yield(); + } else { + // Make sure pending commands using the resource get + // executed on the the GPU if we have to wait for it + Flush(); + + while (Resource->isInUse()) + dxvk::this_thread::yield(); + } } return true;