-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cherry-pick wayland improvements from upstream bgfx #13070
Conversation
…ove dependencies at program startup. (mamedev#3359)
* 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.
* Fix Vulkan swapchain invalidation issue. * Always clamp render pass to frame buffer size. * Fix formatting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to break building on macOS:
Compiling 3rdparty/bgfx/src/renderer_gl.cpp...
../../../../../3rdparty/bgfx/src/renderer_gl.cpp:7148:59: error: too many arguments to function call, expected single argument '_nwh', have 3 arguments
m_swapChain = s_renderGL->m_glctx.createSwapChain(_nwh, _width, _height);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~
In file included from ../../../../../3rdparty/bgfx/src/renderer_gl.cpp:9:
In file included from ../../../../../3rdparty/bgfx/src/renderer_gl.h:1158:
../../../../../3rdparty/bgfx/src/glcontext_nsgl.h:29:16: note: 'createSwapChain' declared here
SwapChainGL* createSwapChain(void* _nwh);
^
1 error generated.
make[2]: *** [../../../../osx_clang/obj/x64/Release/3rdparty/bgfx/src/renderer_gl.o] Error 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What’s the rationale for this change? Does SDL always create the Wayland EGL window now? If it does, when did that change happen? Does it raise the minimum SDL requirement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way I understand it, wayland detection is moved from compile-time to run-time with these changes. If SDL is built with Wayland support (SDL_VIDEO_DRIVER_WAYLAND), then the required Wayland library will be dlopened at runtime and things will just work. There is some explanation in the three upstream bgfx PRs, which have prompted me to submit this PR:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears that creating wayland EGL window is taken care by glcontext. Quoting bkaradzic/bgfx#3358:
In this PR, the EGL context now creates this wl_egl_window when the NativeWindowHandleType is set to Wayland.
Looks like this is fixed. I do not have access to a mac though so testing would be appreciated - especially the GL renderer. |
I'll pull the branch and smoke test it on at least macOS. I believe there's an issue with MAME itself that's causing a lot of the BGFX issues where we're misreporting the width and/or stride and that's why so many drivers segfault during a memcpy(). |
Never mind, I was on the wrong branch of the branch, whee. On macOS it works pretty much identically to top of tree. Some shaders work, some don't. Lots of this diagnostic in Metal mode on some drivers (sexyparo does it, for instance). |
If we want to merge it, it’s probably better to do it sooner rather than later so Linux users are exposed to it for a while. |
Gonna test it locally. |
* Properly support Wayland under EGL and Vulkan. (mamedev#3358) * Dynamically load libwayland-egl.so.1 when dealing with Wayland to remove dependencies at program startup. (mamedev#3359) * Cleanup. * Support both X11 and Wayland in the same build. (mamedev#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. (mamedev#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>
As full sync with upstream is not an option at the moment (see #13054 (comment)), cherry-pick recent wayland fixes from upstream bgfx instead.
This uses the API more correctly as well as moves wayland detection to runtime, reducing the build requirements slightly.