Hi,
Is it possible to merge Graphics.RenderMeshIndirect calls with same render params and same mesh?
I have tens of calls for:
Graphics.RenderMeshIndirect(renderParams, mesh, argsBuffer);
I think since render params and mesh doesn’t change, if I can find a way to combine GraphicsBuffer argsBuffer parameter into single one it will reduce draw call to 1.
using: Unity 6000.0.34f1 with URP
Yes, that’s exactly the intention behind indirect draws. If you check documentation for Graphics.RenderMeshIndirect
you will see it accepts two more optional arguments: commandCount
and startCommand
, which tell it where from command buffer to read arguments.
If you’re rendering same mesh, you possibly don’t even need separate commands. Just set IndirectDrawIndexedArgs.instanceCount
to amount of instances you need?