Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:GX texture formats (GameCube and Wii)

From ReverseEngineering.wiki
Format
On this wiki Facts · Code · Notes · Topics

The eleven texture formats of the GameCube and Wii GX graphics hardware (I4, I8, IA4, IA8, RGB565, RGB5A3, RGBA8, C4, C8, C14X2, CMPR) and three palette formats, shared by TPL, BTI, BRRES TEX0 and other containers: tiled pixel data in fixed blocks, big endian 16-bit texels.

Overview

Every container of GameCube and Wii textures (Format:TPL texture palette, BTI in Format:J3D model (BMD, BDL), TEX0/PLT0 in Format:BRRES resource archive) stores the same GX hardware formats: a numeric format id, a width and height, and pixel data in tiles (blocks), not in scanlines. This page lists the formats and how two independent decoders read them. Sources: noclip.website (MIT, src/gx/gx_enum.ts, gx_texture.ts) at fd973ff240233c63883750a557c62baf6ff2a6c7 and Dolphin (GPL-2.0-or-later, Source/Core/VideoCommon/TextureDecoder.h, TextureDecoder_Common.cpp, TextureDecoder_Generic.cpp) at cf5cb7ef81c3e8e7af5c9d566334219ffda9f68b. Both were read, not run.

Format ids and block sizes

The id list is identical in both sources (the value 7 and 0xB-0xD are not texture formats; Dolphin adds a private XFB value 0xF that does not exist on the console).

id name bits per texel block (w x h) block bytes
0x0 I4 4 8 x 8 32
0x1 I8 8 8 x 4 32
0x2 IA4 8 8 x 4 32
0x3 IA8 16 4 x 4 32
0x4 RGB565 16 4 x 4 32
0x5 RGB5A3 16 4 x 4 32
0x6 RGBA8 32 4 x 4 64
0x8 C4 4 8 x 8 32
0x9 C8 8 8 x 4 32
0xA C14X2 16 4 x 4 32
0xE CMPR 4 8 x 8 32

The block bytes column is computed from the bits per texel and the block size (both sources agree on those). The width and height are padded up to whole blocks: noclip's calcTextureSize aligns both to the block size before multiplying; Dolphin's TexDecoder_GetTextureSizeInBytes does width * height * nibbles / 2 without padding (Unverified: that its callers pass block-padded sizes). Unverified: that the padding rule is the same in every game container (the sizes stored in headers are the unpadded image sizes in the TPL and BTI readers read here).

Palette (TLUT) formats

C4, C8 and C14X2 store indices into a palette of 16-bit entries: 16, 256 and 16384 entries (palette byte size 32, 512 and 32768). The entry format is one of 0 IA8, 1 RGB565, 2 RGB5A3. BRRES keeps the palette in a separate PLT0 sub file paired with the TEX0 of the same name; TPL has a palette header; BTI has the palette inline fields.

Texel decoding as Dolphin does it

  • RGB565: r = 5 bits at 15-11, g = 6 bits at 10-5, b = 5 bits at 4-0, alpha 0xFF, on the big-endian 16-bit value (Dolphin swaps the loaded halfword).
  • RGB5A3: if bit 15 is set, 5-5-5 colour (bits 14-10, 9-5, 4-0) with alpha 0xFF; otherwise a 3-bit alpha (bits 14-12) and 4-4-4 colour (bits 11-8, 7-4, 3-0).
  • RGBA8: each 4 x 4 block is 64 bytes in two 32-byte halves; the first half holds 16 alpha/red byte pairs, the second 16 green/blue pairs, row by row (TextureDecoder_Generic.cpp lines 122-126 and 300-311). The byte order inside each pair follows from the shifts in that function on a little-endian host; Unverified: confirm with a real RGBA8 texture.
  • CMPR: each 8 x 8 tile holds four S3TC (DXT1-like) blocks in the order top-left, top-right, bottom-left, bottom-right; the two 16-bit colours are big endian RGB565; when colour 1 is greater than colour 2 the other two colours are blends, otherwise the third is the average and the fourth is the same average with alpha 0 (Dolphin comment: unlike DXT1, which uses transparent black).

Mip chains

noclip's calcMipChain stores levels one after another, each level padded to its block size and at least 32 bytes, with width and height halved per level. It discards a trailing level whose data is shorter than the padded size, and its comment attributes such short levels to a buggy mipmap encoder in Retro Studios games.

Related

Platform:Nintendo GameCube, Platform:Nintendo Wii, Technique:Block-compressed texture formats.

Code & repositories

  • https://github.com/magcius/noclip.website @ fd973ff240233c63883750a557c62baf6ff2a6c7 · license: MIT (declared by the contributor for the files used; GitHub reports MIT (read from LICENSE; GitHub's detector did not classify it) for the repository)
    src/gx/gx_enum.ts, gx_texture.ts, src/Common/JSYSTEM/JUTTexture.ts, src/rres/brres.ts and u8.ts: TypeScript parsers for GX textures, BTI, BRRES and U8
    Tested on: source read, not run · checked 2026-10-19; last activity 2026-10-19
  • https://github.com/dolphin-emu/dolphin @ cf5cb7ef81c3e8e7af5c9d566334219ffda9f68b · license: GPL-2.0-or-later (declared by the contributor; GitHub's detector did not recognize COPYING)
    Source/Core/VideoCommon/TextureDecoder.h, TextureDecoder_Common.cpp and TextureDecoder_Generic.cpp: reference GX texture block sizes and decoders
    Tested on: source read, not run · checked 2026-10-19; last activity 2026-10-19