Skip to content

SDL 3#749

Draft
timangus wants to merge 3 commits into
mainfrom
sdl3
Draft

SDL 3#749
timangus wants to merge 3 commits into
mainfrom
sdl3

Conversation

@timangus

@timangus timangus commented Aug 4, 2025

Copy link
Copy Markdown
Member

This isn't ready for review yet, I'm just putting it here as a placeholder/discussion point. It's a bare minimum get it compiling and ostensibly working effort. That being said there are quite a small number of things missing:

  • Video gamma/brightness support is missing as SDL 3 removed it citing difficulty supporting it; will need to be replaced with a shader I guess. Not sure what we do for the GL1 renderer.
  • SDL 3 seems to be more pixel density aware, though I confess I haven't looked into how or if that affects us.
  • Linux distros don't appear to have caught up yet in terms of having SDL 3 packages, so it's probably way too soon to merge to main anyway.

Actually that's it, I think; surprisingly straight forward. Much easier than 1.2 -> 2.0 was.

Comment thread code/client/keycodes.h
K_PAD0_PADDLE3, /* Xbox Elite paddle P2 */
K_PAD0_PADDLE4, /* Xbox Elite paddle P4 */
K_PAD0_TOUCHPAD, /* PS4/PS5 touchpad button */

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Key codes are passed to the CGame/UI API. If any mods/games added support for K_PAD0_LEFTSTICK_LEFT, etc in the menu, this change would break it. This is purely hypothetical—I don't know of such mods—but that's why these buttons were separate.

K_CONSOLE is never passed to VMs, so it's last.

@timangus timangus Aug 5, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah OK, I wondered what all that stuff was about. I've made a change on main to make this mapping more robust and a bit more readable, but I will also append the new buttons so they don't cause reordering.

@zturtleman

Copy link
Copy Markdown

By the way, icculus also ported ioq3 to SDL3. The function typedefs for casting function pointers seem cleaner in that port (for SDL_GL_GetProcAddress(), etc) . I haven't significantly reviewed either branch to have many comments about them.

@Calinou

Calinou commented Aug 4, 2025

Copy link
Copy Markdown
  • Video gamma/brightness support is missing as SDL 3 removed it citing difficulty supporting it; will need to be replaced with a shader I guess. Not sure what we do for the GL1 renderer.

See #632.

  • SDL 3 seems to be more pixel density aware, though I confess I haven't looked into how or if that affects us.

This probably won't have an effect on ioquake3 to my knowledge. I think mouse sensitivity is already DPI-independent, and 2D scaling has always been automatically scaled according to resolution in id Tech 3 (with the exception of console text, but /con_scale can fix that).

@timangus

timangus commented Aug 5, 2025

Copy link
Copy Markdown
Member Author

By the way, icculus also ported ioq3 to SDL3. The function typedefs for casting function pointers seem cleaner in that port (for SDL_GL_GetProcAddress(), etc) . I haven't significantly reviewed either branch to have many comments about them.

Two things I wish I'd known about before starting:

  1. Ryan's port.
  2. The semantic patching tool. That's cool.

Oh well, as I say it didn't take very long anyway. It's quite spooky how similar our patches turned out, though I missed some stuff he caught and vice versa, so it's net beneficial I guess. I had a quick skim through the video. Got slight spider man meme vibes at the sound section as I think most of the code he talks about saying "oh they have done X or Y..." was originally written by... Ryan 😁.

@timangus

timangus commented Aug 5, 2025

Copy link
Copy Markdown
Member Author
  • Video gamma/brightness support is missing as SDL 3 removed it citing difficulty supporting it; will need to be replaced with a shader I guess. Not sure what we do for the GL1 renderer.

See #632.

👍

  • SDL 3 seems to be more pixel density aware, though I confess I haven't looked into how or if that affects us.

This probably won't have an effect on ioquake3 to my knowledge. I think mouse sensitivity is already DPI-independent, and 2D scaling has always been automatically scaled according to resolution in id Tech 3 (with the exception of console text, but /con_scale can fix that).

The thing that made me suspect some pixel density shenanigans is going on is that for a given r_mode, on my high density display laptop when using SDL 3 the window appears much larger than it did under SDL 2. As I say though, I haven't looked into it in any detail, so that symptom could be something else entirely.

@inolen

inolen commented Dec 27, 2025

Copy link
Copy Markdown

What's the plan for merging this?

@timangus

Copy link
Copy Markdown
Member Author

The main blockers are doing something about gamma control and waiting for SDL packages to exist on popular Linux distros. Why do you ask?

@inolen

inolen commented Dec 27, 2025

Copy link
Copy Markdown

I've been updating a project I setup a decade ago and ran into some SDL2 issues in the browser. Given the SDL3 browser code has been changed substantially, I wanted to check in on the status of that before investing much time in patching up SDL2.

@timangus timangus mentioned this pull request May 21, 2026
@timangus

timangus commented Jul 1, 2026

Copy link
Copy Markdown
Member Author

For what it's worth I did try using the libsdl-org/setup-sdl github action, and it works fine for the Linux and Linux (external libs) builds, but only those, so for sake of keeping it homogeneous I decided against using it. In detail:

Windows and macOS use the internal SDL copy
32 bit Linux doesn't appear to be supported (might be wrong here)
Emscripten doesn't appear to be supported (ditto)
The BSDs run in VMs (in a VM) so obviously the GHA won't be available in the VMs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants