Search Unity

Crash with CullLocalShadowCastersJob when using an SRP

Discussion in 'General Graphics' started by Kolyasisan, Apr 21, 2020.

  1. Kolyasisan

    Kolyasisan

    Joined:
    Feb 2, 2015
    Posts:
    397
    This is a very serious bug that considerably disrupts our workflow.

    Our project is currently being integrated with a custom SRP, our Unity version 2019.3.10f1. Unity crashes when SRP performs culling with a ShadowCasters option enbaled (removing the option fixes the bug). This crash didn't happen with a built-in pipeline.

    I believe this is the issue that I currently experience https://issuetracker.unity3d.com/is...40.1624311080.1586253342-188390374.1572461572

    and this is the corresponding thread https://forum.unity.com/threads/random-editor-crash-on-entering-play-mode.793137/

    both state that the bug is already fixed, but that is clearly not the case in our situation.
    Currently I cannot reproduce this bug in an empty project, I cannot identify what exactly causes it.

    This doesn't appear to be the issue with pointlights as stated in the linked thread, disabling/removing them doesn't prevent the crash. Removing or disabling all of the lights in the scene does fix it though. Disabling shadows on the lights doesn't help. Not drawing shadows at all doesn't help either, the crash is exclusively tied to culling it seems.

    Our project is too big to be sent for reproduction purposes. Please, we need your help in identifying what causes it. Here is a zip file containing Unity's output to the crashes folder under appdata.
     

    Attached Files:

    Last edited: Apr 21, 2020
  2. LucidSloth

    LucidSloth

    Joined:
    Mar 9, 2021
    Posts:
    5
    @Kolyasisan did you ever figure out the issue? We're having something very similar.
     
  3. Kolyasisan

    Kolyasisan

    Joined:
    Feb 2, 2015
    Posts:
    397
    Somewhat. I don't know what exactly fixed it, it stopped after some point that I can't pinpoint. However, based on changes that I've made to my SRP I can idenfity two possible issues:
    1 - You're trying to draw shadows, but the light failed to create culling results because there are no eligible shadowcasters for it (no shadowcasters to draw, in that case GetShadowCasterBounds() will return false. Do note that ComputeXShadowMatricesAndCullingPrimitives() will still return true otherwise if light is in shadow drawing region).
    2 - Culling results had some punctual lights, but you didn't draw them. This might've been fixed, not too sure about that, but early on we had definitive crashes because of that.

    Either way, this issue stopped happening for us on Unity 2020.1 and beyond, so it might've been also fixed by UT.