Skip to content

ImGui: Vulkan GPU rendering for debug inspectors#170

Merged
cursor[bot] merged 2 commits intomainfrom
cursor/imgui-vulkan-render-0a71
May 4, 2026
Merged

ImGui: Vulkan GPU rendering for debug inspectors#170
cursor[bot] merged 2 commits intomainfrom
cursor/imgui-vulkan-render-0a71

Conversation

@timfox
Copy link
Copy Markdown
Owner

@timfox timfox commented May 3, 2026

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 existing overlay_compose render 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_VULKAN when not already set by CMake (USE_VULKAN=1) — removes macro redefinition warnings in C++ TUs.
  • HiDPI / SDL: io.DisplayFramebufferScale and mouse position use the ratio of glConfig drawable size to SDL_GetWindowSize when they differ (matches imgui_impl_sdl2 behavior for Vulkan windows).

Toggle / UX

  • r_imgui (default 1, archive): enables GPU overlay and SDL mouse sampling when on.
  • Startup log when enabled: ImGui inspector overlay: r_imgui 1 (toggle with r_imgui 0) (from tr_init.c).
  • VkImgui_SwapchainRestarted calls ImGui_ImplVulkan_SetMinImageCount after swapchain recreation.

Files

  • New vk_imgui_vulkan.cpp: init/shutdown, VkImgui_RecordOverlayPass, SDL mouse, backend-ready flag.
  • vk_frame_end.c: call VkImgui_RecordOverlayPass() after gamma.
  • CMakeLists.txt: add imgui_impl_vulkan.cpp, vk_imgui_vulkan.cpp, VK_NO_PROTOTYPES on backend TU, USE_VULKAN for ImGui targets, optional SDL2::Core link.

Testing

  • ./scripts/compile_engine.sh vulkan succeeds locally.
Open in Web Open in Cursor 

cursoragent and others added 2 commits May 3, 2026 09:44
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>
@cursor cursor Bot merged commit b42e044 into main May 4, 2026
45 of 53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants