Search Issue Tracker
Fixed
Votes
22
Found in
5.3.4f1
Issue ID
786455
Regression
No
[Metal] API provides 32-bit depth texture when a 16-bit texture is expected
How to reproduce:
1. Open attached project
2. Build to iOS
3. Open in Xcode
4. In Xcode, go to Product -> Scheme -> Edit Scheme...
5. In the Options tab change the GPU Frame Capture setting to Metal
6. Build to device
- Note that it crashes before getting to the Splash Screen with this error:
/BuildRoot/Library/Caches/com.apple.xbs/Sources/Metal/Metal-56.7/ToolsLayers/Debug/MTLDebugRenderCommandEncoder.mm:1602: failed assertion `MTLPixelFormat of texture [TempBuffer 2 1920x1080 (MTLPixelFormatDepth32Float)] bound at index 1 is incompatible with texture parameter [MTLDataTypeHalf _CameraDepthTexture[0]]. MTLPixelFormatDepth32Float is compatible with texture data types type(s) (
float
).'
- Reproduced in Version 5.2.4f1 (98095704e6fe), Version 5.3.4p2 (fdf8d87c549e), Version 5.4.0b14 (0d4790749194) on an iPhone 6+ (iOS 9.3.1)
- Not reproducible on an iPhone 5 (iOS 7.1)
RESOLUTION:
As a workaround: please disable the Metal validation setting in the Xcode schema options
Proper solution: search for CameraDepthTexture in your shaders and verify that it uses sampler2D_float, not just sampler2D. Note that ignoring this issue may crash the GPU driver on certain hardware.
Unity will have a warning for this in the future.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Rendering locks up when not looking at a transparent material on Meta Quest 2
- Volumetrics break when using a Custom Pass to create a Thickness Buffer for Alpha Clipping
- All tests are run instead of only the failed ones when the "Rerun Failed" button is pressed
- GameObject is not masked when the "Render PostProcessing Effects" pass executes with a resolved non-MSAA Color target and MSAA DepthStencil target
- [Android] Gfx.WaitForGfxCommandsFromMainThread high performance usage and inconsistency when built Player scene has Canvas GameObject on a specific Project
glowmadejonny
Nov 02, 2016 16:05
It's _CameraDepthTexture - it says it in the error message.
If you go to Edit Scheme... / Options and set Metal API Validation to Disabled, you'll be ok.
justdizzy
Oct 12, 2016 21:26
Any way to figure out which texture is at fault? Maybe a workaround is to resize the texture or add/remove alpha layer?
justdizzy
Oct 12, 2016 19:28
Just verified this is still an issue in 5.4.1p4. As a side note, it only throws the exception for me when launching the app through Xcode, if I launch it directly on device, then the app continues to run.
Ben_SEM
Sep 28, 2016 21:04
Similar issue here on 5.3.4p4 with iOS10 / XCode 8. It is working fine on the same Unity version in iOS9 / XCode 7.
lacost
Sep 26, 2016 12:00
We do have same issues, had to manually switch to OpenGLES2. Now we can alt least work with the app,
justdizzy
Sep 14, 2016 22:48
Instead of adjusting settings in Xcode, in Unity I set the Graphics API in iOS Player Settings to "Metal", unchecking "Auto Graphics API".
I can reproduce the crash with Unity 5.4.0f3 & 5.4.1f1, building with Xcode 8 on device running iOS 10.0.1 (iPad Mini 2 and iPhone 6s), but not iOS 9.3.5 (iPad Air 2). I have not tried side loading a build from Xcode 7