diff options
author | 2025-01-02 13:50:37 +0100 | |
---|---|---|
committer | 2025-01-02 13:50:37 +0100 | |
commit | ba6f5853e9382a959af8ff81980c0f06a6ffe80e (patch) | |
tree | 82f1b4963be587f0aa8766a03557c58996b4ca38 /src/osd/modules/render/drawbgfx.cpp | |
parent | 6a403fc29993062aa451f5557cc88abc2fe7b2e7 (diff) |
Cherry-pick wayland improvements from upstream bgfx (#13070)
* Properly support Wayland under EGL and Vulkan. (#3358)
* Dynamically load libwayland-egl.so.1 when dealing with Wayland to remove dependencies at program startup. (#3359)
* Cleanup.
* Support both X11 and Wayland in the same build. (#3360)
* Support both X11 and Wayland in the same build.
- Works for both Vulkan and OpenGL.
- Remove --with-wayland from genie options.
- Vulkan loads all three extensions for surface creation instead of only one.
- Add width and height parameter to GlContext::createSwapChain(), which is needed for EGL to create
a SwapChain with the given window size.
- Dirty-fix the example-22-windows to recreate the FrameBuffer by first destroying and then
recreating to make sure the window is released of its swapchain.
- Fix dbgText glitch in example-22-windows.
- Remove old X11-related dependencies for GLFW3.
* Formatting.
* Adapt to latest bgfx wayland code
* Cleanup.
* Fix Vulkan swapchain invalidation issue. (#3379)
* Fix Vulkan swapchain invalidation issue.
* Always clamp render pass to frame buffer size.
* Fix formatting.
* Hopefully fix macOS build
* Hopefully fix macOS build, attempt 2
---------
Co-authored-by: Martijn Courteaux <courteauxmartijn@gmail.com>
Co-authored-by: Бранимир Караџић <branimirkaradzic@gmail.com>
Diffstat (limited to 'src/osd/modules/render/drawbgfx.cpp')
-rw-r--r-- | src/osd/modules/render/drawbgfx.cpp | 45 |
1 files changed, 4 insertions, 41 deletions
diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index 36758914961..5fbb697089f 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -56,10 +56,6 @@ extern void *GetOSWindow(void *wincontroller); #endif #endif -#if defined(SDLMAME_USE_WAYLAND) -#include <wayland-egl.h> -#endif - #include <bgfx/bgfx.h> #include <bgfx/platform.h> @@ -387,36 +383,6 @@ bool video_bgfx::init_bgfx_library(osd_window &window) //============================================================ -// Helper for creating a wayland window -//============================================================ - -#if defined(SDLMAME_USE_WAYLAND) -wl_egl_window *create_wl_egl_window(SDL_Window *window, struct wl_surface *surface) -{ - if (!surface) - { - osd_printf_error("Wayland surface missing, aborting\n"); - return nullptr; - } - 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); - win_impl = wl_egl_window_create(surface, width, height); - if (!win_impl) - { - osd_printf_error("Creating wayland window failed\n"); - return nullptr; - } - SDL_SetWindowData(window, "wl_egl_window", win_impl); - } - return win_impl; -} -#endif - - -//============================================================ // Utility for setting up window handle //============================================================ @@ -457,10 +423,10 @@ bool video_bgfx::set_platform_data(bgfx::PlatformData &platform_data, osd_window platform_data.nwh = wmi.info.cocoa.window; break; #endif -#if defined(SDL_VIDEO_DRIVER_WAYLAND) && SDL_VERSION_ATLEAST(2, 0, 16) && defined(SDLMAME_USE_WAYLAND) +#if defined(SDL_VIDEO_DRIVER_WAYLAND) && SDL_VERSION_ATLEAST(2, 0, 16) case SDL_SYSWM_WAYLAND: platform_data.ndt = wmi.info.wl.display; - platform_data.nwh = create_wl_egl_window(dynamic_cast<sdl_window_info const &>(window).platform_window(), wmi.info.wl.surface); + platform_data.nwh = wmi.info.wl.surface; if (!platform_data.nwh) { osd_printf_error("BGFX: Error creating a Wayland window\n"); @@ -553,12 +519,9 @@ static std::pair<void *, bool> sdlNativeWindowHandle(SDL_Window *window) case SDL_SYSWM_COCOA: return std::make_pair(wmi.info.cocoa.window, true); #endif -#if defined(SDL_VIDEO_DRIVER_WAYLAND) && SDL_VERSION_ATLEAST(2, 0, 16) && defined(SDLMAME_USE_WAYLAND) +#if defined(SDL_VIDEO_DRIVER_WAYLAND) && SDL_VERSION_ATLEAST(2, 0, 16) case SDL_SYSWM_WAYLAND: - { - void *const platform_window = osd::create_wl_egl_window(window, wmi.info.wl.surface); - return std::make_pair(platform_window, platform_window != nullptr); - } + return std::make_pair(wmi.info.wl.surface, true); #endif #if defined(SDL_VIDEO_DRIVER_ANDROID) case SDL_SYSWM_ANDROID: |