From 6c889c000599e3c956d472ce086005ce8578eced Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Mon, 17 Sep 2018 23:08:00 +0200 Subject: [PATCH] Revert "[d3d11] Avoid unnecessary buffer slice copy when mapping buffer" This reverts commit 72106a02cb5fff627481a20b5acbdccc13b7c867. Breaks things for some reason. Doesn't have much of an impact anyway. --- src/d3d11/d3d11_context_imm.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/d3d11/d3d11_context_imm.cpp b/src/d3d11/d3d11_context_imm.cpp index bbec0ac6f..e9af28bb2 100644 --- a/src/d3d11/d3d11_context_imm.cpp +++ b/src/d3d11/d3d11_context_imm.cpp @@ -333,14 +333,12 @@ namespace dxvk { Logger::err("D3D11: Cannot map a device-local buffer"); return E_INVALIDARG; } - - DxvkPhysicalBufferSlice physicalSlice; if (MapType == D3D11_MAP_WRITE_DISCARD) { // Allocate a new backing slice for the buffer and set // it as the 'new' mapped slice. This assumes that the // only way to invalidate a buffer is by mapping it. - physicalSlice = buffer->allocPhysicalSlice(); + auto physicalSlice = buffer->allocPhysicalSlice(); pResource->SetMappedSlice(physicalSlice); EmitCs([ @@ -352,13 +350,13 @@ namespace dxvk { } else if (MapType != D3D11_MAP_WRITE_NO_OVERWRITE) { if (!WaitForResource(buffer->resource(), MapFlags)) return DXGI_ERROR_WAS_STILL_DRAWING; - - physicalSlice = pResource->GetMappedSlice(); } // Use map pointer from previous map operation. This // way we don't have to synchronize with the CS thread // if the map mode is D3D11_MAP_WRITE_NO_OVERWRITE. + DxvkPhysicalBufferSlice physicalSlice = pResource->GetMappedSlice(); + pMappedResource->pData = physicalSlice.mapPtr(0); pMappedResource->RowPitch = pResource->GetSize(); pMappedResource->DepthPitch = pResource->GetSize();