Page MenuHomeWildfire Games

Workaround for the SDL bug on macOS Mojave
Changes PlannedPublic

Authored by Itms on Nov 9 2018, 10:03 PM.

Details

Reviewers
trompetin17
Trac Tickets
#5341
Summary

On macOS Mojave, the game will start black; the correct fix would be to upgrade SDL and use the Metal framework, which would make us drop versions 10.9 to 10.11.
Alternatively, starting the game windowed works around the bug by trigerring a redraw of the window.

Test Plan

Check that a bundle generated like this has the correct tweaked default config.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Lint Skipped
Unit
Unit Tests Skipped
Build Status
Buildable 6443
Build 10672: Vulcan BuildJenkins

Event Timeline

Itms created this revision.Nov 9 2018, 10:03 PM
Vulcan added a subscriber: Vulcan.Nov 9 2018, 10:06 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/differential/776/

Itms, could you point me where do you see about drop 10.9 to 10.11, because when i tried sdl2.0.9 i didnt change minimal osx version and builded normally

Itms added a comment.Nov 10 2018, 2:41 AM

Itms, could you point me where do you see about drop 10.9 to 10.11, because when i tried sdl2.0.9 i didnt change minimal osx version and builded normally

Yes, but if you linked Metal dynamically, users of the built bundle will not be able to start the game if they are below 10.11. Did I misunderstand something about the availability of Metal for older versions?

elexis added inline comments.
build/workspaces/build-osx-bundle.sh
185

This won't work for people who already have a user.cfg.
Don't we have HWDetect.cpp / hwdetect.js for that? perhaps @fabio has some input on that.
(It looks like RunHardwareDetection had to be run prior to InitSDL in InitGraphics of GameSetup.cpp.)

correct fix would be to upgrade SDL

Which would be changing a number and seeing if it falls apart?

Stan added a subscriber: Stan.Nov 10 2018, 2:39 PM
Stan added inline comments.
build/workspaces/build-osx-bundle.sh
185

changing a number

Yeah basically. I believe we are still trying to limit changes for this re release...

Stan added inline comments.Nov 10 2018, 2:45 PM
build/workspaces/build-osx-bundle.sh
185

Which makes not much sense to me especially since we are trying to fix Mac.

Itms planned changes to this revision.Nov 10 2018, 3:13 PM
Itms added inline comments.
build/workspaces/build-osx-bundle.sh
185

Ah right I was thinking that users with the bug couldn't have had changed the windowed value before, since they can't use 0ad, but I was forgetting about the people who used to have a working game and upgraded to Mojave.

This is not really about limiting the number of changes, rather about not dropping users who don't have Metal. But maybe we can make two packages, one for platforms with Metal, and one for platforms without Metal (those don't have the bug).

elexis added inline comments.Nov 10 2018, 3:36 PM
build/workspaces/build-osx-bundle.sh
185

A HardwareDetect implementation would likely also prevent the user from enabling fullscreen mode.
But upgrading SDL seems to be easier than trying to mess with that? My Ubuntu is using SDL 2.0.8.
Don't we have to rework the entire graphics codebase to support using Metal instead of OpenGL?

Stan added a comment.Nov 10 2018, 3:54 PM

Metal was introduced in El Capitan (OSX 10.11)
https://en.m.wikipedia.org/wiki/Metal_(API)
I'd like trompetin17 to try to play with us and Vladislav to make sure everything is fine.

trompetin17 added a comment.EditedNov 10 2018, 3:55 PM

Just an idea, could we add code in osx about include explicitly at run time Metal Lib is you already have, because SDL2.0.9 check witch use depending on osx, isnt?

The other option is to disable "Full Screen" in osx, we already have "windowed full screen".
So we could detect that we are using osx so disabled "FULL Screen", this should be another option