Emscripten / WebGPU failing with Emscripten 3.1.68
Version/Branch of Dear ImGui:
Version 1.91.3, Branch: master
Back-ends:
imgui_impl_glfw.cpp + imgui_impl_wgpu.cpp
Compiler, OS:
Emscripten 3.1.68
Full config/build information:
No response
Details:
After upgrading to Emscripten 3.1.68 I rebuilt the example example_glfw_wgpu using
> make -f Makefile.emscripten serve
So it is using GLFW built-in (not my new port) and WebGPU.
Running results in this failures in the console (and nothing gets rendered):
(index):41 Validation error: Write range (bufferOffset: 0, size: 592656) does not fit in [Buffer "Dear ImGui Vertex buffer"] size (115240).
(index):41 - While calling [Queue].WriteBuffer([Buffer "Dear ImGui Vertex buffer"], (0 bytes), data, (592656 bytes))
(index):41
28Write range (bufferOffset: 0, size: 592656) does not fit in [Buffer "Dear ImGui Vertex buffer"] size (115240).
- While calling [Queue].WriteBuffer([Buffer "Dear ImGui Vertex buffer"], (0 bytes), data, (592656 bytes))
Understand this warning
(index):41 Validation error: Write range (bufferOffset: 0, size: 547616) does not fit in [Buffer "Dear ImGui Index buffer"] size (22528).
(index):41 - While calling [Queue].WriteBuffer([Buffer "Dear ImGui Index buffer"], (0 bytes), data, (547616 bytes))
(index):41
.... etc... forever
I do not know if it is a Emscripten regression issue or an ImGui issue. I highly suspect it is a regression in Emscripten because I simply upgraded the version of Emscripten and did a build without any other code change. So unless there was something wrong with ImGui that was somehow working with a previous version, it is most likely an Emscripten regression bug.
I have opened a ticket to report it.
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
No response
Linking to #8031 as it seems similar.
Based on this comment it seems fairly obvious that it is not an ImGui problem but an Emscripten problem.
A workaround for the time being is to not use Emscripten 3.1.68. You can easily use a different version, one that is known to work, like this:
emsdk install 3.1.66
I will report back when it is fixed.
Emscripten 3.1.69 has been released and it fixes this issue which I am closing now. I have rebuilt 1.91.3 with it and now everything is fine: