public sealed class GpuDrawArgumentsThe visibility bits turned into draw calls on the device, so the answer never has to come back to the host.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
The last part of [docs/plan/06]'s GPU culling line: "output an indirect draw buffer". Its inputs are Bits — which never left the device — and a template per object that the host filled during Prepare; its output is a buffer a draw call reads its own arguments out of.
It zeroes instance counts rather than compacting. The textbook form appends survivors to a list and draws that list. Claiming a slot needs an atomic add, which Raven has — so what stands in the way is the draw, in two independent ways. A single command covers a compacted run only if its count comes from the device, and DrawIndexedIndirect takes drawCount as a host integer. And a single command covers several objects only if they share their bindings, which they do not: MeshRenderFeature binds a vertex buffer, an index buffer and a material set per object, so a compacted list would be a list nothing could draw in one call.
Bindless materials are what change the second of those, and are the prerequisite [docs/plan/14] records against compaction. Until then the buffer holds one record per object slot at that slot's own index and a culled object gets zero instances, which every API defines as a draw that fetches and rasterises nothing. The cost is a command submitted per object rather than per visible object; the saving is the whole round trip.
A record per object per view, because the bits are: a shadow cascade and the camera disagree about what is visible, and one buffer between them would hold whatever was dispatched last. Twenty bytes each, so a hundred thousand objects across six views is twelve megabytes — the number a project trades against, and the reason this is opt-in rather than always on.
Where it goes next. With this in place the host does not need the bits at all — see ReadBack, which turns off the stall and leaves the CPU recording every object while the GPU decides which of them draw anything.
Fields and properties (12)
public const int StrideHow many bytes one draw's arguments occupy.
public bool CompactWhether survivors are appended to a per-batch list rather than left at their own slot with a zeroed instance count.
public EffectSystem? EffectsWhere the compaction variant is resolved from. Null updates nothing.
public ComputePipelineCache? PipelinesWhere the compute pipeline comes from. Null updates nothing.
public int DispatchesPerFrameHow many times a frame Update is called, which is what the set ring has to be deep enough for.
public BufferHandle CommandsThe arguments a draw call reads. Invalid before the first update.
public int ObjectCountHow many object slots the last update covered.
public int ViewCountHow many views it covered.
public bool IsFilledWhether the buffer holds this frame's arguments.
public bool IsCompactedWhether the last update wrote a compacted list rather than a padded one.
public BufferHandle CountsThe per-batch survivor counts a count-buffer draw reads.
public int BatchCountHow many batches the last update covered.
Methods (10)
public GpuDrawArguments(IGraphicsDevice device)Creates an argument buffer on a device. Nothing is allocated until the first update.
public long OffsetOf(int viewIndex, RenderObjectId id)Where one object's arguments start, for one view.
public int BatchOf(RenderObjectId id)Which batch an object was put in, or 0 for one nothing assigned.
public int BatchSizeOf(int batch)How many objects are in a batch — the ceiling a count-buffer draw is given.
public long BatchOffsetOf(int viewIndex, int batch)Where a batch's compacted run starts, for one view.
public long CountOffsetOf(int viewIndex, int batch)Where a batch's survivor count is, for one view.
public Span<uint> Batches(int objectCount)One batch id per object slot, to be filled before an update.
public Span<DrawCommand> Fill(int objectCount)The templates to fill, one per object slot, before an update.
public bool Update(ICommandList list, BufferHandle visibility, int viewCount, int objectCount)Records the dispatch that writes this frame's arguments.
public void Dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Used by (11)
- CompositorAssetTestsVixen.Rendering.Tests
- CompositorBuilderVixen.Rendering
- DrawCompactionTestsVixen.Rendering.Tests
- GpuCullingRendererVixen.Rendering
- GpuDrivenCompositorTestsVixen.Rendering.Tests
- GpuVisibilityGroupTestsVixen.Rendering.Tests
- HarnessVixen.Rendering.Tests
- IDrawArgumentSourceVixen.Rendering
- MeshRenderFeatureVixen.Rendering
- MeshRenderFeatureTestsVixen.Rendering.Tests
- ViewCullingDeviceTestsVixen.Graphics.Golden.Tests