From 2c20bf4dcbd53d48433301d7ed3dadd418d34a7f Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Tue, 23 Jan 2018 12:16:28 +0100 Subject: [PATCH] [d3d11] Use Map() for host-visible buffers in UpdateSubresource --- src/d3d11/d3d11_cmdlist.cpp | 2 +- src/d3d11/d3d11_cmdlist.h | 2 +- src/d3d11/d3d11_context.cpp | 16 ++++------------ 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/d3d11/d3d11_cmdlist.cpp b/src/d3d11/d3d11_cmdlist.cpp index f3be6f5a1..64f910121 100644 --- a/src/d3d11/d3d11_cmdlist.cpp +++ b/src/d3d11/d3d11_cmdlist.cpp @@ -30,7 +30,7 @@ namespace dxvk { } - UINT D3D11CommandList::GetContextFlags() { + UINT STDMETHODCALLTYPE D3D11CommandList::GetContextFlags() { return m_contextFlags; } diff --git a/src/d3d11/d3d11_cmdlist.h b/src/d3d11/d3d11_cmdlist.h index 541638a09..f8c265429 100644 --- a/src/d3d11/d3d11_cmdlist.h +++ b/src/d3d11/d3d11_cmdlist.h @@ -21,7 +21,7 @@ namespace dxvk { void STDMETHODCALLTYPE GetDevice( ID3D11Device **ppDevice) final; - UINT GetContextFlags(); + UINT STDMETHODCALLTYPE GetContextFlags() final; void AddChunk(Rc&& Chunk); diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index 3dad73994..e93c6c534 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -564,18 +564,10 @@ namespace dxvk { if (((size == bufferSlice.length()) && (bufferSlice.buffer()->memFlags() & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT))) { - auto physicalSlice = bufferSlice.buffer()->allocPhysicalSlice(); - physicalSlice.resource()->acquire(); - - std::memcpy(physicalSlice.mapPtr(0), pSrcData, size); - - EmitCs([ - cDstBuffer = bufferSlice.buffer(), - cPhysicalSlice = std::move(physicalSlice) - ] (DxvkContext* ctx) { - ctx->invalidateBuffer(cDstBuffer, cPhysicalSlice); - cPhysicalSlice.resource()->release(); - }); + D3D11_MAPPED_SUBRESOURCE mappedSr; + Map(pDstResource, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedSr); + std::memcpy(mappedSr.pData, pSrcData, size); + Unmap(pDstResource, 0); } else { EmitCs([ cDataBuffer = Rc(new DxvkDataBuffer(pSrcData, size)),