Search Issue Tracker
By Design
Votes
0
Found in
2020.3
2020.3.14f1
2021.1
2021.2
2022.1
Issue ID
1375788
Regression
No
[MacOS] Crash on mono_handle_native_crash when loading a Compute Shader
Reproduction steps:
1. Download the attached Unity project "CrashBug.zip" from Google Drive (link in the edit)
2. Go to Assets > WickedRealm > Levels > Scenes folder
3. Open "Sam.Gym.unity" Scene
4. Observe the Editor
Expected result: Editor does not crash
Actual result: Editor crashes
Reproducible with: 2020.3.22f1, 2021.1.28f1, 2021.2.2f1, 2022.1.0a15
Could not test with: 2019.4.32f1 (Console errors after downgrading)
First lines of stack trace:
0 libmonobdwgc-2.0.dylib 0x000000015e75c9ce mono_handle_native_crash + 241
1 libmonobdwgc-2.0.dylib 0x000000015e6cd2dc mono_sigsegv_signal_handler + 202
2 libsystem_platform.dylib 0x00007fff2040fd7d _sigtramp + 29
3 ??? 0x00007fb245436470 0x0 + 140403642950768
4 Foundation 0x00007fff21216087 +[NSString stringWithUTF8String:] + 29
5 Unity 0x0000000106877ebe
Notes:
- Issue is not reproducible on Windows (no crash)
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
- Font character thickness does not adjust properly in UI Toolkit text when changing Bold Weight in Font Asset
- Multiple "[...] is inaccessible due to its protection level" errors are thrown when opening project with Unity Version Control installed
- Sorting icons are tiny and misaligned in Import Activity window
- The Undo system does not record HideFlags.HideInHierarchy changes
- [Linux] Bug Reporter window is in Light mode when the Editor theme is Dark mode
Resolution Note:
According to the documentation, section "Cross-platform best practices" (https://docs.unity3d.com/Manual/class-ComputeShader.html), the user needs to guard against out-of-bounds access in compute shaders, as this may lead to undefined behavior and crashes when e.g. using Metal.
1. Add `settings.explosionCompute.SetInt("_VertPosBufferSize", _NeighbrosBufferSize);` to line ExplosionEffectRenderFeature.cs:390.
2. Add `if (id.x >= _VertPosBufferSize) return;` to the beginning of `CS_InitialDisplace`, `CS_SecondaryDisplace` and `CS_RectifyNormals` in `ExplosionCompute.compute`.
In addition to this, `cmd.Clear()` at ExplosionEffectRenderFeature.cs:376 is also causing problems, because the clear is called inside the `using (new ProfilingScope(cmd, _profilingSampler)) {}` block. Therefore, `cmd.Clear()` should be called before this block (e.g. at line 367).