[integration] DDS preview formats: R8/RG8, RGBA16 UNORM/SNORM, R9G9B9E5, B5 packed, R10G10B10A2 UINT/TYPELESS (INTEGRATION-ZRO-DRAFTS) #2394

Manually merged
github merged 24 commits from gh-pr/2394/head into gh-pr/2394/base 2026-11-26 18:35:49 +00:00
Owner

@⁠aslan2142 on GitHub · 2026-11-26 18:28 UTC · original
aslan2142:integration/dds-preview-formats → main · +356 −24 · 6 files · 24 commits · merged 2026-11-26 18:28 UTC

One tested batch of DDS preview formats for tools/dds_png.py and tools/tex_export.py --png: 11 pull requests, merged one by one with a merge commit each, so the authors' commits stay theirs. Then one maintainer commit adds the missing tests and the tex_export --png fix for R9G9B9E5.

Claim: #1608 (INTEGRATION-ZRO-DRAFTS)

Base: main at bdbc7e923.

Included

PR Author Formats (DXGI) Head merged
#2247 @⁠kirigayakazima R8_UNORM (61), R8G8_UNORM (49) f833599c8
#2157 @⁠ZroIsHere R16G16B16A16_UNORM (11) 7286d7823
#2158 @⁠ZroIsHere R16G16B16A16_SNORM (13) c4439f583
#2218 @⁠ZroIsHere R9G9B9E5_SHAREDEXP (67) d36c961c3
#2314 @⁠ZroIsHere B5G6R5_UNORM (85), B5G5R5A1_UNORM (86) 3e8c273d6
#2317 @⁠ZroIsHere R8G8_SNORM (51) 893f1a0f4
#2319 @⁠ZroIsHere R8G8_UINT (50), R8G8_SINT (52) 81df9f5ed
#2320 @⁠ZroIsHere R10G10B10A2_UINT (25) 943bba2dd
#2321 @⁠ZroIsHere R10G10B10A2_TYPELESS (23) c5efad48c
#2323 @⁠ZroIsHere R8_SNORM (63) 1c78f0fee
#2324 @⁠ZroIsHere R8_UINT (62), R8_SINT (64) 4ba0afc2d

We checked each decoder against the format's definition:

  • channel order and bit layout (B5G6R5: blue in bits 0-4; B5G5R5A1: alpha in bit 15; R10G10B10A2: R in the low bits);
  • R9G9B9E5 uses mantissa * 2^(e - 24);
  • SNORM: -128 and -127 are both -1.0, the same mapping as the existing BC4/BC5 SNORM;
  • linear, not sRGB.

The merges conflicted in the same format tables. Every format is kept, and each PR's new decoder function is byte-identical to its head.

Added by the maintainers (commit a28d96796)

  • Tests: synthetic tests for every format that had none: R9G9B9E5, B5G6R5, B5G5R5A1, R8G8 SNORM/UINT/SINT, R8 SNORM/UINT/SINT, and R10G10B10A2 TYPELESS/UINT (checked against UNORM). Each uses hand-built 2x2 texels with a padded row pitch and a payload one byte short.
  • tex_export --png for R9G9B9E5 (ecox982745's finding on #2218): tools/tex_headers.py now lists DXGI 67 in DXGI and FMT_INFO. New tests:
    • test_shared_exponent_r9g9b9e5_writes_a_png follows the texture from the index through the DDS to the PNG;
    • test_shared_exponent_format_is_indexed_and_sized checks the indexer's table.
  • Test update for #2320: two test_tex_export.py cases used DXGI 25 as an undecodable format, and #2320 makes it decodable. They now use R8G8B8A8_UINT (30). len(T.FMT) is now 57.
  • Docstrings: one list of the decoded formats in dds_png.py and tex_export.py, instead of a line per PR.

Left out

  • #2322 and #2316 duplicate #2247: they add the same formats.
  • No other pull request by ZroIsHere is in this batch.

Tests

Linux, Python 3.13, CPU only, no GPU needed:

  • Texture tool tests (pytest): 503 passed, 3 skipped, 515 subtests. Files: test_tex_export.py, test_dds_png.py, test_dds_png_dx10.py, test_dds_subresources.py, test_tex_headers.py, test_tex_headers_report_paths.py, test_ttpf_mips.py, test_ttpf_assets.py, test_calibrated_texture.py, test_calibrated_texture_extra.py.
  • Standalone under python3 -I, all OK:
    • test_dds_png_dx10.py: 16 tests
    • test_dds_png.py: 100
    • test_dds_subresources.py: 13
    • test_tex_headers.py: 78
    • test_tex_headers_report_paths.py: 8
    • test_ci_registration.py: 16
    • test_text_write_line_endings.py: 3
  • The new tests fail on main: we ran the branch's three changed test files against main's tools. 16 tests fail: every new format test, the R9G9B9E5 export test, the indexer table test and the FMT count.
  • Other checks: compileall is clean, make_game.py --help runs, and check_no_game_data.py passes on all six changed files.

Not tested

  • No game files: the formats were not tested on game textures.
  • Indexer change: adding DXGI 67 means the indexer now keeps descriptors whose format byte is 67. We have not counted how many such descriptors the full corpus has.
  • restofworld_index.py: its own format table (commented "kept in step with tools/tex_headers.py") is unchanged.
  • B5G6R5, B5G5R5A1 and R10G10B10A2_TYPELESS: these decode in dds_png.py, but the indexer does not list them, so tex_export --png cannot reach them. The tex_export docstring no longer claims them.
  • Platforms: Windows and macOS not run.

AI-assisted (Claude Code, Claude Opus 5.5 and Claude Fable 5.2)

**@⁠aslan2142** on GitHub · 2026-11-26 18:28 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2394) `aslan2142:integration/dds-preview-formats` → `main` · +356 −24 · 6 files · 24 commits · merged 2026-11-26 18:28 UTC One tested batch of DDS preview formats for `tools/dds_png.py` and `tools/tex_export.py --png`: 11 pull requests, merged one by one with a merge commit each, so the authors' commits stay theirs. Then one maintainer commit adds the missing tests and the `tex_export --png` fix for R9G9B9E5. Claim: https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608 (`INTEGRATION-ZRO-DRAFTS`) Base: `main` at `bdbc7e923`. ## Included | PR | Author | Formats (DXGI) | Head merged | | --- | --- | --- | --- | | #2247 | @⁠kirigayakazima | R8_UNORM (61), R8G8_UNORM (49) | `f833599c8` | | #2157 | @⁠ZroIsHere | R16G16B16A16_UNORM (11) | `7286d7823` | | #2158 | @⁠ZroIsHere | R16G16B16A16_SNORM (13) | `c4439f583` | | #2218 | @⁠ZroIsHere | R9G9B9E5_SHAREDEXP (67) | `d36c961c3` | | #2314 | @⁠ZroIsHere | B5G6R5_UNORM (85), B5G5R5A1_UNORM (86) | `3e8c273d6` | | #2317 | @⁠ZroIsHere | R8G8_SNORM (51) | `893f1a0f4` | | #2319 | @⁠ZroIsHere | R8G8_UINT (50), R8G8_SINT (52) | `81df9f5ed` | | #2320 | @⁠ZroIsHere | R10G10B10A2_UINT (25) | `943bba2dd` | | #2321 | @⁠ZroIsHere | R10G10B10A2_TYPELESS (23) | `c5efad48c` | | #2323 | @⁠ZroIsHere | R8_SNORM (63) | `1c78f0fee` | | #2324 | @⁠ZroIsHere | R8_UINT (62), R8_SINT (64) | `4ba0afc2d` | We checked each decoder against the format's definition: - channel order and bit layout (B5G6R5: blue in bits 0-4; B5G5R5A1: alpha in bit 15; R10G10B10A2: R in the low bits); - R9G9B9E5 uses `mantissa * 2^(e - 24)`; - SNORM: -128 and -127 are both -1.0, the same mapping as the existing BC4/BC5 SNORM; - linear, not sRGB. The merges conflicted in the same format tables. Every format is kept, and each PR's new decoder function is byte-identical to its head. ## Added by the maintainers (commit `a28d96796`) - **Tests:** synthetic tests for every format that had none: R9G9B9E5, B5G6R5, B5G5R5A1, R8G8 SNORM/UINT/SINT, R8 SNORM/UINT/SINT, and R10G10B10A2 TYPELESS/UINT (checked against UNORM). Each uses hand-built 2x2 texels with a padded row pitch and a payload one byte short. - **`tex_export --png` for R9G9B9E5** (ecox982745's finding on #2218): `tools/tex_headers.py` now lists DXGI 67 in `DXGI` and `FMT_INFO`. New tests: - `test_shared_exponent_r9g9b9e5_writes_a_png` follows the texture from the index through the DDS to the PNG; - `test_shared_exponent_format_is_indexed_and_sized` checks the indexer's table. - **Test update for #2320:** two `test_tex_export.py` cases used DXGI 25 as an undecodable format, and #2320 makes it decodable. They now use R8G8B8A8_UINT (30). `len(T.FMT)` is now 57. - **Docstrings:** one list of the decoded formats in `dds_png.py` and `tex_export.py`, instead of a line per PR. ## Left out - #2322 and #2316 duplicate #2247: they add the same formats. - No other pull request by ZroIsHere is in this batch. ## Tests Linux, Python 3.13, CPU only, no GPU needed: - **Texture tool tests (pytest):** 503 passed, 3 skipped, 515 subtests. Files: `test_tex_export.py`, `test_dds_png.py`, `test_dds_png_dx10.py`, `test_dds_subresources.py`, `test_tex_headers.py`, `test_tex_headers_report_paths.py`, `test_ttpf_mips.py`, `test_ttpf_assets.py`, `test_calibrated_texture.py`, `test_calibrated_texture_extra.py`. - **Standalone under `python3 -I`, all OK:** - `test_dds_png_dx10.py`: 16 tests - `test_dds_png.py`: 100 - `test_dds_subresources.py`: 13 - `test_tex_headers.py`: 78 - `test_tex_headers_report_paths.py`: 8 - `test_ci_registration.py`: 16 - `test_text_write_line_endings.py`: 3 - **The new tests fail on `main`:** we ran the branch's three changed test files against `main`'s tools. 16 tests fail: every new format test, the R9G9B9E5 export test, the indexer table test and the `FMT` count. - **Other checks:** `compileall` is clean, `make_game.py --help` runs, and `check_no_game_data.py` passes on all six changed files. ## Not tested - **No game files:** the formats were not tested on game textures. - **Indexer change:** adding DXGI 67 means the indexer now keeps descriptors whose format byte is 67. We have not counted how many such descriptors the full corpus has. - **`restofworld_index.py`:** its own format table (commented "kept in step with tools/tex_headers.py") is unchanged. - **B5G6R5, B5G5R5A1 and R10G10B10A2_TYPELESS:** these decode in `dds_png.py`, but the indexer does not list them, so `tex_export --png` cannot reach them. The `tex_export` docstring no longer claims them. - **Platforms:** Windows and macOS not run. AI-assisted (Claude Code, Claude Opus 5.5 and Claude Fable 5.2)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

# Conflicts:
#	tools/dds_png.py
Co-Authored-By: Claude Opus 5.5 <[email protected]>

# Conflicts:
#	tests/test_dds_png_dx10.py
#	tools/dds_png.py
Co-Authored-By: Claude Opus 5.5 <[email protected]>

# Conflicts:
#	tools/dds_png.py
#	tools/tex_export.py
Co-Authored-By: Claude Opus 5.5 <[email protected]>

# Conflicts:
#	tools/dds_png.py
#	tools/tex_export.py
Co-Authored-By: Claude Opus 5.5 <[email protected]>

# Conflicts:
#	tools/dds_png.py
#	tools/tex_export.py
Co-Authored-By: Claude Opus 5.5 <[email protected]>

# Conflicts:
#	tools/dds_png.py
#	tools/tex_export.py
Co-Authored-By: Claude Opus 5.5 <[email protected]>

# Conflicts:
#	tools/tex_export.py
Co-Authored-By: Claude Opus 5.5 <[email protected]>

# Conflicts:
#	tools/dds_png.py
#	tools/tex_export.py
Co-Authored-By: Claude Opus 5.5 <[email protected]>

# Conflicts:
#	tools/dds_png.py
#	tools/tex_export.py
Co-Authored-By: Claude Opus 5.5 <[email protected]>

# Conflicts:
#	tools/dds_png.py
#	tools/tex_export.py
- tests/test_dds_png_dx10.py: hand-built 2x2 texels with padded row pitch and a one-byte-short payload for
  R9G9B9E5_SHAREDEXP (67), B5G6R5 (85), B5G5R5A1 (86), R8G8 SNORM/UINT/SINT (51/50/52),
  R8 SNORM/UINT/SINT (63/62/64) and R10G10B10A2 TYPELESS/UINT (23/25, checked against UNORM 24);
  these merged without tests.
- tools/tex_headers.py: list DXGI 67 in DXGI and FMT_INFO (4-byte element), so the indexer keeps such
  textures and tex_export --png reaches dds_png's decoder instead of "unsupported format" (ecox982745's
  finding on #2218). New tests in test_tex_export.py (index -> DDS -> PNG) and test_tex_headers.py.
- tests/test_tex_export.py: the "undecodable format" cases used DXGI 25, which #2320 now decodes; they use
  R8G8B8A8_UINT (30) instead. FMT has 57 entries with 67.
- tools/dds_png.py, tools/tex_export.py: one docstring list of the decoded formats instead of the per-PR lines.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 18:35:45 +00:00
github manually merged commit a28d967966 into gh-pr/2394/base 2026-11-26 18:35:49 +00:00
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-26 18:28 UTC · original

Merging. This is a self-merge of an integration batch.

  • Why a batch: eleven small PRs add preview decoders to the same two format tables and conflict with each other pairwise. One branch with all of them, tested once, replaces eleven rounds of rebase and review.
  • Included: #2247 (@⁠kirigayakazima), and #2157, #2158, #2218, #2314, #2317, #2319, #2320, #2321, #2323 and #2324 (@⁠ZroIsHere). Each decoder was checked against its format definition and is unchanged from its PR.
  • Added by the maintainers: tests for the nine formats that had none, the tex_export --png path for R9G9B9E5 that @⁠ecox982745 pointed out, and a fix for two existing tests that used a format as undecodable which #2320 makes decodable.
  • Tested on main bdbc7e923 + this branch (a28d96796), Linux, Python 3.13:
    • pytest over the texture test files: 503 passed, 3 skipped.
    • The standalone test files, test_ci_registration.py and test_text_write_line_endings.py pass.
    • The changed test files run against main's tools: 16 fail, so every new test fails on main.
    • compileall, make_game.py --help and check_no_game_data.py on the changed files are clean.
  • Not tested: real game textures, Windows and macOS. Three of the formats decode in dds_png.py but tex_export --png cannot reach them yet; the description says which.

AI-assisted (Claude Code, Claude Opus 5.5 and Claude Fable 5.2)

**@⁠aslan2142** on GitHub · 2026-11-26 18:28 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2394#issuecomment-7200508348) Merging. This is a self-merge of an integration batch. - **Why a batch:** eleven small PRs add preview decoders to the same two format tables and conflict with each other pairwise. One branch with all of them, tested once, replaces eleven rounds of rebase and review. - **Included:** #2247 (@⁠kirigayakazima), and #2157, #2158, #2218, #2314, #2317, #2319, #2320, #2321, #2323 and #2324 (@⁠ZroIsHere). Each decoder was checked against its format definition and is unchanged from its PR. - **Added by the maintainers:** tests for the nine formats that had none, the `tex_export --png` path for R9G9B9E5 that @⁠ecox982745 pointed out, and a fix for two existing tests that used a format as undecodable which #2320 makes decodable. - **Tested on `main` `bdbc7e923` + this branch** (`a28d96796`), Linux, Python 3.13: - pytest over the texture test files: 503 passed, 3 skipped. - The standalone test files, `test_ci_registration.py` and `test_text_write_line_endings.py` pass. - The changed test files run against `main`'s tools: 16 fail, so every new test fails on `main`. - `compileall`, `make_game.py --help` and `check_no_game_data.py` on the changed files are clean. - **Not tested:** real game textures, Windows and macOS. Three of the formats decode in `dds_png.py` but `tex_export --png` cannot reach them yet; the description says which. AI-assisted (Claude Code, Claude Opus 5.5 and Claude Fable 5.2)
Author
Owner

@⁠ecox982745 on GitHub · 2026-11-26 18:49 UTC · original

On native Windows 11 x64 with Python 3.13.18, the ten texture test files listed above gave 500 passed, 6 skipped, with all 515 subtests passing on merged main e57bc63bc5. The R9G9B9E5 test exercised the synthetic index → DDS → PNG export and checked the actual pixels. The skips were two symlink cases, one POSIX file-mode case, and three cases requiring optional native tools.

I also checked three decoders through dds_to_png_bytes, reading the emitted PNG with Pillow. Every synthetic DDS row had seven padding bytes between it and the next row.

Format Coverage PNG result
B5G6R5_UNORM All 65,536 packed words Every RGBA byte matched channel bit replication
B5G5R5A1_UNORM All 65,536 packed words Every RGBA byte matched, including the alpha bit
R9G9B9E5_SHAREDEXP All 32 exponents × 512 mantissas in each channel, with different channel orders All 16,384 pixels matched an integer reference for scaling, rounding and clamping

The two B5 checks use the DDS decoder directly. All results here are CPU-only synthetic texture checks.

**@⁠ecox982745** on GitHub · 2026-11-26 18:49 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2394#issuecomment-7200894387) On native Windows 11 x64 with Python 3.13.18, the ten texture test files listed above gave **500 passed, 6 skipped**, with all 515 subtests passing on merged main `e57bc63bc5`. The R9G9B9E5 test exercised the synthetic index → DDS → PNG export and checked the actual pixels. The skips were two symlink cases, one POSIX file-mode case, and three cases requiring optional native tools. I also checked three decoders through `dds_to_png_bytes`, reading the emitted PNG with Pillow. Every synthetic DDS row had seven padding bytes between it and the next row. | Format | Coverage | PNG result | | --- | --- | --- | | B5G6R5_UNORM | All 65,536 packed words | Every RGBA byte matched channel bit replication | | B5G5R5A1_UNORM | All 65,536 packed words | Every RGBA byte matched, including the alpha bit | | R9G9B9E5_SHAREDEXP | All 32 exponents × 512 mantissas in each channel, with different channel orders | All 16,384 pixels matched an integer reference for scaling, rounding and clamping | The two B5 checks use the DDS decoder directly. All results here are CPU-only synthetic texture checks.
This discussion has been locked. Commenting is limited to contributors.
No description provided.