Mikemon/patches/0002-imgui-add-callback-support-for-sdlgpu3-backend.patch
2025-08-28 05:59:13 +02:00

36 lines
2.1 KiB
Diff

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;
};
#endif // #ifndef IMGUI_DISABLE
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);