Shapes IM and Unity 2023.3

  • updated

Is Shapes not compatible with Unity 2023.3 yet? I can't seem to get immediate mode drawing to work. I see nothing in the frame debugger and the console has the following error produced every frame

"RecordRenderGraph is not implemented, the pass Shapes.ShapesRenderPass won't be recorded in the current RenderGraph."

Adding shapes to the scene works. Just immediate mode rendering doesn't seem to work.

Reporting a bug? please specify Unity version:
Reporting a bug? please specify Shapes version:
Reporting a bug? please specify Render Pipeline:
Freya Holmér creator

does the Shapes settings window say anything about a faulty URP install?

Patrick Hogan

I did a little digging and found the problem. As of Unity 2023.3.0a18, in new projects, Render Graph in URP is now enabled by default. There is still a compatibility mode that can be turned on in Project Settings > Graphics > Render Graph Settings, which I turned on and that works for the time being.

It comes with a warning: "Unity no longer develops or improves the rendering path that does not use Render Graph API. Use the Render Graph API when developing new graphics features."

So, it seems ShapesRenderPass will require some modification. Execute() is deprecated and there's a new method RecordRenderGraph().

I made a brief foray into writing the modification, but my knowledge of render passes is very limited and it doesn't appear to be a straightforward conversion.

This is what I tried:

class PassData {}
public override void RecordRenderGraph( RenderGraph renderGraph, ContextContainer frameData )
using var builder = renderGraph.AddRasterRenderPass<PassData>( "Render Shapes", out _ );
builder.SetRenderFunc( ( PassData _, RasterGraphContext context ) =>
drawCommand.AppendToBuffer( context.cmd ); // modified to take a RasterCommandBuffer
} ); }

This compiles, but produces execution errors along the lines of "BeginRenderPass: Already inside a Renderpass ..." at which point I was out of my depth and gave up. ¯\_(ツ)_/¯

Scott Daley

I managed to get Shapes working in 2023.3.0b10 with minimal changes:

// Added to ShapesRenderPass.cs

private class PassData { }
public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData)
using IUnsafeRenderGraphBuilder builder = renderGraph.AddUnsafePass<PassData>("Render Shapes", out _);
(PassData _, UnsafeGraphContext context) =>
CommandBuffer unsafeCmd = CommandBufferHelpers.GetNativeCommandBuffer(context.cmd);

This is very similar to what Patrick did above, but with the following changes:

  • builder.AllowPassCulling(false) : This fixes the "BeginRenderPass: Already inside a Renderpass ..." error
  • Instead of modifying DrawCommand to work with a RasterCommandBuffer, I added an "unsafe" pass so that it could continue using a normal CommandBuffer. This was only to reduce the amount of code changes needed. But I think adding a raster pass would be the more "correct" way from what I've read in the RenderGraph docs.
james billy

Just wanted to comment to say that this issue still occurs in all Unity versions past 2023.3 and makes IM mode non-functional out of the box. The fix suggested by Scott Daley seems to work perfectly.

Freya Holmér creator

thanks for looking into this yall <3 I'll push a proper fix for the next update

manik bhat

Any updates on when this will be resolved? Using Immediate mode is my main use case so hoping for a fix to come soon.