3 ms·
Feels like SDL3 suffers the second system effect. (SDL2 was just SDL1 with explicit window handles, so SDL3 is the second system, not the third). SDL1/2 is a th
by immibis 2y ago
Feels like SDL3 suffers the second system effect. (SDL2 was just SDL1 with explicit window handles, so SDL3 is the second system, not the third). SDL1/2 is a thin layer that wraps the platform-specific boilerplate of opening a window and handling input events, so you can get to the OpenGL rendering stuff that you actually wanted to write.
- caspar 2y agoIf you only want to support Windows/Linux/Android, then sure, you can definitely argue that the SDL GPU API is bloat. But if you want to support Apple's operating systems then you're stuck with OpenGL 4.1 (officially deprecated by Apple 5 years ago) - so no modern GPU features like compute shaders. You can go the Vulkan route and use MoltenVK for Apple systems, but Vulkan is quite a step up in complexity from OpenGL ("1000 lines of code for a triangle" as people like to say). The goal for SDL3's GPU API is to give you a more approachable (but still plenty flexible) alternative to that. And similar story for consoles, presumably. Apparently lots of people asked for "SDL_render but can you add shader support that works for all platforms", so that's the origin story. SDL3 does also add a higher level audio API - I don't know much about its merits.
- caspar 2y agoAh, I managed to dig up the original announcement post[0]; relevant snippet: > But this is terrible advice in 2021, because OpenGL, for all intents and purposes, is a deprecated API. It still works, it's still got some reasonably modern features, but even if you add up the 22 years Microsoft spent trying to kill it with Apple's seven-or-maybe-twenty, it doesn't change the fact that the brains behind OpenGL would rather you migrate to Vulkan, which is also terrible advice. > It seems bonkers to tell people "write these three lines of code to make a window, and then 2000 more to clear it," but that's the migration funnel--and meat grinder--that SDL users are eventually going to get shoved into, and that's unacceptable to me. [0]: https://www.patreon.com/posts/new-project-top-58563886 https://www.patreon.com/posts/new-project-top-58563886
- hgs3 2y agoBut why does the GPU API need to be in mainline SDL? Couldn't it be a separate project like SDL_net, SDL_mixer, SDL_image, and SDL_ttf? I would think that as a separate project "SDL_gpu" could be versioned independently, evolve independently, and not be obligated to support every platform SDL itself supports. In fact if "SDL_gpu" only required a windowing context, then it could presumably integrate with SDL2 and non-SDL applications!
- gary_0 2y agoSee dottrap's comment: https://news.ycombinator.com/item?id=41397198 https://news.ycombinator.com/item?id=41397198 SDL needs to be able to render graphics efficiently, but the SDL2 way is no longer sufficient. Since SDL3 is a major version change, it makes sense to overhaul it while a variety of other API-breaking improvements are being made.
- caspar 2y agoAFAICT, if you don't want to use it then you don't have to - just like you didn't have to use SDL_render in SDL2. That is what was pitched by maintainer Ryan Gordon[0][1] at least. [0]: https://github.com/libsdl-org/SDL_shader_tools/blob/main/docs/README-SDL_gpu.md https://github.com/libsdl-org/SDL_shader_tools/blob/main/doc... , though the approach that ended up getting merged was an initially-competing approach implemented by FNA folks instead and they seem to have made some different decisions than what was outlined in that markdown doc.
- gary_0 2y agoWhile using SDL for drawing is optional (and seldom done if you're doing 3D) I would like to add that its drawing API is useful to have out-of-the-box so that new/basic users can get stuff on screen right away without having to write their own high-level graphics engine first.
- creata 2y agoSlightly off-topic, but where's the complexity of Vulkan (the 1000 lines) coming from? My memory tells me that most of the misery is from the window system integration, and that the rest is pretty pleasant.
- davemp 2y agoYou have to wrangle a bunch of complex structs into rendering pipelines before you can really do anything at all: https://vkguide.dev/docs/new_chapter_3/building_pipeline/ https://vkguide.dev/docs/new_chapter_3/building_pipeline/
- cyber_kinetist 2y agoCounter-intuitively, when you actually start caring about performance (easy to write "working" Vulkan code, hard to write efficient Vulkan code that competes with DX11 driver magic)
- gary_0 2y agoSDL2 was not "just SDL1 with explicit window handles". There were a variety of changes and new features all over the API, including (like SDL3) major changes to the graphics subsystem (SDL1 used software rendering, SDL2 added hardware acceleration). Also, SDL2 has evolved considerably since 2.0.0, and SDL3 continues that evolution while allowing API-breaking changes. SDL3 is not a from-scratch re-write and as an SDL user I dont anticipate migrating from SDL2 to SDL3 will be that difficult. [edit] And SDL1/2 was never so "thin" that it didn't have its own high-level graphics system, which is useful to have out-of-the-box so that new/basic users can get stuff on screen right away. [edit2] As ahefner points out, SDL1 was pretty "thin" by modern standards, but it still gave you enough to draw basic stuff on screen without writing your own pixel math, which was pretty helpful back in the 90's.
- ahefner 2y agoSDL1 had no high-level graphics system - you either got a raw framebuffer, or an OpenGL context.
- gary_0 2y agoTrue, now that I think back, all it had was a blit function, and nowadays that's not a graphics system. (But back in the old days, I was impressed that it handled alpha blending for me! Fancy!)
- flohofwoe 2y agoThe problem is that OpenGL is (pretty much) dead, while Vulkan is a poor replacement for OpenGL when it comes to ease of use.
- shortrounddev2 2y agoYeah, there needs to be a DirectX 11-like API between Vulkan an OpenGL
- sylware 2y agoI don't run GL games anymore on elf/linux. And it has been a while. Most cross-platform game engines have a vulkan backend now. Very small teams are able to show games running the latest UE5.x engine on native elf/linux, vulkan ("vein", "shmaragon" something). But the steam client... is still 32bits and x11/GL hard dependent... I still plan to code my own wayland compositor once the steam client is ELF64 and does proper wayland->x11/vulkan->CPU fallbacks. It will feel weird to have a clean 64bits system.
- account42 2y agoThe render API was already needless bloat for many SDL users. SDL2 was also significantly larger than SDL1 in binary size already. This abstraction at least has the potential to fulfil the needs of anything more than simple 2D games while allowing you to target the sadly increasingly fragmented graphics API ecosystem (RIP dreams of an universal OpenGL(Next) future). Looks like the hardest part (shader translation) isn't there yet though.