packages feed

dear-imgui-impl-sdlrenderer3 (empty) → 1.0.0

raw patch · 12 files changed

+948/−0 lines, 12 filesdep +basedep +dear-imgui-rawdep +sdl3-bindgen-sys

Dependencies added: base, dear-imgui-raw, sdl3-bindgen-sys, unliftio-core

Files

+ CHANGELOG.md view
@@ -0,0 +1,13 @@+# Changelog for `dear-imgui-impl-sdlrenderer3`++All notable changes to this package will be documented in this file.++The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),+and this project adheres to the+[Haskell Package Versioning Policy](https://pvp.haskell.org/).++## 1.0.0 - 2026-10-21++Initial release.++- Generated with dear_bindings `v0.26` from Dear ImGui `v1.93.0-docking`.
+ LICENSE view
@@ -0,0 +1,26 @@+Copyright 2026 IC Rainbow++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++1.  Redistributions of source code must retain the above copyright notice, this+    list of conditions and the following disclaimer.++2.  Redistributions in binary form must reproduce the above copyright notice,+    this list of conditions and the following disclaimer in the documentation+    and/or other materials provided with the distribution.++3.  Neither the name of the copyright holder nor the names of its contributors+    may be used to endorse or promote products derived from this software+    without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ README.md view
@@ -0,0 +1,6 @@+# dear-imgui-impl-sdlrenderer3++Renderer backend for [Dear ImGui] on SDL3's `SDL_Renderer`.+Pair it with the SDL3 platform backend.++[Dear ImGui]: https://github.com/ocornut/imgui
+ cbits/DearImGuiWrappers.cpp view
@@ -0,0 +1,3 @@+// Generated by dear-bindings-ffi. Do not edit.+#include "DearImGuiWrappers.h"+
+ cbits/DearImGuiWrappers.h view
@@ -0,0 +1,16 @@+// Generated by dear-bindings-ffi. Do not edit.+#ifndef DEAR_IMGUI_WRAPPERS_H+#define DEAR_IMGUI_WRAPPERS_H++#include "dcimgui_impl_sdlrenderer3.h"++#ifdef __cplusplus+extern "C" {+#endif+++#ifdef __cplusplus+}+#endif++#endif
+ cbits/dcimgui_impl_sdlrenderer3.cpp view
@@ -0,0 +1,138 @@+// THIS FILE HAS BEEN AUTO-GENERATED BY THE 'DEAR BINDINGS' GENERATOR.+// **DO NOT EDIT DIRECTLY**+// https://github.com/dearimgui/dear_bindings++#include "imgui.h"+#include "imgui_impl_sdlrenderer3.h"++#include <stdio.h>++// Wrap this in a namespace to keep it separate from the C++ API+// This define prevents #defines in the header getting defined again (as they are already in the normal header above),+// and thus generating redefinition warnings+#define DEAR_BINDINGS_INTERNAL_GLUE_CODE+namespace cimgui+{+#include "dcimgui_impl_sdlrenderer3.h"+}+#undef DEAR_BINDINGS_INTERNAL_GLUE_CODE++// By-value struct conversions++static inline cimgui::ImVec2 ConvertFromCPP_ImVec2(const ::ImVec2& src)+{+    cimgui::ImVec2 dest;+    dest.x = src.x;+    dest.y = src.y;+    return dest;+}++static inline ::ImVec2 ConvertToCPP_ImVec2(const cimgui::ImVec2& src)+{+    ::ImVec2 dest;+    dest.x = src.x;+    dest.y = src.y;+    return dest;+}++static inline cimgui::ImVec4 ConvertFromCPP_ImVec4(const ::ImVec4& src)+{+    cimgui::ImVec4 dest;+    dest.x = src.x;+    dest.y = src.y;+    dest.z = src.z;+    dest.w = src.w;+    return dest;+}++static inline ::ImVec4 ConvertToCPP_ImVec4(const cimgui::ImVec4& src)+{+    ::ImVec4 dest;+    dest.x = src.x;+    dest.y = src.y;+    dest.z = src.z;+    dest.w = src.w;+    return dest;+}++static inline cimgui::ImTextureRef ConvertFromCPP_ImTextureRef(const ::ImTextureRef& src)+{+    cimgui::ImTextureRef dest;+    dest._TexData = reinterpret_cast<cimgui::ImTextureData*>(src._TexData);+    dest._TexID = src._TexID;+    return dest;+}++static inline ::ImTextureRef ConvertToCPP_ImTextureRef(const cimgui::ImTextureRef& src)+{+    ::ImTextureRef dest;+    dest._TexData = reinterpret_cast<::ImTextureData*>(src._TexData);+    dest._TexID = src._TexID;+    return dest;+}++static inline cimgui::ImColor ConvertFromCPP_ImColor(const ::ImColor& src)+{+    cimgui::ImColor dest;+    dest.Value.x = src.Value.x;+    dest.Value.y = src.Value.y;+    dest.Value.z = src.Value.z;+    dest.Value.w = src.Value.w;+    return dest;+}++static inline ::ImColor ConvertToCPP_ImColor(const cimgui::ImColor& src)+{+    ::ImColor dest;+    dest.Value.x = src.Value.x;+    dest.Value.y = src.Value.y;+    dest.Value.z = src.Value.z;+    dest.Value.w = src.Value.w;+    return dest;+}++// Function stubs++#ifndef IMGUI_DISABLE++CIMGUI_IMPL_API bool cimgui::cImGui_ImplSDLRenderer3_Init(SDL_Renderer* renderer)+{+    return ::ImGui_ImplSDLRenderer3_Init(renderer);+}++CIMGUI_IMPL_API void cimgui::cImGui_ImplSDLRenderer3_Shutdown(void)+{+    ::ImGui_ImplSDLRenderer3_Shutdown();+}++CIMGUI_IMPL_API void cimgui::cImGui_ImplSDLRenderer3_NewFrame(void)+{+    ::ImGui_ImplSDLRenderer3_NewFrame();+}++CIMGUI_IMPL_API void cimgui::cImGui_ImplSDLRenderer3_RenderDrawData(cimgui::ImDrawData* draw_data, SDL_Renderer* renderer)+{+    ::ImGui_ImplSDLRenderer3_RenderDrawData(reinterpret_cast<::ImDrawData*>(draw_data), renderer);+}++CIMGUI_IMPL_API void cimgui::cImGui_ImplSDLRenderer3_CreateDeviceObjects(void)+{+    ::ImGui_ImplSDLRenderer3_CreateDeviceObjects();+}++CIMGUI_IMPL_API void cimgui::cImGui_ImplSDLRenderer3_DestroyDeviceObjects(void)+{+    ::ImGui_ImplSDLRenderer3_DestroyDeviceObjects();+}++CIMGUI_IMPL_API void cimgui::cImGui_ImplSDLRenderer3_UpdateTexture(cimgui::ImTextureData* tex)+{+    ::ImGui_ImplSDLRenderer3_UpdateTexture(reinterpret_cast<::ImTextureData*>(tex));+}++CIMGUI_IMPL_API cimgui::ImGui_ImplSDLRenderer3_RenderState* cimgui::cImGui_ImplSDLRenderer3_GetRenderState(void)+{+    return reinterpret_cast<::cimgui::ImGui_ImplSDLRenderer3_RenderState*>(::ImGui_ImplSDLRenderer3_GetRenderState());+}++#endif // #ifndef IMGUI_DISABLE
+ cbits/dcimgui_impl_sdlrenderer3.h view
@@ -0,0 +1,85 @@+// THIS FILE HAS BEEN AUTO-GENERATED BY THE 'DEAR BINDINGS' GENERATOR.+// **DO NOT EDIT DIRECTLY**+// https://github.com/dearimgui/dear_bindings++// Dear Bindings version as a string+#ifndef DEAR_BINDINGS_VERSION+#define DEAR_BINDINGS_VERSION "0.26"+#endif++// Dear Bindings version as an integer+#ifndef DEAR_BINDINGS_VERSION_NUMBER+#define DEAR_BINDINGS_VERSION_NUMBER 26+#endif++// dear imgui: Renderer Backend for SDL_Renderer for SDL3+// Auto-generated forward declarations for C header+typedef struct ImGui_ImplSDLRenderer3_RenderState_t ImGui_ImplSDLRenderer3_RenderState;+// ImDrawIdx: vertex index. [Compile-time configurable type]+// - To use 16-bit indices + allow large meshes: backend need to set 'io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset' and handle ImDrawCmd::VtxOffset (recommended).+// - To use 32-bit indices: override with '#define ImDrawIdx unsigned int' in your imconfig.h file.+#ifndef ImDrawIdx+typedef unsigned short ImDrawIdx;  // Default: 16-bit (for maximum compatibility with renderer backends)+#endif // #ifndef ImDrawIdx+// (Requires: SDL 3.1.8+)++// Note that SDL_Renderer is an _optional_ component of SDL3, which IMHO is now largely obsolete.+// For a multi-platform app consider using other technologies:+// - SDL3+SDL_GPU: SDL_GPU is SDL3 new graphics abstraction API.+// - SDL3+DirectX, SDL3+OpenGL, SDL3+Vulkan: combine SDL with dedicated renderers.+// If your application wants to render any non trivial amount of graphics other than UI,+// please be aware that SDL_Renderer currently offers a limited graphic API to the end-user+// and it might be difficult to step out of those boundaries.++// Implemented features:+//  [X] Renderer: User texture binding. Use 'SDL_Texture*' as texture identifier. Read the FAQ about ImTextureID/ImTextureRef!+//  [X] Renderer: Large meshes support (64k+ vertices) even with 16-bit indices (ImGuiBackendFlags_RendererHasVtxOffset).+//  [X] Renderer: Texture updates support for dynamic font atlas (ImGuiBackendFlags_RendererHasTextures).+//  [X] Renderer: Expose selected render state for draw callbacks to use. Access with ImGui_ImplSDLRenderer3_GetRenderState().+// Missing features:+//  [ ] Renderer: Multi-viewport support (multiple windows).++// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.+// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.+// Learn about Dear ImGui:+// - FAQ                  https://dearimgui.com/faq+// - Getting Started      https://dearimgui.com/getting-started+// - Documentation        https://dearimgui.com/docs (same as your local docs/ folder).+// - Introduction, links and more at the top of imgui.cpp++#pragma once++#ifdef __cplusplus+extern "C"+{+#endif+#include "dcimgui.h"+#ifndef IMGUI_DISABLE+// For SDL_ScaleMode which cannot be forward declared.+typedef struct ImDrawData_t ImDrawData;+#include <SDL3/SDL_render.h>                                           // Follow "Getting Started" link and check examples/ folder to learn about using backends!+CIMGUI_IMPL_API bool cImGui_ImplSDLRenderer3_Init(SDL_Renderer* renderer);+CIMGUI_IMPL_API void cImGui_ImplSDLRenderer3_Shutdown(void);+CIMGUI_IMPL_API void cImGui_ImplSDLRenderer3_NewFrame(void);+CIMGUI_IMPL_API void cImGui_ImplSDLRenderer3_RenderDrawData(ImDrawData* draw_data, SDL_Renderer* renderer);++// Called by Init/NewFrame/Shutdown+CIMGUI_IMPL_API void cImGui_ImplSDLRenderer3_CreateDeviceObjects(void);+CIMGUI_IMPL_API void cImGui_ImplSDLRenderer3_DestroyDeviceObjects(void);++// (Advanced) Use e.g. if you need to precisely control the timing of texture updates (e.g. for staged rendering), by setting ImDrawData::Textures = nullptr to handle this manually.+CIMGUI_IMPL_API void cImGui_ImplSDLRenderer3_UpdateTexture(ImTextureData* tex);++// [BETA] Selected render state data shared with callbacks.+// This is temporarily stored in GetPlatformIO().Renderer_RenderState during the ImGui_ImplSDLRenderer3_RenderDrawData() call.+// (Please open an issue if you feel you need access to more data)+struct ImGui_ImplSDLRenderer3_RenderState_t+{+    SDL_Renderer* Renderer;+    SDL_ScaleMode CurrentScaleMode;  // Current scale mode during render. Set to SDL_SCALEMODE_INVALID to use "SetSamplerFromTex" mode.+};+CIMGUI_IMPL_API ImGui_ImplSDLRenderer3_RenderState* cImGui_ImplSDLRenderer3_GetRenderState(void);+#endif// #ifndef IMGUI_DISABLE+#ifdef __cplusplus+} // End of extern "C" block+#endif
+ cbits/imgui_impl_sdlrenderer3.cpp view
@@ -0,0 +1,405 @@+// dear imgui: Renderer Backend for SDL_Renderer for SDL3+// (Requires: SDL 3.1.8+)++// Note that SDL_Renderer is an _optional_ component of SDL3, which IMHO is now largely obsolete.+// For a multi-platform app consider using other technologies:+// - SDL3+SDL_GPU: SDL_GPU is SDL3 new graphics abstraction API.+// - SDL3+DirectX, SDL3+OpenGL, SDL3+Vulkan: combine SDL with dedicated renderers.+// If your application wants to render any non trivial amount of graphics other than UI,+// please be aware that SDL_Renderer currently offers a limited graphic API to the end-user+// and it might be difficult to step out of those boundaries.++// Implemented features:+//  [X] Renderer: User texture binding. Use 'SDL_Texture*' as texture identifier. Read the FAQ about ImTextureID/ImTextureRef!+//  [X] Renderer: Large meshes support (64k+ vertices) even with 16-bit indices (ImGuiBackendFlags_RendererHasVtxOffset).+//  [X] Renderer: Texture updates support for dynamic font atlas (ImGuiBackendFlags_RendererHasTextures).+//  [X] Renderer: Expose selected render state for draw callbacks to use. Access with ImGui_ImplSDLRenderer3_GetRenderState().+// Missing features:+//  [ ] Renderer: Multi-viewport support (multiple windows).++// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.+// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.+// Learn about Dear ImGui:+// - FAQ                  https://dearimgui.com/faq+// - Getting Started      https://dearimgui.com/getting-started+// - Documentation        https://dearimgui.com/docs (same as your local docs/ folder).+// - Introduction, links and more at the top of imgui.cpp++// CHANGELOG+// (minor and older changes stripped away, please see git history for details)+//  2026-09-17: Restore modified texture scale modes at the end of RenderDrawData(). Added DrawCallback_SetSamplerFromTex support. Added CurrentScaleMode in ImGui_ImplSDLRenderer3_RenderState (#9543, #9378)+//  2026-07-15: Fixed default sampler state to be linear (broken 2026-04-23). (#9470, #9378)+//  2026-04-23: Added support for standard draw callbacks (in platform_io): DrawCallback_ResetRenderState, DrawCallback_SetSamplerLinear, DrawCallback_SetSamplerNearest. (#9378)+//  2026-03-12: Fixed invalid assert in ImGui_ImplSDLRenderer3_UpdateTexture() if ImTextureID_Invalid is defined to be != 0, which became the default since 2026-03-12. (#9295)+//  2025-09-18: Call platform_io.ClearRendererHandlers() on shutdown.+//  2025-06-11: Added support for ImGuiBackendFlags_RendererHasTextures, for dynamic font atlas. Removed ImGui_ImplSDLRenderer3_CreateFontsTexture() and ImGui_ImplSDLRenderer3_DestroyFontsTexture().+//  2025-01-18: Use endian-dependent RGBA32 texture format, to match SDL_Color.+//  2024-10-09: Expose selected render state in ImGui_ImplSDLRenderer3_RenderState, which you can access in 'void* platform_io.Renderer_RenderState' during draw callbacks.+//  2024-07-01: Update for SDL3 api changes: SDL_RenderGeometryRaw() uint32 version was removed (SDL#9009).+//  2024-05-14: *BREAKING CHANGE* ImGui_ImplSDLRenderer3_RenderDrawData() requires SDL_Renderer* passed as parameter.+//  2024-02-12: Amend to query SDL_RenderViewportSet() and restore viewport accordingly.+//  2023-05-30: Initial version.++#include "imgui.h"+#ifndef IMGUI_DISABLE+#include "imgui_impl_sdlrenderer3.h"+#include <stdint.h>     // intptr_t++// Clang warnings with -Weverything+#if defined(__clang__)+#pragma clang diagnostic push+#pragma clang diagnostic ignored "-Wsign-conversion"    // warning: implicit conversion changes signedness+#elif defined(__GNUC__)+#pragma GCC diagnostic ignored "-Wfloat-equal"          // warning: comparing floating-point with '==' or '!=' is unsafe+#endif++// SDL+#include <SDL3/SDL_render.h>+#include <SDL3/SDL_version.h>+#if !SDL_VERSION_ATLEAST(3,0,0)+#error This backend requires SDL 3.0.0++#endif++// SDL_Renderer data+struct ImGui_ImplSDLRenderer3_TexScaleModeEntry+{+    SDL_Texture*    Texture;+    SDL_ScaleMode   ScaleModeBackup;+};++struct ImGui_ImplSDLRenderer3_Data+{+    SDL_Renderer*           Renderer;       // Main viewport's renderer+    ImVector<SDL_FColor>    ColorBuffer;+    ImVector<ImGui_ImplSDLRenderer3_TexScaleModeEntry> TexScaleModeBackups;  // Backup of texture scale modes++    ImGui_ImplSDLRenderer3_Data()   { memset((void*)this, 0, sizeof(*this)); }+};++// Backend data stored in io.BackendRendererUserData to allow support for multiple Dear ImGui contexts+// It is STRONGLY preferred that you use docking branch with multi-viewports (== single Dear ImGui context + multiple windows) instead of multiple Dear ImGui contexts.+static ImGui_ImplSDLRenderer3_Data* ImGui_ImplSDLRenderer3_GetBackendData()+{+    return ImGui::GetCurrentContext() ? (ImGui_ImplSDLRenderer3_Data*)ImGui::GetIO().BackendRendererUserData : nullptr;+}++ImGui_ImplSDLRenderer3_RenderState* ImGui_ImplSDLRenderer3_GetRenderState()+{+    return (ImGui_ImplSDLRenderer3_RenderState*)ImGui::GetPlatformIO().Renderer_RenderState;+}++// Functions+static void ImGui_ImplSDLRenderer3_SetupRenderState(SDL_Renderer* renderer)+{+    ImGui_ImplSDLRenderer3_RenderState* render_state = ImGui_ImplSDLRenderer3_GetRenderState();++    // Clear out any viewports and cliprect set by the user+    // FIXME: Technically speaking there are lots of other things we could backup/setup/restore during our render process.+    SDL_SetRenderViewport(renderer, nullptr);+    SDL_SetRenderClipRect(renderer, nullptr);+    render_state->CurrentScaleMode = SDL_SCALEMODE_LINEAR;+}++void ImGui_ImplSDLRenderer3_NewFrame()+{+    ImGui_ImplSDLRenderer3_Data* bd = ImGui_ImplSDLRenderer3_GetBackendData();+    IM_ASSERT(bd != nullptr && "Context or backend not initialized! Did you call ImGui_ImplSDLRenderer3_Init()?");+    IM_UNUSED(bd);+}++// https://github.com/libsdl-org/SDL/issues/9009+static int SDL_RenderGeometryRaw8BitColor(SDL_Renderer* renderer, ImVector<SDL_FColor>& colors_out, SDL_Texture* texture, const float* xy, int xy_stride, const SDL_Color* color, int color_stride, const float* uv, int uv_stride, int num_vertices, const void* indices, int num_indices, int size_indices)+{+    const Uint8* color2 = (const Uint8*)color;+    colors_out.resize(num_vertices);+    SDL_FColor* color3 = colors_out.Data;+    for (int i = 0; i < num_vertices; i++)+    {+        color3[i].r = color->r / 255.0f;+        color3[i].g = color->g / 255.0f;+        color3[i].b = color->b / 255.0f;+        color3[i].a = color->a / 255.0f;+        color2 += color_stride;+        color = (const SDL_Color*)color2;+    }+    return SDL_RenderGeometryRaw(renderer, texture, xy, xy_stride, color3, sizeof(*color3), uv, uv_stride, num_vertices, indices, num_indices, size_indices);+}++// Draw callbacks+static void ImGui_ImplSDLRenderer3_DrawCallback_ResetRenderState(const ImDrawList*, const ImDrawCmd*)   {} // Intentionally empty. Used as an identifier for rendering loop to call its code. Simpler to implement this way.+static void ImGui_ImplSDLRenderer3_DrawCallback_SetSamplerLinear(const ImDrawList*, const ImDrawCmd*)   { ImGui_ImplSDLRenderer3_RenderState* render_state = ImGui_ImplSDLRenderer3_GetRenderState(); render_state->CurrentScaleMode = SDL_SCALEMODE_LINEAR; }+static void ImGui_ImplSDLRenderer3_DrawCallback_SetSamplerNearest(const ImDrawList*, const ImDrawCmd*)  { ImGui_ImplSDLRenderer3_RenderState* render_state = ImGui_ImplSDLRenderer3_GetRenderState(); render_state->CurrentScaleMode = SDL_SCALEMODE_NEAREST; }+static void ImGui_ImplSDLRenderer3_DrawCallback_SetSamplerFromTex(const ImDrawList*, const ImDrawCmd*)  { ImGui_ImplSDLRenderer3_RenderState* render_state = ImGui_ImplSDLRenderer3_GetRenderState(); render_state->CurrentScaleMode = SDL_SCALEMODE_INVALID; } // SDL_SCALEMODE_INVALID = use/keep value in texture.++// SDLRenderer has various design issues which makes it hard to do it compared to regular graphics API.+// - scale/filtering mode is tied to a texture.+// - scale/filtering mode is not queued as part of the SDL_RenderGeometryXXX commands, so a change in one texture requires a flush.+static void ImGui_ImplSDLRenderer3_TexScaleModeUpdate(SDL_Renderer* renderer, SDL_Texture* tex, SDL_ScaleMode desired_scale_mode)+{+    ImGui_ImplSDLRenderer3_Data* bd = ImGui_ImplSDLRenderer3_GetBackendData();+    if (desired_scale_mode != SDL_SCALEMODE_INVALID)+    {+        // Enforce a scale mode+        SDL_ScaleMode tex_scale_mode = desired_scale_mode;+        if (!SDL_GetTextureScaleMode(tex, &tex_scale_mode) || tex_scale_mode == desired_scale_mode)+            return;+        SDL_FlushRenderer(renderer);+        SDL_SetTextureScaleMode(tex, desired_scale_mode);++        // Store backup of old scale mode (FIXME-OPT)+        for (ImGui_ImplSDLRenderer3_TexScaleModeEntry& entry : bd->TexScaleModeBackups)+            if (entry.Texture == tex)+            {+                if (entry.ScaleModeBackup == SDL_SCALEMODE_INVALID)+                    entry.ScaleModeBackup = tex_scale_mode;+                return;+            }+        ImGui_ImplSDLRenderer3_TexScaleModeEntry entry = { tex, tex_scale_mode };+        bd->TexScaleModeBackups.push_back(entry);+    }+    else+    {+        // Use scale mode that was set in texture by user. If there is an entry, restore it and clear the entry.+        for (ImGui_ImplSDLRenderer3_TexScaleModeEntry& entry : bd->TexScaleModeBackups)+            if (entry.Texture == tex && entry.ScaleModeBackup != SDL_SCALEMODE_INVALID)+            {+                SDL_FlushRenderer(renderer);+                SDL_SetTextureScaleMode(tex, entry.ScaleModeBackup);+                entry.ScaleModeBackup = SDL_SCALEMODE_INVALID;+                return;+            }+    }+}++static void ImGui_ImplSDLRenderer3_TexScaleModeRestoreBackups(SDL_Renderer* renderer)+{+    ImGui_ImplSDLRenderer3_Data* bd = ImGui_ImplSDLRenderer3_GetBackendData();+    if (bd->TexScaleModeBackups.Size == 0)+        return;+    SDL_FlushRenderer(renderer);+    for (ImGui_ImplSDLRenderer3_TexScaleModeEntry& entry : bd->TexScaleModeBackups)+        if (entry.ScaleModeBackup != SDL_SCALEMODE_INVALID)+            SDL_SetTextureScaleMode(entry.Texture, entry.ScaleModeBackup);+    bd->TexScaleModeBackups.resize(0);+}++void ImGui_ImplSDLRenderer3_RenderDrawData(ImDrawData* draw_data, SDL_Renderer* renderer)+{+    ImGui_ImplSDLRenderer3_Data* bd = ImGui_ImplSDLRenderer3_GetBackendData();++    // If there's a scale factor set by the user, use that instead+    // If the user has specified a scale factor to SDL_Renderer already via SDL_RenderSetScale(), SDL will scale whatever we pass+    // to SDL_RenderGeometryRaw() by that scale factor. In that case we don't want to be also scaling it ourselves here.+    float rsx = 1.0f;+    float rsy = 1.0f;+    SDL_GetRenderScale(renderer, &rsx, &rsy);+    ImVec2 render_scale;+    render_scale.x = (rsx == 1.0f) ? draw_data->FramebufferScale.x : 1.0f;+    render_scale.y = (rsy == 1.0f) ? draw_data->FramebufferScale.y : 1.0f;++    // Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates)+    int fb_width = (int)(draw_data->DisplaySize.x * render_scale.x);+    int fb_height = (int)(draw_data->DisplaySize.y * render_scale.y);+    if (fb_width == 0 || fb_height == 0)+        return;++    // Catch up with texture updates. Most of the times, the list will have 1 element with an OK status, aka nothing to do.+    // (This almost always points to ImGui::GetPlatformIO().Textures[] but is part of ImDrawData to allow overriding or disabling texture updates).+    if (draw_data->Textures != nullptr)+        for (ImTextureData* tex : *draw_data->Textures)+            if (tex->Status != ImTextureStatus_OK)+                ImGui_ImplSDLRenderer3_UpdateTexture(tex);++    // Backup SDL_Renderer state that will be modified to restore it afterwards+    struct BackupSDLRendererState+    {+        SDL_Rect    Viewport;+        bool        ViewportEnabled;+        bool        ClipEnabled;+        SDL_Rect    ClipRect;+    };+    BackupSDLRendererState old = {};+    old.ViewportEnabled = SDL_RenderViewportSet(renderer);+    old.ClipEnabled = SDL_RenderClipEnabled(renderer);+    SDL_GetRenderViewport(renderer, &old.Viewport);+    SDL_GetRenderClipRect(renderer, &old.ClipRect);++    // Setup render state structure (for callbacks and custom texture bindings)+    ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO();+    ImGui_ImplSDLRenderer3_RenderState render_state;+    render_state.Renderer = renderer;+    platform_io.Renderer_RenderState = &render_state;++    // Setup desired state+    ImGui_ImplSDLRenderer3_SetupRenderState(renderer);+    IM_ASSERT(bd->TexScaleModeBackups.Size == 0);++    // Will project scissor/clipping rectangles into framebuffer space+    ImVec2 clip_off = draw_data->DisplayPos;         // (0,0) unless using multi-viewports+    ImVec2 clip_scale = render_scale;++    // Render command lists+    for (const ImDrawList* draw_list : draw_data->CmdLists)+    {+        const ImDrawVert* vtx_buffer = draw_list->VtxBuffer.Data;+        const ImDrawIdx* idx_buffer = draw_list->IdxBuffer.Data;++        for (int cmd_i = 0; cmd_i < draw_list->CmdBuffer.Size; cmd_i++)+        {+            const ImDrawCmd* pcmd = &draw_list->CmdBuffer[cmd_i];+            if (pcmd->UserCallback)+            {+                // User callback, registered via ImDrawList::AddCallback()+                if (pcmd->UserCallback == ImGui_ImplSDLRenderer3_DrawCallback_ResetRenderState)+                    ImGui_ImplSDLRenderer3_SetupRenderState(renderer);+                else+                    pcmd->UserCallback(draw_list, pcmd);+            }+            else+            {+                // Project scissor/clipping rectangles into framebuffer space+                ImVec2 clip_min((pcmd->ClipRect.x - clip_off.x) * clip_scale.x, (pcmd->ClipRect.y - clip_off.y) * clip_scale.y);+                ImVec2 clip_max((pcmd->ClipRect.z - clip_off.x) * clip_scale.x, (pcmd->ClipRect.w - clip_off.y) * clip_scale.y);+                if (clip_min.x < 0.0f) { clip_min.x = 0.0f; }+                if (clip_min.y < 0.0f) { clip_min.y = 0.0f; }+                if (clip_max.x > (float)fb_width) { clip_max.x = (float)fb_width; }+                if (clip_max.y > (float)fb_height) { clip_max.y = (float)fb_height; }+                if (clip_max.x <= clip_min.x || clip_max.y <= clip_min.y)+                    continue;+                SDL_Rect r = { (int)(clip_min.x), (int)(clip_min.y), (int)(clip_max.x - clip_min.x), (int)(clip_max.y - clip_min.y) };+                SDL_SetRenderClipRect(renderer, &r);++                // Setup texture scale/filtering mode+                SDL_Texture* tex = (SDL_Texture*)pcmd->GetTexID();+                ImGui_ImplSDLRenderer3_TexScaleModeUpdate(renderer, tex, render_state.CurrentScaleMode);++                // Draw+                const float* xy = (const float*)(const void*)((const char*)(vtx_buffer + pcmd->VtxOffset) + offsetof(ImDrawVert, pos));+                const float* uv = (const float*)(const void*)((const char*)(vtx_buffer + pcmd->VtxOffset) + offsetof(ImDrawVert, uv));+                const SDL_Color* color = (const SDL_Color*)(const void*)((const char*)(vtx_buffer + pcmd->VtxOffset) + offsetof(ImDrawVert, col));+                SDL_RenderGeometryRaw8BitColor(renderer, bd->ColorBuffer, tex,+                    xy, (int)sizeof(ImDrawVert),+                    color, (int)sizeof(ImDrawVert),+                    uv, (int)sizeof(ImDrawVert),+                    draw_list->VtxBuffer.Size - pcmd->VtxOffset,+                    idx_buffer + pcmd->IdxOffset, pcmd->ElemCount, sizeof(ImDrawIdx));+            }+        }+    }+    platform_io.Renderer_RenderState = nullptr;++    // Restore modified SDL_Renderer state+    SDL_SetRenderViewport(renderer, old.ViewportEnabled ? &old.Viewport : nullptr);+    SDL_SetRenderClipRect(renderer, old.ClipEnabled ? &old.ClipRect : nullptr);+    ImGui_ImplSDLRenderer3_TexScaleModeRestoreBackups(renderer);+}++void ImGui_ImplSDLRenderer3_UpdateTexture(ImTextureData* tex)+{+    ImGui_ImplSDLRenderer3_Data* bd = ImGui_ImplSDLRenderer3_GetBackendData();++    if (tex->Status == ImTextureStatus_WantCreate)+    {+        // Create and upload new texture to graphics system+        //IMGUI_DEBUG_LOG("UpdateTexture #%03d: WantCreate %dx%d\n", tex->UniqueID, tex->Width, tex->Height);+        IM_ASSERT(tex->TexID == ImTextureID_Invalid && tex->BackendUserData == nullptr);+        IM_ASSERT(tex->Format == ImTextureFormat_RGBA32);++        // Create texture (bilinear sampling is required)+        SDL_Texture* sdl_texture = SDL_CreateTexture(bd->Renderer, SDL_PIXELFORMAT_RGBA32, SDL_TEXTUREACCESS_STATIC, tex->Width, tex->Height);+        IM_ASSERT(sdl_texture != nullptr && "Backend failed to create texture!");+        SDL_UpdateTexture(sdl_texture, nullptr, tex->GetPixels(), tex->GetPitch());+        SDL_SetTextureBlendMode(sdl_texture, SDL_BLENDMODE_BLEND);+        SDL_SetTextureScaleMode(sdl_texture, SDL_SCALEMODE_LINEAR);++        // Store identifiers+        tex->SetTexID((ImTextureID)(intptr_t)sdl_texture);+        tex->SetStatus(ImTextureStatus_OK);+    }+    else if (tex->Status == ImTextureStatus_WantUpdates)+    {+        // Update selected blocks. We only ever write to textures regions which have never been used before!+        // This backend choose to use tex->Updates[] but you can use tex->UpdateRect to upload a single region.+        SDL_Texture* sdl_texture = (SDL_Texture*)(intptr_t)tex->TexID;+        for (ImTextureRect& r : tex->Updates)+        {+            SDL_Rect sdl_r = { r.x, r.y, r.w, r.h };+            SDL_UpdateTexture(sdl_texture, &sdl_r, tex->GetPixelsAt(r.x, r.y), tex->GetPitch());+        }+        tex->SetStatus(ImTextureStatus_OK);+    }+    else if (tex->Status == ImTextureStatus_WantDestroy)+    {+        if (tex->TexID != ImTextureID_Invalid)+            if (SDL_Texture* sdl_texture = (SDL_Texture*)(intptr_t)tex->TexID)+                SDL_DestroyTexture(sdl_texture);++        // Clear identifiers and mark as destroyed (in order to allow e.g. calling InvalidateDeviceObjects while running)+        tex->SetTexID(ImTextureID_Invalid);+        tex->SetStatus(ImTextureStatus_Destroyed);+    }+}++void ImGui_ImplSDLRenderer3_CreateDeviceObjects()+{+}++void ImGui_ImplSDLRenderer3_DestroyDeviceObjects()+{+    // Destroy all textures+    for (ImTextureData* tex : ImGui::GetPlatformIO().Textures)+        if (tex->RefCount == 1)+        {+            tex->SetStatus(ImTextureStatus_WantDestroy);+            ImGui_ImplSDLRenderer3_UpdateTexture(tex);+        }+}++bool ImGui_ImplSDLRenderer3_Init(SDL_Renderer* renderer)+{+    ImGuiIO& io = ImGui::GetIO();+    IMGUI_CHECKVERSION();+    IM_ASSERT(io.BackendRendererUserData == nullptr && "Already initialized a renderer backend!");+    IM_ASSERT(renderer != nullptr && "SDL_Renderer not initialized!");++    // Setup backend capabilities flags+    ImGui_ImplSDLRenderer3_Data* bd = IM_NEW(ImGui_ImplSDLRenderer3_Data)();+    io.BackendRendererUserData = (void*)bd;+    io.BackendRendererName = "imgui_impl_sdlrenderer3";+    io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset;  // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.+    io.BackendFlags |= ImGuiBackendFlags_RendererHasTextures;   // We can honor ImGuiPlatformIO::Textures[] requests during render.++    ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO();+    platform_io.DrawCallback_ResetRenderState = ImGui_ImplSDLRenderer3_DrawCallback_ResetRenderState;+    platform_io.DrawCallback_SetSamplerLinear = ImGui_ImplSDLRenderer3_DrawCallback_SetSamplerLinear;+    platform_io.DrawCallback_SetSamplerNearest = ImGui_ImplSDLRenderer3_DrawCallback_SetSamplerNearest;+    platform_io.DrawCallback_SetSamplerFromTex = ImGui_ImplSDLRenderer3_DrawCallback_SetSamplerFromTex;++    bd->Renderer = renderer;++    return true;+}++void ImGui_ImplSDLRenderer3_Shutdown()+{+    ImGui_ImplSDLRenderer3_Data* bd = ImGui_ImplSDLRenderer3_GetBackendData();+    IM_ASSERT(bd != nullptr && "No renderer backend to shutdown, or already shutdown?");+    ImGuiIO& io = ImGui::GetIO();+    ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO();++    ImGui_ImplSDLRenderer3_DestroyDeviceObjects();++    io.BackendRendererName = nullptr;+    io.BackendRendererUserData = nullptr;+    io.BackendFlags &= ~(ImGuiBackendFlags_RendererHasVtxOffset | ImGuiBackendFlags_RendererHasTextures);+    platform_io.ClearRendererHandlers();+    IM_DELETE(bd);+}++//-----------------------------------------------------------------------------++#if defined(__clang__)+#pragma clang diagnostic pop+#endif++#endif // #ifndef IMGUI_DISABLE
+ cbits/imgui_impl_sdlrenderer3.h view
@@ -0,0 +1,58 @@+// dear imgui: Renderer Backend for SDL_Renderer for SDL3+// (Requires: SDL 3.1.8+)++// Note that SDL_Renderer is an _optional_ component of SDL3, which IMHO is now largely obsolete.+// For a multi-platform app consider using other technologies:+// - SDL3+SDL_GPU: SDL_GPU is SDL3 new graphics abstraction API.+// - SDL3+DirectX, SDL3+OpenGL, SDL3+Vulkan: combine SDL with dedicated renderers.+// If your application wants to render any non trivial amount of graphics other than UI,+// please be aware that SDL_Renderer currently offers a limited graphic API to the end-user+// and it might be difficult to step out of those boundaries.++// Implemented features:+//  [X] Renderer: User texture binding. Use 'SDL_Texture*' as texture identifier. Read the FAQ about ImTextureID/ImTextureRef!+//  [X] Renderer: Large meshes support (64k+ vertices) even with 16-bit indices (ImGuiBackendFlags_RendererHasVtxOffset).+//  [X] Renderer: Texture updates support for dynamic font atlas (ImGuiBackendFlags_RendererHasTextures).+//  [X] Renderer: Expose selected render state for draw callbacks to use. Access with ImGui_ImplSDLRenderer3_GetRenderState().+// Missing features:+//  [ ] Renderer: Multi-viewport support (multiple windows).++// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.+// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.+// Learn about Dear ImGui:+// - FAQ                  https://dearimgui.com/faq+// - Getting Started      https://dearimgui.com/getting-started+// - Documentation        https://dearimgui.com/docs (same as your local docs/ folder).+// - Introduction, links and more at the top of imgui.cpp++#pragma once+#include "imgui.h"      // IMGUI_IMPL_API+#ifndef IMGUI_DISABLE++// For SDL_ScaleMode which cannot be forward declared.+#include <SDL3/SDL_render.h>++// Follow "Getting Started" link and check examples/ folder to learn about using backends!+IMGUI_IMPL_API bool     ImGui_ImplSDLRenderer3_Init(SDL_Renderer* renderer);+IMGUI_IMPL_API void     ImGui_ImplSDLRenderer3_Shutdown();+IMGUI_IMPL_API void     ImGui_ImplSDLRenderer3_NewFrame();+IMGUI_IMPL_API void     ImGui_ImplSDLRenderer3_RenderDrawData(ImDrawData* draw_data, SDL_Renderer* renderer);++// Called by Init/NewFrame/Shutdown+IMGUI_IMPL_API void     ImGui_ImplSDLRenderer3_CreateDeviceObjects();+IMGUI_IMPL_API void     ImGui_ImplSDLRenderer3_DestroyDeviceObjects();++// (Advanced) Use e.g. if you need to precisely control the timing of texture updates (e.g. for staged rendering), by setting ImDrawData::Textures = nullptr to handle this manually.+IMGUI_IMPL_API void     ImGui_ImplSDLRenderer3_UpdateTexture(ImTextureData* tex);++// [BETA] Selected render state data shared with callbacks.+// This is temporarily stored in GetPlatformIO().Renderer_RenderState during the ImGui_ImplSDLRenderer3_RenderDrawData() call.+// (Please open an issue if you feel you need access to more data)+struct ImGui_ImplSDLRenderer3_RenderState+{+    SDL_Renderer*       Renderer;+    SDL_ScaleMode       CurrentScaleMode;   // Current scale mode during render. Set to SDL_SCALEMODE_INVALID to use "SetSamplerFromTex" mode.+};+IMGUI_IMPL_API ImGui_ImplSDLRenderer3_RenderState* ImGui_ImplSDLRenderer3_GetRenderState();++#endif // #ifndef IMGUI_DISABLE
+ dear-imgui-impl-sdlrenderer3.cabal view
@@ -0,0 +1,68 @@+cabal-version: 2.2++-- This file has been generated from package.yaml by hpack version 0.39.6.+--+-- see: https://github.com/sol/hpack++name:           dear-imgui-impl-sdlrenderer3+version:        1.0.0+synopsis:       SDL3 SDL_Renderer renderer-backend bindings for dear-imgui-raw.+description:    Generated with dear_bindings from the imgui_impl_sdlrenderer3 backend that ships with Dear ImGui.+category:       GUI+maintainer:     IC Rainbow <aenor.realm@gmail.com>+license:        BSD-3-Clause+license-file:   LICENSE+build-type:     Simple+extra-source-files:+    cbits/dcimgui_impl_sdlrenderer3.h+    cbits/DearImGuiWrappers.h+    cbits/imgui_impl_sdlrenderer3.h+extra-doc-files:+    README.md+    CHANGELOG.md++flag sdl3+  description: Bridge module DearImGui.Impl.SDLRenderer3 over the sdl3-bindgen-sys Renderer type.+  manual: True+  default: True++library+  exposed-modules:+      DearImGui.Raw.Impl.SDLRenderer3+  other-modules:+      Paths_dear_imgui_impl_sdlrenderer3+  autogen-modules:+      Paths_dear_imgui_impl_sdlrenderer3+  hs-source-dirs:+      src+  default-extensions:+      BlockArguments+      DataKinds+      DuplicateRecordFields+      LambdaCase+      NoFieldSelectors+      OverloadedRecordDot+      OverloadedStrings+      StrictData+  ghc-options: -Wall -optc-Wno-discarded-qualifiers -optc-Wno-incompatible-pointer-types+  cxx-options: -std=c++11 -fpermissive+  include-dirs:+      cbits+  cxx-sources:+      cbits/dcimgui_impl_sdlrenderer3.cpp+      cbits/DearImGuiWrappers.cpp+      cbits/imgui_impl_sdlrenderer3.cpp+  pkgconfig-depends:+      sdl3+  build-tool-depends:+      hsc2hs:hsc2hs+  build-depends:+      base >=4.16 && <5+    , dear-imgui-raw ==1.0.*+  default-language: GHC2021+  if flag(sdl3)+    exposed-modules:+        DearImGui.Impl.SDLRenderer3+    build-depends:+        sdl3-bindgen-sys ==0.0.1.*+      , unliftio-core
+ src/DearImGui/Impl/SDLRenderer3.hs view
@@ -0,0 +1,39 @@+module DearImGui.Impl.SDLRenderer3+  ( rendererPtr+  , init+  , withInit+  , renderDrawData+  , Raw.ImGui_ImplSDLRenderer3_RenderState (..)+  , Raw.getRenderState+  , Raw.createDeviceObjects+  , Raw.destroyDeviceObjects+  , Raw.newFrame+  , Raw.shutdown+  , Raw.updateTexture+  ) where++import Prelude hiding (init)++import Control.Monad.IO.Unlift (MonadUnliftIO)+import Foreign.Marshal.Utils (toBool)+import Foreign.Ptr (Ptr, castPtr)+import SDL3.Sys qualified as SDL3++import DearImGui.Impl.Init (withInitOrFail)+import DearImGui.Raw.ImDrawData (ImDrawData)+import DearImGui.Raw.Impl.SDLRenderer3 (SDL_Renderer)+import DearImGui.Raw.Impl.SDLRenderer3 qualified as Raw++rendererPtr :: Ptr SDL3.SDL_Renderer -> Ptr SDL_Renderer+rendererPtr = castPtr++init :: Ptr SDL3.SDL_Renderer -> IO Bool+init renderer =+  toBool <$> Raw.init (rendererPtr renderer)++withInit :: (MonadUnliftIO m) => Ptr SDL3.SDL_Renderer -> m a -> m a+withInit renderer = withInitOrFail "ImGui_ImplSDLRenderer3_Init" (init renderer) Raw.shutdown++renderDrawData :: Ptr ImDrawData -> Ptr SDL3.SDL_Renderer -> IO ()+renderDrawData drawData renderer =+  Raw.renderDrawData drawData (rendererPtr renderer)
+ src/DearImGui/Raw/Impl/SDLRenderer3.hsc view
@@ -0,0 +1,91 @@+{-# LANGUAGE CApiFFI #-}+{-# LANGUAGE PatternSynonyms #-}++-- This file was generated by dear-bindings-ffi. Do not edit by hand.++module DearImGui.Raw.Impl.SDLRenderer3+  ( ImGui_ImplSDLRenderer3_RenderState (..)+  , SDL_Renderer+  , createDeviceObjects+  , destroyDeviceObjects+  , getRenderState+  , init+  , newFrame+  , renderDrawData+  , shutdown+  , updateTexture+  ) where++import DearImGui.Raw.ImDrawData (ImDrawData)+import DearImGui.Raw.ImTextureData (ImTextureData)+import Foreign.C.Types+import Foreign.Ptr (Ptr, plusPtr)+import Foreign.Storable (Storable (..))+import GHC.Records (HasField (..))+import Prelude hiding (init)++#include "dcimgui_impl_sdlrenderer3.h"++-- structs (opaque)++data {-# CTYPE "dcimgui_impl_sdlrenderer3.h" "ImGui_ImplSDLRenderer3_RenderState" #-} ImGui_ImplSDLRenderer3_RenderState = ImGui_ImplSDLRenderer3_RenderState+  { renderer :: Ptr SDL_Renderer+  , currentScaleMode :: CInt+  }+  deriving (Eq, Show)+instance Storable ImGui_ImplSDLRenderer3_RenderState where+  sizeOf _    = #{size ImGui_ImplSDLRenderer3_RenderState}+  alignment _ = #{alignment ImGui_ImplSDLRenderer3_RenderState}+  peek p = ImGui_ImplSDLRenderer3_RenderState <$> #{peek ImGui_ImplSDLRenderer3_RenderState, Renderer} p <*> #{peek ImGui_ImplSDLRenderer3_RenderState, CurrentScaleMode} p+  poke p v = do+    #{poke ImGui_ImplSDLRenderer3_RenderState, Renderer} p v.renderer+    #{poke ImGui_ImplSDLRenderer3_RenderState, CurrentScaleMode} p v.currentScaleMode++instance HasField "renderer" (Ptr ImGui_ImplSDLRenderer3_RenderState) (Ptr (Ptr SDL_Renderer)) where+  getField = #{ptr ImGui_ImplSDLRenderer3_RenderState, Renderer}++instance HasField "currentScaleMode" (Ptr ImGui_ImplSDLRenderer3_RenderState) (Ptr CInt) where+  getField = #{ptr ImGui_ImplSDLRenderer3_RenderState, CurrentScaleMode}++data SDL_Renderer++-- functions++-- C: void ImGui_ImplSDLRenderer3_CreateDeviceObjects()+foreign import capi safe "dcimgui_impl_sdlrenderer3.h cImGui_ImplSDLRenderer3_CreateDeviceObjects"+  createDeviceObjects :: IO ()++-- C: void ImGui_ImplSDLRenderer3_DestroyDeviceObjects()+foreign import capi safe "dcimgui_impl_sdlrenderer3.h cImGui_ImplSDLRenderer3_DestroyDeviceObjects"+  destroyDeviceObjects :: IO ()++-- C: ImGui_ImplSDLRenderer3_RenderState* ImGui_ImplSDLRenderer3_GetRenderState()+foreign import capi safe "dcimgui_impl_sdlrenderer3.h cImGui_ImplSDLRenderer3_GetRenderState"+  getRenderState :: IO (Ptr ImGui_ImplSDLRenderer3_RenderState)++-- C: bool ImGui_ImplSDLRenderer3_Init(SDL_Renderer* renderer)+foreign import capi safe "dcimgui_impl_sdlrenderer3.h cImGui_ImplSDLRenderer3_Init"+  init+    :: (Ptr SDL_Renderer) -- ^ renderer+    -> IO CBool++-- C: void ImGui_ImplSDLRenderer3_NewFrame()+foreign import capi safe "dcimgui_impl_sdlrenderer3.h cImGui_ImplSDLRenderer3_NewFrame"+  newFrame :: IO ()++-- C: void ImGui_ImplSDLRenderer3_RenderDrawData(ImDrawData* draw_data, SDL_Renderer* renderer)+foreign import capi safe "dcimgui_impl_sdlrenderer3.h cImGui_ImplSDLRenderer3_RenderDrawData"+  renderDrawData+    :: (Ptr ImDrawData) -- ^ draw_data+    -> (Ptr SDL_Renderer) -- ^ renderer+    -> IO ()++-- C: void ImGui_ImplSDLRenderer3_Shutdown()+foreign import capi safe "dcimgui_impl_sdlrenderer3.h cImGui_ImplSDLRenderer3_Shutdown"+  shutdown :: IO ()++-- C: void ImGui_ImplSDLRenderer3_UpdateTexture(ImTextureData* tex)+foreign import capi safe "dcimgui_impl_sdlrenderer3.h cImGui_ImplSDLRenderer3_UpdateTexture"+  updateTexture+    :: (Ptr ImTextureData) -- ^ tex+    -> IO ()