From c9fc175bba44546428848f5b6e0986f1c275ab3e Mon Sep 17 00:00:00 2001 From: Enrico Galli Date: Thu, 9 Jul 2020 20:40:53 +0000 Subject: [PATCH] D3D12: Empty CPU written range in Unmap calls on READBACK heaps In order to remove a warning in the D3D debug layer, this patch passes an empty range CPU written range to calls of Unmap on READBACK buffers. Bug: dawn:419 Change-Id: Ic4dcbf31beb3a257c3d88896f4bb97e19caf0cc6 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24301 Commit-Queue: Corentin Wallez Reviewed-by: Corentin Wallez --- src/dawn_native/d3d12/AdapterD3D12.cpp | 4 ---- src/dawn_native/d3d12/BufferD3D12.cpp | 4 +++- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/dawn_native/d3d12/AdapterD3D12.cpp b/src/dawn_native/d3d12/AdapterD3D12.cpp index c6078e59b1..5b98915ddc 100644 --- a/src/dawn_native/d3d12/AdapterD3D12.cpp +++ b/src/dawn_native/d3d12/AdapterD3D12.cpp @@ -143,10 +143,6 @@ namespace dawn_native { namespace d3d12 { // Temporary IDs: list of warnings that should be fixed or promoted // - // Remove after warning have been addressed - // https://crbug.com/dawn/419 - D3D12_MESSAGE_ID_UNMAP_RANGE_NOT_EMPTY, - // Remove after warning have been addressed // https://crbug.com/dawn/421 D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_INCOMPATIBLE_RESOURCE_STATE, diff --git a/src/dawn_native/d3d12/BufferD3D12.cpp b/src/dawn_native/d3d12/BufferD3D12.cpp index 2521e93431..808b134e14 100644 --- a/src/dawn_native/d3d12/BufferD3D12.cpp +++ b/src/dawn_native/d3d12/BufferD3D12.cpp @@ -265,7 +265,9 @@ namespace dawn_native { namespace d3d12 { } MaybeError Buffer::MapAtCreationImpl() { - DAWN_TRY(MapInternal(true, "D3D12 map at creation")); + // Setting isMapWrite to false on MapRead buffers to silence D3D12 debug layer warning. + bool isMapWrite = (GetUsage() & wgpu::BufferUsage::MapWrite) != 0; + DAWN_TRY(MapInternal(isMapWrite, "D3D12 map at creation")); return {}; }