Don't rely on null::Queue::Submit resolving mapping operations.

In the validation tests, we relied on Queue.Submit(0, nullptr) to
resolve mapping operations. This is fragile so we replace it with a
FlushMappingOperations() function that uses device.Tick() instead.

This allows removing the mapSerial argument from
Buffer::MapRead/WriteAsyncImpl (which was the actual goal of this CL).

Bug: dawn:445
Change-Id: Id98822287370c371bebb83afb8e290e17f3c1b55
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24381
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez
2020-07-09 06:12:04 +00:00
committed by Commit Bot service account
parent d761d5a575
commit 1318c603d9
17 changed files with 92 additions and 109 deletions

View File

@@ -87,6 +87,21 @@ std::string ValidationTest::GetLastDeviceErrorMessage() const {
return mDeviceErrorMessage;
}
void ValidationTest::WaitForAllOperations(const wgpu::Device& device) const {
wgpu::Queue queue = device.GetDefaultQueue();
wgpu::Fence fence = queue.CreateFence();
// Force the currently submitted operations to completed.
queue.Signal(fence, 1);
while (fence.GetCompletedValue() < 1) {
device.Tick();
}
// TODO(cwallez@chromium.org): It's not clear why we need this additional tick. Investigate it
// once WebGPU has defined the ordering of callbacks firing.
device.Tick();
}
// static
void ValidationTest::OnDeviceError(WGPUErrorType type, const char* message, void* userdata) {
ASSERT(type != WGPUErrorType_NoError);