Skip to content

Commit b4a5d1d

Browse files
committed
Backends: SDLGPU3: Rename GpuDevice->Device. Expose ImGui_ImplSDLGPU3_CreateDeviceObjects(), ImGui_ImplSDLGPU3_DestroyDeviceObjects(). Misc renaming. (#8163, #7998, #7988)
1 parent 0f33d71 commit b4a5d1d

File tree

4 files changed

+80
-75
lines changed

4 files changed

+80
-75
lines changed

backends/imgui_impl_sdlgpu3.cpp

+62-65
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,16 @@
2121
// Calling the function is MANDATORY, otherwise the ImGui will not upload neither the vertex nor the index buffer for the GPU. See imgui_impl_sdlgpu3.cpp for more info.
2222

2323
// CHANGELOG
24-
// 2025-01-09: SDL_Gpu: Added the SDL_GPU3 backend.
24+
// 2025-01-16: Renamed ImGui_ImplSDLGPU3_InitInfo::GpuDevice to Device.
25+
// 2025-01-09: SDL_GPU: Added the SDL_GPU3 backend.
2526

2627
#include "imgui.h"
2728
#ifndef IMGUI_DISABLE
2829
#include "imgui_impl_sdlgpu3.h"
2930
#include "imgui_impl_sdlgpu3_shaders.h"
3031

32+
// SDL_GPU Data
33+
3134
// Reusable buffers used for rendering 1 current in-flight frame, for ImGui_ImplSDLGPU3_RenderDrawData()
3235
struct ImGui_ImplSDLGPU3_FrameData
3336
{
@@ -37,10 +40,9 @@ struct ImGui_ImplSDLGPU3_FrameData
3740
uint32_t IndexBufferSize = 0;
3841
};
3942

40-
// SDL_GPU Data
4143
struct ImGui_ImplSDLGPU3_Data
4244
{
43-
ImGui_ImplSDLGPU3_InitInfo GPUInitInfo;
45+
ImGui_ImplSDLGPU3_InitInfo InitInfo;
4446

4547
// Graphics pipeline & shaders
4648
SDL_GPUShader* VertexShader = nullptr;
@@ -57,8 +59,6 @@ struct ImGui_ImplSDLGPU3_Data
5759
};
5860

5961
// Forward Declarations
60-
static bool ImGui_ImplSDLGPU3_CreateDeviceObjects();
61-
static void ImGui_ImplSDLGPU3_DestroyDeviceObjects();
6262
static void ImGui_ImplSDLGPU3_DestroyFrameData();
6363

6464
//-----------------------------------------------------------------------------
@@ -116,16 +116,16 @@ static void ImGui_ImplSDLGPU3_SetupRenderState(ImDrawData* draw_data, SDL_GPUGra
116116
static void CreateOrResizeBuffer(SDL_GPUBuffer** buffer, uint32_t* old_size, uint32_t new_size, SDL_GPUBufferUsageFlags usage)
117117
{
118118
ImGui_ImplSDLGPU3_Data* bd = ImGui_ImplSDLGPU3_GetBackendData();
119-
ImGui_ImplSDLGPU3_InitInfo* v = &bd->GPUInitInfo;
119+
ImGui_ImplSDLGPU3_InitInfo* v = &bd->InitInfo;
120120

121-
SDL_WaitForGPUIdle(v->GpuDevice);
122-
SDL_ReleaseGPUBuffer(v->GpuDevice, *buffer);
121+
SDL_WaitForGPUIdle(v->Device);
122+
SDL_ReleaseGPUBuffer(v->Device, *buffer);
123123

124124
SDL_GPUBufferCreateInfo buffer_info = {};
125125
buffer_info.usage = usage;
126126
buffer_info.size = new_size;
127127
buffer_info.props = 0;
128-
*buffer = SDL_CreateGPUBuffer(v->GpuDevice, &buffer_info);
128+
*buffer = SDL_CreateGPUBuffer(v->Device, &buffer_info);
129129
*old_size = new_size;
130130
IM_ASSERT(*buffer != nullptr && "Failed to create GPU Buffer, call SDL_GetError() for more information");
131131
}
@@ -142,7 +142,7 @@ void Imgui_ImplSDLGPU3_PrepareDrawData(ImDrawData* draw_data, SDL_GPUCommandBuff
142142
return;
143143

144144
ImGui_ImplSDLGPU3_Data* bd = ImGui_ImplSDLGPU3_GetBackendData();
145-
ImGui_ImplSDLGPU3_InitInfo* v = &bd->GPUInitInfo;
145+
ImGui_ImplSDLGPU3_InitInfo* v = &bd->InitInfo;
146146
ImGui_ImplSDLGPU3_FrameData* fd = &bd->MainWindowFrameData;
147147

148148
uint32_t vertex_size = draw_data->TotalVtxCount * sizeof(ImDrawVert);
@@ -160,13 +160,13 @@ void Imgui_ImplSDLGPU3_PrepareDrawData(ImDrawData* draw_data, SDL_GPUCommandBuff
160160
index_transferbuffer_info.usage = SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD;
161161
index_transferbuffer_info.size = index_size;
162162

163-
SDL_GPUTransferBuffer* vertex_transferbuffer = SDL_CreateGPUTransferBuffer(v->GpuDevice, &vertex_transferbuffer_info);
163+
SDL_GPUTransferBuffer* vertex_transferbuffer = SDL_CreateGPUTransferBuffer(v->Device, &vertex_transferbuffer_info);
164164
IM_ASSERT(vertex_transferbuffer != nullptr && "Failed to create the vertex transfer buffer, call SDL_GetError() for more information");
165-
SDL_GPUTransferBuffer* index_transferbuffer = SDL_CreateGPUTransferBuffer(v->GpuDevice, &index_transferbuffer_info);
165+
SDL_GPUTransferBuffer* index_transferbuffer = SDL_CreateGPUTransferBuffer(v->Device, &index_transferbuffer_info);
166166
IM_ASSERT(index_transferbuffer != nullptr && "Failed to create the index transfer buffer, call SDL_GetError() for more information");
167167

168-
ImDrawVert* vtx_dst = (ImDrawVert*)SDL_MapGPUTransferBuffer(v->GpuDevice, vertex_transferbuffer, true);
169-
ImDrawIdx* idx_dst = (ImDrawIdx*)SDL_MapGPUTransferBuffer(v->GpuDevice, index_transferbuffer, true);
168+
ImDrawVert* vtx_dst = (ImDrawVert*)SDL_MapGPUTransferBuffer(v->Device, vertex_transferbuffer, true);
169+
ImDrawIdx* idx_dst = (ImDrawIdx*)SDL_MapGPUTransferBuffer(v->Device, index_transferbuffer, true);
170170
for (int n = 0; n < draw_data->CmdListsCount; n++)
171171
{
172172
const ImDrawList* draw_list = draw_data->CmdLists[n];
@@ -175,8 +175,8 @@ void Imgui_ImplSDLGPU3_PrepareDrawData(ImDrawData* draw_data, SDL_GPUCommandBuff
175175
vtx_dst += draw_list->VtxBuffer.Size;
176176
idx_dst += draw_list->IdxBuffer.Size;
177177
}
178-
SDL_UnmapGPUTransferBuffer(v->GpuDevice, vertex_transferbuffer);
179-
SDL_UnmapGPUTransferBuffer(v->GpuDevice, index_transferbuffer);
178+
SDL_UnmapGPUTransferBuffer(v->Device, vertex_transferbuffer);
179+
SDL_UnmapGPUTransferBuffer(v->Device, index_transferbuffer);
180180

181181
SDL_GPUTransferBufferLocation vertex_buffer_location = {};
182182
vertex_buffer_location.offset = 0;
@@ -199,8 +199,8 @@ void Imgui_ImplSDLGPU3_PrepareDrawData(ImDrawData* draw_data, SDL_GPUCommandBuff
199199
SDL_UploadToGPUBuffer(copy_pass, &vertex_buffer_location, &vertex_buffer_region,true);
200200
SDL_UploadToGPUBuffer(copy_pass, &index_buffer_location, &index_buffer_region,true);
201201
SDL_EndGPUCopyPass(copy_pass);
202-
SDL_ReleaseGPUTransferBuffer(v->GpuDevice, index_transferbuffer);
203-
SDL_ReleaseGPUTransferBuffer(v->GpuDevice, vertex_transferbuffer);
202+
SDL_ReleaseGPUTransferBuffer(v->Device, index_transferbuffer);
203+
SDL_ReleaseGPUTransferBuffer(v->Device, vertex_transferbuffer);
204204
}
205205

206206
void ImGui_ImplSDLGPU3_RenderDrawData(ImDrawData* draw_data, SDL_GPUCommandBuffer* command_buffer, SDL_GPURenderPass* render_pass, SDL_GPUGraphicsPipeline* pipeline)
@@ -278,16 +278,16 @@ void ImGui_ImplSDLGPU3_RenderDrawData(ImDrawData* draw_data, SDL_GPUCommandBuffe
278278
SDL_SetGPUScissor(render_pass, &scissor_rect);
279279
}
280280

281-
bool ImGui_ImplSDLGPU3_CreateFontsTexture()
281+
void ImGui_ImplSDLGPU3_CreateFontsTexture()
282282
{
283283
ImGuiIO& io = ImGui::GetIO();
284284
ImGui_ImplSDLGPU3_Data* bd = ImGui_ImplSDLGPU3_GetBackendData();
285-
ImGui_ImplSDLGPU3_InitInfo* v = &bd->GPUInitInfo;
285+
ImGui_ImplSDLGPU3_InitInfo* v = &bd->InitInfo;
286286

287287
// Destroy existing texture (if any)
288288
if (bd->FontTexture)
289289
{
290-
SDL_WaitForGPUIdle(v->GpuDevice);
290+
SDL_WaitForGPUIdle(v->Device);
291291
ImGui_ImplSDLGPU3_DestroyFontsTexture();
292292
}
293293

@@ -308,7 +308,7 @@ bool ImGui_ImplSDLGPU3_CreateFontsTexture()
308308
texture_info.num_levels = 1;
309309
texture_info.sample_count = SDL_GPU_SAMPLECOUNT_1;
310310

311-
bd->FontTexture = SDL_CreateGPUTexture(v->GpuDevice, &texture_info);
311+
bd->FontTexture = SDL_CreateGPUTexture(v->Device, &texture_info);
312312
IM_ASSERT(bd->FontTexture && "Failed to create font texture, call SDL_GetError() for more info");
313313
}
314314

@@ -317,50 +317,48 @@ bool ImGui_ImplSDLGPU3_CreateFontsTexture()
317317

318318
// Create all the upload structures and upload:
319319
{
320-
SDL_GPUTransferBufferCreateInfo font_transferbuffer_info = {};
321-
font_transferbuffer_info.usage = SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD;
322-
font_transferbuffer_info.size = upload_size;
320+
SDL_GPUTransferBufferCreateInfo transferbuffer_info = {};
321+
transferbuffer_info.usage = SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD;
322+
transferbuffer_info.size = upload_size;
323323

324-
SDL_GPUTransferBuffer* font_transferbuffer = SDL_CreateGPUTransferBuffer(v->GpuDevice, &font_transferbuffer_info);
325-
IM_ASSERT(font_transferbuffer != nullptr && "Failed to create font transfer buffer, call SDL_GetError() for more information");
324+
SDL_GPUTransferBuffer* transferbuffer = SDL_CreateGPUTransferBuffer(v->Device, &transferbuffer_info);
325+
IM_ASSERT(transferbuffer != nullptr && "Failed to create font transfer buffer, call SDL_GetError() for more information");
326326

327-
void* texture_ptr = SDL_MapGPUTransferBuffer(v->GpuDevice, font_transferbuffer, false);
327+
void* texture_ptr = SDL_MapGPUTransferBuffer(v->Device, transferbuffer, false);
328328
memcpy(texture_ptr, pixels, upload_size);
329-
SDL_UnmapGPUTransferBuffer(v->GpuDevice, font_transferbuffer);
329+
SDL_UnmapGPUTransferBuffer(v->Device, transferbuffer);
330330

331-
SDL_GPUTextureTransferInfo font_transfer_info = {};
332-
font_transfer_info.offset = 0;
333-
font_transfer_info.transfer_buffer = font_transferbuffer;
331+
SDL_GPUTextureTransferInfo transfer_info = {};
332+
transfer_info.offset = 0;
333+
transfer_info.transfer_buffer = transferbuffer;
334334

335-
SDL_GPUTextureRegion font_texture_region = {};
336-
font_texture_region.texture = bd->FontTexture;
337-
font_texture_region.w = width;
338-
font_texture_region.h = height;
339-
font_texture_region.d = 1;
335+
SDL_GPUTextureRegion texture_region = {};
336+
texture_region.texture = bd->FontTexture;
337+
texture_region.w = width;
338+
texture_region.h = height;
339+
texture_region.d = 1;
340340

341-
SDL_GPUCommandBuffer* cmd = SDL_AcquireGPUCommandBuffer(v->GpuDevice);
341+
SDL_GPUCommandBuffer* cmd = SDL_AcquireGPUCommandBuffer(v->Device);
342342
SDL_GPUCopyPass* copy_pass = SDL_BeginGPUCopyPass(cmd);
343-
SDL_UploadToGPUTexture(copy_pass, &font_transfer_info, &font_texture_region, false);
343+
SDL_UploadToGPUTexture(copy_pass, &transfer_info, &texture_region, false);
344344
SDL_EndGPUCopyPass(copy_pass);
345345
SDL_SubmitGPUCommandBuffer(cmd);
346-
SDL_ReleaseGPUTransferBuffer(v->GpuDevice, font_transferbuffer);
346+
SDL_ReleaseGPUTransferBuffer(v->Device, transferbuffer);
347347
}
348348

349349
// Store our identifier
350350
io.Fonts->SetTexID((ImTextureID)&bd->FontBinding);
351-
352-
return true;
353351
}
354352

355353
// You probably never need to call this, as it is called by ImGui_ImplSDLGPU3_CreateFontsTexture() and ImGui_ImplSDLGPU3_Shutdown().
356354
void ImGui_ImplSDLGPU3_DestroyFontsTexture()
357355
{
358356
ImGuiIO& io = ImGui::GetIO();
359357
ImGui_ImplSDLGPU3_Data* bd = ImGui_ImplSDLGPU3_GetBackendData();
360-
ImGui_ImplSDLGPU3_InitInfo* v = &bd->GPUInitInfo;
358+
ImGui_ImplSDLGPU3_InitInfo* v = &bd->InitInfo;
361359
if (bd->FontTexture)
362360
{
363-
SDL_ReleaseGPUTexture(v->GpuDevice, bd->FontTexture);
361+
SDL_ReleaseGPUTexture(v->Device, bd->FontTexture);
364362
bd->FontBinding.texture = nullptr;
365363
bd->FontTexture = nullptr;
366364
}
@@ -371,9 +369,9 @@ static void Imgui_ImplSDLGPU3_CreateShaders()
371369
{
372370
// Create the shader modules
373371
ImGui_ImplSDLGPU3_Data* bd = ImGui_ImplSDLGPU3_GetBackendData();
374-
ImGui_ImplSDLGPU3_InitInfo* v = &bd->GPUInitInfo;
372+
ImGui_ImplSDLGPU3_InitInfo* v = &bd->InitInfo;
375373

376-
const char* driver = SDL_GetGPUDeviceDriver(v->GpuDevice);
374+
const char* driver = SDL_GetGPUDeviceDriver(v->Device);
377375

378376
SDL_GPUShaderCreateInfo vertex_shader_info = {};
379377
vertex_shader_info.entrypoint = "main";
@@ -422,16 +420,16 @@ static void Imgui_ImplSDLGPU3_CreateShaders()
422420
fragment_shader_info.code_size = sizeof(metallib_fragment);
423421
}
424422
#endif
425-
bd->VertexShader = SDL_CreateGPUShader(v->GpuDevice, &vertex_shader_info);
426-
bd->FragmentShader = SDL_CreateGPUShader(v->GpuDevice, &fragment_shader_info);
423+
bd->VertexShader = SDL_CreateGPUShader(v->Device, &vertex_shader_info);
424+
bd->FragmentShader = SDL_CreateGPUShader(v->Device, &fragment_shader_info);
427425
IM_ASSERT(bd->VertexShader != nullptr && "Failed to create vertex shader, call SDL_GetError() for more information");
428426
IM_ASSERT(bd->FragmentShader != nullptr && "Failed to create fragment shader, call SDL_GetError() for more information");
429427
}
430428

431429
static void ImGui_ImplSDLGPU3_CreateGraphicsPipeline()
432430
{
433431
ImGui_ImplSDLGPU3_Data* bd = ImGui_ImplSDLGPU3_GetBackendData();
434-
ImGui_ImplSDLGPU3_InitInfo* v = &bd->GPUInitInfo;
432+
ImGui_ImplSDLGPU3_InitInfo* v = &bd->InitInfo;
435433
Imgui_ImplSDLGPU3_CreateShaders();
436434

437435
SDL_GPUVertexBufferDescription vertex_buffer_desc[1];
@@ -507,14 +505,14 @@ static void ImGui_ImplSDLGPU3_CreateGraphicsPipeline()
507505
pipeline_info.depth_stencil_state = depth_stencil_state;
508506
pipeline_info.target_info = target_info;
509507

510-
bd->Pipeline = SDL_CreateGPUGraphicsPipeline(v->GpuDevice, &pipeline_info);
508+
bd->Pipeline = SDL_CreateGPUGraphicsPipeline(v->Device, &pipeline_info);
511509
IM_ASSERT(bd->Pipeline != nullptr && "Failed to create graphics pipeline, call SDL_GetError() for more information");
512510
}
513511

514-
bool ImGui_ImplSDLGPU3_CreateDeviceObjects()
512+
void ImGui_ImplSDLGPU3_CreateDeviceObjects()
515513
{
516514
ImGui_ImplSDLGPU3_Data* bd = ImGui_ImplSDLGPU3_GetBackendData();
517-
ImGui_ImplSDLGPU3_InitInfo* v = &bd->GPUInitInfo;
515+
ImGui_ImplSDLGPU3_InitInfo* v = &bd->InitInfo;
518516

519517
if (!bd->FontSampler)
520518
{
@@ -533,23 +531,22 @@ bool ImGui_ImplSDLGPU3_CreateDeviceObjects()
533531
sampler_info.max_anisotropy = 1.0f;
534532
sampler_info.enable_compare = false;
535533

536-
bd->FontSampler = SDL_CreateGPUSampler(v->GpuDevice, &sampler_info);
534+
bd->FontSampler = SDL_CreateGPUSampler(v->Device, &sampler_info);
537535
bd->FontBinding.sampler = bd->FontSampler;
538536
IM_ASSERT(bd->FontSampler != nullptr && "Failed to create font sampler, call SDL_GetError() for more information");
539537
}
540538

541539
ImGui_ImplSDLGPU3_CreateGraphicsPipeline();
542-
543-
return true;
540+
ImGui_ImplSDLGPU3_CreateFontsTexture();
544541
}
545542

546543
void ImGui_ImplSDLGPU3_DestroyFrameData()
547544
{
548545
ImGui_ImplSDLGPU3_Data* bd = ImGui_ImplSDLGPU3_GetBackendData();
549-
ImGui_ImplSDLGPU3_InitInfo* v = &bd->GPUInitInfo;
546+
ImGui_ImplSDLGPU3_InitInfo* v = &bd->InitInfo;
550547

551-
SDL_ReleaseGPUBuffer(v->GpuDevice, bd->MainWindowFrameData.VertexBuffer);
552-
SDL_ReleaseGPUBuffer(v->GpuDevice, bd->MainWindowFrameData.IndexBuffer);
548+
SDL_ReleaseGPUBuffer(v->Device, bd->MainWindowFrameData.VertexBuffer);
549+
SDL_ReleaseGPUBuffer(v->Device, bd->MainWindowFrameData.IndexBuffer);
553550
bd->MainWindowFrameData.VertexBuffer = nullptr;
554551
bd->MainWindowFrameData.IndexBuffer = nullptr;
555552
bd->MainWindowFrameData.VertexBufferSize = 0;
@@ -559,15 +556,15 @@ void ImGui_ImplSDLGPU3_DestroyFrameData()
559556
void ImGui_ImplSDLGPU3_DestroyDeviceObjects()
560557
{
561558
ImGui_ImplSDLGPU3_Data* bd = ImGui_ImplSDLGPU3_GetBackendData();
562-
ImGui_ImplSDLGPU3_InitInfo* v = &bd->GPUInitInfo;
559+
ImGui_ImplSDLGPU3_InitInfo* v = &bd->InitInfo;
563560

564561
ImGui_ImplSDLGPU3_DestroyFrameData();
565562
ImGui_ImplSDLGPU3_DestroyFontsTexture();
566563

567-
if (bd->VertexShader) { SDL_ReleaseGPUShader(v->GpuDevice, bd->VertexShader); bd->VertexShader = nullptr;}
568-
if (bd->FragmentShader) { SDL_ReleaseGPUShader(v->GpuDevice, bd->FragmentShader); bd->FragmentShader = nullptr;}
569-
if (bd->FontSampler) { SDL_ReleaseGPUSampler(v->GpuDevice, bd->FontSampler); bd->FontSampler = nullptr;}
570-
if (bd->Pipeline) { SDL_ReleaseGPUGraphicsPipeline(v->GpuDevice, bd->Pipeline); bd->Pipeline = nullptr;}
564+
if (bd->VertexShader) { SDL_ReleaseGPUShader(v->Device, bd->VertexShader); bd->VertexShader = nullptr;}
565+
if (bd->FragmentShader) { SDL_ReleaseGPUShader(v->Device, bd->FragmentShader); bd->FragmentShader = nullptr;}
566+
if (bd->FontSampler) { SDL_ReleaseGPUSampler(v->Device, bd->FontSampler); bd->FontSampler = nullptr;}
567+
if (bd->Pipeline) { SDL_ReleaseGPUGraphicsPipeline(v->Device, bd->Pipeline); bd->Pipeline = nullptr;}
571568
}
572569

573570
bool ImGui_ImplSDLGPU3_Init(ImGui_ImplSDLGPU3_InitInfo* info)
@@ -582,10 +579,10 @@ bool ImGui_ImplSDLGPU3_Init(ImGui_ImplSDLGPU3_InitInfo* info)
582579
io.BackendRendererName = "imgui_impl_sdlgpu3";
583580
io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.
584581

585-
IM_ASSERT(info->GpuDevice != nullptr);
582+
IM_ASSERT(info->Device != nullptr);
586583
IM_ASSERT(info->ColorTargetFormat != SDL_GPU_TEXTUREFORMAT_INVALID);
587584

588-
bd->GPUInitInfo = *info;
585+
bd->InitInfo = *info;
589586

590587
ImGui_ImplSDLGPU3_CreateDeviceObjects();
591588

backends/imgui_impl_sdlgpu3.h

+11-8
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,21 @@
2929
// - Remember to set ColorTargetFormat to the correct format. If you're rendering to the swapchain, call SDL_GetGPUSwapchainTextureFormat to query the right value
3030
struct ImGui_ImplSDLGPU3_InitInfo
3131
{
32-
SDL_GPUDevice* GpuDevice = nullptr;
32+
SDL_GPUDevice* Device = nullptr;
3333
SDL_GPUTextureFormat ColorTargetFormat = SDL_GPU_TEXTUREFORMAT_INVALID;
3434
SDL_GPUSampleCount MSAASamples = SDL_GPU_SAMPLECOUNT_1;
3535
};
3636

3737
// Follow "Getting Started" link and check examples/ folder to learn about using backends!
38-
IMGUI_IMPL_API bool ImGui_ImplSDLGPU3_Init(ImGui_ImplSDLGPU3_InitInfo* info);
39-
IMGUI_IMPL_API void ImGui_ImplSDLGPU3_Shutdown();
40-
IMGUI_IMPL_API void ImGui_ImplSDLGPU3_NewFrame();
41-
IMGUI_IMPL_API void Imgui_ImplSDLGPU3_PrepareDrawData(ImDrawData* draw_data, SDL_GPUCommandBuffer* command_buffer);
42-
IMGUI_IMPL_API void ImGui_ImplSDLGPU3_RenderDrawData(ImDrawData* draw_data, SDL_GPUCommandBuffer* command_buffer, SDL_GPURenderPass* render_pass, SDL_GPUGraphicsPipeline* pipeline = nullptr);
43-
IMGUI_IMPL_API bool ImGui_ImplSDLGPU3_CreateFontsTexture();
44-
IMGUI_IMPL_API void ImGui_ImplSDLGPU3_DestroyFontsTexture();
38+
IMGUI_IMPL_API bool ImGui_ImplSDLGPU3_Init(ImGui_ImplSDLGPU3_InitInfo* info);
39+
IMGUI_IMPL_API void ImGui_ImplSDLGPU3_Shutdown();
40+
IMGUI_IMPL_API void ImGui_ImplSDLGPU3_NewFrame();
41+
IMGUI_IMPL_API void Imgui_ImplSDLGPU3_PrepareDrawData(ImDrawData* draw_data, SDL_GPUCommandBuffer* command_buffer);
42+
IMGUI_IMPL_API void ImGui_ImplSDLGPU3_RenderDrawData(ImDrawData* draw_data, SDL_GPUCommandBuffer* command_buffer, SDL_GPURenderPass* render_pass, SDL_GPUGraphicsPipeline* pipeline = nullptr);
43+
44+
IMGUI_IMPL_API void ImGui_ImplSDLGPU3_CreateDeviceObjects();
45+
IMGUI_IMPL_API void ImGui_ImplSDLGPU3_DestroyDeviceObjects();
46+
IMGUI_IMPL_API void ImGui_ImplSDLGPU3_CreateFontsTexture();
47+
IMGUI_IMPL_API void ImGui_ImplSDLGPU3_DestroyFontsTexture();
4548

4649
#endif // #ifndef IMGUI_DISABLE

docs/CHANGELOG.txt

+6-1
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,18 @@ HOW TO UPDATE?
4141

4242
Breaking changes:
4343

44+
- Backends: SDLGPU3: Renamed ImGui_ImplSDLGPU3_InitInfo::GpuDevice to Device
45+
for consistency. (#8163, #7998, #7988)
46+
4447
Other changes:
4548

4649
- ImDrawList: texture baked storage for thick line reduced from ~64x64 to ~32x32. (#3245)
4750
- Examples: DirectX12: Reduced number of frame in flight from 3 to 2 in
4851
provided example, to reduce latency.
4952
- Examples: Vulkan: better handle VK_SUBOPTIMAL_KHR being returned by
5053
vkAcquireNextImageKHR() or vkQueuePresentKHR(). (#7825, #7831) [@NostraMagister]
54+
- Backends: SDLGPU3: Exposed ImGui_ImplSDLGPU3_CreateDeviceObjects()/_DestroyDeviceObjects().
55+
Removed return value from ImGui_ImplSDLGPU3_CreateFontsTexture(). (#8163, #7998, #7988)
5156
- Backends: DirectX12: Texture upload use the command queue provided in
5257
ImGui_ImplDX12_InitInfo instead of creating its own.
5358

@@ -110,7 +115,7 @@ Other changes:
110115
- Demo: Added label edition to Property Editor demo + fix an ID issue. (#8266) [@moritz-h]
111116
- Misc: Fixed misc/cpp/imgui_stdlib.h/.cpp not supporting IMGUI_DISABLE. (#8294) [@juur]
112117
- Misc: Fixed MinGW builds not using UTF-8 friendly _wfopen(). (#8300)
113-
- Backends: SDL_GPU for SDL3: Added backend for SDL_GPU! (#8163, #7998, #7988) [@DeltaW0x].
118+
- Backends: SDLGPU3 for SDL3: Added backend for SDL_GPU! (#8163, #7998, #7988) [@DeltaW0x].
114119
- Backends: SDL3: Added ImGui_ImplSDL3_InitForSDLGPU() for consistency, even
115120
though it is currently not doing anything particular. (#8163, #7998, #7988)
116121
- Backends: Allegro5: Avoid calling al_set_mouse_cursor() repeatedly since it appears

examples/example_sdl3_sdlgpu3/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ int main(int, char**)
6969
// Setup Platform/Renderer backends
7070
ImGui_ImplSDL3_InitForSDLGPU(window);
7171
ImGui_ImplSDLGPU3_InitInfo init_info = {};
72-
init_info.GpuDevice = gpu_device;
72+
init_info.Device = gpu_device;
7373
init_info.ColorTargetFormat = SDL_GetGPUSwapchainTextureFormat(gpu_device, window);
7474
init_info.MSAASamples = SDL_GPU_SAMPLECOUNT_1;
7575
ImGui_ImplSDLGPU3_Init(&init_info);

0 commit comments

Comments
 (0)