Support for iOS Metal

Apple's Metal rendering API is supported for iOS devices running iOS 8 and above when using Vuforia SDK version 5.5 and above.

This article describes how to configure native iOS apps that use the Vuforia iOS SDK to use Metal. Vuforia Unity iOS apps do not need to use the Vuforia API to configure Metal support, Metal is supported by default as the Auto Graphics API setting in Build Settings.

Configuring Metal support in native iOS apps

To use Metal in your iOS apps, you will need to pass the Metal initialization flag to Vuforia::setInitParameters in order to configure your app's rendering context before initializing the SDK. 

The METAL initialization flag is defined in the Vuforia.h header file.

enum INIT_FLAGS {
    GL_20 = 1,          ///< Enables OpenGL ES 2.x rendering (not available on UWP platforms)
    METAL = 2,          ///< Enables Metal rendering (available on Apple platforms)
    DX_11 = 4,          ///< Enables DirectX 11 rendering (available only on UWP platforms)
    GL_30 = 8,          ///< Enables OpenGL ES 3.x rendering (not available on UWP platforms)
};

In order to utilize the Metal API in your app, you will need to pass the METAL INIT_FLAGS value to the SDK using the Vuforia::setInitParameters method.
Vuforia::setInitParameters(Vuforia::METAL,"");

Note: Vuforia::setInitParameters() must be called before calling Vuforia::init() to commence with the initialization of the Vuforia SDK. The correct call sequence for initializing your app to use Metal is demonstrated in the ImageTargetsMetal Advanced Topics sample project for iOS. Metal API support can be configured by assigning the mVuforiaInitFlags variable the value Vuforia::METAL on line 144 in SampleApplicationSession.mm.
Vuforia::setInitParameters(mVuforiaInitFlags,"");

mVuforiaInitFlags can be defined when calling initAR or later in initVuforiaInBackground in the sample code.

See: Changes in Vuforia 5.5 for more information on how support for the iOS Metal APIs has been introduced the Vuforia SDK.