googlevr / gvr-unity-sdk

Google VR SDK for Unity
http://developers.google.com/vr/unity/
Other
2.71k stars 1.09k forks source link

Metal on iOS doesn't work *at all* #331

Closed yolque closed 8 years ago

yolque commented 8 years ago

OK, I know the release notes say "Metal is not fully supported on iOS", but still...

Steps to reproduce:

  1. Create a new empty project, import the GVR package and load the Cardboard headset demo
  2. Publish for iOS with Auto Graphics API
  3. Build on Xcode, start -> crash at startup

This happens on both GVR 0.9.1 and 1.0. With OpenGLES2 it works fine.

Phone: iPhone 6s Plus iOS: 10.0.2 Unity: 5.4.1p2 Xcode:8.0

Xcode debugger says it crashes here:

0x100888b2c <+1500>: b 0x100888b48 ; <+1528> [inlined] GetPrimitiveCount at GfxDeviceMetal.mm:626

Console log from 1.9.1:


-> applicationDidBecomeActive() GfxDevice: creating device client; threaded=1 Init: screen size 1080x1920 Initializing Metal device caps: Apple A9 GPU Initialize engine version: 5.4.1p2 (a8ddefd1bf1d) OnLevelWasLoaded was found on GvrViewer This message has been deprecated and will be removed in a later version of Unity. Add a delegate to SceneManager.sceneLoaded instead to get notifications after scene loading has completed

(Filename: Line: 375)

UnloadTime: 1.221083 ms Built-in distortion correction disabled. Causes: [Requires OpenGL] GvrViewer:InitDevice() GvrViewer:Awake()

(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

/BuildRoot/Library/Caches/com.apple.xbs/Sources/Metal/Metal-85.83/ToolsLayers/Debug/MTLDebugRenderCommandEncoder.mm:2699: failed assertion `missing sampler binding at index 0 for _mtlsmp__MainTex[0].'

(lldb)

Console log from 1.0:


-> applicationDidBecomeActive() GfxDevice: creating device client; threaded=1 Init: screen size 1080x1920 Initializing Metal device caps: Apple A9 GPU Initialize engine version: 5.4.1p2 (a8ddefd1bf1d) UnloadTime: 1.118416 ms /BuildRoot/Library/Caches/com.apple.xbs/Sources/Metal/Metal-85.83/ToolsLayers/Debug/MTLDebugRenderCommandEncoder.mm:2699: failed assertion `missing sampler binding at index 0 for _mtlsmp__MainTex[0].'

(lldb)

nathanmartz commented 8 years ago

Yes. This is a known issue as mentioned. It'll be fixed in our next release, but if it's critical to you I suggest you drop back to 0.9.1.

frelei commented 7 years ago

I downgrade to 0.9.1 and I am using Xcode 8 and I am still getting the same error. Does anybody have another solution?

jaraen commented 7 years ago

same here :( I have error "failed assertion `missing sampler binding at index 0 for _mtlsmp__MainTex[0]" running 0.9.1 and xcode 8

Bersaelor commented 7 years ago

Unfortunately I encoured the error just now. GearVR version v1.0.1 and xcode8.

Just mentioning since @nathanmartz said it'll be fixed in the next release.

AliasSCM commented 7 years ago

Has this been fixed? Please let me know! I just tried it with xcode 8 and im facing this issue

gratco commented 7 years ago

I had the issue when I had a UI scene with jpgs in it. If I only run the 3D scene it works.

AliasSCM commented 7 years ago

I have a 3d scene with an imported fbx model. Its a single fbx model with materials applied to it. Im not sure whats happening at this point. It works on the play mode in the editor but crashes when i try to launch it as an iOS app.

Is this a problem with the fbx? Or something to do with the latest version of xcode. I use xcode 8 and unity 5.4.

xiangshun110 commented 7 years ago

me too. looking forward to repair

paulgailey commented 7 years ago

Apple reject non iOS 10.1 compliant apps, we're facing same problem as this thread with :

iOS 10.1, XCode 8.1, Mac OS Sierra, Unity 5.4.2p1 and Cardboard 9

WillDonohoe commented 7 years ago

I also have had this issue. Have you got an ETA for a fix?

iOS 10.1, XCode 8.0, Mac OS El Capitan, Unity 5.4.2f2

marymg78 commented 7 years ago

Disable "Metal API Validation" https://developer.vuforia.com/forum/ios/ios-10-support-black-screen#comment-56290

WillDonohoe commented 7 years ago

Works for me, thanks @marymg78

sameekhan commented 7 years ago

Worked like a charm @marymg78 appreciate it!

z3t0 commented 7 years ago

Just wanted to check in if the issue has been resolved yet? I am using @marymg78 's workaround for now and it works like a charm however.

bradbecker commented 7 years ago

still broken, I guess.

z3t0 commented 7 years ago

@nathanmartz This issue may need to be reopened as 0.9.1 did not resolve it. Thanks!

eapenzhan commented 7 years ago

All i want to know is what's the bad effect when Metal is disabled.

Can anybody tell me something? Thx

z3t0 commented 7 years ago

@eapenzhan well metal is the low level graphics API on Apple devices. So you can't exactly "disable" it

eapenzhan commented 7 years ago

@z3t0 Thank you for the reply.

So when we disable Metal API Validation, it's just disable the validation part, not the actual API. Is that right?

z3t0 commented 7 years ago

@eapenzhan I believe that is correct.

"When Metal API Validation is enabled, each call is validated, which affects performance further"