Properly support Wayland under EGL and Vulkan. (#3358)

This commit is contained in:
Martijn Courteaux
2024-10-01 18:01:44 +02:00
committed by GitHub
parent f8b20616de
commit 3303b451a1
6 changed files with 34 additions and 27 deletions

View File

@@ -46,18 +46,8 @@ namespace entry
{
# if BX_PLATFORM_LINUX
# if ENTRY_CONFIG_USE_WAYLAND
wl_egl_window *win_impl = (wl_egl_window*)glfwGetWindowUserPointer(_window);
if(!win_impl)
{
int width, height;
glfwGetWindowSize(_window, &width, &height);
struct wl_surface* surface = (struct wl_surface*)glfwGetWaylandWindow(_window);
if(!surface)
return nullptr;
win_impl = wl_egl_window_create(surface, width, height);
glfwSetWindowUserPointer(_window, (void*)(uintptr_t)win_impl);
}
return (void*)(uintptr_t)win_impl;
struct wl_surface* surface = (struct wl_surface*)glfwGetWaylandWindow(_window);
return (void*)surface;
# else
return (void*)(uintptr_t)glfwGetX11Window(_window);
# endif

View File

@@ -51,20 +51,7 @@ namespace entry
# if BX_PLATFORM_LINUX
# if ENTRY_CONFIG_USE_WAYLAND
if (wmi.subsystem == SDL_SYSWM_WAYLAND)
{
wl_egl_window *win_impl = (wl_egl_window*)SDL_GetWindowData(_window, "wl_egl_window");
if(!win_impl)
{
int width, height;
SDL_GetWindowSize(_window, &width, &height);
struct wl_surface* surface = wmi.info.wl.surface;
if(!surface)
return nullptr;
win_impl = wl_egl_window_create(surface, width, height);
SDL_SetWindowData(_window, "wl_egl_window", win_impl);
}
return (void*)(uintptr_t)win_impl;
}
return (void*)wmi.info.wl.surface;
else
# endif // ENTRY_CONFIG_USE_WAYLAND
return (void*)wmi.info.x11.window;

View File

@@ -290,6 +290,8 @@ void showExampleDialog(entry::AppI* _app, const char* _errorText)
}
}
}
#else
ImGui::Text("Renderer: %s", bgfx::getRendererName(bgfx::getRendererType()));
#endif // 0
const bgfx::Stats* stats = bgfx::getStats();