From d0efda21adacdd6c74dfdc3e0582ccf8aeaccafe Mon Sep 17 00:00:00 2001 From: Powei Feng Date: Wed, 15 Oct 2025 11:11:05 -0700 Subject: [PATCH] webgpu: fix deadlock for readPixels (#9319) To enable the readPixels callback to be called, we need to make move to 'AllowSpontaneous' mode in order to not have to call Instance::ProcessEvents() to force process the callback. --- filament/backend/src/webgpu/WebGPUDriver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filament/backend/src/webgpu/WebGPUDriver.cpp b/filament/backend/src/webgpu/WebGPUDriver.cpp index 009eb73b6d..05e1959374 100644 --- a/filament/backend/src/webgpu/WebGPUDriver.cpp +++ b/filament/backend/src/webgpu/WebGPUDriver.cpp @@ -1497,7 +1497,7 @@ void WebGPUDriver::readPixels(Handle sourceRenderTargetHandle, c mReadPixelMapsCounter.startTask(); userData->buffer.MapAsync( - wgpu::MapMode::Read, 0, bufferSize, wgpu::CallbackMode::AllowProcessEvents, + wgpu::MapMode::Read, 0, bufferSize, wgpu::CallbackMode::AllowSpontaneous, [](wgpu::MapAsyncStatus status, const char* message, UserData* userdata) { std::unique_ptr data(static_cast(userdata)); if (UTILS_LIKELY(status == wgpu::MapAsyncStatus::Success)) {