Unity crashes or an error "Metal: GrabIntoRenderTexture mismatched grab pass: 80 / 92)" is thrown and the Game view becomes corrupted when HDR is enabled in an iOS module after enabling and disabling the Frame Debugger with Clear Flags set to Depth only
How to reproduce:
1. Open the “TestCameraDepth“ project
2. Open the “SampleScene“
3. Enter the Play Mode
4. Set Clear flags to Depth Only in the “Main Camera“ GameObject
5. Open the “Windows > Analysis > Frame Debugger“
6. Enable and Disable the Frame Debugger
7. Exit the Play Mode
8. Open the “Main Camera“ GameObject in the Inspector
9. Set the Viewport Rect X value to 0.1 and Y value to 0
10. Navigate to the “Edit > Project Settings > Graphics > iOS“
11. Enable “Use HDR“ for all of the Tiers
Expected result: No crash happens and no error “Metal: GrabIntoRenderTexture mismatched grab pass: 80 / 92)” and the Game view is not corrupted
Actual result: Unity silently crashes or an error “Metal: GrabIntoRenderTexture mismatched grab pass: 80 / 92)” and the Game view is corrupted
Reproducible with: 2021.3.39f1, 2022.3.32f1, 6000.0.5f1
Reproducible on: macOS 14.5 (Intel)
Not reproducible on: No other environments tested
Notes:
- An error “Unity[11771:167278] CAMetalLayer ignoring invalid setDrawableSize width=0.000000 height=0.000000“ can be observed in the Editor.log even though W and H values of the Viewport Rect are not set to zero
- Not reproducible on a fresh project
- Might need to redownload the project for the issue to reproduce again
- Only reproducible with the Clear Flags set to Depth only