textures: add optional Rust BCPack support to the batch exporter #822

Manually merged
github merged 2 commits from gh-pr/822/head into gh-pr/822/base 2026-11-26 22:21:17 +00:00
Owner

@⁠wish131400 on GitHub · 2026-11-23 08:59 UTC · original
wish131400:textures/optional-rust-bcpack → main · +187 −44 · 4 files · 2 commits · merged 2026-11-23 09:25 UTC

Refs #811. Uses the optional Rust kernels from Leonida #5116 at ff5f36b or later.

The existing TTPF-to-DDS batch command can use the Rust kernels from the selected Leonida checkout. The default remains strict and also works with the earlier Python reference checkout. --require-rust checks the Release library and expected kernels before pool open. Chunk-level fallback still applies. --calibration PROFILE.json explicitly retries strict decode failures with a local version-1 profile and records successful retries as mode: fitted. DDS publication remains atomic. The current manifest records the hash of the published bytes and omits the file and hash for a failed entry.

Verification

Windows 10 x64 build 19045, CPython 3.14.2, Cargo 1.98.1, NumPy 2.5.2 for the fitted path. CPU only. The tests use generated input.

cargo build --release --locked --offline --manifest-path "$Leonida/tools/bcpack_calibration/Cargo.toml" --target-dir "$Leonida/tools/bcpack_calibration/target"
$env:TTPF_TOOLS_DIR = "$Leonida/tools"
python -B tests/ttpf_batch_export_check.py -q
python -B tests/docs_links_check.py
python -B tools/ttpf_batch_export.py "$Fixtures/timing.ttpf" --threads 8 --tools-path "$Leonida/tools" --require-rust -o "$Out/native-1"
python -B tools/ttpf_batch_export.py "$Fixtures/timing.ttpf" --threads 8 --tools-path "$Reference/tools" -o "$Out/reference-1"
  • The batch suite passed 11/11 against both b0befb4 and ff5f36b. The docs link check passed. Requiring Rust with the reference checkout exited 2 before creating the output directory.
  • The generated 4×4 BC1 and mode-6 BC7 controls matched expected blocks, independently decoded pixels and DDS hashes. The truncated BC7 stream failed without a file or hash while its BC1 sibling exported.
  • A generated multi-mip BC1 fixture requiring external history was refused in strict mode. Supplying a synthetic profile produced one fitted DDS of 2,876 bytes with byte-for-byte parity against NumPy reconstruction.
  • With eight workers, 1,024 generated BC1 and mode-6 BC7 textures and fresh directories on the same NTFS volume, the times below cover pool open through manifest publication. Each run produced 1,024 strict DDS files totaling 4,345,856 bytes. Every DDS and every manifest entry matched across the two configurations.
Trial Reference tools b0befb4 Rust enabled ff5f36b
1 15.269 s 1.983 s
2 15.503 s 2.021 s
3 15.510 s 2.064 s
Median 15.503 s 2.021 s

The measured path is the batch exporter, including hashing and file publication. The previously reported standalone Rust benchmark includes the fixture generator and runs a different exporter. The timings here use generated streams eligible for the strict BC7 shortcut. The upstream coverage check observed 0/5,167 whole-chunk acceptances on its BC7 corpus.

AI-assisted.

**@⁠wish131400** on GitHub · 2026-11-23 08:59 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/822) `wish131400:textures/optional-rust-bcpack` → `main` · +187 −44 · 4 files · 2 commits · merged 2026-11-23 09:25 UTC Refs #811. Uses the optional Rust kernels from [Leonida #5116](https://github.com/ItsNotRexed/Leonida/pull/5116) at `ff5f36b` or later. The existing TTPF-to-DDS batch command can use the Rust kernels from the selected Leonida checkout. The default remains strict and also works with the earlier Python reference checkout. `--require-rust` checks the Release library and expected kernels before pool open. Chunk-level fallback still applies. `--calibration PROFILE.json` explicitly retries strict decode failures with a local version-1 profile and records successful retries as `mode: fitted`. DDS publication remains atomic. The current manifest records the hash of the published bytes and omits the file and hash for a failed entry. ### Verification Windows 10 x64 build 19045, CPython 3.14.2, Cargo 1.98.1, NumPy 2.5.2 for the fitted path. CPU only. The tests use generated input. ```powershell cargo build --release --locked --offline --manifest-path "$Leonida/tools/bcpack_calibration/Cargo.toml" --target-dir "$Leonida/tools/bcpack_calibration/target" $env:TTPF_TOOLS_DIR = "$Leonida/tools" python -B tests/ttpf_batch_export_check.py -q python -B tests/docs_links_check.py python -B tools/ttpf_batch_export.py "$Fixtures/timing.ttpf" --threads 8 --tools-path "$Leonida/tools" --require-rust -o "$Out/native-1" python -B tools/ttpf_batch_export.py "$Fixtures/timing.ttpf" --threads 8 --tools-path "$Reference/tools" -o "$Out/reference-1" ``` - The batch suite passed 11/11 against both `b0befb4` and `ff5f36b`. The docs link check passed. Requiring Rust with the reference checkout exited 2 before creating the output directory. - The generated 4×4 BC1 and mode-6 BC7 controls matched expected blocks, independently decoded pixels and DDS hashes. The truncated BC7 stream failed without a file or hash while its BC1 sibling exported. - A generated multi-mip BC1 fixture requiring external history was refused in strict mode. Supplying a synthetic profile produced one fitted DDS of 2,876 bytes with byte-for-byte parity against NumPy reconstruction. - With eight workers, 1,024 generated BC1 and mode-6 BC7 textures and fresh directories on the same NTFS volume, the times below cover pool open through manifest publication. Each run produced 1,024 strict DDS files totaling 4,345,856 bytes. Every DDS and every manifest entry matched across the two configurations. | Trial | Reference tools `b0befb4` | Rust enabled `ff5f36b` | | --- | ---: | ---: | | 1 | 15.269 s | 1.983 s | | 2 | 15.503 s | 2.021 s | | 3 | 15.510 s | 2.064 s | | Median | **15.503 s** | **2.021 s** | The measured path is the batch exporter, including hashing and file publication. The previously reported [standalone Rust benchmark](https://gist.github.com/wish131400/41e2c73bccf284bc7f58214ab788b665) includes the fixture generator and runs a different exporter. The timings here use generated streams eligible for the strict BC7 shortcut. The [upstream coverage check](https://github.com/ItsNotRexed/Leonida/pull/5116#issuecomment-7095547634) observed 0/5,167 whole-chunk acceptances on its BC7 corpus. AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:21:15 +00:00
github manually merged commit 10fa426ed4 into gh-pr/822/base 2026-11-26 22:21:17 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-23 09:13 UTC · original

I built the optional Rust library offline from Leonida ff5f36b, then ran the 11 batch-export checks against both the pinned Python reference checkout and the new checkout. The --require-rust CLI also exported both source-built control textures in strict mode. I pushed 10fa426 with the exact checkout and build commands so the Rust example does not silently reuse the older reference directory. Waiting for the new CI run.

**@⁠R0Y00** on GitHub · 2026-11-23 09:13 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/822#issuecomment-7096380446) I built the optional Rust library offline from Leonida `ff5f36b`, then ran the 11 batch-export checks against both the pinned Python reference checkout and the new checkout. The `--require-rust` CLI also exported both source-built control textures in strict mode. I pushed `10fa426` with the exact checkout and build commands so the Rust example does not silently reuse the older reference directory. Waiting for the new CI run.
This discussion has been locked. Commenting is limited to contributors.
No description provided.