diff --git a/src/tests/DawnTest.cpp b/src/tests/DawnTest.cpp index 64e74555d3..d396e25b6a 100644 --- a/src/tests/DawnTest.cpp +++ b/src/tests/DawnTest.cpp @@ -1015,8 +1015,8 @@ void DawnTestBase::MapSlotsSynchronously() { for (size_t i = 0; i < mReadbackSlots.size(); ++i) { MapReadUserdata* userdata = new MapReadUserdata{this, i}; - auto& slot = mReadbackSlots[i]; - slot.buffer.MapReadAsync(SlotMapReadCallback, userdata); + const ReadbackSlot& slot = mReadbackSlots[i]; + slot.buffer.MapAsync(wgpu::MapMode::Read, 0, 0, SlotMapCallback, userdata); } // Busy wait until all map operations are done. @@ -1026,17 +1026,15 @@ void DawnTestBase::MapSlotsSynchronously() { } // static -void DawnTestBase::SlotMapReadCallback(WGPUBufferMapAsyncStatus status, - const void* data, - uint64_t, - void* userdata_) { +void DawnTestBase::SlotMapCallback(WGPUBufferMapAsyncStatus status, void* userdata_) { DAWN_ASSERT(status == WGPUBufferMapAsyncStatus_Success); - auto userdata = static_cast(userdata_); - userdata->test->mReadbackSlots[userdata->slot].mappedData = data; - userdata->test->mNumPendingMapOperations--; + std::unique_ptr userdata(static_cast(userdata_)); + DawnTestBase* test = userdata->test; + ReadbackSlot* slot = &test->mReadbackSlots[userdata->slot]; - delete userdata; + slot->mappedData = slot->buffer.GetConstMappedRange(); + test->mNumPendingMapOperations--; } void DawnTestBase::ResolveExpectations() { diff --git a/src/tests/DawnTest.h b/src/tests/DawnTest.h index 7a29bc0e99..9e9f987041 100644 --- a/src/tests/DawnTest.h +++ b/src/tests/DawnTest.h @@ -328,10 +328,7 @@ class DawnTestBase { // Maps all the buffers and fill ReadbackSlot::mappedData void MapSlotsSynchronously(); - static void SlotMapReadCallback(WGPUBufferMapAsyncStatus status, - const void* data, - uint64_t dataLength, - void* userdata); + static void SlotMapCallback(WGPUBufferMapAsyncStatus status, void* userdata); size_t mNumPendingMapOperations = 0; // Reserve space where the data for an expectation can be copied