kakashidinho / metalangle

MetalANGLE: OpenGL ES to Metal API translation layer
Other
459 stars 64 forks source link

Building for visionOS (xrOS) #93

Open lirbar opened 10 months ago

lirbar commented 10 months ago

Hi,

Is it easy enough to add support for building with visionOS (xrOS) SDK ?

Both EAGLContext and CAEAGLLayer are not available on visionOS. Tested on Xcode 15.1 beta 3, visionOS SDK beta 6.

OpenGL ES framework is available on visionOS (although deprecated, as on all other Apple platforms). As seen here:
https://developer.apple.com/documentation/opengles

huntermonk commented 9 months ago

We are interested in this as well. Notably, OpenGL ES and GLKit are described as not available in visionOS in the Apple docs:

image

In addition, on Xcode Version 15.0 beta 8 (15A5229m), I can confirm that attempts to build a visionOS app referencing either MetalANGLE-flavored framework will result in an error similar to below:

'glEnable' is unavailable: not available on visionOS

That error occurs even when MetalANGLE is imported; clicking into glEnable correctly opens the path project-root/Libraries/MetalANGLE.framework/Headers/GLES2/gl2.h.

Lastly, when attempting to build the MetalANGLE SDK for native Vision Pro simulator, not Vision Pro (Designed for iPad), Vision Pro is not an option for building.

UInt2048 commented 9 months ago

Maybe I'm missing something obvious, but why are you compiling in the OpenGLES backend? Just use the Metal backend and/or MGLKit.

lirbar commented 9 months ago

Maybe I'm missing something obvious, but why are you compiling in the OpenGLES backend? Just use the Metal backend and/or MGLKit.

We are just unfamiliar how. Can you direct how we can exclude building the OpenGLES backend from the MetalAngle Xcode project?

UInt2048 commented 9 months ago

@lirbar Have you tried simply removing the angle_gl_backend library from whatever target you're building?

lirbar commented 9 months ago

@UInt2048 thank you! that worked. I needed to change a few small things but metalangle now builds and works as expected on visionOS.

danoli3 commented 9 months ago

Great news! Shall someone update the xcode example with a stripped back build with just what we need or please document steps required for visionOS linking success. Screenshot of project linked built binaries plz

lirbar commented 9 months ago

Here is a zip file with the files I updated in order to build. Also included a new script: generate_MetalAngle_xcframework.sh

Which will create XCFramework for all Apple devices and simulators (iOS/iPadOS, macOS, Mac Catalyst, tvOS and visionOS). Just make sure you have all these SDKs installed in Xcode.

https://drive.google.com/file/d/1X9wJ8urgJmPql-pxFDWThd72gPYoImJv/view?usp=sharing

danoli3 commented 9 months ago

Thanks @lirbar legend!