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/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Graphics/GraphicsEngineVulkan') diff --git a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp index 1681b456..76163513 100644 --- a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp @@ -1318,6 +1318,16 @@ void DeviceContextVkImpl::MapBuffer(IBuffer* pBuffer, MAP_TYPE MapType, MAP_FLAG else { VERIFY_EXPR(MapFlags & MAP_FLAG_NO_OVERWRITE); + + if (pBufferVk->m_VulkanBuffer != VK_NULL_HANDLE) + { + LOG_ERROR("Formatted or structured buffers require actual Vulkan 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 the same allocation } -- cgit v1.2.3