Vixen
02b45cc4
csharp
public sealed class SurfaceCacheAtlas

Where each card's texels live — shelf allocation over one fixed rectangle.

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

Remarks

Doc 19 § 6's "texture atlas allocation and residency", CPU half. Shelves because cards are rectangles of a handful of quantised sizes: each shelf is a row as tall as the first card that opened it, filled left to right. Released rectangles go to a free list and are reused on exact size match only — cards recur at the sizes their meshes generate, so the exact match is the common case, and a general best-fit packer is an optimisation with this as its baseline.

Running out is not an error, for the brick pool's reason: a scene with more cards than atlas is a quality reduction — the refused card simply stays uncached and its surfaces answer black through the tracers — not a failure.

Fields and properties (2)

  • public Int2 Size

    The atlas's size, in texels.

  • public int Occupied

    How many texels have been handed out and not released.

Methods (4)

  • public SurfaceCacheAtlas(Int2 size)

    Builds an empty atlas.

  • public bool TryAllocate(Int2 size, out Int2 origin)

    Finds room for one card's texels.

  • public void Release(Int2 origin, Int2 size)

    Gives a card's texels back for a same-sized card to reuse.

  • public void Clear()

    Empties the atlas entirely.

Used by (11)

  • ArenaIlluminationThirdPersonShooter
  • CompositorAssetTestsVixen.Rendering.Tests
  • CornellBoxTestsVixen.Rendering.SurfaceCache.Tests
  • ReflectionTraceDeviceTestsVixen.Graphics.Golden.Tests
  • SurfaceCacheRadiosityDeviceTestsVixen.Graphics.Golden.Tests
  • SurfaceCacheRendererDeviceTestsVixen.Graphics.Golden.Tests
  • SurfaceCacheStoreVixen.Rendering.SurfaceCache
  • SurfaceCacheTestsVixen.Rendering.SurfaceCache.Tests
  • SurfaceCacheTextureVixen.Rendering
  • SurfaceCardCaptureDeviceTestsVixen.Graphics.Golden.Tests
  • TracedReflectionTestsVixen.Rendering.Reflections.Tests