Fun times ahead for game developers, as the very popular SDL (Simple DirectMedia Layer) has a preview of the upcoming SDL 3 now available for feedback and testing.
What is SDL used for? It's a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware on many different platforms like Linux, macOS, Windows, iOS and Android.
Yesterday, March 24th, Sam Lantinga of Valve announced the preview.
Some of the highlights of SDL 3 include:
- The API has been significantly reworked to be easier to use and more consistent
- The 2D rendering API now has support for more advanced colorspaces and HDR rendering
- The 2D rendering API now has a Vulkan backend
- An example of hardware accelerated video playback using ffmpeg has been added in test/testffmpeg.c
- The shaped window API has been replaced with transparent windows
- Time and date functions have been added in SDL_time.h
- Support for webcam video capture has been added in SDL_camera.h
- Support for handling pens and tablets has been added in SDL_pen.h
- Support for file open and save dialogs has been added in SDL_dialog.h
- Cross-platform functions for working with files and directories are available in SDL_filesystem.h
- A cross-platform abstraction for working with user and game data has been added in SDL_storage.h
- Handling of main() has been moved to a header library and an optional callback-based program flow is available
- Support for simple object properties has been added in SDL_properties.h. These properties are available on many SDL objects, and can be used for more advanced functionality.
Additionally, one thing that seems to be changing, is moving the default back to X11 instead of Wayland due to various issues that need solving.
Some you may have missed, popular articles from the last month:
We're nearing a final release! Exciting news since this could become the default for games going forward.
2 Likes, Who?
Interesting to see two Valve employees, Joshua Ashton and Sam Lantinga, as contributors and even creator/maintainer of SDL. I wonder how many more there are.
Taking a look at the CREDITS.md file:
And just as an interesting point-of-fact:
That Wayland vs X11 issue is quite contentious. We've got everyone from Conan-Kudo, Xaver Hugl from KDE, to Mattias Klumpp weighing in on it. One thing that strikes me is how long it would take for Wayland support to be implemented if the missing protocol isn't merged in time for SDL3's release:
What's more, every major desktop is now Wayland-first, and GNOME is soon to be Wayland-only, maybe next year. The XWayland X server is still around, so there's still support for the features SDL needs...but it also has problems.
Shipping a broken default is the wrong thing to do. Unfortunately, that protocol is unlikely to be finished before SDL3's release (3+ months away).
Two bad options. There's suggestions of flipping the default later on in the lifecycle of SDL3 once this protocol is implemented, and that seems like what's going to happen. I'm not sure what the downsides of this are.
Taking a look at the CREDITS.md file:
QuoteMike Sartain for incorporating SDL into Team Fortress 2 and cheering me on at Valve.
Pierre-Loup Griffais for his deep knowledge of OpenGL drivers.
And just as an interesting point-of-fact:
QuoteEverybody at Loki Software, Inc. for their great contributions!
That Wayland vs X11 issue is quite contentious. We've got everyone from Conan-Kudo, Xaver Hugl from KDE, to Mattias Klumpp weighing in on it. One thing that strikes me is how long it would take for Wayland support to be implemented if the missing protocol isn't merged in time for SDL3's release:
QuoteIf we do this, we are basically accepting these issues are unfixable for the next ten years (SDL4).
What's more, every major desktop is now Wayland-first, and GNOME is soon to be Wayland-only, maybe next year. The XWayland X server is still around, so there's still support for the features SDL needs...but it also has problems.
Shipping a broken default is the wrong thing to do. Unfortunately, that protocol is unlikely to be finished before SDL3's release (3+ months away).
Two bad options. There's suggestions of flipping the default later on in the lifecycle of SDL3 once this protocol is implemented, and that seems like what's going to happen. I'm not sure what the downsides of this are.
5 Likes, Who?
I can't wait until this get released. And, of course, that pygame gets sdl3 support. I'd love to see my silly 2D games perform better with Vulkan graphics
0 Likes
QuoteConan-Kudo: Having this as the default in SDL3 (which isn't being used yet!) is important for signaling to other stakeholders that we actually do need to get solutions in place for detected issues.
QuoteJoshua-Ashton: SDL is not your tool for "signaling to stakeholders" about what is important. It's an actual library used by real developers and users!
You are suggesting we do those users and developers a disservice by forcing an fundamentally broken default onto them purely for your own ideological reasons.
It's really important as a developer is to be pragmatic and separate your own desires from what actually benefits your customers/users.
*Stands up and applauds*
HELL YEAH! Thank you Joshua! Perfectly put.
Can we frame that quote from Joshua and put it on a sign that we lift up and show people every time they suggest pushing on users something that's broken for ideological reasons?
0 Likes
I recently built a barebones pdf viewer (with libmupdf as engine) on SDL3; native wayland works perfectly well in my testing, and libdecor takes care of the CSD on the windows just fine.
Not that my opinion is worth anything as a silly amateur, but one thing that *was* pretty frustrating with SDL is the formatting of the documentation in their wiki; and that the site index would take you to SDL2 functions if you weren't careful. I'm hoping that the documentation gets a better website after the SDL3 release.
Not that my opinion is worth anything as a silly amateur, but one thing that *was* pretty frustrating with SDL is the formatting of the documentation in their wiki; and that the site index would take you to SDL2 functions if you weren't careful. I'm hoping that the documentation gets a better website after the SDL3 release.
4 Likes, Who?
Quoting: pleasereadthemanualPierre-Loup Griffais for his deep knowledge of OpenGL drivers.
That skilllset isn't especially surprising: Valve poached him from the Linux driver team at Nvidia.
4 Likes, Who?
Even with later versions of SDL2, Wayland support is fairly good, but the absolute biggest problem for me is scaling. This is something Wayland does that Xorg cannot; X11 has no standardized way of scaling applications at all.
Worse, even most Wayland applications don't support the newer fractional scaling protocol, which particularly for games has a HUGE cost to performance. If fractional scaling isn't supported, the compositor has to tell the application to render at 2x scale at a higher resolution, and then downscale. With my 4K monitor, which is already a stress on my GPU, that means having to render at an even HIGHER resolution.
I've exclusively used Linux for over a decade now, but this is the one thing I'm envious of Windows for. The lack of scaling support in general, let alone fractional scaling, makes it painful to use a high-DPI monitor. And currently, as far as I'm aware, Wayland is the only thing trying to fix that; there's still no standardized way of doing scaling with X11, just a variety of library-specific ways using Gtk, Qt, etc.
Also worth mentioning that until Xorg MR 733, or something equivalent, gets merged, Xwayland is fundamentally broken on systems using scaling, as it will always render applications at a lower resolution and then upscale (although some DEs like Plasma have implemented their own non-standard solutions to fix this temporarily iirc). Even with MR 733, that just fixes the regression over native X11, you still have no scaling because that's not a feature native X11 supports. The design of X11 means it's fundamentally not possible to create a general solution to scaling.
TL;DR Wayland addresses some serious problems with gaming on Linux which are not addressed by X11 and likely never will be now that it's on the way out.
Worse, even most Wayland applications don't support the newer fractional scaling protocol, which particularly for games has a HUGE cost to performance. If fractional scaling isn't supported, the compositor has to tell the application to render at 2x scale at a higher resolution, and then downscale. With my 4K monitor, which is already a stress on my GPU, that means having to render at an even HIGHER resolution.
I've exclusively used Linux for over a decade now, but this is the one thing I'm envious of Windows for. The lack of scaling support in general, let alone fractional scaling, makes it painful to use a high-DPI monitor. And currently, as far as I'm aware, Wayland is the only thing trying to fix that; there's still no standardized way of doing scaling with X11, just a variety of library-specific ways using Gtk, Qt, etc.
Also worth mentioning that until Xorg MR 733, or something equivalent, gets merged, Xwayland is fundamentally broken on systems using scaling, as it will always render applications at a lower resolution and then upscale (although some DEs like Plasma have implemented their own non-standard solutions to fix this temporarily iirc). Even with MR 733, that just fixes the regression over native X11, you still have no scaling because that's not a feature native X11 supports. The design of X11 means it's fundamentally not possible to create a general solution to scaling.
TL;DR Wayland addresses some serious problems with gaming on Linux which are not addressed by X11 and likely never will be now that it's on the way out.
1 Likes, Who?
Quoting: pleasereadthemanualQuoteIf we do this, we are basically accepting these issues are unfixable for the next ten years (SDL4).
[...]
Shipping a broken default is the wrong thing to do. Unfortunately, that protocol is unlikely to be finished before SDL3's release (3+ months away).
Two bad options. There's suggestions of flipping the default later on in the lifecycle of SDL3 once this protocol is implemented, and that seems like what's going to happen. I'm not sure what the downsides of this are.
I'm not interested enough to go and read the whole debate. But is there really a 10 year life cycle for SDL? Or something preventing them from releasing SLD4 a year from now?
0 Likes
Quoting: hell0There is no evidence supporting this one way or the other that I can find, aside from Conan-Kudo's argument. He is the only one that mentioned it, and no one else responded about it. I couldn't find any information about how long SDL versions are supported for.Quoting: pleasereadthemanualQuoteIf we do this, we are basically accepting these issues are unfixable for the next ten years (SDL4).
[...]
Shipping a broken default is the wrong thing to do. Unfortunately, that protocol is unlikely to be finished before SDL3's release (3+ months away).
Two bad options. There's suggestions of flipping the default later on in the lifecycle of SDL3 once this protocol is implemented, and that seems like what's going to happen. I'm not sure what the downsides of this are.
I'm not interested enough to go and read the whole debate. But is there really a 10 year life cycle for SDL? Or something preventing them from releasing SLD4 a year from now?
I can only assume it's based on the time between SDL1 and SDL2, and now SDL2 and SDL3.
0 Likes
development-adoption cycles for SDL can't be very fast... it must offer a truly stable API once each version is released and the older versions must keep working after a new one is released (directly or via a drop-in replacement shim from the old version to the new, as was done for SDL 1.2 over SDL 2)
this is because games are mostly proprietary static apps released once and never touched again afterwards (not by their devs, nor anyone else), unlike common foss linux apps that are constantly adapted to newer libs and their modified APIs
if they release new versions of SDL every year they'll quickly build up a huge inertial mass of legacy APIs/libs to support forever and that will eat away from new efforts
they could delay SDL3... but that only helps if Wayland devs clearly signal they'll solve their end of the issue soon with high priority... which seems a bit unlikely, though Valve does have plenty of people working for them on both things, iirc
Last edited by Marlock on 26 March 2024 at 9:31 am UTC
this is because games are mostly proprietary static apps released once and never touched again afterwards (not by their devs, nor anyone else), unlike common foss linux apps that are constantly adapted to newer libs and their modified APIs
if they release new versions of SDL every year they'll quickly build up a huge inertial mass of legacy APIs/libs to support forever and that will eat away from new efforts
they could delay SDL3... but that only helps if Wayland devs clearly signal they'll solve their end of the issue soon with high priority... which seems a bit unlikely, though Valve does have plenty of people working for them on both things, iirc
Last edited by Marlock on 26 March 2024 at 9:31 am UTC
1 Likes, Who?
See more from me