Vixen
caa30e12
csharp
public sealed class Ktx2Layout

Everything a KTX2 file's header and level index say, and none of its pixels.

Read the guide page for this →

Remarks

The half of Read that a streamer can afford. A header and a level index are 80 + 24n bytes at the front of the file; the pixels are everything else. Reading the first of those says how big the texture is, how many levels it has and where each one lives, which is enough to decide what to load without having loaded any of it.

The mip tail is one contiguous run at the front of the level data, and that is the whole point. Level data is stored smallest first, so levels firstLevel through LevelCount - 1 occupy a single range starting at DataOffset — one seek and one read, whatever the resolution asked for. Were the file stored largest first the same request would be a read per level from scattered offsets, which is the difference between streaming a mip tail and streaming a mip tail badly.

Fields and properties (10)

  • public PixelFormat Format

    What the bytes mean.

  • public int Width

    The largest level's width.

  • public int Height

    The largest level's height.

  • public int Depth

    The largest level's depth. One for a 2D texture.

  • public int LayerCount

    How many array layers. One for a plain texture.

  • public int FaceCount

    How many faces. Six for a cube map, one otherwise.

  • public IReadOnlyList<Ktx2Level> Levels

    Every level, largest first, each with the file offset its bytes start at.

  • public int LevelCount

    How many mip levels.

  • public long DataOffset

    Where the level data starts: the smallest level's offset.

  • public long DataLength

    How many bytes every level together occupies.

Methods (3)

  • public long TailLength(int firstLevel)

    How many bytes the tail from a level down to the smallest occupies.

  • public int TailFor(long budget)

    The largest tail that fits in a budget.

  • public TextureData Allocate(int firstLevel)

    Describes the texture a tail of this file decodes to.

Used by (8)

  • AssetTextureSourceVixen.Engine.Renderer
  • EntryVixen.Engine.Renderer
  • FilesVixen.Engine.Renderer.Tests
  • Ktx2Vixen.Core.Imaging
  • Ktx2TestsVixen.Core.Imaging.Tests
  • TexturePagePoolVixen.Engine.Renderer
  • TextureStreamerVixen.Engine.Renderer
  • TextureStreamingTestsVixen.Engine.Renderer.Tests