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 <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
This commit is contained in:
Bryan Bernhart 2021-08-12 19:46:18 +00:00 committed by Dawn LUCI CQ
parent 39c4fcbdd3
commit 0d6da1072c
1 changed files with 2 additions and 2 deletions

View File

@ -42,13 +42,13 @@ namespace dawn_native { namespace d3d12 {
mDevice->AllocateMemory(D3D12_HEAP_TYPE_UPLOAD, resourceDescriptor, mDevice->AllocateMemory(D3D12_HEAP_TYPE_UPLOAD, resourceDescriptor,
D3D12_RESOURCE_STATE_GENERIC_READ)); 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 // 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. // evicted. This buffer should already have been made resident when it was created.
DAWN_TRY(mDevice->GetResidencyManager()->LockAllocation( DAWN_TRY(mDevice->GetResidencyManager()->LockAllocation(
ToBackend(mUploadHeap.GetResourceHeap()))); ToBackend(mUploadHeap.GetResourceHeap())));
DAWN_TRY(mUploadHeap.SetDebugName("Dawn_StagingBuffer"));
return CheckHRESULT(GetResource()->Map(0, nullptr, &mMappedPointer), "ID3D12Resource::Map"); return CheckHRESULT(GetResource()->Map(0, nullptr, &mMappedPointer), "ID3D12Resource::Map");
} }