Skip to content

Upgrade imgui to 1.92.6#101

Open
OndraVoves wants to merge 1 commit into
zig-gamedev:mainfrom
cyberegoorg:upgrade_to_imgui_1_92_6_docking
Open

Upgrade imgui to 1.92.6#101
OndraVoves wants to merge 1 commit into
zig-gamedev:mainfrom
cyberegoorg:upgrade_to_imgui_1_92_6_docking

Conversation

@OndraVoves
Copy link
Copy Markdown
Contributor

No description provided.

@OndraVoves OndraVoves force-pushed the upgrade_to_imgui_1_92_6_docking branch 2 times, most recently from 8100546 to b24996a Compare March 29, 2026 09:39
@OndraVoves OndraVoves marked this pull request as ready for review March 29, 2026 09:42
@OndraVoves
Copy link
Copy Markdown
Contributor Author

Ready for review ;)

@OndraVoves OndraVoves force-pushed the upgrade_to_imgui_1_92_6_docking branch 2 times, most recently from 9a6f167 to c01bb11 Compare March 29, 2026 12:34
@hazeycode hazeycode requested a review from Copilot March 30, 2026 18:41
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the vendored Dear ImGui stack to 1.92.6 and aligns this repo’s Zig/C wrappers, test engine, and backend integrations with upstream API/ABI changes introduced across the 1.92.x series.

Changes:

  • Exposes new default font variants (vector/bitmap) through the C API (zgui.cpp) and Zig bindings (gui.zig).
  • Updates Zig bindings for newly added/changed flags, style fields, and enums to match ImGui 1.92.6.
  • Syncs upstream backend/test-engine changes needed for dynamic texture updates, viewport parenting, and other 1.92.6 behavior.

Reviewed changes

Copilot reviewed 50 out of 57 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/zgui.cpp Adds C wrappers for AddFontDefaultVector() / AddFontDefaultBitmap().
src/gui.zig Updates Zig API/bindings for new flags/fields/enums and new default font entry points.
libs/node_editor/imgui_node_editor_internal.inl Adds missing ImRect_Floor() helper implementation for node editor internals.
libs/node_editor/imgui_node_editor_internal.h Declares ImRect_Floor() helper.
libs/imgui_test_engine/imgui_te_utils.h Adds IM_COUNTOF compatibility macro for older ImGui versions.
libs/imgui_test_engine/imgui_te_utils.cpp Syncs upstream changes (warnings pragmas, IM_COUNTOF, logic tweaks, unused vars).
libs/imgui_test_engine/imgui_te_ui.cpp Updates Test Engine UI for newer ImGui APIs and adds help popup + run behavior changes.
libs/imgui_test_engine/imgui_te_perftool.cpp Syncs perf tool with new macros and warning pragmas; updates buffer-size macros.
libs/imgui_test_engine/imgui_te_internal.h Adds new internal fields for host mouse position and hook state tracking.
libs/imgui_test_engine/imgui_te_exporters.cpp Adds warning pragmas and small upstream portability adjustments.
libs/imgui_test_engine/imgui_te_engine.h Updates public Test Engine API (teardown func, logging hook, IM_COUNTOF, check op rename).
libs/imgui_test_engine/imgui_te_engine.cpp Syncs engine implementation with new APIs, teardown flow, texture macros, and robustness tweaks.
libs/imgui_test_engine/imgui_te_context.h Updates context helpers/macros and adds new generic vars/status fields.
libs/imgui_test_engine/imgui_capture_tool.h Updates comment to match renamed capture flag.
libs/imgui_test_engine/imgui_capture_tool.cpp Syncs capture tool with warnings pragmas and IM_COUNTOF conversions.
libs/imgui_test_engine/LICENSE.txt Updates copyright year.
libs/imgui/misc/freetype/imgui_freetype.cpp Syncs FreeType loader integration with new ImFontConfig semantics (const correctness, ExtraSizeScale).
libs/imgui/imstb_textedit.h Syncs Dear ImGui’s patched stb_textedit for new insertion semantics and wrapping/cursor behavior.
libs/imgui/imconfig.h Updates upstream docs/comments about assertions, fonts, and FreeType usage.
libs/imgui/backends/imgui_impl_win32.h Minor comment grammar updates.
libs/imgui/backends/imgui_impl_win32.cpp Syncs Win32 backend with viewport parenting, gamepad packet optimizations, IME changes, etc.
libs/imgui/backends/imgui_impl_wgpu.h Adds Emscripten defaults, extra helpers, and init struct defaults.
libs/imgui/backends/imgui_impl_wgpu.cpp Syncs WGPU backend for Dawn/WGPU split and adds helper utilities.
libs/imgui/backends/imgui_impl_vulkan.h Syncs Vulkan backend init structs/APIs and adds new pipeline/helper interfaces.
libs/imgui/backends/imgui_impl_sdlrenderer3.h Migrates SDL3 renderer backend to texture-update path + signature changes.
libs/imgui/backends/imgui_impl_sdlrenderer3.cpp Implements texture update support via ImTextureData and clears handlers on shutdown.
libs/imgui/backends/imgui_impl_sdlrenderer2.h Migrates SDL2 renderer backend to texture-update path + signature changes.
libs/imgui/backends/imgui_impl_sdlrenderer2.cpp Implements texture update support via ImTextureData and clears handlers on shutdown.
libs/imgui/backends/imgui_impl_sdlgpu3_shaders.h Adds embedded MSL shader sources for broader macOS support.
libs/imgui/backends/imgui_impl_sdlgpu3.h Extends init info + exposes render state for callbacks/sampler switching.
libs/imgui/backends/imgui_impl_sdlgpu3.cpp Syncs SDLGPU3 backend (texture id change, samplers, MSL support, viewport swapchain params).
libs/imgui/backends/imgui_impl_sdl3.h Adds API to control mouse-capture mode (X11/debugger ergonomics).
libs/imgui/backends/imgui_impl_sdl3.cpp Syncs SDL3 platform backend (IME handling changes, mouse capture mode, parent viewport support).
libs/imgui/backends/imgui_impl_sdl2.h Adds API to control mouse-capture mode (X11/debugger ergonomics).
libs/imgui/backends/imgui_impl_sdl2.cpp Syncs SDL2 platform backend (mouse capture mode, clipboard behavior, handler clearing).
libs/imgui/backends/imgui_impl_osx.mm Clears platform handlers on shutdown; syncs upstream changelog/comments.
libs/imgui/backends/imgui_impl_osx.h Updates comments to reflect missing parent viewport support.
libs/imgui/backends/imgui_impl_opengl3_loader.h Updates embedded GL loader for samplers, shutdown, and portability.
libs/imgui/backends/imgui_impl_opengl3.h Updates texture-update comment to nullptr.
libs/imgui/backends/imgui_impl_opengl3.cpp Syncs OpenGL3 backend (embedded loader shutdown, sampler binding tracking, texture update pixel-store).
libs/imgui/backends/imgui_impl_metal.mm Syncs Metal backend for texture list and handler clearing.
libs/imgui/backends/imgui_impl_metal.h Updates texture-update comment to nullptr.
libs/imgui/backends/imgui_impl_glfw.h Updates comments (requirements/typos) to match upstream.
libs/imgui/backends/imgui_impl_dx12.h Wraps warnings and updates texture-update comment to nullptr.
README.md Updates documented versions for ImGui, Test Engine, and Node Editor.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md Outdated
Comment on lines +1898 to +1900
ctx->LogInfo("Running TestShutdownFunc:");
IM_ASSERT(ctx->ActiveFunc == ImGuiTestActiveFunc_GuiFunc || ctx->ActiveFunc == ImGuiTestActiveFunc_TestFunc);
ctx->ActiveFunc = ImGuiTestActiveFunc_TeardownFunc;
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The log string says "Running TestShutdownFunc:" but the callback and enum are named TeardownFunc/ImGuiTestActiveFunc_TeardownFunc. Consider renaming the log text to match the API to avoid confusion when reading test logs.

Copilot uses AI. Check for mistakes.
if (ctx)
{
IM_ASSERT(ctx->ActiveFunc == ImGuiTestActiveFunc_TestFunc && "Can only yield inside TestFunc()!");
IM_ASSERT(ctx->ActiveFunc != ImGuiTestActiveFunc_GuiFunc && "Can only yield inside a TestFunc()!");
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assert now allows yielding from TeardownFunc as well as TestFunc, but the message still says "Can only yield inside a TestFunc()!". Update the message to reflect the actual allowed contexts (or to say it cannot be called from GuiFunc).

Copilot uses AI. Check for mistakes.
Comment thread src/gui.zig Outdated
Comment on lines +824 to +825
ImStrncpy(_FilterDateFrom, "9999-99-99", IM_COUNTOF(_FilterDateFrom));
ImStrncpy(_FilterDateTo, "0000-00-00", IM_COUNTOF(_FilterDateFrom));
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The copy into _FilterDateTo uses IM_COUNTOF(_FilterDateFrom) as the destination buffer size. This should use the size of _FilterDateTo to avoid incorrect bounds if the array sizes ever diverge.

Copilot uses AI. Check for mistakes.
Comment thread src/gui.zig Outdated
@zig-gamedev zig-gamedev deleted a comment from Copilot AI Mar 30, 2026
@OndraVoves OndraVoves force-pushed the upgrade_to_imgui_1_92_6_docking branch from c01bb11 to 0d1f385 Compare March 30, 2026 19:02
@hazeycode
Copy link
Copy Markdown
Member

I'll try to test this against our sample app repo on all platforms in the next few days

@OndraVoves
Copy link
Copy Markdown
Contributor Author

Great, if everything looks good and it gets merged, I’ll prepare another PR for the fresh new version of imgui v1.92.7 =D. Then I’d be happy to help with #65—if we can get it to the same version v1.92.7, I can easily test it on my project. And getting it into the master branch could really help us with future updates.

@hazeycode
Copy link
Copy Markdown
Member

The samples fail to build against this. Something with wgpu symbols is broken:

/Users/chris/Projects/zig-gamedev-libs/zgui/libs/imgui/backends/imgui_impl_wgpu.h:104:49: error: unknown type name 'WGPUSurfaceGetCurrentTextureStatus'
bool        ImGui_ImplWGPU_IsSurfaceStatusError(WGPUSurfaceGetCurrentTextureStatus status);
                                                ^
/Users/chris/Projects/zig-gamedev-libs/zgui/libs/imgui/backends/imgui_impl_wgpu.cpp:68:10: note: in file included from /Users/chris/Projects/zig-gamedev-libs/zgui/libs/imgui/backends/imgui_impl_wgpu.cpp:68:
#include "imgui_impl_wgpu.h"
         ^
/Users/chris/Projects/zig-gamedev-libs/zgui/libs/imgui/backends/imgui_impl_wgpu.h:105:54: error: unknown type name 'WGPUSurfaceGetCurrentTextureStatus'
bool        ImGui_ImplWGPU_IsSurfaceStatusSubOptimal(WGPUSurfaceGetCurrentTextureStatus status);    // Return whether the texture is suboptimal and may need to be recreated.
                                                     ^
/Users/chris/Projects/zig-gamedev-libs/zgui/libs/imgui/backends/imgui_impl_wgpu.cpp:68:10: note: in file included from /Users/chris/Projects/zig-gamedev-libs/zgui/libs/imgui/backends/imgui_impl_wgpu.cpp:68:
#include "imgui_impl_wgpu.h"
         ^
/Users/chris/Projects/zig-gamedev-libs/zgui/libs/imgui/backends/imgui_impl_wgpu.cpp:74:2: error: Exactly one of IMGUI_IMPL_WEBGPU_BACKEND_DAWN or IMGUI_IMPL_WEBGPU_BACKEND_WGPU must be defined!
#error Exactly one of IMGUI_IMPL_WEBGPU_BACKEND_DAWN or IMGUI_IMPL_WEBGPU_BACKEND_WGPU must be defined!
 ^
/Users/chris/Projects/zig-gamedev-libs/zgui/libs/imgui/backends/imgui_impl_wgpu.cpp:280:5: error: unknown type name 'WGPUShaderSourceWGSL'
    WGPUShaderSourceWGSL wgsl_desc = {};
    ^
/Users/chris/Projects/zig-gamedev-libs/zgui/libs/imgui/backends/imgui_impl_wgpu.cpp:281:29: error: use of undeclared identifier 'WGPUSType_ShaderSourceWGSL'
    wgsl_desc.chain.sType = WGPUSType_ShaderSourceWGSL;
                            ^
/Users/chris/Projects/zig-gamedev-libs/zgui/libs/imgui/backends/imgui_impl_wgpu.cpp:282:37: error: use of undeclared identifier 'WGPU_STRLEN'
    wgsl_desc.code = { wgsl_source, WGPU_STRLEN };
                                    ^
/Users/chris/Projects/zig-gamedev-libs/zgui/libs/imgui/backends/imgui_impl_wgpu.cpp:296:39: error: use of undeclared identifier 'WGPU_STRLEN'
    stage_desc.entryPoint = { "main", WGPU_STRLEN };
                                      ^
/Users/chris/Projects/zig-gamedev-libs/zgui/libs/imgui/backends/imgui_impl_wgpu.cpp:419:43: error: use of undeclared identifier 'WGPU_STRLEN'
            { "Dear ImGui Vertex buffer", WGPU_STRLEN, },
                                          ^
/Users/chris/Projects/zig-gamedev-libs/zgui/libs/imgui/backends/imgui_impl_wgpu.cpp:447:42: error: use of undeclared identifier 'WGPU_STRLEN'
            { "Dear ImGui Index buffer", WGPU_STRLEN, },
                                         ^
/Users/chris/Projects/zig-gamedev-libs/zgui/libs/imgui/backends/imgui_impl_wgpu.cpp:583:50: error: use of undeclared identifier 'WGPU_STRLEN'
        tex_desc.label = { "Dear ImGui Texture", WGPU_STRLEN };
                                                 ^
/Users/chris/Projects/zig-gamedev-libs/zgui/libs/imgui/backends/imgui_impl_wgpu.cpp:628:9: error: unknown type name 'WGPUTexelCopyTextureInfo'
        WGPUTexelCopyTextureInfo dst_view = {};
        ^
/Users/chris/Projects/zig-gamedev-libs/zgui/libs/imgui/backends/imgui_impl_wgpu.cpp:637:9: error: unknown type name 'WGPUTexelCopyBufferLayout'
        WGPUTexelCopyBufferLayout layout = {};
        ^
/Users/chris/Projects/zig-gamedev-libs/zgui/libs/imgui/backends/imgui_impl_wgpu.cpp:659:40: error: use of undeclared identifier 'WGPU_STRLEN'
        { "Dear ImGui Uniform buffer", WGPU_STRLEN, },
                                       ^
/Users/chris/Projects/zig-gamedev-libs/zgui/libs/imgui/backends/imgui_impl_wgpu.cpp:775:45: error: use of undeclared identifier 'WGPUOptionalBool_False'
    depth_stencil_state.depthWriteEnabled = WGPUOptionalBool_False;
                                            ^
/Users/chris/Projects/zig-gamedev-libs/zgui/libs/imgui/backends/imgui_impl_wgpu.cpp:937:42: error: unknown type name 'WGPUSurfaceGetCurrentTextureStatus'
bool ImGui_ImplWGPU_IsSurfaceStatusError(WGPUSurfaceGetCurrentTextureStatus status)
                                         ^
/Users/chris/Projects/zig-gamedev-libs/zgui/libs/imgui/backends/imgui_impl_wgpu.cpp:942:23: error: use of undeclared identifier 'WGPUSurfaceGetCurrentTextureStatus_OutOfMemory'
    return (status == WGPUSurfaceGetCurrentTextureStatus_OutOfMemory || status == WGPUSurfaceGetCurrentTextureStatus_DeviceLost);
                      ^
/Users/chris/Projects/zig-gamedev-libs/zgui/libs/imgui/backends/imgui_impl_wgpu.cpp:942:83: error: use of undeclared identifier 'WGPUSurfaceGetCurrentTextureStatus_DeviceLost'
    return (status == WGPUSurfaceGetCurrentTextureStatus_OutOfMemory || status == WGPUSurfaceGetCurrentTextureStatus_DeviceLost);
                                                                                  ^
/Users/chris/Projects/zig-gamedev-libs/zgui/libs/imgui/backends/imgui_impl_wgpu.cpp:946:47: error: unknown type name 'WGPUSurfaceGetCurrentTextureStatus'
bool ImGui_ImplWGPU_IsSurfaceStatusSubOptimal(WGPUSurfaceGetCurrentTextureStatus status)
                                              ^
/Users/chris/Projects/zig-gamedev-libs/zgui/libs/imgui/backends/imgui_impl_wgpu.cpp:951:23: error: use of undeclared identifier 'WGPUSurfaceGetCurrentTextureStatus_Timeout'
    return (status == WGPUSurfaceGetCurrentTextureStatus_Timeout || status == WGPUSurfaceGetCurrentTextureStatus_Outdated || status == WGPUSurfaceGetCurrentTextureStatus_Lost || status == WGPUSurfaceGetCurrentTextureStatus_SuccessSuboptimal);

// This condition is false for all other 3 cases: WGPU-Native, DAWN-Native or DAWN-EMSCRIPTEN (using --use-port=emdawnwebgpu flag)
#if defined(__EMSCRIPTEN__) && defined(IMGUI_IMPL_WEBGPU_BACKEND_WGPU)
#define IMGUI_IMPL_WEBGPU_BACKEND_WGPU_EMSCRIPTEN
#endif
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this upstream change we need to account for to fix the gpu backend build

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem is only with emscripten?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ouch, I see what you mean. Unfortunately, I don't have any experience with wgpu, so I'm not really sure how to fix it properly. The defines have changed, but we might run into a problem with the version the backend is for, and we'll have to do another workaround :( Btw, it's good to see you back

@tonitch
Copy link
Copy Markdown
Contributor

tonitch commented Apr 26, 2026

Great, if everything looks good and it gets merged, I’ll prepare another PR for the fresh new version of imgui v1.92.7 =D. Then I’d be happy to help with #65—if we can get it to the same version v1.92.7, I can easily test it on my project. And getting it into the master branch could really help us with future updates.

I don't plan on updating and fixing this pr so if you'd like to, please do. If you have any questions, I can help. This pr should allow easy upgrades, though. So future-proofing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants