Vixen
02b45cc4
csharp
public sealed class StreamMeshletPageSource

Reads pages out of seekable blobs, which is what a build's artefacts are.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

The source a shipping build uses, and the reason WithoutData exists. A build writes a mesh's records and its geometry as two artefacts; the records are deserialised whole at load, and this reads the geometry a page at a time from wherever the second one landed. What it never does is read the whole blob, which is the difference between streaming and loading.

A stream per source rather than one shared handle. Reads are issued from whatever thread the residency service's continuations land on, and a Stream's position is not thread-safe — so the seek and the read are one operation under one lock per source. A file provider that hands out MemoryMappedFiles would not need it; the interface does not promise one.

Offsets come from OffsetOf rather than from Offset, because a data-less set's pages carry the offsets they had in a blob that is no longer attached — the same numbers, and derived rather than trusted.

Methods (4)

  • public void Add(int source, MeshletPageSet pages, Stream data)

    Registers a mesh's page blob under a source id.

  • public bool Remove(int source)

    Forgets a source and closes its blob.

  • public ValueTask<int> ReadAsync(PageKey key, Memory<byte> destination, CancellationToken cancellation)

    Reads one page's bytes.

  • public void Dispose()

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Used by (4)

  • MeshletStreamingTestsVixen.Rendering.Tests
  • VirtualGeometryContentVixen.Rendering
  • VirtualGeometryContentTestsVixen.Rendering.Tests
  • VirtualGeometrySystemVixen.Rendering