GizStack
View .mdOpen in ChatGPTOpen in Claude

gizlang/ktx

KTX2 owns container parsing. GPU formats, reservations and uploads use the existing rendering contract.

gizlang
import * as Ktx from "gizlang/ktx";

Types

Container

gizlang
type Container = { format: string; width: i64; height: i64; depth: i64; layers: i64; faces: i64; levels: Vec<Level>; metadata: Map<string, bytes>; }

A decoded native-format KTX2 file: its format, size, array layers, cube faces, mips and metadata. Graph.texture uploads its levels; gizlang/image texture reads a 2D one as a meshdraw Texture. Basis payloads need an asset conversion first.

  • format: string
  • width: i64
  • height: i64
  • depth: i64
  • layers: i64
  • faces: i64
  • levels: Vec<gizlang_render.Level>
  • metadata: _gizlang_sdk_collections.Map<string, bytes>

Functions

load

gizlang
function load(data: bytes, budget: i64 = 268435456): Container throws string

Reads uncompressed, Zstandard or zlib KTX2 native blocks with bounded expansion and disjoint sections.

Effects: fail, alloc.