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

[WIP] MetalANGLE support? #448

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

[WIP] MetalANGLE support? #448

wants to merge 2 commits into from

Conversation

misl6
Copy link
Member

@misl6 misl6 commented Apr 18, 2020

Apple deprecated OpenGLES.framework since iOS 12.

This is a first-stage testing and migration to MetalANGLE, a OpenGL ES to Metal API translation layer.

It's something I'm going to work on weekends, I hope is going to be ready for when Apple will remove support for opengles.

TODO:

  • Test, test, test, test, and test again
  • Wait for glGenerateMipmap fix or disable mipmap
  • Cleanup

KNOWN ISSUES:

@misl6
Copy link
Member Author

misl6 commented Apr 25, 2020

Tested over touchtracer and showcase and works fine with mipmapping disabled.

@misl6 misl6 force-pushed the metalangle branch 3 times, most recently from 3ce2a3c to 7eb3b2f Compare April 26, 2020 09:59
@misl6
Copy link
Member Author

misl6 commented Apr 26, 2020

  • ✔️ mipmap issue got fixed thanks to @kakashidinho (The author of MetalANGLE).
  • 📫 I proposed to the SDL2 team a migration to MetalANGLE.framework in order to not rely on my patched repo in the future.
  • 🏭 Updated toolchain to automagically include embedded frameworks inside the project

Testing it's still appreciated

@misl6
Copy link
Member Author

misl6 commented May 23, 2020

Update:

@mbrockman1
Copy link

If this is merged, I noticed that XCode fails to build the app because the target is iOS 8.1+ and Metal is only supported on iOS 12+

@misl6
Copy link
Member Author

misl6 commented Sep 24, 2020

@mbrockman1
It's not merged yet.
You're using it for some specific reason or just for testing?

@mbrockman1
Copy link

@misl6
Only for testing.
You are a legend for setting this up by the way. If it is helpful, I could identify all the problems I had from start to finish in making the app using your branch.

@misl6
Copy link
Member Author

misl6 commented Sep 24, 2020

@mbrockman1 Sounds good to have some testing and reporting!

FYI: I'm not expecting to remove the WIP tag and requesting for a merge until at least one of these two conditions are met:

  1. Apple removes support for OpenGL

  2. An intuitive and recipe oriented method for selecting OpenGL vs MetalANGLE during compilation is available.

I was working on the 2nd option, but then I had to stop due to lack of free time.

Apart of that, feel free to send bug reports or suggestions!

@mbrockman1
Copy link

I posted this in discord. I was using a blend of your pull request plus the latest Kivy-iOS master to attempt to release an app. Here is a list of the problems and how I revolved them:

- Had to hard code Python.h and initconfig.h in Xcode
*fix: https://www.reddit.com/r/kivy/comments/gr1zep/xcode_validate_fails_cant_find_pythonh/*

- Line 1473 & 1477 of kivy-ios/toolchain.py was causing an import error
Import xcassets => from .tools.external import xcassets

- Had issues with icon generation to the point where I had to make my own and put them into the assets folder. I dont know if it is related to xcassets import or not.

- The MetalAngle branch worked well, only thing that needed adjustment was increase the target deployment to iOS 12+ from iOS 8.1+ because that is when Metal started support.

- Missing purpose string for NSCamera fixed by following this: https://stackoverflow.com/questions/44690075/xcode-missing-info-plist-key-for-nscamerausagedescription/49439492#49439492

- Had to specify “-exportOptionsPlist” but regardless buildozer iOS release didnt work so I had to release it via Xcode. Link: https://github.com/kivy/kivy-ios/issues/326#issuecomment-451656753

- Had to cut iPad support due to this issue: https://forum.defold.com/t/error-itms-90474-invalid-bundle-ipad-multitasking-support-requires-these-orientations/56128

@kakashidinho
Copy link

FYI, MetalANGLE requires iOS min version 9.0 not 12.0. You can set deployment target 9.0 and it should still work (although it will fallback to native OpenGL on pre iOS 11.0 devices but from application point of view everything will work the same)

@misl6 misl6 force-pushed the metalangle branch 2 times, most recently from df4e6f2 to aa0aa11 Compare April 25, 2021 10:42
@misl6
Copy link
Member Author

misl6 commented Apr 25, 2021

Some updates:

  • I did a complete rework of the SDL2 code, so it could hopefully get merged into the SDL2 upstream, I will submit a PR ASAP.
  • Now We share the same SDL codebase for both MetalANGLE and OpenGLES versions of SDL2 provided views.
  • Our user is able to select the needed (by default it's still OpenGLES) SDL2 by using an environment variable (export KIVYIOS_USE_METALANGLE=1)
  • Now We're downloading the provided binaries for MetalANGLEwithout building them. (Definitely faster, but that behavior could be changed if someone have some concerns about it)

What is unsupported right now:

  • Due to how Apple Framework are managed, at this time (due to lack of time) We're unable to build for both iOS and iOS Simulator without the intervention of the user, by default, the toolchain selects iOS. This could be easily managed by creating an xcframework

Will add a specific section for "Building with MetalANGLE.framework in README.md after the SDL PR.

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

Successfully merging this pull request may close these issues.

None yet

3 participants