Using SDL 2 on Windows

Remember, just because you request it, that doesn't mean you'll get it.

Moderator: GZDoom Developers

Professor Hastig
Posts: 234
Joined: Mon Jan 09, 2023 2:02 am
Graphics Processor: nVidia (Modern GZDoom)

Using SDL 2 on Windows

Post by Professor Hastig »

I am aware of the reasons why GZDoom on Windows uses a native backend but since SDL2 has come a long way since the days this decision was made, would it make sense to reverse that decision?

It is true that may games based on the old SDL v1 exhibit some technical issues on Windows, sometimes serious ones, but I never experienced any of this with SDL2 - unless there is some bad coding on the game side it works flawlessly with virtually everything.
The reason I'm asking? Controller support! SDL 2 has excellent handling of different controllers that far eclipses the old code from ZDoom that's still being used in GZDoom and where I see zero chances that it ever gets upgraded to modern standards.

That being said, what would be the downside? After having a look over the Win32 backend code, its main tasks are
- input handling
- video backend creation
- crash handling

Is there anything in here that still warrants maintaining 3 system specific backends, including macOS?
User avatar
Rachael
Posts: 13593
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her

Re: Using SDL 2 on Windows

Post by Rachael »

Completely unifying the backends is something I've wished could be done. It really would be nice to have a change which, once effected, only ever has to be done once.

I think the most major concern was how it would handle international IME's if enabled on Windows. Particularly Asian or Arabic languages which do not necessarily always go LTR. If it can do those okay, I guess it would make sense to fully transition.
User avatar
Chris
Posts: 2942
Joined: Thu Jul 17, 2003 12:07 am
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: Using SDL 2 on Windows

Post by Chris »

IIRC, Graf once said mouse movement through SDL (2?) wasn't as good as using the native APIs on Windows, that it was sluggish or had some kind of acceleration or something. I don't know if that's still true.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49090
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Using SDL 2 on Windows

Post by Graf Zahl »

I am fairly certain that modern SDL uses RawInput for the mouse, just like the native backend, but someone would have to set this up and run some tests. The controller issue is a good point, GZDoom's code has indeed seen very little change over the last 15 years. If it can be proven that SDL is just as good on Windows and moving to SDL would simplify matters I won't stand in the way.
I cannot say anything about IMEs but in all seriousness, running these things in a gaming context is an open invitation for trouble, but for that I'd have to ask someone with experience because I've never used such a thing.

An added problem we are facing is macOS. Without anyone in the position to implement the new picker popup there the platform is kind of stuck. AFAIK the reason why the Cocoa backend was made was the poor performance of the original software renderer, but that's long gone, so even if we could just move the Mac version back to SDL would probably help somewhat.
Completely unifying the backends will never be possible anyway, things like the crash logger or the platform specific folder paths both for saving and Steam/GOG will have to remain separate.

Return to “Feature Suggestions [GZDoom]”