ImGui: Vulkan GPU rendering for debug inspectors#170
Merged
cursor[bot] merged 2 commits intomainfrom May 4, 2026
Merged
Conversation
Wire Dear ImGui through imgui_impl_vulkan with engine qvk* loader resolution, record UI into overlay_compose after gamma pass. Add r_imgui toggle (default 1), SDL mouse sampling when enabled, swapchain restart notification, SDL2::Core link. Adds vk_imgui_vulkan.cpp bridge; avoids including tr_local.h in C++ due to reserved-member conflicts. Co-authored-by: Tim Fox <timfox@outlook.com>
- Guard tr_common.h USE_VULKAN define when CMake passes USE_VULKAN=1 - Scale SDL mouse coords by drawable/window ratio (glConfig vs SDL_GetWindowSize) - Set io.DisplayFramebufferScale to match (SDL window with HiDPI) - Include vk_imgui.h in vk_imgui_vulkan.cpp for vkImguiState in RecordOverlayPass Co-authored-by: Tim Fox <timfox@outlook.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ImGui previously built UI CPU-side (
ImGui::Render()) but never submitted draw lists to Vulkan, so inspectors had no visible overlay.This wires Dear ImGui through
imgui_impl_vulkan.cpp, resolves Vulkan entry points via the engine loader (ri.VK_GetInstanceProcAddr/qvkGetDeviceProcAddr), and records UI into the existingoverlay_composerender pass after the gamma fullscreen pass (same swapchain attachment path as the optional UI overlay composite).Follow-up (second commit)
tr_common.h: only#define USE_VULKANwhen not already set by CMake (USE_VULKAN=1) — removes macro redefinition warnings in C++ TUs.io.DisplayFramebufferScaleand mouse position use the ratio ofglConfigdrawable size toSDL_GetWindowSizewhen they differ (matchesimgui_impl_sdl2behavior for Vulkan windows).Toggle / UX
r_imgui(default 1, archive): enables GPU overlay and SDL mouse sampling when on.ImGui inspector overlay: r_imgui 1 (toggle with r_imgui 0)(fromtr_init.c).VkImgui_SwapchainRestartedcallsImGui_ImplVulkan_SetMinImageCountafter swapchain recreation.Files
vk_imgui_vulkan.cpp: init/shutdown,VkImgui_RecordOverlayPass, SDL mouse, backend-ready flag.vk_frame_end.c: callVkImgui_RecordOverlayPass()after gamma.CMakeLists.txt: addimgui_impl_vulkan.cpp,vk_imgui_vulkan.cpp,VK_NO_PROTOTYPESon backend TU,USE_VULKANfor ImGui targets, optionalSDL2::Corelink.Testing
./scripts/compile_engine.sh vulkansucceeds locally.