Hi. I have very strange error when using multiple cameras.
Here is my setup (simplified):
Unity 2019.4.4f1 + URP 7.4.1
- Scene has main base camera (A), + additional UI overlay camera (B).
- While playing, create secondary base camera (C) which has RenderTexture output. And the rendertexture is shown with MeshRenderer, rendered on camera (B).
My project works on Windows/Mac editor, Android device without any problems. But on iOS devices (metal), it throws GPU hang error when step 2:
Error log
2020-07-24 14:16:10.396178+0900 ent[1250:260154] Execution of the command buffer was aborted due to an error during execution. Caused GPU Hang Error (IOAF code 3)
2020-07-24 14:16:10.396292+0900 ent[1250:260154] Execution of the command buffer was aborted due to an error during execution. Caused GPU Hang Error (IOAF code 3)
-[MTLDebugRenderCommandEncoder setVertexBuffer:offset:atIndex:]:1376: failed assertion `offset(4792532) must be < buffer length.’
Not always, but frequently. No other error log, so it is very hard to diagnose the problem.
Any ideas and hints are welcome. Thanks.
I found that upgrading 2020.1 and enabling Graphics jobs makes this issue gone. Still can’t narrow down what is the problem, and only upgrading 2020.1 or only enabling Graphics Jobs doesn’t work. I think that there are something bugs in unity’s metal device implementation.
Hey Kichang-Kim,
Did you report a bug about this? If you find the time, please report this so we can take a closer look.
I can confirm we had the same issue with 2019.4.15f1 and URP 7.3.1. Upgrading to 2020.1 and enabling Graphics jobs seems to have fixed it.
We also use cameras with RenderTexture output, but the setup is a little more complicated, but the details given by Kichang-Kim should hopefully be enough for you to reproduce without someone submitting an official bug report.
I know that Unity needs bug reports with a sample project to actually fix these things but I think there should be some other way to report bugs and have them be tracked and fixed. It takes way too long to upload an in production project with all the necessary steps to build and run the project. No one that I know of is still willing to spend the time creating a small project to show off the bug. One because of how long it takes to create this project and make sure the bug occurs in it. The other is because, from my experience and those I’ve talked to, these reports generally don’t seem to give any feedback as to what happened with them. Even if it was “Won’t Fix”, “Unable to Reproduce”, or “Duplicate of XXX” I would much prefer that to not response at all.
That’s a long way of saying, there is a bug here and whether or not there is an official bug report you should look into it given it’s severity.
Unfortunately, I still can’t narrow down to minimal reproduction project. My team has no time to deeply investigate this issue, so simply I enabled GraphicsJobs to avoid this issue.
Apparently, it might be some of your rendering is a bit heavy, causing a stall in metal, causing some edge case in the synchronizing of the metal calls.
The Vulkan people at Khronos also encountered a similar issue.
https://github.com/KhronosGroup/MoltenVK/issues/602
It might provide clues for the Unity team to resolve the problem.
Graphics Job simply offloads some of the rendering/synchronizing code to different tasks, which kinds of avoided the edge case.
1 Like
@Elvar_Orn I think @weiping-toh 's comment is very close to this issue. It seems that only occurred when gpu is in the very high load.