Structures sizes should be mosly correct and have found by estimate
sizes that could have lump size mod equal to zero as for other formats.
Possition of fields are taken from IBSP structures, that could be
incorrect. All other fields marked as unknow/unused.
...and alter the render finding and fallback sequences to include GLES3
as the first fallback. This should have been done years ago, when GL3
became the clear better option above GL1.
SDL major versions must not be combined in one process, otherwise bad
things will happen. In the best case the game crashes, in the worst case
strange bugs will occure. To prevent that:
* Add a new field `framework_version` to the renderer API and use it to
pass the SDL major version from the renderer to client. Don't load the
renderer if it and the client were build with different SDL major
versions.
* Bump the renderer API version to 7. This could have been implemented
by assuming `framework_version == 0` (not filled by renderer) as SDL
2, but let's keep things clean and bump the version.
While here fix a long standing bug with printing the error when not
loading a renderer lib. The message must be generated before shutting
down the renderer, otherwise the API version will alsways be 0. The
struct is zeroed at renderer shutdown.
Changes are:
* SDL_SetWindowGrab() was renamed to SDL_SetWindowMouseGrab().
* SDL doesn't give precalculated battery states anymore. Use the same
scale as SDL 3.1.0, 20% is low and 1% is empty.
With SDL3 the high dpi support is in much better shape than with SDL2.
And for Wayland the experience on high dpi displays is generally better
when the application is high dpi aware.
Reimplement `SDL_BackendInit()` and `SDL_BackendShutdown()` for SDL 3.
Hide now unnecessary locking calls behind !USE_SDL3. To minimize code
duplication `SDL_Callback()` is hidden behind a wrapper function.
SDL_INIT_VIDEO includes SDL_INIT_EVENTS when initialized through
SDL_Init(), but not when shutdown to SDL_Quit(). Handle the shutdown
in the input subsystem. This closes some memory leaks in SDL.
With SDL 2 the refreshrate handling was rather limited by SDL 2 only
supporting integer refreshrates, making it impossible to represent the
common 59.95hz and other non-integer refreshrates. Quake II works around
this by assuming a refreshrate of 2hz higher than returned by SDL.
SDL 3 finally supports float refreshrates. Refactor the internal API to
also use floats.
This should be a no-op since the 'refreshrate * 1.02' logic stayes in
place for the time being. This can be reevaluated at a later time for
the SDL 3 build, but needs testing.
As a nice side effect fix the `vid_displayrefreshrate` cvar. It was
broken in both SDL 2 and 3 since it was always overwritten with the
actual display refresh rate.
In SDL 2 the first display was 0 and the error code -1. In SDL 3 this
changed to 1 as the first display and 0 for the error code. While at
it implement error handling and fallbacks for all cases.
SDL 3 has a new approach to fullscreen handling, which is way better
than the old fiddling with several window flags. In SDL 3:
* The SDL_FULLSCREEN_FLAG puts the window in fullscreen window mode.
* For exclusive fullscreen a fullscreen mode must be requested and set.
* Applying the mode to the window is asynchronous, the mode change may
occure at any later time. The window can be synchronized to force the
mode change.
This is - of course - totaly untested, since the client doesn't build
yet with SDL 3. There will likely be bugs and shortcomings.
And the code is still ugly, it can be refactored somewhat more.
Not many changes here. `make ref_gl1` now builds a library and it works
with the proof of concept port of the client.
SDL3 dropped support for hardware gamma, so `vid_gamma` will be ignored
until we can come up with something else. If we can, gamma without
shaders is hard to impossible :/
SDL3 TODOs will be marked with 'TODO SDL3:'.