From 0d6da1072c684a85fd6747f82619ed9b1346a87e Mon Sep 17 00:00:00 2001 From: Bryan Bernhart Date: Thu, 12 Aug 2021 19:46:18 +0000 Subject: [PATCH] Fix ASSERT setting staging buffer label Ensures the mapped staging buffer will always be locked before setting the label. Otherwise, setting the label could fail and leave it unlocked which isn't allowed. BUG: chromium:1239112 Change-Id: I738f8d6fc3b20b8c8b51671d77e7014d967ffd52 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61860 Reviewed-by: Austin Eng Commit-Queue: Bryan Bernhart --- src/dawn_native/d3d12/StagingBufferD3D12.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dawn_native/d3d12/StagingBufferD3D12.cpp b/src/dawn_native/d3d12/StagingBufferD3D12.cpp index d525276a4c..4c1e90b96e 100644 --- a/src/dawn_native/d3d12/StagingBufferD3D12.cpp +++ b/src/dawn_native/d3d12/StagingBufferD3D12.cpp @@ -42,13 +42,13 @@ namespace dawn_native { namespace d3d12 { mDevice->AllocateMemory(D3D12_HEAP_TYPE_UPLOAD, resourceDescriptor, D3D12_RESOURCE_STATE_GENERIC_READ)); - DAWN_TRY(mUploadHeap.SetDebugName("Dawn_StagingBuffer")); - // The mapped buffer can be accessed at any time, so it must be locked to ensure it is never // evicted. This buffer should already have been made resident when it was created. DAWN_TRY(mDevice->GetResidencyManager()->LockAllocation( ToBackend(mUploadHeap.GetResourceHeap()))); + DAWN_TRY(mUploadHeap.SetDebugName("Dawn_StagingBuffer")); + return CheckHRESULT(GetResource()->Map(0, nullptr, &mMappedPointer), "ID3D12Resource::Map"); }