From 5eca9ecce9770af037006c31f206bdad22b10be2 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Sun, 22 Jul 2018 11:47:37 -0700 Subject: Implemented mapping with MAP_FLAG_DO_NOT_SYNCHRONIZE flag in Vulkan and D3D12 --- Graphics/GraphicsEngine/include/BufferBase.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Graphics/GraphicsEngine') diff --git a/Graphics/GraphicsEngine/include/BufferBase.h b/Graphics/GraphicsEngine/include/BufferBase.h index 66096e3c..d3eaf2d4 100644 --- a/Graphics/GraphicsEngine/include/BufferBase.h +++ b/Graphics/GraphicsEngine/include/BufferBase.h @@ -173,8 +173,9 @@ void BufferBase :: Cop template -void BufferBase :: Map( IDeviceContext* pContext, MAP_TYPE MapType, Uint32 MapFlags, PVoid &pMappedData ) +void BufferBase :: Map( IDeviceContext* pContext, MAP_TYPE MapType, Uint32 MapFlags, PVoid& pMappedData ) { + pMappedData = nullptr; switch( MapType ) { case MAP_READ: @@ -200,7 +201,8 @@ void BufferBase :: Map if (this->m_Desc.Usage == USAGE_DYNAMIC) { - VERIFY_BUFFER((MapFlags & MAP_FLAG_DISCARD) != 0 && MapType == MAP_WRITE, "Dynamic buffers can only be mapped for writing with discard flag"); + VERIFY_BUFFER((MapFlags & (MAP_FLAG_DISCARD | MAP_FLAG_DO_NOT_SYNCHRONIZE)) != 0 && MapType == MAP_WRITE, "Dynamic buffers can only be mapped for writing with MAP_FLAG_DISCARD or MAP_FLAG_DO_NOT_SYNCHRONIZE flag"); + VERIFY_BUFFER((MapFlags & (MAP_FLAG_DISCARD | MAP_FLAG_DO_NOT_SYNCHRONIZE)) != (MAP_FLAG_DISCARD | MAP_FLAG_DO_NOT_SYNCHRONIZE), "When mapping dynamic buffer, only one of MAP_FLAG_DISCARD or MAP_FLAG_DO_NOT_SYNCHRONIZE flags must be specified"); } if ( (MapFlags & MAP_FLAG_DISCARD) != 0 ) -- cgit v1.2.3