DrawIndirect and render bundles...

Skip to first unread message

Mark Sibly

Feb 4, 2023, 4:35:43 PMFeb 4
to Dawn Graphics

Does anyone have any experience with DrawIndirect (I don't)?

Am I correct in thinking it's only really of use when you're also using render bundles? Or  when using compute pipelines (I'm not yet)?

Otherwise, since you can't 'reuse' command lists or renderpasses etc there's a 1-to-1 mapping between calls to Draw and actual drawing, so there's no benefit in the extra overhead of having to upload the draw params to a buffer, right?

Render bundles *can* be reused though, so I can see the point in have using DrawIndirect commands there. And looking at the current state of my code I can it's 99% of the way to be quite nicely 'render bundled'.

But would it be worth it? Are render bundles actually accelerated somehow? I've had a look at the code but can't really follow the render bundle logic, although there don't seem to be a VkRenderBundle, D3D12RenderBundle etc classes, but maybe all the magic happens in the queues, I dunno...


Corentin Wallez

Feb 5, 2023, 11:44:50 AMFeb 5
to Mark Sibly, Dawn Graphics
Hey Mark,

While DrawIndirect can be used to change the size of work in render bundles, that's not the primary use case for them. (note that in Dawn render bundles are emulated by just replaying commands but you still have a lot of gains from that from skipped validation, less code on your app, less instruction cache thrashing etc) DrawIndirect and friends are useful when you want to size the work of a draw based on information produced on the GPU itself. For example if you run a compute shader to simulate particles with random lifetimes, only the compute shader knows how many particles are still alive each frame. Getting that number on the CPU would cause a stall and be bad for performance. Instead the compute shader can write the final amount of particles to a storage buffer which is then used as the indirect buffer for a DrawIndirect.

I believe the WebGPU metaballs demo does something similar when producing triangles through marching cubes on the GPU: here again a compute shader produces data that's used to size a draw command in the same frame.

Hope this helps,


You received this message because you are subscribed to the Google Groups "Dawn Graphics" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dawn-graphic...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dawn-graphics/d2299c4a-28c0-43f9-8dbe-d67724f5e383n%40googlegroups.com.

Mark Sibly

Feb 6, 2023, 5:09:47 PMFeb 6
to Corentin Wallez, Dawn Graphics
HI Corentin, thanks for that.

I wont be getting into compute shaders just yet, but would it still be worth using DrawIndirect with render bundles (considering the associated extra overhead of uploading draw params via writeBuffer or something) or should I only use render bundles for the non-drawing stuff, which is typically only a few SetBindGroups?

I'll probably experiment with some of this on my own soon, just trying to work out the best experiments to run at this point!


Reply all
Reply to author
0 new messages