-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Description
Version of emscripten/emsdk:
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 4.0.7 (8dc91db45bf96c174531006839472a3924d105aa)
clang version 21.0.0git (https:/github.com/llvm/llvm-project 57025b42c43b2f14f7e58692bc19cd53d1b8a45e)
Target: wasm32-unknown-emscripten
Thread model: posix
Full link command and output with -v appended:
[100%] Linking CXX executable my_app.js
cd /home/my_user/repos/my_solution/out/my_app && /usr/bin/cmake -E cmake_link_script CMakeFiles/my_app.dir/link.txt --verbose=1
/home/my_user/repos/emsdk/upstream/emscripten/em++ -sWASM=1 -sUSE_WEBGPU=0 -sASYNCIFY=1 --use-port=/home/my_user/repos/my_solution/my_project/external/emscripten_ports/emdawnwebgpu.py --closure-args=--externs=/home/my_user/repos/emsdk/upstream/emscripten/cache/ports/emdawnwebgpu/emdawnwebgpu_pkg/webgpu/src/webgpu-externs.js @CMakeFiles/my_app.dir/objects1.rsp -o my_app.js @CMakeFiles/my_app.dir/linkLibs.rsp
gmake[2]: Leaving directory '/home/my_user/repos/my_solution/out'
[100%] Built target my_app
gmake[1]: Leaving directory '/home/my_user/repos/my_solution/out'
/usr/bin/cmake -E cmake_progress_start /home/my_user/repos/my_solution/out/CMakeFiles 0
Browser:
Google Chrome: Version 136.0.7103.0 (Official Build) canary (64-bit)
TLDR Browser console output:
my_app.html:46 [my_app] Calling wgpuInstanceWaitAny for wgpuBufferMapAsync future with timeout 1'500'000'000ull...
my_app.html:1 Uncaught (in promise) unwind
Promise.then
(anonymous) @ my_app.js:6457
handleSleep @ my_app.js:6374
handleAsync @ my_app.js:6455
_emwgpuWaitAny @ my_app.js:5239
imports.<computed> @ my_app.js:6225
$EventManager::WaitAny(unsigned long long, unsigned long, WGPUFutureWaitInfo*, unsigned long long) @ webgpu.cpp:530
$WGPUInstanceImpl::WaitAny(unsigned long, WGPUFutureWaitInfo*, unsigned long long) @ webgpu.cpp:1572
$wgpuInstanceWaitAny @ webgpu.cpp:1902
Full Browser console output:
Expand
[C/C++ DevTools Support (DWARF)] Loading debug symbols for http://localhost:6931/my_app.wasm...
my_app.html:46 [my_app] Calling wgpuCreateInstance...
my_app.html:46 [my_app] Called wgpuCreateInstance
my_app.html:46 [my_app] Called wgpuInstanceCreateSurface
my_app.html:46 [my_app] Calling wgpuInstanceRequestAdapter...
my_app.js:5189 WebGPU is experimental on this platform. See https://github.com/gpuweb/gpuweb/wiki/Implementation-Status#implementation-status
my_app.html:46 [my_app] Called wgpuInstanceRequestAdapter
my_app.html:46 [my_app] Calling wgpuInstanceWaitAny for wgpuInstanceRequestAdapter future with timeout 1'500'000'000ull...
[C/C++ DevTools Support (DWARF)] Loaded debug symbols for http://localhost:6931/my_app.wasm, found 872 source file(s)
my_app.html:46 [my_app] WGPURequestAdapterStatus: WGPURequestAdapterStatus_Success
my_app.html:46 [my_app] WGPUWaitStatus: WGPUWaitStatus_Success
my_app.html:46 [my_app] Setting only WGPUFeatureName_IndirectFirstInstance as required feature
my_app.html:46 [my_app] Setting supported limits as required limits
my_app.html:46 [my_app] Called wgpuAdapterRequestDevice
my_app.html:46 [my_app] Calling wgpuInstanceWaitAny for wgpuAdapterRequestDevice future with timeout 1'500'000'000ull...
my_app.html:46 [my_app] WGPURequestDeviceStatus: WGPURequestDeviceStatus_Success
my_app.html:46 [my_app] WGPUWaitStatus: WGPUWaitStatus_Success
my_app.html:46 [my_app] Called wgpuDeviceGetQueue
my_app.html:46 [my_app] Calling emscripten_request_animation_frame_loop...
my_app.html:46 [my_app] Called emscripten_request_animation_frame_loop
my_app.html:46 [my_app] Calling emscripten_exit_with_live_runtime...
my_app.html:46 [my_app] In onAnimationFrame...
my_app.html:46 [my_app] Created WGPUTexture 336576 (with format WGPUTextureFormat_BGRA8Unorm, sampleCount 1, usage (WGPUTextureUsage_CopySrc | WGPUTextureUsage_RenderAttachment)
my_app.html:46 [my_app] Created WGPUTextureView 336600 for texture 336576
my_app.html:46 [my_app] Called wgpuTextureSetLabel for WGPUTexture 336576 with label "Color RenderAttachment image 0"
my_app.html:46 [my_app] Called wgpuTextureViewSetLabel for WGPUTextureView 336600 with label "Color RenderAttachment image 0 (View)"
my_app.html:46 [my_app] WGPUSurfaceGetCurrentTextureStatus: SuccessOptimal
my_app.html:46 [my_app] Got WGPUTexture 337136 from wgpuSurfaceGetCurrentTexture with format WGPUTextureFormat_BGRA8Unorm, usage (WGPUTextureUsage_CopyDst | WGPUTextureUsage_RenderAttachment)
my_app.html:46 [my_app] Created WGPUTextureView 337160 for texture 337136 with format WGPUTextureFormat_BGRA8Unorm, usage: (WGPUTextureUsage_CopyDst | WGPUTextureUsage_RenderAttachment)
my_app.html:46 [my_app] Called wgpuTextureSetLabel for WGPUTexture 337136 with label "Swapchain image 0"
my_app.html:46 [my_app] Called wgpuTextureViewSetLabel for WGPUTextureView 337160 with label "Swapchain image 0 (View)"
my_app.html:46 [my_app] Created WGPUBuffer 338304 with usage (WGPUBufferUsage_CopyDst | WGPUBufferUsage_Vertex)
my_app.html:46 [my_app] Created WGPUBuffer 338376 with usage (WGPUBufferUsage_CopyDst | WGPUBufferUsage_Index)
my_app.html:46 [my_app] Created WGPUBuffer 338480 with usage (WGPUBufferUsage_CopyDst | WGPUBufferUsage_Storage)
my_app.html:46 [my_app] Created WGPUBuffer 331128 with usage (WGPUBufferUsage_CopyDst | WGPUBufferUsage_Storage)
my_app.html:46 [my_app] Created WGPUBuffer 330304 with usage (WGPUBufferUsage_CopyDst | WGPUBufferUsage_Indirect)
my_app.html:46 [my_app] Created WGPUBuffer 330408 with usage (WGPUBufferUsage_MapWrite | WGPUBufferUsage_CopySrc)
my_app.html:46 [my_app] Created WGPUTexture 338584 (with format WGPUTextureFormat_RGBA8Unorm, sampleCount 1, usage (WGPUTextureUsage_CopyDst | WGPUTextureUsage_TextureBinding)
my_app.html:46 [my_app] Created WGPUTextureView 338608 for texture 338584
my_app.html:46 [my_app] Created WGPUTexture 338632 (with format WGPUTextureFormat_RGBA8Unorm, sampleCount 1, usage (WGPUTextureUsage_CopyDst | WGPUTextureUsage_TextureBinding)
my_app.html:46 [my_app] Created WGPUTextureView 331200 for texture 338632
my_app.html:46 [my_app] Called wgpuTextureSetLabel for WGPUTexture 338584 with label "Background TextureBinding image 0"
my_app.html:46 [my_app] Called wgpuTextureViewSetLabel for WGPUTextureView 338608 with label "Background TextureBinding image 0 (View)"
my_app.html:46 [my_app] Called wgpuTextureSetLabel for WGPUTexture 338632 with label "Sprite TextureBinding image 0"
my_app.html:46 [my_app] Called wgpuTextureViewSetLabel for WGPUTextureView 331200 with label "Sprite TextureBinding image 0 (View)"
my_app.html:46 [my_app] Calling wgpuBufferMapAsync for buffer 330408...
my_app.html:46 [my_app] Called wgpuBufferMapAsync
my_app.html:46 [my_app] Calling wgpuInstanceWaitAny for wgpuBufferMapAsync future with timeout 1'500'000'000ull...
my_app.html:1 Uncaught (in promise) unwind
Promise.then
(anonymous) @ my_app.js:6457
handleSleep @ my_app.js:6374
handleAsync @ my_app.js:6455
_emwgpuWaitAny @ my_app.js:5239
imports.<computed> @ my_app.js:6225
$EventManager::WaitAny(unsigned long long, unsigned long, WGPUFutureWaitInfo*, unsigned long long) @ webgpu.cpp:530
$WGPUInstanceImpl::WaitAny(unsigned long, WGPUFutureWaitInfo*, unsigned long long) @ webgpu.cpp:1572
$wgpuInstanceWaitAny @ webgpu.cpp:1902
$my_namespace::webgpu::waitAny(WGPUInstanceImpl*, my_namespace::webgpu::DeviceProcs&, WGPUFuture, std::__2::basic_string_view<char, std::__2::char_traits<char>>) @ my_lib_webgpu.cpp:1368
$my_namespace::webgpu::requestDevice(WGPUInstanceImpl*, my_namespace::webgpu::DeviceProcs&, WGPUAdapterImpl*, my_namespace::webgpu::Log&, State&) @ my_lib_webgpu.cpp:2113
$my_namespace::webgpu::requestDevice(Instance, Surface*, unsigned long long) @ my_lib_webgpu.cpp:2174
$my_namespace::Instance::requestDevice(my_namespace::Surface const*, unsigned long long) @ my_lib_webgpu.hpp:985
$my_namespace::test::test(my_namespace::State&&) @ my_app.cpp:2985
$__original_main @ my_app_main.cpp:21
$main @ my_app.wasm:0x4b4acc
ret.<computed> @ my_app.js:6257
doRewind @ my_app.js:6362
(anonymous) @ my_app.js:6396
Promise.then
(anonymous) @ my_app.js:6457
handleSleep @ my_app.js:6374
handleAsync @ my_app.js:6455
_emwgpuWaitAny @ my_app.js:5239
imports.<computed> @ my_app.js:6225
$EventManager::WaitAny(unsigned long long, unsigned long, WGPUFutureWaitInfo*, unsigned long long) @ webgpu.cpp:530
$WGPUInstanceImpl::WaitAny(unsigned long, WGPUFutureWaitInfo*, unsigned long long) @ webgpu.cpp:1572
$wgpuInstanceWaitAny @ webgpu.cpp:1902
$my_namespace::webgpu::waitAny(WGPUInstanceImpl*, my_namespace::webgpu::DeviceProcs&, WGPUFuture, std::__2::basic_string_view<char, std::__2::char_traits<char>>) @ my_lib_webgpu.cpp:1368
$my_namespace::webgpu::requestAdapter(WGPUInstanceImpl*, WGPUSurfaceImpl*, my_namespace::webgpu::DeviceProcs&, my_namespace::webgpu::Log&) @ my_lib_webgpu.cpp:1491
$my_namespace::webgpu::requestDevice(Instance, Surface*, unsigned long long) @ my_lib_webgpu.cpp:2172
$my_namespace::Instance::requestDevice(my_namespace::Surface const*, unsigned long long) @ my_lib_webgpu.hpp:985
$my_namespace::test::test(my_namespace::State&&) @ my_app.cpp:2985
$__original_main @ my_app_main.cpp:21
$main @ my_app.wasm:0x4b4acc
ret.<computed> @ my_app.js:6257
(anonymous) @ my_app.js:635
callMain @ my_app.js:7206
doRun @ my_app.js:7259
run @ my_app.js:7272
removeRunDependency @ my_app.js:586
receiveInstance @ my_app.js:745
receiveInstantiationResult @ my_app.js:763
createWasm @ my_app.js:789
await in createWasm
(anonymous)
my_app.html:46 [my_app] WGPUMapAsyncStatus: WGPUMapAsyncStatus_Success
my_app.html:46 [my_app] WGPUWaitStatus: WGPUWaitStatus_Success
my_app.html:46 [my_app] Created WGPUBuffer 331696 with usage (WGPUBufferUsage_CopyDst | WGPUBufferUsage_Vertex)
my_app.html:46 [my_app] Created WGPUBuffer 333624 with usage (WGPUBufferUsage_CopyDst | WGPUBufferUsage_Index)
my_app.html:46 [my_app] Created WGPUBuffer 333728 with usage (WGPUBufferUsage_CopyDst | WGPUBufferUsage_Storage)
my_app.html:46 [my_app] Created WGPUBuffer 333832 with usage (WGPUBufferUsage_CopyDst | WGPUBufferUsage_Storage)
my_app.html:46 [my_app] Created WGPUBuffer 333936 with usage (WGPUBufferUsage_CopyDst | WGPUBufferUsage_Indirect)
my_app.html:46 [my_app] Created WGPUBuffer 334040 with usage (WGPUBufferUsage_MapWrite | WGPUBufferUsage_CopySrc)
my_app.html:46 [my_app] Created WGPUTexture 334144 (with format WGPUTextureFormat_RGBA8Unorm, sampleCount 1, usage (WGPUTextureUsage_CopyDst | WGPUTextureUsage_TextureBinding)
my_app.html:46 [my_app] Created WGPUTextureView 334168 for texture 334144
my_app.html:46 [my_app] Calling wgpuBufferMapAsync for buffer 334040...
my_app.html:46 [my_app] Called wgpuBufferMapAsync
my_app.html:46 [my_app] Calling wgpuInstanceWaitAny for wgpuBufferMapAsync future with timeout 1'500'000'000ull...
my_app.html:46 [my_app] WGPUMapAsyncStatus: WGPUMapAsyncStatus_Success
my_app.html:46 [my_app] WGPUWaitStatus: WGPUWaitStatus_Success
my_app.html:46 [my_app] Calling wgpuCommandEncoderBeginRenderPass...
my_app.html:46 [my_app] Called wgpuCommandEncoderBeginRenderPass
my_app.html:46 [my_app] Calling wgpuRenderPassEncoderEnd...
my_app.html:46 [my_app] Called wgpuRenderPassEncoderEnd
my_app.html:46 [my_app] Calling wgpuCommandEncoderCopyTextureToTexture from (Color RenderAttachment image 0) to (Swapchain image 0)...
my_app.html:46 [my_app] Called wgpuCommandEncoderCopyTextureToTexture
my_app.html:46 [my_app] Calling wgpuCommandEncoderFinish...
my_app.html:46 [my_app] Called wgpuCommandEncoderFinish
my_app.html:46 [my_app] Calling wgpuQueueSubmit...
my_app.html:46 [my_app] Called wgpuQueueSubmit
my_app.html:46 [my_app] Calling wgpuQueueOnSubmittedWorkDone...
my_app.html:46 [my_app] Called wgpuQueueOnSubmittedWorkDone
[my_app] WGPUUncapturedErrorCallback got WGPUErrorType_Validation (Destroyed texture [Texture "Swapchain image 0"] used in a submit.
my_app.html:46 - While calling [Queue].Submit([[CommandBuffer]])
my_app.html:46 )
There is a few things I don't understand here:
- When looking at the full browser console output, the stacktrace leading up to the "Uncaught (in promise) unwind" is not from the wgpuInstanceWaitAny for the wgpuBufferMapAsync future as I would have expected, it's from a call to wgpuInstanceWaitAny for the future from wgpuAdapterRequestDevice. As seen earlier in the log the wgpuInstanceWaitAny has already completed for that future with status WGPUWaitStatus_Success, and it's WGPURequestDeviceStatus was WGPURequestDeviceStatus_Success.
- The wgpuInstanceWaitAny for the future of wgpuBufferMapAsync do complete with status WGPUWaitStatus_Success and WGPUMapAsyncStatus_Success dispite the "Uncaught (in promise) unwind", and I'm later able to call wgpuBufferMapAsync for another buffer which completes successfully without any "Uncaught (in promise) unwind".
- From the perspective of WebGPU, all functions return the expected successful statuses until the end of the frame where I'm calling wgpuQueueOnSubmittedWorkDone before returning from the emscripten_request_animation_frame_loop callback, but I get a WGPUUncapturedErrorCallback validation error "Destroyed texture [Texture "Swapchain image 0"] used in a submit.", even though I've not released any textures or texture views at this point.
From my perspective, the WebGPU code returns all the expected success return statuses, and the code do work for Dawn on Windows, but I don't know how to prevent the swapchain image from being released since it's not me doing that.
So I guess it's more relevant to focus on the "Uncaught (in promise) unwind" since it happens before that, with a JS stacktrace which already has a successful status on the C++ side.
Could I get help from someone with more insight in the JS machinery behind the wgpuInstanceWaitAny/ASYNCIFY parts on how to proceed here?
As seen in the full link commands, I'm using the emdawnwebgpu port from:
#23432