From ceb1bc219e2eb5a4151130c2b5fb2833854a8b45 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Fri, 5 Apr 2019 08:00:59 -0700 Subject: Implemented staging textures in Vk backend --- Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Graphics/GraphicsEngineD3D12') diff --git a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp index 0fb907da..d34bc493 100644 --- a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp @@ -1403,7 +1403,7 @@ namespace Diligent } if( (MapFlags & (MAP_FLAG_DISCARD | MAP_FLAG_DO_NOT_SYNCHRONIZE)) != 0 ) - LOG_WARNING_MESSAGE_ONCE("Mapping textures with flags MAP_FLAG_DISCARD or MAP_FLAG_DO_NOT_SYNCHRONIZE has no effect in D3D12 backend"); + LOG_INFO_MESSAGE_ONCE("Mapping textures with flags MAP_FLAG_DISCARD or MAP_FLAG_DO_NOT_SYNCHRONIZE has no effect in D3D12 backend"); Box FullExtentBox; if (pMapRegion == nullptr) @@ -1455,10 +1455,15 @@ namespace Diligent D3D12_RANGE InvalidateRange = {1,0}; if (MapType == MAP_READ) { + 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); InvalidateRange.End = static_cast(Footprint.Offset + TotalBytes); } + else if (MapType == MAP_WRITE) + { + DEV_CHECK_ERR((TexDesc.CPUAccessFlags & CPU_ACCESS_WRITE), "Texture '", TexDesc.Name, "' was not created with CPU_ACCESS_WRITE flag and can't be mapped for writing"); + } // Nested Map() calls are supported and are ref-counted. The first call to Map() allocates // a CPU virtual address range for the resource. The last call to Unmap deallocates the CPU -- cgit v1.2.3