[dawn][test] Fix event test to use 2 userdatas.
Change-Id: I9773d61396949fdc8987aa1cde57d30cf3a4478d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/213158
Auto-Submit: Loko Kung <lokokung@google.com>
Reviewed-by: Shrek Shao <shrekshao@google.com>
Commit-Queue: Shrek Shao <shrekshao@google.com>
diff --git a/src/dawn/tests/end2end/EventTests.cpp b/src/dawn/tests/end2end/EventTests.cpp
index ed8945a..83d8878 100644
--- a/src/dawn/tests/end2end/EventTests.cpp
+++ b/src/dawn/tests/end2end/EventTests.cpp
@@ -45,29 +45,30 @@
wgpu::Device CreateExtraDevice(wgpu::Instance instance) {
// IMPORTANT: DawnTest overrides RequestAdapter and RequestDevice and mixes
// up the two instances. We use these to bypass the override.
- auto* requestAdapter = reinterpret_cast<WGPUProcInstanceRequestAdapter>(
- wgpu::GetProcAddress("wgpuInstanceRequestAdapter"));
- auto* requestDevice = reinterpret_cast<WGPUProcAdapterRequestDevice>(
- wgpu::GetProcAddress("wgpuAdapterRequestDevice"));
+ auto* requestAdapter = reinterpret_cast<WGPUProcInstanceRequestAdapter2>(
+ wgpu::GetProcAddress("wgpuInstanceRequestAdapter2"));
+ auto* requestDevice = reinterpret_cast<WGPUProcAdapterRequestDevice2>(
+ wgpu::GetProcAddress("wgpuAdapterRequestDevice2"));
wgpu::Adapter adapter2;
- requestAdapter(
- instance.Get(), nullptr,
- [](WGPURequestAdapterStatus status, WGPUAdapter adapter, WGPUStringView, void* userdata) {
- ASSERT_EQ(status, WGPURequestAdapterStatus_Success);
- *reinterpret_cast<wgpu::Adapter*>(userdata) = wgpu::Adapter::Acquire(adapter);
- },
- &adapter2);
+ requestAdapter(instance.Get(), nullptr,
+ {nullptr, WGPUCallbackMode_AllowSpontaneous,
+ [](WGPURequestAdapterStatus status, WGPUAdapter adapter, WGPUStringView, void*,
+ void* result) {
+ *reinterpret_cast<wgpu::Adapter*>(result) = wgpu::Adapter::Acquire(adapter);
+ },
+ nullptr, &adapter2});
DAWN_ASSERT(adapter2);
wgpu::Device device2;
- requestDevice(
- adapter2.Get(), nullptr,
- [](WGPURequestDeviceStatus status, WGPUDevice device, WGPUStringView, void* userdata) {
- ASSERT_EQ(status, WGPURequestDeviceStatus_Success);
- *reinterpret_cast<wgpu::Device*>(userdata) = wgpu::Device::Acquire(device);
- },
- &device2);
+ requestDevice(adapter2.Get(), nullptr,
+ {nullptr, WGPUCallbackMode_AllowSpontaneous,
+ [](WGPURequestDeviceStatus status, WGPUDevice device, WGPUStringView, void*,
+ void* result) {
+ ASSERT_EQ(status, WGPURequestDeviceStatus_Success);
+ *reinterpret_cast<wgpu::Device*>(result) = wgpu::Device::Acquire(device);
+ },
+ nullptr, &device2});
DAWN_ASSERT(device2);
return device2;