dds_png: preview signed and unsigned BC6H textures #2248

Merged
kirigayakazima merged 1 commit from upstream-pr/2248 into main 2026-11-28 23:48:31 +00:00
kirigayakazima commented 2026-11-26 10:23:51 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kirigayakazima on 2026-11-26T10:23:51Z.


Claimed in the coordination issue as: DDS-PNG-BC6H-PREVIEW

Depends on: #140 (overlapping changes in the existing BC7 decoder). #2247 (adjacent format-dispatch cases; keep both handlers when merging). Each branch builds directly on main. These references flag textual merge conflicts.

What and why

Decode signed and unsigned BC6H subresources using the repository’s BC6H block decoder. Reuse the BC7 block traversal and cache, clip blocks at texture edges and map linear RGB to the eight-bit preview range. The synthetic fixtures cover both signedness variants and an incomplete block.

Tested

Windows, Python 3.14.7. The regression failed on the parent commit and passed with this change.

  • python -I tests/test_dds_subresources.py
  • python -I tests/test_dds_png.py
  • python -I tests/test_ttpf_mips.py
  • git diff --check and the changed-path no-game-data scan passed.
  • Shared main baseline: 498 semantic test files, 6,351 tests passed.

GPUs tested: N/A (synthetic CPU tests).

AI-assisted: Yes.

Checklist

  • Based on current main and merges cleanly with the tested base.
  • One topic.
  • No game data, keys or decryption.
  • Translator contract table: N/A.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5508232195 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2248). Originally posted by [kirigayakazima](https://github.com/kirigayakazima) on 2026-11-26T10:23:51Z. --- Claimed in the coordination issue as: [DDS-PNG-BC6H-PREVIEW](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7189018014) Depends on: #140 (overlapping changes in the existing BC7 decoder). #2247 (adjacent format-dispatch cases; keep both handlers when merging). Each branch builds directly on main. These references flag textual merge conflicts. ### What and why Decode signed and unsigned BC6H subresources using the repository’s BC6H block decoder. Reuse the BC7 block traversal and cache, clip blocks at texture edges and map linear RGB to the eight-bit preview range. The synthetic fixtures cover both signedness variants and an incomplete block. ### Tested Windows, Python 3.14.7. The regression failed on the parent commit and passed with this change. - `python -I tests/test_dds_subresources.py` - `python -I tests/test_dds_png.py` - `python -I tests/test_ttpf_mips.py` - `git diff --check` and the changed-path no-game-data scan passed. - Shared main baseline: 498 semantic test files, 6,351 tests passed. GPUs tested: N/A (synthetic CPU tests). AI-assisted: Yes. ### Checklist - [x] Based on current main and merges cleanly with the tested base. - [x] One topic. - [x] No game data, keys or decryption. - Translator contract table: N/A.
DeadlyChirp commented 2026-11-26 10:42:36 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DeadlyChirp on 2026-11-26T10:42:36Z.


Tested on Windows 11, Python 3.12.10, with this PR merged onto current upstream main.

  • tests/test_dds_png.py + tests/test_dds_subresources.py: 114 passed, 173 subtests passed (main: 113 passed, 172 subtests).

(AI-assisted test run; output checked by hand.)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7189728430 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2248#issuecomment-7189728430). Originally posted by [DeadlyChirp](https://github.com/DeadlyChirp) on 2026-11-26T10:42:36Z. --- Tested on Windows 11, Python 3.12.10, with this PR merged onto current upstream main. - `tests/test_dds_png.py` + `tests/test_dds_subresources.py`: 114 passed, 173 subtests passed (main: 113 passed, 172 subtests). (AI-assisted test run; output checked by hand.)
lixonik commented 2026-11-26 11:08:20 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-26T11:08:20Z.

Review: COMMENTED


Windows 11: 100 DDS/PNG tests and 14 subresource tests passed. I also ran the isolated CLI on authored BC6H UF16 and SF16 blocks, verified metadata plus the exact 4×4 PNG pixels, and checked rejection of typeless BC6H. No findings from these checks.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6073066089 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2248#pullrequestreview-6073066089). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-26T11:08:20Z. **Review:** COMMENTED --- Windows 11: 100 DDS/PNG tests and 14 subresource tests passed. I also ran the isolated CLI on authored BC6H UF16 and SF16 blocks, verified metadata plus the exact 4×4 PNG pixels, and checked rejection of typeless BC6H. No findings from these checks. AI-assisted.
lixonik commented 2026-11-27 15:50:29 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-27T15:50:29Z.

Review: COMMENTED


Re-verified after rebase at 7811fd88c (merged cleanly onto main ec91d695c).

  • Windows 11, Python 3.12: python -I -B tests/test_dds_png.py -v (100/100) and python -I -B tests/test_dds_subresources.py -v (14/14, including signed/unsigned BC6H clamping, edge clipping, and truncation) passed; scripts/check_no_game_data.py and git diff --check clean.
  • Confirmed decode_bc6h_block() in tools/ttpf_mips.py produces finite IEEE 754 half-float values (clamped to 0x7BFF), so the [0, 1] preview clamp in _decode_bptc() cannot fail on NaN/inf.
  • No findings.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6090598168 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2248#pullrequestreview-6090598168). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-27T15:50:29Z. **Review:** COMMENTED --- Re-verified after rebase at `7811fd88c` (merged cleanly onto `main` `ec91d695c`). - Windows 11, Python 3.12: `python -I -B tests/test_dds_png.py -v` (100/100) and `python -I -B tests/test_dds_subresources.py -v` (14/14, including signed/unsigned BC6H clamping, edge clipping, and truncation) passed; `scripts/check_no_game_data.py` and `git diff --check` clean. - Confirmed `decode_bc6h_block()` in `tools/ttpf_mips.py` produces finite IEEE 754 half-float values (clamped to `0x7BFF`), so the `[0, 1]` preview clamp in `_decode_bptc()` cannot fail on `NaN`/`inf`. - No findings. AI-assisted.
TheGeogeo commented 2026-11-28 23:38:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-28T23:38:12Z.


Tested 7811fd88c merged (no commit) with main aa918e5d9: Python 3.12.4, Windows 11 10.0.26300, CPU only. check_no_game_data.py is clean.

  • Green: test_dds_png.py (102 tests) and test_dds_subresources.py (14 tests) pass.
  • Red: with tools/dds_png.py back to main, test_dds_subresources.py errors twice (Unsupported DXGI format: 96, BC6H signed).

No blocker from my side.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7247562866 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2248#issuecomment-7247562866). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-11-28T23:38:12Z. --- Tested `7811fd88c` merged (no commit) with `main` `aa918e5d9`: Python 3.12.4, Windows 11 10.0.26300, CPU only. `check_no_game_data.py` is clean. - Green: `test_dds_png.py` (102 tests) and `test_dds_subresources.py` (14 tests) pass. - Red: with `tools/dds_png.py` back to `main`, `test_dds_subresources.py` errors twice (`Unsupported DXGI format: 96`, BC6H signed). No blocker from my side. AI-assisted (Claude Code).
MoonEyes commented 2026-11-28 23:48:34 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T23:48:34Z.


Merged after TheGeogeo's red/green check (check) (Windows, Python tests, no GPU needed) and a local re-check here. Merged after local re-verification: this PR merged onto main ace0e9d1c without conflict, and its test file(s) (tests/test_dds_png.py, tests/test_dds_subresources.py) pass there. Earlier today the same tests failed on main without the PR (red/green) and a bundle with other open PRs showed no new failures. check_no_game_data.py is clean. Windows 11, Python 3.14; no GPU needed for these tests.

AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7247677673 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2248#issuecomment-7247677673). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T23:48:34Z. --- Merged after **TheGeogeo**'s red/green check ([check](https://github.com/ProjectLeonida/mandy/pull/2248#issuecomment-7247562866)) (Windows, Python tests, no GPU needed) and a local re-check here. Merged after local re-verification: this PR merged onto `main` ace0e9d1c without conflict, and its test file(s) (`tests/test_dds_png.py`, `tests/test_dds_subresources.py`) pass there. Earlier today the same tests failed on `main` without the PR (red/green) and a bundle with other open PRs showed no new failures. `check_no_game_data.py` is clean. Windows 11, Python 3.14; no GPU needed for these tests. _AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes._
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!2248
No description provided.