Documentation
¶
Overview ¶
Package ktx2 inspects Karty's bounded UASTC LDR 4x4 + Zstandard profile. It does not decode pixels or transcode GPU blocks.
Index ¶
Constants ¶
const ( HeaderSize = 80 MaxLevels = 14 MaxLayers = 256 MaxEncodedBytes = asset.MaxSourceAssetBytes )
Variables ¶
var (
ErrInvalid = errors.New("KTX2 UASTC texture is invalid")
)
Functions ¶
This section is empty.
Types ¶
type Info ¶
type Info struct {
Width, Height, Layers uint32
SRGB bool
HasAlpha bool // False means the fourth component is implicitly 1.
Levels []Level
InflatedBytes, RGBABytes uint64
}
Info describes a validated container and preflight allocation costs. RGBABytes is the full fallback texture size; InflatedBytes is the UASTC block size or the exact RGBA byte size for the separate lossless profile. Alpha is straight and linear even when RGB uses the sRGB transfer function.
func Inspect ¶
Inspect validates all ranges, the complete mip chain, DFD, supported metadata and Zstandard frame boundaries before any inflated or GPU allocation. It cannot validate compressed block contents: consumers must fully decompress and transcode before publishing a texture. Returned slices are newly owned.
func InspectRGBA8 ¶
InspectRGBA8 validates the separate lossless, linear RGBA8_UNORM + Zstandard array profile. It has exactly one level, straight alpha and no pixel transforms. Consumers must completely decompress and verify the frame before publication.
func InspectRGBA8Array ¶
InspectRGBA8Array validates prepared lossless RGBA8 arrays with linear or sRGB RGB transfer and explicit mip levels. Every level already contains all layers in GPU order; consumers only decompress complete validated frames.