From 647a308ad3c72479a3f9dc321ee466b97ea77944 Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 10 Feb 2021 17:27:33 +0100 Subject: [PATCH] Backends: GLFW: Add ImGui_ImplGlfw_InitForOther() instead of ImGui_ImplGlfw_InitForWebGPU() so it can be used for e.g. DX11. (#3632) Amend dff0044 --- backends/imgui_impl_glfw.cpp | 7 +++---- backends/imgui_impl_glfw.h | 2 +- docs/CHANGELOG.txt | 4 +--- examples/example_emscripten_wgpu/main.cpp | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/backends/imgui_impl_glfw.cpp b/backends/imgui_impl_glfw.cpp index 0b9ac2160501..fbc167d65423 100644 --- a/backends/imgui_impl_glfw.cpp +++ b/backends/imgui_impl_glfw.cpp @@ -63,8 +63,7 @@ enum GlfwClientApi { GlfwClientApi_Unknown, GlfwClientApi_OpenGL, - GlfwClientApi_Vulkan, - GlfwClientApi_WebGPU + GlfwClientApi_Vulkan }; static GLFWwindow* g_Window = NULL; // Main window static GlfwClientApi g_ClientApi = GlfwClientApi_Unknown; @@ -232,9 +231,9 @@ bool ImGui_ImplGlfw_InitForVulkan(GLFWwindow* window, bool install_callbacks) return ImGui_ImplGlfw_Init(window, install_callbacks, GlfwClientApi_Vulkan); } -bool ImGui_ImplGlfw_InitForWebGPU(GLFWwindow* window, bool install_callbacks) +bool ImGui_ImplGlfw_InitForOther(GLFWwindow* window, bool install_callbacks) { - return ImGui_ImplGlfw_Init(window, install_callbacks, GlfwClientApi_WebGPU); + return ImGui_ImplGlfw_Init(window, install_callbacks, GlfwClientApi_Unknown); } void ImGui_ImplGlfw_Shutdown() diff --git a/backends/imgui_impl_glfw.h b/backends/imgui_impl_glfw.h index f04ba72881d6..018f1a1ee6c3 100644 --- a/backends/imgui_impl_glfw.h +++ b/backends/imgui_impl_glfw.h @@ -23,7 +23,7 @@ struct GLFWwindow; IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForOpenGL(GLFWwindow* window, bool install_callbacks); IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForVulkan(GLFWwindow* window, bool install_callbacks); -IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForWebGPU(GLFWwindow* window, bool install_callbacks); +IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForOther(GLFWwindow* window, bool install_callbacks); IMGUI_IMPL_API void ImGui_ImplGlfw_Shutdown(); IMGUI_IMPL_API void ImGui_ImplGlfw_NewFrame(); diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 23a997018d68..1ab321561ebd 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -107,9 +107,7 @@ Other Changes: - Backends: WebGPU: Added enderer backend for WebGPU support (imgui_impl_wgpu.cpp) (#3632) [@bfierz] Please note that WebGPU is currently experimental, will not run on non-beta browsers, and may break. - Examples: WebGPU: Added Emscripten+WebGPU example. (#3632) [@bfierz] -- Backends: GLFW: Added ImGui_ImplGlfw_InitForWebGPU() init point. It currently has strictly no effect on anything, - but because some multi-viewport renderers require knowledge of the render stack in the Platform back-end, we're - adding it for consistency. (#3632) +- Backends: GLFW: Added ImGui_ImplGlfw_InitForOther() init point to use with non OpenGL API. (#3632) ----------------------------------------------------------------------- diff --git a/examples/example_emscripten_wgpu/main.cpp b/examples/example_emscripten_wgpu/main.cpp index b550f9dfc67e..9b72ba9b07d6 100644 --- a/examples/example_emscripten_wgpu/main.cpp +++ b/examples/example_emscripten_wgpu/main.cpp @@ -75,7 +75,7 @@ int main(int, char**) //ImGui::StyleColorsClassic(); // Setup Platform/Renderer backends - ImGui_ImplGlfw_InitForWebGPU(window, true); + ImGui_ImplGlfw_InitForOther(window, true); ImGui_ImplWGPU_Init(wgpu_device, 3, WGPUTextureFormat_RGBA8Unorm); // Load Fonts