metalangle icon indicating copy to clipboard operation
metalangle copied to clipboard

Building for visionOS (xrOS)

Open lirbar opened this issue 1 year ago • 8 comments

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

lirbar avatar Nov 15 '23 13:11 lirbar

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.

huntermonk avatar Dec 01 '23 20:12 huntermonk

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

UInt2048 avatar Dec 14 '23 18:12 UInt2048

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?

lirbar avatar Dec 14 '23 18:12 lirbar

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

UInt2048 avatar Dec 14 '23 19:12 UInt2048

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

lirbar avatar Dec 18 '23 06:12 lirbar

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

danoli3 avatar Dec 18 '23 12:12 danoli3

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

lirbar avatar Dec 18 '23 13:12 lirbar

Thanks @lirbar legend!

danoli3 avatar Dec 18 '23 16:12 danoli3