public sealed class BufferReadbackRendererA buffer the frame produced, back on the host.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
The other half of the seam BufferUploadRenderer opens, and the one five other things were waiting on: a numeric gate that compares a shader against its C# port needs the shader's answer, an auto-exposure chain needs the histogram's, and a particle system that reaps on the device needs to know how many survived. None of them can get it from a device-local buffer — the host cannot map one — so the value comes out through a copy into host-readable memory, which is a pass, which is an edge the graph has to know about.
Declaring the read is what makes the answer mean anything. A copy recorded without it runs wherever it was written and reads whatever the buffer held before the dispatch — which is zeroes on a fresh allocation and last frame's contents on a recycled one. Both look like a plausible result. The declared read is what puts the barrier between the producer and the copy, and it is exactly the thing a hand-written readback gets wrong.
The pass has a side effect, because its whole point is outside the graph. Nothing in the frame reads what this writes, so culling would remove it — see SideEffect.
When the bytes are valid is Latency's question, and it is the only hard one here. There is no implicit wait anywhere in this — see Read for why an RHI that inserted one would be hiding a stall the caller cannot see.
Fields and properties (9)
public required string BufferThe name of the buffer to read.
public long OffsetWhere in that buffer to start reading.
public long SizeHow many bytes, or zero for the rest of the buffer from Offset.
public int LatencyHow many frames sit between the copy and the read.
public ReadOnlySpan<byte> DataWhat came back, valid once ReadCount is above zero.
public long LengthHow many bytes each read produces.
public int ReadCountHow many times bytes have come back.
public int CopyCountHow many frames have been copied.
public Action<BufferReadbackRenderer>? OnReadWhat to do with the bytes, run by every Fetch that produces some.
Methods (4)
public ReadOnlySpan<T> As<T>() where T : unmanagedWhat came back, as records.
public bool Fetch()Reads the region copied Latency frames before the most recent one.
protected internal override void Build(GraphicsCompositor compositor, CompositorFrame frame)Declares this node's render-graph passes.
public void Dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Used by (3)
- BufferTransferDeviceTestsVixen.Graphics.Golden.Tests
- BufferTransferTestsVixen.Rendering.Tests
- CompositorBuilderVixen.Rendering