Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ruby: Update to SDL3 #1845

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

ruby: Update to SDL3 #1845

wants to merge 2 commits into from

Conversation

jcm93
Copy link
Contributor

@jcm93 jcm93 commented Feb 19, 2025

Draft status pending ares-deps update and further testing.

In the input subsystem, changes are mostly cosmetic with renamed functions and joystick enumeration being slightly different.

In the audio subsystem, there are somewhat more significant changes. Audio queues are replaced by audio streams. The conversation between the API and the host to get a desired buffer size proceeds differently; the only way to request a specific buffer size is now via an SDL_HINT. It seems like the behavior here is quite platform-dependent. On macOS at least, it looks like we actually have more precise control over our buffer sizes with SDL3; buffer sizes no longer need be powers of 2. Performance seems to be fine; blocking behavior is somewhat different but not significantly.

@jcm93 jcm93 force-pushed the sdl3 branch 3 times, most recently from c9326e0 to 47192eb Compare February 19, 2025 18:33
@jcm93
Copy link
Contributor Author

jcm93 commented Feb 19, 2025

CI on this PR has functional builds that use SDL3; testing is welcome. This branch currently fetches updated macOS and Windows dependencies from my fork of ares-deps, which contains SDL3 as well as updated librashader and slang-shaders. To test on macOS and Windows, all that should be needed is re-running CMake and then rebuilding ares.

@bsdcode
Copy link
Contributor

bsdcode commented Feb 20, 2025

Testing on FreeBSD. Audio subsystem working fine so far. Input subsystem doesn't pick up my gamepad, SDL_GetJoysticks returns 0 found joysticks. This seems to be a specific problem with SDL3 on FreeBSD and not related to ares. I'll report the problem to the SDL3 port maintainer on FreeBSD and to SDL upstream if appropriate.

@jcm93
Copy link
Contributor Author

jcm93 commented Feb 20, 2025

Thanks for testing! Hopefully that can get figured out before long. Good to know.

@jcm93
Copy link
Contributor Author

jcm93 commented Feb 20, 2025

I pushed an update as we were enumerating devices wrong which could have caused your issue, probably worth retesting again.

@bsdcode
Copy link
Contributor

bsdcode commented Feb 20, 2025

Thanks, unfortunately this doesn't fix the issue. I can reproduce the problem with a minimal C program which just initializes the Joystick subsystem and then uses SDL_GetJoysticks to retrieve the number of the currently connected joysticks. An equivalent program using SDL2 works as expected. I opened a bug report on the FreeBSD bugzilla: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=284919

@bsdcode
Copy link
Contributor

bsdcode commented Feb 21, 2025

Another user has just reported an issue with undetected gamepads on Windows upstream: libsdl-org/SDL#12347

@bsdcode
Copy link
Contributor

bsdcode commented Feb 24, 2025

I found the problems with the SDL3 port on FreeBSD. The build system doesn't pick up the installed dependencies and the libusb backend of the HIDAPI driver needs a small patch to work with FreeBSD's implementation of the libusb API. I submitted a patch to the maintainer. With these fixes the input system detects my gamepad and it's working fine now :)

@jcm93
Copy link
Contributor Author

jcm93 commented Feb 24, 2025

Got it; thanks for chasing those down. I'm sure we can wait a bit for that to be fixed. We may or may not also want to wait for the next SDL3 release so we don't ship the 8BitDo Micro regression, since some ares users could easily have that controller.

For ares-deps on macOS and Windows we can discuss internally what to do; we could either ship an update that stays on SDL2, or just stay on the current ares-deps for the time being until the next SDL3 release.

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

Successfully merging this pull request may close these issues.

2 participants