Intermittent render failure with URP's Render Graph

Avatar

Having an interesting issue in 6000, where my ImmediateModeShapeDrawers produce an error with rendering in Edit Mode after several have been added to the scene (everything is fine in Play Mode!).

Some background

My setup includes several independent instances of ImmediateModeShapeDrawers set to "[ExecuteAlways]", but with the following general pattern:

Image 877

The objects get rendered by a singleton instance of ImmediateModeShapeDrawer which stores a reference to all individual instances on those scripts' OnEnable():

Image 878

I've tested in a fresh scene, and I am able to add up to 16 individual drawers:

Image 879

After adding just 1 more, rendering fails with the following errors:

1)

Render Graph Execution error
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

2)

Exception: Invalid version: 20
UnityEngine.Rendering.RenderGraphModule.NativeRenderPassCompiler.ResourcesData.get_Item (UnityEngine.Rendering.RenderGraphModule.ResourceHandle h) (at ./Library/PackageCache/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/ResourcesData.cs:325)
UnityEngine.Rendering.RenderGraphModule.NativeRenderPassCompiler.NativePassCompiler.BuildGraph () (at ./Library/PackageCache/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/NativePassCompiler.cs:261)
UnityEngine.Rendering.RenderGraphModule.NativeRenderPassCompiler.NativePassCompiler.Compile (UnityEngine.Rendering.RenderGraphModule.RenderGraphResourceRegistry resources) (at ./Library/PackageCache/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/NativePassCompiler.cs:84)
UnityEngine.Rendering.RenderGraphModule.RenderGraph.CompileNativeRenderGraph (System.Int32 graphHash) (at ./Library/PackageCache/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraph.Compiler.cs:20)
UnityEngine.Rendering.RenderGraphModule.RenderGraph.Execute () (at ./Library/PackageCache/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraph.cs:1221)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

3)

InvalidOperationException: Trying to use a texture (_InternalGradingLut) that was already released or not yet created. Make sure you declare it for reading in your pass or you don't read it before it's been written to at least once.
UnityEngine.Rendering.RenderGraphModule.RenderGraphResourceRegistry.CheckTextureResource (UnityEngine.Rendering.RenderGraphModule.TextureResource texResource) (at ./Library/PackageCache/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResourceRegistry.cs:177)
UnityEngine.Rendering.RenderGraphModule.RenderGraphResourceRegistry.GetTexture (UnityEngine.Rendering.RenderGraphModule.TextureHandle& handle) (at ./Library/PackageCache/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResourceRegistry.cs:185)
UnityEngine.Rendering.RenderGraphModule.TextureHandle.op_Implicit (UnityEngine.Rendering.RenderGraphModule.TextureHandle texture) (at ./Library/PackageCache/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResourceTexture.cs:102)
UnityEngine.Rendering.Universal.Internal.ColorGradingLutPass+<>c.b__14_0 (UnityEngine.Rendering.Universal.Internal.ColorGradingLutPass+PassData data, UnityEngine.Rendering.RenderGraphModule.RasterGraphContext context) (at ./Library/PackageCache/com.unity.render-pipelines.universal/Runtime/Passes/ColorGradingLutPass.cs:302)
UnityEngine.Rendering.RenderGraphModule.RasterRenderGraphPass`1[PassData].Execute (UnityEngine.Rendering.RenderGraphModule.InternalRenderGraphContext renderGraphContext) (at ./Library/PackageCache/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphPass.cs:599)
UnityEngine.Rendering.RenderGraphModule.NativeRenderPassCompiler.NativePassCompiler.ExecuteGraphNode (UnityEngine.Rendering.RenderGraphModule.InternalRenderGraphContext& rgContext, UnityEngine.Rendering.RenderGraphModule.RenderGraphResourceRegistry resources, UnityEngine.Rendering.RenderGraphModule.RenderGraphPass pass) (at ./Library/PackageCache/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/NativePassCompiler.cs:1326)
UnityEngine.Rendering.RenderGraphModule.NativeRenderPassCompiler.NativePassCompiler.ExecuteGraph (UnityEngine.Rendering.RenderGraphModule.InternalRenderGraphContext rgContext, UnityEngine.Rendering.RenderGraphModule.RenderGraphResourceRegistry resources, System.Collections.Generic.List`1[UnityEngine.Rendering.RenderGraphModule.RenderGraphPass]& passes) (at ./Library/PackageCache/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/NativePassCompiler.cs:1428)
UnityEngine.Rendering.RenderGraphModule.RenderGraph.ExecuteNativeRenderGraph () (at ./Library/PackageCache/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraph.Compiler.cs:42)
UnityEngine.Rendering.RenderGraphModule.RenderGraph.Execute () (at ./Library/PackageCache/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraph.cs:1233)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

Workaround

I am able to completely bypass the issue by simply enabling compatibility mode with Render Graph, and this is entirely sufficient for me right now - but wondering if something's amiss with my potentially wonky setup or there's a sneaky bug.

Image 880

Thank you for this amazing tool and for any time spent investigating! 

Reporting a bug? please specify Unity version:
6000.0.30f1
Reporting a bug? please specify Shapes version:
4.5.0
Reporting a bug? please specify Render Pipeline:
URP