Search Issue Tracker

Won't Fix

Votes

0

Found in

6000.0.36f1

6000.1.0b3

6000.2.0a1

Issue ID

UUM-95348

Regression

No

Crash on SendShadowCullingCallbacks when using ScriptableRenderContext.Cull()

-

Reproduction steps:
1. Open the attached project "CrashPROJECT"
2. Open “SCENE“ scene
3. Select “RPASSET“ in the project window and enable “Global Illumination“
4. Enter and exit Play mode until crash
5. Resizing the Game View viewport, disabling and reenabling “Global Illumination“ in “RPASSET“ and other actions that rerender the game view can also cause it to crash

Expected result: Playmode starts/stops without crashing.
Actual result: Editor crashes

Reproducible with: 6000.0.36f1, 6000.1.0b3
Couldn’t test with: 2022.3.56f1 - package errors

Reproducible on: Windows 11
Not reproducible on: No other environment tested

Note: Upgrading the project to 6000.0.36f1 made the crash extremely rare and took an hour to reproduce it locally. On the reported version or upgraded to 6000.1.0b3 only takes a few minutes at most.

First few lines of stack trace:

{noformat}0x00007FFF158055C9 (Unity) SendShadowCullingCallbacks
0x00007FFF15A741A2 (Unity) PrepareDrawShadowsCommandStep1
0x00007FFF15A702E8 (Unity) ScriptableRenderContext::ExecuteScriptableRenderLoop
0x00007FFF15081FD4 (Unity) ScriptableRenderContext_CUSTOM_Submit_Internal
0x000002574E01FF03 (Mono JIT Code) (wrapper managed-to-native) UnityEngine.Rendering.ScriptableRenderContext:Submit_Internal (UnityEngine.Rendering.ScriptableRenderContext&)
0x000002574E01FE43 (Mono JIT Code) UnityEngine.Rendering.ScriptableRenderContext:Submit (){noformat}

  1. Resolution Note:

    The issue is that the user is calling context.Cull in two different points with the same context during the same frame. he first culling call produces a set of results (a CullingResults object) that are used for render, so when calling Cull another time "breaks" this set of results which leads to undefined behavior...
    In fact to avoid this crash, exists this two protection calls in the API ScriptableRenderContext.PushDisableApiRenderers and ScriptableRenderContext.PopDisableApiRenderers that should be used to protect against the creation of renderer indices after the Cull is computed.
    We use it internally in HDRP and the user should use them to protect his code too
    The problem has been explained to the user and he understand the issue and thinks he'll be able to fix the issues.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.