Textures: decode R32_FLOAT, R16G16_FLOAT and R10G10B10A2; store chunk table past 4 GiB #149

Manually merged
github merged 1 commit from gh-pr/149/head into gh-pr/149/base 2026-11-26 20:13:26 +00:00
Owner

@⁠holdmysocks on GitHub · 2026-11-24 13:07 UTC · original
holdmysocks:claude/tex-formats → master · +235 −16 · 4 files · 1 commits · merged 2026-11-24 13:19 UTC

SIX-98, SIX-16.

Formats

R32_FLOAT (DXGI 39–41), R16G16_FLOAT (33, 34) and R10G10B10A2_UNORM (23–25) now decode. They are 4-byte formats, so they use the existing 4-byte Gfx10 layout in every tile mode, in texture dictionaries and in the stores.

  • PNG: R32 float as grey clamped to 0–1, like R16_FLOAT. R16G16 float as red and green clamped to 0–1, with blue 0. R10G10B10A2 as the top 8 bits of each channel, with alpha × 85.
  • DDS keeps the original data.

Checks

  • Full texture dictionary export (textures + levels, 2,366 dictionaries): 0 errors and 0 "unsupported format" warnings. The master build gives 5 (2 R32 float, 2 R10G10B10A2, 1 R16G16 float). Both builds give the same 11 "texture data out of range" warnings from one levels dictionary, which this PR does not change.
  • Census: those 5 are the only textures in these formats in the dictionaries. The bulk stores have none.
  • Mip n+1 against mip n downsampled: only one of the 5 has a mip chain (32×32 R32 float, 6 mips, mips 1–5 in the mip-tail block).
    • Mips 1→5 are exact 2×2 averages of the mip above: mean error 0.0000.
    • Mip 0→1: mean error 0.011 (mean value 0.061), against 0.121 when mip 0 is read without untiling. That is 11× closer, and the overall mean is the same on both mips.
  • Single-mip textures, checked on their values:
    • The 256×256 R32 float Gaussian noise decodes to mean 0.0005 and standard deviation 0.9988.
    • The R10G10B10A2 noise centres on 512 of 1023 in each colour channel, and alpha is always 3.
    • The R16G16 float LUT has neighbour differences of 26.2 untiled against 48.3 read linear, and it looks right.
  • Unit tests for the three conversions and for the chunk entry. cargo test -p sixng-core: 162 pass. The workspace builds.

Store chunk table (SIX-16)

Checked on all 57 stores in the install:

  • The file offset >> 8 is the low 26 bits of an entry (stores up to 16 GiB). The codec flags keep bits 26–31 only. No real entry sets bits 24–25 today (largest store 2.8 GB), so decoding does not change.
  • The virtual size is 40 bits: +0x0C's low byte is bits 32–39. It is 1 on the 18 stores whose virtual space passes 4 GiB, and every store's terminator entry lands on that size.
  • The page address of a texture was already read as 21 bits. No change.
  • The entry count includes the header's own entry, so the table at +0x18 holds count − 1 entries. We read one too many. On 3 stores that extra entry was the index magic, which became a fake chunk with codec bits. Its range was empty, so it was harmless, and it is no longer read.

examples/fmtmips runs the census and the checks.

**@⁠holdmysocks** on GitHub · 2026-11-24 13:07 UTC · [original](https://github.com/holdmysocks/SixNG/pull/149) `holdmysocks:claude/tex-formats` → `master` · +235 −16 · 4 files · 1 commits · merged 2026-11-24 13:19 UTC SIX-98, SIX-16. ## Formats R32_FLOAT (DXGI 39–41), R16G16_FLOAT (33, 34) and R10G10B10A2_UNORM (23–25) now decode. They are 4-byte formats, so they use the existing 4-byte Gfx10 layout in every tile mode, in texture dictionaries and in the stores. - PNG: R32 float as grey clamped to 0–1, like R16_FLOAT. R16G16 float as red and green clamped to 0–1, with blue 0. R10G10B10A2 as the top 8 bits of each channel, with alpha × 85. - DDS keeps the original data. ## Checks - **Full texture dictionary export** (textures + levels, 2,366 dictionaries): 0 errors and 0 "unsupported format" warnings. The master build gives 5 (2 R32 float, 2 R10G10B10A2, 1 R16G16 float). Both builds give the same 11 "texture data out of range" warnings from one levels dictionary, which this PR does not change. - **Census**: those 5 are the only textures in these formats in the dictionaries. The bulk stores have none. - **Mip n+1 against mip n downsampled**: only one of the 5 has a mip chain (32×32 R32 float, 6 mips, mips 1–5 in the mip-tail block). - Mips 1→5 are exact 2×2 averages of the mip above: mean error 0.0000. - Mip 0→1: mean error 0.011 (mean value 0.061), against 0.121 when mip 0 is read without untiling. That is 11× closer, and the overall mean is the same on both mips. - **Single-mip textures**, checked on their values: - The 256×256 R32 float Gaussian noise decodes to mean 0.0005 and standard deviation 0.9988. - The R10G10B10A2 noise centres on 512 of 1023 in each colour channel, and alpha is always 3. - The R16G16 float LUT has neighbour differences of 26.2 untiled against 48.3 read linear, and it looks right. - Unit tests for the three conversions and for the chunk entry. `cargo test -p sixng-core`: 162 pass. The workspace builds. ## Store chunk table (SIX-16) Checked on all 57 stores in the install: - The file offset >> 8 is the low **26** bits of an entry (stores up to 16 GiB). The codec flags keep bits 26–31 only. No real entry sets bits 24–25 today (largest store 2.8 GB), so decoding does not change. - The virtual size is **40 bits**: +0x0C's low byte is bits 32–39. It is 1 on the 18 stores whose virtual space passes 4 GiB, and every store's terminator entry lands on that size. - The page address of a texture was already read as 21 bits. No change. - The entry count includes the header's own entry, so the table at +0x18 holds count − 1 entries. We read one too many. On 3 stores that extra entry was the index magic, which became a fake chunk with codec bits. Its range was empty, so it was harmless, and it is no longer read. `examples/fmtmips` runs the census and the checks.
The last formats the texture dictionaries hold now decode, so a full
texture dictionary export gives no "unsupported format" warnings. They are
4-byte formats and use the existing 4-byte Gfx10 layout in every tile mode,
in dictionaries and stores. PNG: R32 float as grey clamped to 0..1 (like
R16_FLOAT), R16G16 float as red/green clamped with blue 0, R10G10B10A2 as
the top 8 bits per channel and alpha x 85. DDS keeps the original data.

Store chunk table (SIX-16): the file offset is the low 26 bits of an
entry (stores up to 16 GiB), the codec flags keep bits 26-31 only, the
virtual size is 40 bits (+0x0C low byte is bits 32-39), and the table at
+0x18 holds count - 1 entries (the count includes the header's entry), so
the index magic is no longer read as an extra chunk.

examples/fmtmips: format census of the dictionaries of some archives, with
mip and smoothness checks for chosen formats.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:13:24 +00:00
github manually merged commit ffdbcad35b into gh-pr/149/base 2026-11-26 20:13:26 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.