From 9393ce98a7c6f0a969510503f3b2cf64198273ba Mon Sep 17 00:00:00 2001 From: assiduous Date: Mon, 23 Dec 2019 10:44:13 -0800 Subject: Renamed MAP_FLAG_DO_NOT_SYNCHRONIZE flag to MAP_FLAG_NO_OVERWRITE (API version ) --- .../src/DeviceContextD3D12Impl.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'Graphics/GraphicsEngineD3D12') diff --git a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp index 7812afe0..3d4747fb 100644 --- a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp @@ -1104,7 +1104,7 @@ void DeviceContextD3D12Impl::MapBuffer(IBuffer* pBuffer, MAP_TYPE MapType, MAP_F } else if (BuffDesc.Usage == USAGE_DYNAMIC) { - VERIFY((MapFlags & (MAP_FLAG_DISCARD | MAP_FLAG_DO_NOT_SYNCHRONIZE)) != 0, "D3D12 buffer must be mapped for writing with MAP_FLAG_DISCARD or MAP_FLAG_DO_NOT_SYNCHRONIZE flag"); + VERIFY((MapFlags & (MAP_FLAG_DISCARD | MAP_FLAG_NO_OVERWRITE)) != 0, "D3D12 buffer must be mapped for writing with MAP_FLAG_DISCARD or MAP_FLAG_NO_OVERWRITE flag"); auto& DynamicData = pBufferD3D12->m_DynamicData[m_ContextId]; if ((MapFlags & MAP_FLAG_DISCARD) != 0 || DynamicData.CPUAddress == nullptr) { @@ -1113,7 +1113,7 @@ void DeviceContextD3D12Impl::MapBuffer(IBuffer* pBuffer, MAP_TYPE MapType, MAP_F } else { - VERIFY_EXPR(MapFlags & MAP_FLAG_DO_NOT_SYNCHRONIZE); + VERIFY_EXPR(MapFlags & MAP_FLAG_NO_OVERWRITE); // Reuse previously mapped region } pMappedData = DynamicData.CPUAddress; @@ -1530,8 +1530,8 @@ void DeviceContextD3D12Impl::MapTextureSubresource(ITexture* pTe return; } - if ((MapFlags & (MAP_FLAG_DISCARD | MAP_FLAG_DO_NOT_SYNCHRONIZE)) != 0) - LOG_INFO_MESSAGE_ONCE("Mapping textures with flags MAP_FLAG_DISCARD or MAP_FLAG_DO_NOT_SYNCHRONIZE has no effect in D3D12 backend"); + if ((MapFlags & (MAP_FLAG_DISCARD | MAP_FLAG_NO_OVERWRITE)) != 0) + LOG_INFO_MESSAGE_ONCE("Mapping textures with flags MAP_FLAG_DISCARD or MAP_FLAG_NO_OVERWRITE has no effect in D3D12 backend"); Box FullExtentBox; if (pMapRegion == nullptr) @@ -1554,13 +1554,6 @@ void DeviceContextD3D12Impl::MapTextureSubresource(ITexture* pTe } else if (TexDesc.Usage == USAGE_STAGING) { - if ((MapFlags & MAP_FLAG_DO_NOT_SYNCHRONIZE) == 0) - { - LOG_WARNING_MESSAGE_ONCE("Mapping staging textures is never synchronized in D3D12 backend. " - "Application must use fences or other synchronization methods to explicitly synchronize " - "access and map texture with MAP_FLAG_DO_NOT_SYNCHRONIZE flag."); - } - const auto& Footprint = TextureD3D12.GetStagingFootprint(Subres); // It is valid to specify the CPU won't read any data by passing a range where @@ -1569,6 +1562,13 @@ void DeviceContextD3D12Impl::MapTextureSubresource(ITexture* pTe D3D12_RANGE InvalidateRange = {1, 0}; if (MapType == MAP_READ) { + if ((MapFlags & MAP_FLAG_DO_NOT_WAIT) == 0) + { + LOG_WARNING_MESSAGE("Mapping staging textures for reading never blocks or waits for GPU in D3D12 backend. " + "Applications must use fences or other synchronization methods to explicitly synchronize " + "access and map texture with MAP_FLAG_DO_NOT_WAIT flag."); + } + DEV_CHECK_ERR((TexDesc.CPUAccessFlags & CPU_ACCESS_READ), "Texture '", TexDesc.Name, "' was not created with CPU_ACCESS_READ flag and can't be mapped for reading"); // Resources on D3D12_HEAP_TYPE_READBACK heaps do not support persistent map. InvalidateRange.Begin = static_cast(Footprint.Offset); -- cgit v1.2.3