iOS Metal

Hi

Just working through the beta 5 (b9)

I’m a bit confused regarding the new Metal API.
Does unity 5 compile for it?

It can be set in the player settings → Settings for iOS → Graphics API. Anything else needed?

To my knowledge Metal is an iOS 8+ feature, the Target iOS Version cannot be set to anything higher than 7.1. What does that do?

If I set it to Metal, all my custom shaders, run invalid. Do I need to compile them specifically for metal?
Currently they are set to:

#pragma target 3.0
#pragma glsl
#pragma only_renderers gles d3d9

Seems I have to set it to:

#pragma only_renderers metal d3d9

Now the code compiles for Metal (If I go to “Compile and show code → Metal”)

I noticed I can set the Target Version to 8.1 in xcode.

But the shader doesn’t run on my IPad (IOS8.1.1, Xcode 6.1), they all fall back to vertex lit.
With the error:
… Pass ‘’ shader state not supported
… All passes removed
… Setting to default shader.

Ability to target iOS 8 was added in Beta 14

Metal support will exist in Unity 5 and Unity 4.6.x (But not 4.6.0)

Yes.

By default you don’t have to do anything. The default setting (“automatic” graphics API) will use Metal when on iOS8+ and capable device. On older OSes or older devices, OpenGL ES will be used.

You don’t have to do anything like that. See above - if you’re running on iOS8 and capable device, then Metal will be used under default settings.

Right there in your shader, you say “I’m for Direct3D 9 and OpenGL ES only”. Why? Stop doing that :slight_smile:
Right now your shader will not work on D3D11, Mac/Linux, Metal, or any of the consoles.

Clarification: Metal already exists in Unity 5.0 builds (since beta 9 or so - i.e. all public preorder betas have it). If you have problems with it, report bugs!

We’re also working on backporting Metal to 4.x, since apparently many in-production games do not want to switch to a major Unity version midway, but they want Metal.

2 Likes