Vixen
02b45cc4
csharp
public sealed class MeshletPagePool

A device buffer of fixed-size page slots, filled and emptied by PageResidency.

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

Remarks

This is GeometryBuffer with a residency policy instead of a load-time one, which is what docs/plan/22-virtualized-geometry.md phase 2 says it should be. The same fixed capacity, the same device-local memory written through staging, the same two-call Write/Flush split because a page arrives on one thread and the copy belongs at one known point in one command list. What differs is the allocator: that one hands out ranges of arbitrary size and never takes them back, and this one hands out identical slots and takes them back constantly.

Fixed slots, which is the decision that makes eviction free. A page is a page is a page, so a slot vacated by one page fits any other and the free list is a stack of integers. Variable-size allocations would need a defragmenter in the frame path, and a defragmenter moves bytes the device is reading — which is the shape of problem this whole design exists to not have.

One buffer, not one per vertex layout. GeometryBuffer needs one per layout because a draw's vertexOffset is multiplied by the pipeline's stride; a page is never bound as a vertex buffer at all. It is a storage buffer a shader reads by byte offset, which is what phase 4's raster and phase 5's resolve both want and is why the quantized position format can differ from any pipeline's vertex layout.

Fields and properties (8)

  • public BufferHandle Pages

    The one buffer every resident page lives in.

  • public int PageSize

    How many bytes one page occupies in the pool.

  • public int SlotCount

    How many slots the pool has.

  • public long PendingBytes

    How many bytes are waiting to be copied into the pool.

  • public long Placements

    How many pages have been placed since this was created.

  • public long Evictions

    How many have been evicted.

  • public long Refusals

    How many placements were refused because the staging region was full.

  • public long StagingCapacity

    How many bytes the staging region holds between flushes.

Methods (6)

  • public MeshletPagePool(IGraphicsDevice device, IMeshletPageSource source, int slotCount, int pageSize = 131072, string name = "MeshletPages")

    Creates the pool and the staging region that fills it.

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

    Reads a page's bytes.

  • public bool Place(PageKey key, int slot, ReadOnlySpan<byte> bytes)
  • public void Evict(PageKey key, int slot)
  • public int Flush(ICommandList list)

    Records the copies everything placed since the last flush needs.

  • public void Dispose()

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

Used by (12)

  • BinVixen.Rendering
  • ClusterCullingRendererVixen.Rendering
  • ClusterResolveTestsVixen.Rendering.Tests
  • CompositorAssetTestsVixen.Rendering.Tests
  • CompositorBuilderVixen.Rendering
  • GpuClusterRasterVixen.Rendering
  • GpuClusterResolveVixen.Rendering
  • GpuClusterSoftwareRasterVixen.Rendering
  • MeshletStreamingTestsVixen.Rendering.Tests
  • VirtualGeometryFrameTestsVixen.Rendering.Tests
  • VirtualGeometryRenderFeatureVixen.Rendering
  • VirtualGeometrySystemVixen.Rendering