You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe this issue is partially related to #7765.
My application runs fine until I resize the window at which point I get a crash with the following error message:
Uncaught TypeError: Failed to execute 'createBindGroup' on 'GPUDevice': Failed to read the 'entries' property from 'GPUBindGroupDescriptor': Failed to read the 'resource' property from 'GPUBindGroupEntry': Required member is undefined.
at _wgpuDeviceCreateBindGroup ()
at canvas.wasm.ImGui_ImplWGPU_CreateImageBindGroup(WGPUBindGroupLayoutImpl*, WGPUTextureViewImpl*)
at canvas.wasm.ImGui_ImplWGPU_RenderDrawData(ImDrawData*, WGPURenderPassEncoderImpl*)
This issue is caused by ImTextureID tex_id = pcmd->GetTexID(); in ImGui_ImplWGPU_RenderDrawData returning null after a window resize.
This issue only happens when I compile my application for the web. On desktop it works without issues.
I'm not using any textures with ImGUI aside from the font atlas so what texture is typically bound to each draw command? Is there a default 1x1 white texture somewhere?
Edit: Ok correct me if I'm wrong but it looks like the font atlas is bound to the texture bind group by default. The question now remains why pcmd->GetTexID(); returns the correct id before a window resize and null after a resize.
The text was updated successfully, but these errors were encountered:
Some more information about this bug. This issue started when I added SDL_WINDOW_HIGH_PIXEL_DENSITY to SDL_CreateWindow. After some more testing I found pcmd->GetTexID() only returns null when resizing on a display with fractional UI scaling (150%, 175%, etc). Still not sure about the root cause.
I finally had the chance to look at this again and it was an issue on my end. I was rebuilding my fonts on SDL display scale change events like so in my sdl events handler function:
case SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED:
case SDL_EVENT_WINDOW_DISPLAY_SCALE_CHANGED:
app->dpiFactor = SDL_GetWindowDisplayScale( app->window );
rebuildImGuiFonts();
For some reason on fractional dpi scaling, these events get triggered on a window resize (float precision error maybe?)
These events also would get trigged when the font atlas was locked by ImGui::NewFrame() so the atlas would not get rebuilt correctly causing io.Fonts->TexID to return null.
I have modified that code snipet to the following and now everything works:
case SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED:
case SDL_EVENT_WINDOW_DISPLAY_SCALE_CHANGED:
// do comparison with ints to eliminate precision error
if( static_cast<int>( app->dpiFactor * 100 ) != static_cast<int>( SDL_GetWindowDisplayScale( app->window ) * 100 ) )
{
app->dpiFactor = SDL_GetWindowDisplayScale( app->window );
//rebuild font next time the atlas is not locked
app->rebuildFontAtlas = true;
}
Version/Branch of Dear ImGui:
Version 1.91.0, Branch: master
Back-ends:
imgui_impl_sdl3.cpp + imgui_impl_wgpu.cpp
Compiler, OS:
linux clang (emscripten)
Full config/build information:
NA
Details:
I believe this issue is partially related to #7765.My application runs fine until I resize the window at which point I get a crash with the following error message:
This issue is caused by
ImTextureID tex_id = pcmd->GetTexID();
inImGui_ImplWGPU_RenderDrawData
returning null after a window resize.This issue only happens when I compile my application for the web. On desktop it works without issues.
I'm not using any textures with ImGUI aside from the font atlas so what texture is typically bound to each draw command? Is there a default 1x1 white texture somewhere?
Edit: Ok correct me if I'm wrong but it looks like the font atlas is bound to the texture bind group by default. The question now remains why
pcmd->GetTexID();
returns the correct id before a window resize and null after a resize.The text was updated successfully, but these errors were encountered: