update dear imgui from 1.91.9b to 1.92.2b

This commit is contained in:
Sven Balzer
2025-08-28 05:58:03 +02:00
parent ad651462df
commit 883e13cdf5
107 changed files with 10690 additions and 4643 deletions
@@ -1,60 +1,35 @@
From 3c421b0502a4fed7fcc72cce6e99e40986cdb9a7 Mon Sep 17 00:00:00 2001
From: Sven Balzer <4653051+Kyuusokuna@users.noreply.github.com>
Date: Thu, 20 Mar 2025 12:10:23 +0100
Subject: [PATCH] add callback support for imgui sdlgpu3 backend
---
libs/imgui/backends/imgui_impl_sdlgpu3.cpp | 12 +++++++++++-
libs/imgui/backends/imgui_impl_sdlgpu3.h | 9 +++++++++
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/libs/imgui/backends/imgui_impl_sdlgpu3.cpp b/libs/imgui/backends/imgui_impl_sdlgpu3.cpp
index 74b9662..e399974 100644
--- a/libs/imgui/backends/imgui_impl_sdlgpu3.cpp
+++ b/libs/imgui/backends/imgui_impl_sdlgpu3.cpp
@@ -220,6 +220,13 @@ void ImGui_ImplSDLGPU3_RenderDrawData(ImDrawData* draw_data, SDL_GPUCommandBuffe
diff --git forkSrcPrefix/libs/imgui/backends/imgui_impl_sdlgpu3.h forkDstPrefix/libs/imgui/backends/imgui_impl_sdlgpu3.h
index 39eb7216e472626a0ef858a41e703bbb12ede51c..c062f654a14ca3e2ed3c8735935f504455c962af 100644
--- forkSrcPrefix/libs/imgui/backends/imgui_impl_sdlgpu3.h
+++ forkDstPrefix/libs/imgui/backends/imgui_impl_sdlgpu3.h
@@ -55,9 +55,11 @@ IMGUI_IMPL_API void ImGui_ImplSDLGPU3_UpdateTexture(ImTextureData* tex);
// (Please open an issue if you feel you need access to more data)
struct ImGui_ImplSDLGPU3_RenderState
{
- SDL_GPUDevice* Device;
- SDL_GPUSampler* SamplerDefault; // Default sampler (bilinear filtering)
- SDL_GPUSampler* SamplerCurrent; // Current sampler (may be changed by callback)
+ SDL_GPUDevice* Device;
+ SDL_GPUSampler* SamplerDefault; // Default sampler (bilinear filtering)
+ SDL_GPUSampler* SamplerCurrent; // Current sampler (may be changed by callback)
+ SDL_GPUCommandBuffer* CommandBuffer;
+ SDL_GPURenderPass* RenderPass;
};
ImGui_ImplSDLGPU3_SetupRenderState(draw_data, pipeline, command_buffer, render_pass, fd, fb_width, fb_height);
+ // Setup render state structure (for callbacks and custom texture bindings)
+ ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO();
+ ImGui_ImplSDLGPU3_RenderState render_state;
+ render_state.command_buffer = command_buffer;
+ render_state.render_pass = render_pass;
+ platform_io.Renderer_RenderState = &render_state;
+
// Will project scissor/clipping rectangles into framebuffer space
ImVec2 clip_off = draw_data->DisplayPos; // (0,0) unless using multi-viewports
ImVec2 clip_scale = draw_data->FramebufferScale; // (1,1) unless using retina display which are often (2,2)
@@ -236,7 +243,10 @@ void ImGui_ImplSDLGPU3_RenderDrawData(ImDrawData* draw_data, SDL_GPUCommandBuffe
const ImDrawCmd* pcmd = &draw_list->CmdBuffer[cmd_i];
if (pcmd->UserCallback != nullptr)
{
- pcmd->UserCallback(draw_list, pcmd);
+ if (pcmd->UserCallback == ImDrawCallback_ResetRenderState)
+ ImGui_ImplSDLGPU3_SetupRenderState(draw_data, pipeline, command_buffer, render_pass, fd, fb_width, fb_height);
+ else
+ pcmd->UserCallback(draw_list, pcmd);
}
else
{
diff --git a/libs/imgui/backends/imgui_impl_sdlgpu3.h b/libs/imgui/backends/imgui_impl_sdlgpu3.h
index 865139e..2cc032d 100644
--- a/libs/imgui/backends/imgui_impl_sdlgpu3.h
+++ b/libs/imgui/backends/imgui_impl_sdlgpu3.h
@@ -46,4 +46,13 @@ IMGUI_IMPL_API void ImGui_ImplSDLGPU3_DestroyDeviceObjects();
IMGUI_IMPL_API void ImGui_ImplSDLGPU3_CreateFontsTexture();
IMGUI_IMPL_API void ImGui_ImplSDLGPU3_DestroyFontsTexture();
+// [BETA] Selected render state data shared with callbacks.
+// This is temporarily stored in GetPlatformIO().Renderer_RenderState during the ImGui_ImplSDLGPU3_RenderDrawData() call.
+// (Please open an issue if you feel you need access to more data)
+struct ImGui_ImplSDLGPU3_RenderState
+{
+ SDL_GPUCommandBuffer* command_buffer;
+ SDL_GPURenderPass* render_pass;
+};
+
#endif // #ifndef IMGUI_DISABLE
--
2.49.0
diff --git forkSrcPrefix/libs/imgui/backends/imgui_impl_sdlgpu3.cpp forkDstPrefix/libs/imgui/backends/imgui_impl_sdlgpu3.cpp
index 01ad4e6dcb6abf1384fc2e83e95a82516ad4cd73..ac018b1fddaf855210a6462bfc1fac894a30c845 100644
--- forkSrcPrefix/libs/imgui/backends/imgui_impl_sdlgpu3.cpp
+++ forkDstPrefix/libs/imgui/backends/imgui_impl_sdlgpu3.cpp
@@ -234,8 +234,10 @@ void ImGui_ImplSDLGPU3_RenderDrawData(ImDrawData* draw_data, SDL_GPUCommandBuffe
// Setup render state structure (for callbacks and custom texture bindings)
ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO();
ImGui_ImplSDLGPU3_RenderState render_state;
- render_state.Device = bd->InitInfo.Device;
+ render_state.Device = bd->InitInfo.Device;
render_state.SamplerDefault = render_state.SamplerCurrent = bd->TexSampler;
+ render_state.CommandBuffer = command_buffer;
+ render_state.RenderPass = render_pass;
platform_io.Renderer_RenderState = &render_state;
ImGui_ImplSDLGPU3_SetupRenderState(draw_data, &render_state, pipeline, command_buffer, render_pass, fd, fb_width, fb_height);