imgui_backend.py
_update_texture uses tex.update_rect.w / h as the write extent for want_create, but update_rect only covers modified regions, not the whole texture. The GPU texture ends up partially uninitialized — CJK fonts show missing glyphs with demo window enabled, and all glyphs disappear when tex_glyph_padding is left at default (1).
The bug:
# imgui_backend.py L157-165
if tex.status == imgui.ImTextureStatus.want_create:
upload_x = 0
upload_y = 0
else:
upload_x = tex.update_rect.x
upload_y = tex.update_rect.y
upload_w = tex.update_rect.w # should be tex.width for want_create
upload_h = tex.update_rect.h # should be tex.height
C++ reference (imgui_impl_wgpu.cpp):
const int upload_w = (tex->Status == ImTextureStatus_WantCreate) ? tex->Width : tex->UpdateRect.w;
const int upload_h = (tex->Status == ImTextureStatus_WantCreate) ? tex->Height : tex->UpdateRect.h;
The GPU texture is created at tex.width × tex.height , so the upload should match that. Fix is straightforward: use tex.width / tex.height for want_create.
Proposed fix
- upload_w = tex.update_rect.w
- upload_h = tex.update_rect.h
+ if tex.status == imgui.ImTextureStatus.want_create:
+ upload_w = tex.width
+ upload_h = tex.height
+ else:
+ upload_w = tex.update_rect.w
+ upload_h = tex.update_rect.h
imgui_backend.py
_update_textureusestex.update_rect.w / has the write extent for want_create, butupdate_rectonly covers modified regions, not the whole texture. The GPU texture ends up partially uninitialized — CJK fonts show missing glyphs with demo window enabled, and all glyphs disappear whentex_glyph_paddingis left at default (1).The bug:
C++ reference (imgui_impl_wgpu.cpp):
The GPU texture is created at
tex.width × tex.height, so the upload should match that. Fix is straightforward: usetex.width / tex.heightfor want_create.Proposed fix