Skip to content

Update SDL to latest main#284

Merged
smoogipoo merged 5 commits into
ppy:masterfrom
bdach:updates
Jun 23, 2026
Merged

Update SDL to latest main#284
smoogipoo merged 5 commits into
ppy:masterfrom
bdach:updates

Conversation

@bdach

@bdach bdach commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Add unambiguous instructions how to update SDL

There were none other than a vague hint at half of it in README.

Update SDL submodule to latest main

Doing this to include libsdl-org/SDL#15687, with the hopes of it fixing recent reports of regressing performance and/or fullscreen behaviours (ppy/osu#38121, ppy/osu#38125). I was able to reproduce the part of it to do with the system-level framerate no longer being respected, and updating to latest main does appear to have fixed that issue.

I will say that I think that the established practice of pointing the SDL submodule at wherever upstream main is at time of last person touching this repository contributes a lot to our collective chagrin related to random SDL breakage, and that we should start pointing the submodule at actual tagged stable releases. I almost did that here, but doing so resulted in some code getting removed from the generated bindings, and I did not want to explain myself further.

Fix binding generator emitting duplicate symbols for functions marked unsafe

SDL_system.h now contains a

extern SDL_DECLSPEC const char* SDLCALL SDL_GetDeviceFormFactorName(SDL_FormFactor form_factor);

function which gets marked with the Unsafe_ prefix due to returning a string pointer via a ClangSharp remap.

generated_symbol_regex does not match methods marked Unsafe_. This led to generate_platform_specific_headers() not excluding that method, therefore emitting one extra copy of it per platform, thus causing binding compilation failures.

This adds the prefix into the regex so that relevant methods can match.

Of note, the Unsafe_ prefix is placed in a non-capturing group, and that non-capturing group is not inside the 2nd group that get_generated_symbols() uses to retrieve the function name. This is because the output of get_generated_symbols() gets passed back to ClangSharp, which means that the original function name has to be retrieved for the exclusion of platform-agnostic marked-unsafe functions to actually work.

bdach added 4 commits June 22, 2026 10:28
… unsafe

`SDL_system.h` now contains a

```c
extern SDL_DECLSPEC const char* SDLCALL SDL_GetDeviceFormFactorName(SDL_FormFactor form_factor);
```

function which gets marked with the `Unsafe_` prefix due to returning a
string pointer via a ClangSharp remap.

Due to the `Unsafe_` remap, `generated_symbol_regex` no longer matches
methods marked `Unsafe_`. This led to
`generate_platform_specific_headers()` not excluding that method,
therefore emitting one extra copy of it per platform, thus causing
binding compilation failures.

This adds the prefix into the regex so that relevant methods can match.

Of note, the `Unsafe_` prefix is placed in a *non-capturing group*, and
that non-capturing group *is not inside the 2nd group* that
`get_generated_symbols()` uses to retrieve the function name. This is
because the output of `get_generated_symbols()` gets passed *back to
ClangSharp*, which means that the *original function name* has to be
retrieved for the exclusion of platform-agnostic marked-unsafe functions
to actually work.
@bdach bdach requested review from Susko3 and smoogipoo June 22, 2026 09:11
@bdach bdach self-assigned this Jun 22, 2026
@bdach bdach moved this from Inbox to Pending Review in osu! team task tracker Jun 22, 2026
@Susko3

Susko3 commented Jun 22, 2026

Copy link
Copy Markdown
Member

I will say that I think that the established practice of pointing the SDL submodule at wherever upstream main is at time of last person touching this repository contributes a lot to our collective chagrin related to random SDL breakage, and that we should start pointing the submodule at actual tagged stable releases. I almost did that here, but doing so resulted in some code getting removed from the generated bindings, and I did not want to explain myself further.

Using stable releases (or the tip of the stable branch) makes sense. We can try switching to it when SDL 3.6.0 is out (probably next year), or sooner if we feel like it.

@smoogipoo smoogipoo merged commit 59021ba into ppy:master Jun 23, 2026
4 checks passed
@github-project-automation github-project-automation Bot moved this from Pending Review to Done in osu! team task tracker Jun 23, 2026
@bdach bdach deleted the updates branch June 23, 2026 05:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants