Backends: GLFW: Add ImGui_ImplGlfw_InitForOther() instead of ImGui_ImplGlfw_InitForWebGPU() so it can be used for e.g. DX11. (#3632)

Amend dff0044
This commit is contained in:
ocornut 2021-02-10 17:27:33 +01:00
parent f14042ca78
commit 647a308ad3
4 changed files with 6 additions and 9 deletions

View File

@ -63,8 +63,7 @@ enum GlfwClientApi
{ {
GlfwClientApi_Unknown, GlfwClientApi_Unknown,
GlfwClientApi_OpenGL, GlfwClientApi_OpenGL,
GlfwClientApi_Vulkan, GlfwClientApi_Vulkan
GlfwClientApi_WebGPU
}; };
static GLFWwindow* g_Window = NULL; // Main window static GLFWwindow* g_Window = NULL; // Main window
static GlfwClientApi g_ClientApi = GlfwClientApi_Unknown; 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); 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() void ImGui_ImplGlfw_Shutdown()

View File

@ -23,7 +23,7 @@ struct GLFWwindow;
IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForOpenGL(GLFWwindow* window, bool install_callbacks); 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_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_Shutdown();
IMGUI_IMPL_API void ImGui_ImplGlfw_NewFrame(); IMGUI_IMPL_API void ImGui_ImplGlfw_NewFrame();

View File

@ -107,9 +107,7 @@ Other Changes:
- Backends: WebGPU: Added enderer backend for WebGPU support (imgui_impl_wgpu.cpp) (#3632) [@bfierz] - 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. 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] - Examples: WebGPU: Added Emscripten+WebGPU example. (#3632) [@bfierz]
- Backends: GLFW: Added ImGui_ImplGlfw_InitForWebGPU() init point. It currently has strictly no effect on anything, - Backends: GLFW: Added ImGui_ImplGlfw_InitForOther() init point to use with non OpenGL API. (#3632)
but because some multi-viewport renderers require knowledge of the render stack in the Platform back-end, we're
adding it for consistency. (#3632)
----------------------------------------------------------------------- -----------------------------------------------------------------------

View File

@ -75,7 +75,7 @@ int main(int, char**)
//ImGui::StyleColorsClassic(); //ImGui::StyleColorsClassic();
// Setup Platform/Renderer backends // Setup Platform/Renderer backends
ImGui_ImplGlfw_InitForWebGPU(window, true); ImGui_ImplGlfw_InitForOther(window, true);
ImGui_ImplWGPU_Init(wgpu_device, 3, WGPUTextureFormat_RGBA8Unorm); ImGui_ImplWGPU_Init(wgpu_device, 3, WGPUTextureFormat_RGBA8Unorm);
// Load Fonts // Load Fonts