From 8e53afea612a5b4b17c995d4e24260a6e53d3de5 Mon Sep 17 00:00:00 2001 From: assiduous Date: Tue, 7 Jul 2020 20:18:09 -0700 Subject: D3D12 and VK backends: disallowed mapping structured and formatted dynamic buffers with MAP_FLAG_NO_OVERWRITE flag --- Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Graphics/GraphicsEngineD3D12') diff --git a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp index f118bc98..5fa7f8e1 100644 --- a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp @@ -1085,6 +1085,16 @@ void DeviceContextD3D12Impl::MapBuffer(IBuffer* pBuffer, MAP_TYPE MapType, MAP_F else { VERIFY_EXPR(MapFlags & MAP_FLAG_NO_OVERWRITE); + + if (pd3d12Resource != nullptr) + { + LOG_ERROR("Formatted or structured buffers require actual Direct3D12 backing resource and cannot be suballocated " + "from dynamic heap. In current implementation, the entire contents of the backing buffer is updated when the buffer is unmapped. " + "As a consequence, the buffer cannot be mapped with MAP_FLAG_NO_OVERWRITE flag because updating the whole " + "buffer will overwrite regions that may still be in use by the GPU."); + return; + } + // Reuse previously mapped region } pMappedData = DynamicData.CPUAddress; -- cgit v1.2.3