It turns out that we can safely create a Metal view on an existing window, and that avoids issues with the window being recreated with the wrong orientation in iOS 16.
Fixes https://github.com/libsdl-org/SDL/issues/6289
Clamp the wl_seat max version to 5 if being built against a version of libwayland below 1.21.0, or containers that bundle newer versions of SDL with older versions of libwayland can break if the compositor advertises support for a protocol version above 5.
Depending on the underlying EGL library, it may be desirable to
conditionally set some specific EGL attributes depending on available
extensions and other application state.
SDL's EGL usage makes this a little bit complicated because:
- there are multiple functions used to set up a working EGL context
- some of these functions take different types of EGL attributes
(EGLAttrib vs EGLint)
- the EGL extension list before creating an EGLDisplay differs from the
extension list after (i.e. display vs client extensions)
- all of the above happens in a single SDL_CreateWindow call
This leaves no place for the application to discover what EGL extensions
are available and provide custom attribute lists.
Until now, if a developer wants to add a custom EGL attribute for
eglGetPlatformDisplay, eglCreateWindowSurface or eglCreateContext, they
needed to patch SDL itself. This is very undesirable, since such
developers would have to disable the SDL dynapi in order to maintain
compatibility with their needs.
This patch implements some callbacks which developers can use to
dynamically generate custom EGL attributes for SDL to use during
SDL_CreateWindow.
These functions allow applications to call EGL functions against the SDL
EGL context. For example, applications can use an EGL API loader via
SDL_EGL_GetCurrentDisplay and SDL_EGL_GetProcAddress, and can call
functions such as eglQuerySurface against the internal EGLSurface and
EGLDisplay.
The EGL 1.5 specification says that eglGetPlatformDisplay (unlike
eglGetPlatformDisplayExt) takes an EGLAttrib* rather than EGLint* for
the attribute list.
This fallback is undesirable when using ANGLE, because it will end up
using some default configuration (e.g. on Windows it defaults to the
D3D11 backend).
This implements a new SDL_GL_EGL_PLATFORM attribute to set the
"platform" argument for SDL_EGL_LoadLibrary on Windows, macOS, and
Linux. I've limited it to those three operating systems because that's
what I've been able to test against.
This adds support for forcing the use of EGL on Windows and MacOS. The
SDL_HINT_VIDEO_X11_FORCE_EGL hint is retained for backwards
compatibility but is now deprecated.
- use _Interlocked(Compare)ExchangePointer in case of _M_IX86 as well
- improve assertions:
1. add assertions to SDL_AtomicAdd/SDL_AtomicSet and SDL_AtomicCAS
2. use sizeof(a->value) instead of sizeof(int)