Skip to content

Commit

Permalink
Backends: GLFW: Add ImGui_ImplGlfw_InitForOther() instead of ImGui_Im…
Browse files Browse the repository at this point in the history
…plGlfw_InitForWebGPU() so it can be used for e.g. DX11. (#3632)

Amend dff0044
  • Loading branch information
ocornut committed Feb 10, 2021
1 parent f14042c commit 647a308
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
7 changes: 3 additions & 4 deletions backends/imgui_impl_glfw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion backends/imgui_impl_glfw.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
4 changes: 1 addition & 3 deletions docs/CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)


-----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion examples/example_emscripten_wgpu/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 647a308

Please sign in to comment.