Viewport, Platform: Added void* to render/swap buffer functions. Comments. (#1542, #1042)

This commit is contained in:
omar 2018-03-19 15:20:47 +01:00
parent 0e09032750
commit 2fecd332fc
24 changed files with 71 additions and 48 deletions

View File

@ -208,9 +208,9 @@ int main(int, char**)
ImGui::Render();
ImGui_ImplDX10_RenderDrawData(ImGui::GetDrawData());
// Update and Render additional Platform Windows
// Update and Render additional Platform Windows (when ImGuiConfigFlags_EnableViewports is enabled)
ImGui::UpdatePlatformWindows();
ImGui::RenderPlatformWindows();
ImGui::RenderPlatformWindows(NULL, NULL);
g_pSwapChain->Present(1, 0); // Present with vsync
//g_pSwapChain->Present(0, 0); // Present without vsync

View File

@ -226,9 +226,9 @@ int main(int, char**)
ImGui::Render();
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
// Update and Render additional Platform Windows
// Update and Render additional Platform Windows (when ImGuiConfigFlags_EnableViewports is enabled)
ImGui::UpdatePlatformWindows();
ImGui::RenderPlatformWindows();
ImGui::RenderPlatformWindows(NULL, NULL);
g_pSwapChain->Present(1, 0); // Present with vsync
//g_pSwapChain->Present(0, 0); // Present without vsync

View File

@ -401,9 +401,9 @@ int main(int, char**)
g_pd3dCommandQueue->ExecuteCommandLists(1, (ID3D12CommandList* const*)&g_pd3dCommandList);
// Update and Render additional Platform Windows
// Update and Render additional Platform Windows (when ImGuiConfigFlags_EnableViewports is enabled)
ImGui::UpdatePlatformWindows();
ImGui::RenderPlatformWindows();
ImGui::RenderPlatformWindows(NULL, NULL);
g_pSwapChain->Present(1, 0); // Present with vsync
//g_pSwapChain->Present(0, 0); // Present without vsync

View File

@ -3,6 +3,7 @@
// Implemented features:
// [X] User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// [X] Multi-viewport rendering (when ImGuiConfigFlags_EnableViewports is enabled).
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
@ -581,7 +582,7 @@ static void ImGui_ImplDX10_SetWindowSize(ImGuiViewport* viewport, ImVec2 size)
}
}
static void ImGui_ImplDX10_RenderViewport(ImGuiViewport* viewport)
static void ImGui_ImplDX10_RenderViewport(ImGuiViewport* viewport, void*)
{
ImGuiViewportDataDx10* data = (ImGuiViewportDataDx10*)viewport->RendererUserData;
ImVec4 clear_color = ImVec4(0.0f, 0.0f, 0.0f, 1.0f);
@ -591,7 +592,7 @@ static void ImGui_ImplDX10_RenderViewport(ImGuiViewport* viewport)
ImGui_ImplDX10_RenderDrawData(viewport->DrawData);
}
static void ImGui_ImplDX10_SwapBuffers(ImGuiViewport* viewport)
static void ImGui_ImplDX10_SwapBuffers(ImGuiViewport* viewport, void*)
{
ImGuiViewportDataDx10* data = (ImGuiViewportDataDx10*)viewport->RendererUserData;
data->SwapChain->Present(0, 0); // Present without vsync

View File

@ -3,6 +3,7 @@
// Implemented features:
// [X] User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// [X] Multi-viewport rendering (when ImGuiConfigFlags_EnableViewports is enabled).
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().

View File

@ -3,6 +3,7 @@
// Implemented features:
// [X] User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// [X] Multi-viewport rendering (when ImGuiConfigFlags_EnableViewports is enabled).
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
@ -589,7 +590,7 @@ static void ImGui_ImplDX11_SetWindowSize(ImGuiViewport* viewport, ImVec2 size)
}
}
static void ImGui_ImplDX11_RenderWindow(ImGuiViewport* viewport)
static void ImGui_ImplDX11_RenderWindow(ImGuiViewport* viewport, void*)
{
ImGuiViewportDataDx11* data = (ImGuiViewportDataDx11*)viewport->RendererUserData;
ImVec4 clear_color = ImVec4(0.0f, 0.0f, 0.0f, 1.0f);
@ -599,7 +600,7 @@ static void ImGui_ImplDX11_RenderWindow(ImGuiViewport* viewport)
ImGui_ImplDX11_RenderDrawData(viewport->DrawData);
}
static void ImGui_ImplDX11_SwapBuffers(ImGuiViewport* viewport)
static void ImGui_ImplDX11_SwapBuffers(ImGuiViewport* viewport, void*)
{
ImGuiViewportDataDx11* data = (ImGuiViewportDataDx11*)viewport->RendererUserData;
data->SwapChain->Present(0, 0); // Present without vsync

View File

@ -3,6 +3,7 @@
// Implemented features:
// [X] User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// [X] Multi-viewport rendering (when ImGuiConfigFlags_EnableViewports is enabled).
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().

View File

@ -726,7 +726,7 @@ static void ImGui_ImplDX12_SetWindowSize(ImGuiViewport* viewport, ImVec2 size)
*/
}
static void ImGui_ImplDX12_RenderWindow(ImGuiViewport* viewport)
static void ImGui_ImplDX12_RenderWindow(ImGuiViewport* viewport, void*)
{
ImGuiViewportDataDx12* data = (ImGuiViewportDataDx12*)viewport->RendererUserData;
IM_ASSERT(0);
@ -740,7 +740,7 @@ static void ImGui_ImplDX12_RenderWindow(ImGuiViewport* viewport)
ImGui_ImplDX12_RenderDrawData(viewport->DrawData);
}
static void ImGui_ImplDX12_SwapBuffers(ImGuiViewport* viewport)
static void ImGui_ImplDX12_SwapBuffers(ImGuiViewport* viewport, void*)
{
ImGuiViewportDataDx12* data = (ImGuiViewportDataDx12*)viewport->RendererUserData;
IM_ASSERT(0);

View File

@ -4,6 +4,7 @@
// Implemented features:
// [X] Gamepad navigation mapping. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
// [X] Multi-viewport windows (when ImGuiConfigFlags_EnableViewports is enabled).
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
@ -448,14 +449,14 @@ static void ImGui_ImplGlfw_SetWindowTitle(ImGuiViewport* viewport, const char* t
glfwSetWindowTitle(data->Window, title);
}
static void ImGui_ImplGlfw_RenderWindow(ImGuiViewport* viewport)
static void ImGui_ImplGlfw_RenderWindow(ImGuiViewport* viewport, void*)
{
ImGuiViewportDataGlfw* data = (ImGuiViewportDataGlfw*)viewport->PlatformUserData;
if (g_ClientApi == GlfwClientApi_OpenGL)
glfwMakeContextCurrent(data->Window);
}
static void ImGui_ImplGlfw_SwapBuffers(ImGuiViewport* viewport)
static void ImGui_ImplGlfw_SwapBuffers(ImGuiViewport* viewport, void*)
{
ImGuiViewportDataGlfw* data = (ImGuiViewportDataGlfw*)viewport->PlatformUserData;
if (g_ClientApi == GlfwClientApi_OpenGL)

View File

@ -4,6 +4,7 @@
// Implemented features:
// [X] Gamepad navigation mapping. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
// [X] Multi-viewport windows (when ImGuiConfigFlags_EnableViewports is enabled).
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().

View File

@ -1,6 +1,9 @@
// ImGui Renderer for: OpenGL2 (legacy OpenGL, fixed pipeline)
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
// Implemented features:
// [X] User texture binding. Use 'GLUint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// **DO NOT USE THIS CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
// **Prefer using the code in imgui_impl_opengl3.cpp**
// This code is mostly provided as a reference to learn how ImGui integration works, because it is shorter to read.

View File

@ -1,6 +1,9 @@
// ImGui Renderer for: OpenGL2 (legacy OpenGL, fixed pipeline)
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
// Implemented features:
// [X] User texture binding. Use 'GLUint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// **DO NOT USE THIS CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
// **Prefer using the code in imgui_impl_opengl3.cpp**
// This code is mostly provided as a reference to learn how ImGui integration works, because it is shorter to read.

View File

@ -2,6 +2,10 @@
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
// (Note: We are using GL3W as a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc..)
// Implemented features:
// [X] User texture binding. Use 'GLUint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// [X] Multi-viewport rendering (when ImGuiConfigFlags_EnableViewports is enabled).
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
// 2018-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
@ -328,7 +332,7 @@ void ImGui_ImplOpenGL3_DestroyDeviceObjects()
// Platform Interface (Optional, for multi-viewport support)
//--------------------------------------------------------------------------------------------------------
static void ImGui_ImplOpenGL3_RenderWindow(ImGuiViewport* viewport)
static void ImGui_ImplOpenGL3_RenderWindow(ImGuiViewport* viewport, void*)
{
if (!(viewport->Flags & ImGuiViewportFlags_NoRendererClear))
{

View File

@ -2,6 +2,10 @@
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
// (Note: We are using GL3W as a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc..)
// Implemented features:
// [X] User texture binding. Use 'GLUint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// [X] Multi-viewport rendering (when ImGuiConfigFlags_EnableViewports is enabled).
IMGUI_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = NULL);
IMGUI_API void ImGui_ImplOpenGL3_Shutdown();
IMGUI_API void ImGui_ImplOpenGL3_NewFrame();

View File

@ -3,7 +3,7 @@
// (Info: SDL2 is a cross-platform general purpose library for handling windows, inputs, graphics context creation, etc.)
// Implemented features:
// [X] User texture binding. Cast 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
// [X] Multi-viewport windows (when ImGuiConfigFlags_EnableViewports is enabled).
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
@ -400,14 +400,14 @@ static void ImGui_ImplSDL2_SetWindowTitle(ImGuiViewport* viewport, const char* t
SDL_SetWindowTitle(data->Window, title);
}
static void ImGui_ImplSDL2_RenderWindow(ImGuiViewport* viewport)
static void ImGui_ImplSDL2_RenderWindow(ImGuiViewport* viewport, void*)
{
ImGuiViewportDataSDL2* data = (ImGuiViewportDataSDL2*)viewport->PlatformUserData;
if (data->GLContext)
SDL_GL_MakeCurrent(data->Window, data->GLContext);
}
static void ImGui_ImplSDL2_SwapBuffers(ImGuiViewport* viewport)
static void ImGui_ImplSDL2_SwapBuffers(ImGuiViewport* viewport, void*)
{
ImGuiViewportDataSDL2* data = (ImGuiViewportDataSDL2*)viewport->PlatformUserData;
if (data->GLContext)

View File

@ -2,6 +2,9 @@
// This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..)
// (Info: SDL2 is a cross-platform general purpose library for handling windows, inputs, graphics context creation, etc.)
// Implemented features:
// [X] Multi-viewport windows (when ImGuiConfigFlags_EnableViewports is enabled).
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.

View File

@ -3,6 +3,7 @@
// Missing features:
// [ ] User texture binding. Changes of ImTextureID aren't supported by this binding! See https://github.com/ocornut/imgui/pull/914
// [ ] Multi-viewport rendering (when ImGuiConfigFlags_EnableViewports is enabled). WORK-IN-PROGRESS.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 5 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXX_CreateFontsTexture(), ImGui_ImplXXXX_NewFrame(), ImGui_ImplXXXX_Render() and ImGui_ImplXXXX_Shutdown().
@ -1113,7 +1114,7 @@ static void ImGui_ImplVulkan_SetWindowSize(ImGuiViewport* viewport, ImVec2 size)
ImGui_ImplVulkanH_CreateWindowDataSwapChainAndFramebuffer(g_PhysicalDevice, g_Device, &data->WindowData, g_Allocator, (int)size.x, (int)size.y);
}
static void ImGui_ImplVulkan_RenderWindow(ImGuiViewport* viewport)
static void ImGui_ImplVulkan_RenderWindow(ImGuiViewport* viewport, void*)
{
ImGuiViewportDataVulkan* data = (ImGuiViewportDataVulkan*)viewport->RendererUserData;
ImGui_ImplVulkan_WindowData* wd = &data->WindowData;
@ -1184,7 +1185,7 @@ static void ImGui_ImplVulkan_RenderWindow(ImGuiViewport* viewport)
}
}
static void ImGui_ImplVulkan_SwapBuffers(ImGuiViewport* viewport)
static void ImGui_ImplVulkan_SwapBuffers(ImGuiViewport* viewport, void*)
{
ImGuiViewportDataVulkan* data = (ImGuiViewportDataVulkan*)viewport->RendererUserData;
ImGui_ImplVulkan_WindowData* wd = &data->WindowData;

View File

@ -3,6 +3,7 @@
// Missing features:
// [ ] User texture binding. Changes of ImTextureID aren't supported by this binding! See https://github.com/ocornut/imgui/pull/914
// [ ] Multi-viewport rendering (when ImGuiConfigFlags_EnableViewports is enabled). WORK-IN-PROGRESS.
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
// If you use this binding you'll need to call 5 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXX_CreateFontsTexture(), ImGui_ImplXXXX_NewFrame(), ImGui_ImplXXXX_Render() and ImGui_ImplXXXX_Shutdown().

View File

@ -124,9 +124,9 @@ int main(int, char**)
glClear(GL_COLOR_BUFFER_BIT);
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
// Update and Render additional Platform Windows
// Update and Render additional Platform Windows (when ImGuiConfigFlags_EnableViewports is enabled)
ImGui::UpdatePlatformWindows();
ImGui::RenderPlatformWindows();
ImGui::RenderPlatformWindows(NULL, NULL);
glfwMakeContextCurrent(window);
glfwSwapBuffers(window);

View File

@ -132,9 +132,9 @@ int main(int, char**)
glClear(GL_COLOR_BUFFER_BIT);
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
// Update and Render additional Platform Windows
// Update and Render additional Platform Windows (when ImGuiConfigFlags_EnableViewports is enabled)
ImGui::UpdatePlatformWindows();
ImGui::RenderPlatformWindows();
ImGui::RenderPlatformWindows(NULL, NULL);
SDL_GL_MakeCurrent(window, gl_context);
SDL_GL_SwapWindow(window);

View File

@ -469,9 +469,9 @@ int main(int, char**)
memcpy(&wd->ClearValue.color.float32[0], &clear_color, 4 * sizeof(float));
FrameRender(wd);
// Update and Render additional Platform Windows
// Update and Render additional Platform Windows (when ImGuiConfigFlags_EnableViewports is enabled)
ImGui::UpdatePlatformWindows();
ImGui::RenderPlatformWindows();
ImGui::RenderPlatformWindows(NULL, NULL);
FramePresent(wd);
}

View File

@ -479,9 +479,9 @@ int main(int, char**)
memcpy(&wd->ClearValue.color.float32[0], &clear_color, 4 * sizeof(float));
FrameRender(wd);
// Update and Render additional Platform Windows
// Update and Render additional Platform Windows (when ImGuiConfigFlags_EnableViewports is enabled)
ImGui::UpdatePlatformWindows();
ImGui::RenderPlatformWindows();
ImGui::RenderPlatformWindows(NULL, NULL);
FramePresent(wd);
}

View File

@ -3559,7 +3559,7 @@ void ImGui::UpdatePlatformWindows()
// This is a default/basic function for performing the rendering/swap of multiple platform windows.
// Custom renderers may prefer to not call this function at all, and instead iterate the platform data and handle rendering/sync themselves.
// The Render/Swap functions stored in ImGuiPlatformInterface are merely here to allow for this helper to exist, but you can do it yourself:
// The Render/Swap functions stored in ImGuiPlatformIO are merely here to allow for this helper to exist, but you can do it yourself:
//
// ImGuiPlatformData* data = ImGui::GetPlatformData();
// for (int i = 1; i < data->Viewports.Size; i++)
@ -3568,7 +3568,7 @@ void ImGui::UpdatePlatformWindows()
// MySwapBufferFunction(data->Viewports[i], my_args);
//
// Note how we intentionally skip the main viewport (index 0) which is generally rendered as part of our main application.
void ImGui::RenderPlatformWindows()
void ImGui::RenderPlatformWindows(void* platform_render_arg, void* renderer_render_arg)
{
if (!(ImGui::GetIO().ConfigFlags & ImGuiConfigFlags_EnableViewports))
return;
@ -3578,18 +3578,14 @@ void ImGui::RenderPlatformWindows()
for (int i = 1; i < data->Viewports.Size; i++)
{
ImGuiViewport* viewport = data->Viewports[i];
if (platform_io.Platform_RenderWindow)
platform_io.Platform_RenderWindow(viewport);
if (platform_io.Renderer_RenderWindow)
platform_io.Renderer_RenderWindow(viewport);
if (platform_io.Platform_RenderWindow) platform_io.Platform_RenderWindow(viewport, platform_render_arg);
if (platform_io.Renderer_RenderWindow) platform_io.Renderer_RenderWindow(viewport, renderer_render_arg);
}
for (int i = 1; i < data->Viewports.Size; i++)
{
ImGuiViewport* viewport = data->Viewports[i];
if (platform_io.Platform_SwapBuffers)
platform_io.Platform_SwapBuffers(viewport);
if (platform_io.Renderer_SwapBuffers)
platform_io.Renderer_SwapBuffers(viewport);
if (platform_io.Platform_SwapBuffers) platform_io.Platform_SwapBuffers(viewport, platform_render_arg);
if (platform_io.Renderer_SwapBuffers) platform_io.Renderer_SwapBuffers(viewport, renderer_render_arg);
}
}

22
imgui.h
View File

@ -545,12 +545,12 @@ namespace ImGui
IMGUI_API void SetClipboardText(const char* text);
// (Optional) Platform interface for multi-viewport support
IMGUI_API ImGuiPlatformIO& GetPlatformIO(); // Platform/Renderer functions.
IMGUI_API ImGuiPlatformData* GetPlatformData(); // List of viewports.
IMGUI_API ImGuiViewport* GetMainViewport(); // GetPlatformData()->MainViewport
IMGUI_API void UpdatePlatformWindows(); // Call in main loop. Create/Destroy/Resize platform windows so there's one for each viewport
IMGUI_API void RenderPlatformWindows(); // Call in main loop. Call RenderWindow/SwapBuffers from the ImGuiPlatformIO structure. May be reimplemented by user.
IMGUI_API void DestroyPlatformWindows(); // Call in back-end shutdown.
IMGUI_API ImGuiPlatformIO& GetPlatformIO(); // Platform/Renderer function, for back-end to setup.
IMGUI_API ImGuiPlatformData* GetPlatformData(); // List of viewports. Viewport 0 is always the main viewport, followed by the secondary viewports.
IMGUI_API ImGuiViewport* GetMainViewport(); // GetPlatformData()->MainViewport
IMGUI_API void UpdatePlatformWindows(); // Call in main loop. Create/Destroy/Resize platform windows so there's one for each viewport
IMGUI_API void RenderPlatformWindows(void* platform_render_arg, void* renderer_render_arg); // Call in main loop. Call RenderWindow/SwapBuffers from the ImGuiPlatformIO structure. May be reimplemented by user.
IMGUI_API void DestroyPlatformWindows(); // (Optional) Call in back-end shutdown if you need to close Platform Windows before imgui shutdown.
IMGUI_API ImGuiViewport* FindViewportByPlatformHandle(void* platform_handle);
// Memory Utilities
@ -1868,6 +1868,8 @@ struct ImFont
// This is designed so we can mix and match two imgui_impl_xxxx files, one for the Platform (~ Windowing), one for Renderer.
// Custom engine back-ends will often provide both Platform and Renderer interfaces and thus may not need to use all functions.
// Platform functions are typically called before their Renderer counterpart, apart from Destroy which are called the other way.
// RenderPlatformWindows() basically iterate secondary viewports and call Platform+Renderer's RenderWindow then Platform+Renderer's SwapBuffers,
// You may skip using RenderPlatformWindows() and call your functions yourself if you need specific behavior for your multi-window rendering.
struct ImGuiPlatformIO
{
// Platform (e.g. Win32, GLFW, SDL2)
@ -1880,8 +1882,8 @@ struct ImGuiPlatformIO
ImVec2 (*Platform_GetWindowSize)(ImGuiViewport* vp);
void (*Platform_SetWindowTitle)(ImGuiViewport* vp, const char* title);
void (*Platform_SetWindowAlpha)(ImGuiViewport* vp, float alpha); // (Optional) Setup window transparency
void (*Platform_RenderWindow)(ImGuiViewport* vp); // (Optional) Setup for render (platform side)
void (*Platform_SwapBuffers)(ImGuiViewport* vp); // (Optional) Call Present/SwapBuffers (platform side)
void (*Platform_RenderWindow)(ImGuiViewport* vp, void* render_arg); // (Optional) Setup for render (platform side)
void (*Platform_SwapBuffers)(ImGuiViewport* vp, void* render_arg); // (Optional) Call Present/SwapBuffers (platform side)
float (*Platform_GetWindowDpiScale)(ImGuiViewport* vp); // (Optional) DPI handling: Return DPI scale for this viewport. 1.0f = 96 DPI. (FIXME-DPI)
void (*Platform_OnChangedViewport)(ImGuiViewport* vp); // (Optional) DPI handling: Called during Begin() every time the viewport we are outputting into changes, so back-end has a chance to swap fonts to adjust style.
int (*Platform_CreateVkSurface)(ImGuiViewport* vp, ImU64 vk_inst, const void* vk_allocators, ImU64* out_vk_surface); // (Optional) For Renderer to call into Platform code
@ -1890,8 +1892,8 @@ struct ImGuiPlatformIO
void (*Renderer_CreateWindow)(ImGuiViewport* vp); // Create swap chains, frame buffers etc.
void (*Renderer_DestroyWindow)(ImGuiViewport* vp);
void (*Renderer_SetWindowSize)(ImGuiViewport* vp, ImVec2 size); // Resize swap chain, frame buffers etc.
void (*Renderer_RenderWindow)(ImGuiViewport* vp); // (Optional) Clear targets, Render viewport->DrawData
void (*Renderer_SwapBuffers)(ImGuiViewport* vp); // (Optional) Call Present/SwapBuffers (renderer side)
void (*Renderer_RenderWindow)(ImGuiViewport* vp, void* render_arg); // (Optional) Clear targets, Render viewport->DrawData
void (*Renderer_SwapBuffers)(ImGuiViewport* vp, void* render_arg); // (Optional) Call Present/SwapBuffers (renderer side)
};
// List of viewports to render as platform window (updated by ImGui::UpdatePlatformWindows)