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.
This commit is contained in:
Martijn Courteaux
2024-10-05 23:33:22 +02:00
committed by GitHub
parent 3f9fe0d34e
commit e488a07f1b
21 changed files with 224 additions and 242 deletions

View File

@@ -86,7 +86,7 @@ namespace bgfx { namespace gl
}
else
{
m_primary = createSwapChain((void*)canvas);
m_primary = createSwapChain((void*)canvas, (int)_width, (int)_height) );
}
if (0 != _width
@@ -122,9 +122,10 @@ namespace bgfx { namespace gl
EMSCRIPTEN_CHECK(emscripten_set_canvas_element_size(m_primary->m_canvas, (int) _width, (int) _height) );
}
SwapChainGL* GlContext::createSwapChain(void* _nwh)
SwapChainGL* GlContext::createSwapChain(void* _nwh, int _width, int _height)
{
emscripten_webgl_init_context_attributes(&s_attrs);
BX_UNUSED(_width, _height);
// Work around bug https://bugs.chromium.org/p/chromium/issues/detail?id=1045643 in Chrome
// by having alpha always enabled.