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

Migrate Lime on native platforms to use SDL3 #1848

Open
EliteMasterEric opened this issue Oct 5, 2024 · 4 comments
Open

Migrate Lime on native platforms to use SDL3 #1848

EliteMasterEric opened this issue Oct 5, 2024 · 4 comments

Comments

@EliteMasterEric
Copy link
Contributor

SDL just released version 3.1.3 stable API preview, which means that (while the library still has bugs and issues to resolve before the 3.2 stable release), no existing functions will be removed, making it stable enough for migration.

There is a very long list of useful features that migrating would enable (see the list at the link), and also a long list of issues that are resolved by updating (such as #1569), but this first requires migrating the existing places that SDL2 are used.

I originally attempted this myself by just editing the existing implementation last year, but this resulted in a bunch of graphical glitches, so updating would probably require someone more experienced with C++ and graphics APIs.

@EliteMasterEric
Copy link
Contributor Author

Some features we may find relevant (now or in the future) include:

  • Using nanoseconds for timestamps in various places
  • Using OS timestamps for input events (rather than the SDL timestamp, making it way more accurate)
  • Replacing TinyFileDialog with a more flexible and well-maintained implementation
  • Support for clipboard data of any mime type
  • Improved audio stream handling
  • New storage and file-system APIs that work across platforms
  • The new SDL Graphics API, providing access to cross-platform graphics and compute.

Plus any fixes from newer versions of SDL 2.x.

@Fancy2209
Copy link

Fancy2209 commented Dec 16, 2024

I am willing to give a jab at this since I'm interested in eventually allowing Stage3D from OpenFL to use SDL GPU and as far as I know 3.1.6 is already pretty usable. Will post updates as I get things to work.

@EliteMasterEric
Copy link
Contributor Author

EliteMasterEric commented Dec 16, 2024

I am willing to give a jab at this since I'm interested in eventually allowing Stage3D from OpenFL to use SDL GPU and as far as I know 3.1.6 is already pretty usable. Will post updates as I get things to work.

Great to hear! I'm interested to know whether you think there will be major benefits to using SDL GPU over OpenGL

EDIT: @Fancy2209 Please check this out if you haven't: https://github.com/libsdl-org/SDL/blob/main/docs/README-migration.md

@Fancy2209
Copy link

Fancy2209 commented Dec 16, 2024

I am willing to give a jab at this since I'm interested in eventually allowing Stage3D from OpenFL to use SDL GPU and as far as I know 3.1.6 is already pretty usable. Will post updates as I get things to work.

Great to hear! I'm interested to know whether you think there will be major benefits to using SDL GPU over OpenGL

EDIT: @Fancy2209 Please check this out if you haven't: https://github.com/libsdl-org/SDL/blob/main/docs/README-migration.md

The major benefit I see in SDL3 is portability

Instead of needing to maintain specific backends for platforms (like having a D3D12 backend for Xbox, GNM on PS4/5, Vulkan on Switch, GLES on Android, whatever whatever) lime could just keep the OpenGL/WebGL and the SDL GPU backend. SDL GPU could even allow WebGPU on Web as I believe that's a wip. Keep in mind I'm not a licensed console developer but I know maintaining the console versions has been an issue for lime before.

The other point is many people have been asking for OpenFL and Lime to support more"modern" graphics APIs instead of OpenGL and I believe SDL GPU is the easiest way to do this, as it'll allow support GNM, D3D12, Vulkan and WebGPU with one API.
TODO is to see how hard this'll be, it seems mostly doable but shaders might be a pain, hopefully there's a way to translate GLSL with SDL ShaderCross (or maybe I'll need to translate GLSL to Spir V and then use ShaderCross for platforms without it? Eh problem for later)

Performance improvements I'm not sure but it's probable, we'll know when it's done.

I'll first just port lime to SDL3 though, then look into GPU, as I believe the first thing will already be quite a big thing and I don't want to do an unreviewable PR.

Also I've seen the migration guide before, but I do appreciate pointing to it.

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

No branches or pull requests

2 participants