Tests: read the TTPF texture table's mip count from both of its fields (#1121) #1245

Open
github-bot wants to merge 1 commit from github-bot/gh-1245 into main AGit
Owner

@⁠tiagonogueiraa-bit on GitHub · 2026-11-24 13:41 UTC · original
tiagonogueiraa-bit:ttpf-mip-count → main · +2 −1 · 1 files · 1 commits · open

retail_ttpf_textures_detile_with_their_mip_chains read a texture's stored mip count from dword 0 bits 28–31 only. Dword 1 bits 0–2 (below the DXGI format) add to it. On the archive the test was written for, those extra levels only fall in the mip-tail block, so the size check passed there. On the other archives it failed. Fixes #1121, part of #707.

Across all 46 .ttpf archives of the package (table fields only, gpu/tiling.rs of main), the model now matches the stored size of 351 970 of 352 461 textures, against 294 726 before. The rest are mipped cubes (#707) and each archive's last entry. The extra levels are real mips: each one is the level above it scaled down 2× (details in #1121).

Overlaps #752, which changes the same test. The two edit different lines, and texture.rs merges cleanly with both. #752's "volumes: none" message still applies; its size-miss message becomes rare.

What is in it

  • crates/xcl/src/gpu/texture.rs, mod tests, Ttpf::open: mips = (a >> 28) + (b & 7)

Tested

  • macOS: cargo check -p xcl --lib --tests --target x86_64-pc-windows-msvc, no errors.
  • The test body ran on macOS in a standalone copy, with the same tiling code and only the archive reader changed. The size check passes on 44 of 46 archives, against 10 on main. ttdb_graphics.ttpf is unchanged at 909 / 912.
  • Run by @⁠vitor127wt on this head 830bf78 and its parent 47efa2e (Windows MSVC build under Wine, cargo test -p xcl --lib retail_ttpf with XCL_SAMPLE_TTPF set) (report):
    • ttdb_ui.ttpf: sizes match for 8 115 / 10 013 on the parent and 10 012 / 10 013 on this head. The size assertion now passes. The test then stops at the separate checked >= 5 assertion: only 3 uncompressed mipped textures, all close.
    • ttdb_graphics.ttpf: 909 / 912 on both; the whole test passes on both.
  • The whole suite on native Windows: not run.

Regression run
Not run. The diff is test-only: one line inside #[cfg(test)] mod tests of a runtime file.

Not tested

  • The whole suite on native Windows.
  • Mipped cubes. Their layout is still open (#707), and this change does not touch it.

AI use

  • Claude Code with Claude Opus 5.5. It found the field by analysing the archive tables, wrote the change and this description, and ran the macOS checks.

🤖 Generated with Claude Code

**@⁠tiagonogueiraa-bit** on GitHub · 2026-11-24 13:41 UTC · [original](https://github.com/xcl-dev/xcl/pull/1245) `tiagonogueiraa-bit:ttpf-mip-count` → `main` · +2 −1 · 1 files · 1 commits · open `retail_ttpf_textures_detile_with_their_mip_chains` read a texture's stored mip count from dword 0 bits 28–31 only. Dword 1 bits 0–2 (below the DXGI format) add to it. On the archive the test was written for, those extra levels only fall in the mip-tail block, so the size check passed there. On the other archives it failed. Fixes #1121, part of #707. Across all 46 `.ttpf` archives of the package (table fields only, `gpu/tiling.rs` of main), the model now matches the stored size of 351 970 of 352 461 textures, against 294 726 before. The rest are mipped cubes (#707) and each archive's last entry. The extra levels are real mips: each one is the level above it scaled down 2× (details in #1121). Overlaps #752, which changes the same test. The two edit different lines, and `texture.rs` merges cleanly with both. #752's "volumes: none" message still applies; its size-miss message becomes rare. **What is in it** - `crates/xcl/src/gpu/texture.rs`, `mod tests`, `Ttpf::open`: `mips` = `(a >> 28) + (b & 7)` **Tested** - macOS: `cargo check -p xcl --lib --tests --target x86_64-pc-windows-msvc`, no errors. - The test body ran on macOS in a standalone copy, with the same tiling code and only the archive reader changed. The size check passes on 44 of 46 archives, against 10 on main. `ttdb_graphics.ttpf` is unchanged at 909 / 912. - Run by @⁠vitor127wt on this head `830bf78` and its parent `47efa2e` (Windows MSVC build under Wine, `cargo test -p xcl --lib retail_ttpf` with `XCL_SAMPLE_TTPF` set) ([report](https://github.com/ivall/xcl/pull/1245#issuecomment-7135339434)): - `ttdb_ui.ttpf`: sizes match for 8 115 / 10 013 on the parent and **10 012 / 10 013** on this head. The size assertion now passes. The test then stops at the separate `checked >= 5` assertion: only 3 uncompressed mipped textures, all close. - `ttdb_graphics.ttpf`: 909 / 912 on both; the whole test passes on both. - The whole suite on native Windows: not run. **Regression run** Not run. The diff is test-only: one line inside `#[cfg(test)] mod tests` of a runtime file. **Not tested** - The whole suite on native Windows. - Mipped cubes. Their layout is still open (#707), and this change does not touch it. **AI use** - Claude Code with Claude Opus 5.5. It found the field by analysing the archive tables, wrote the change and this description, and ran the macOS checks. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
retail_ttpf_textures_detile_with_their_mip_chains took the levels a
texture stores from dword 0 bits 28-31 only. Dword 1 bits 0-2, below the
DXGI format, add to that count. On the archive the test was written
against, the textures that set them only gain levels inside the mip tail
block, which takes the same space, so the size check passed there. On
the other archives the test sized textures with too few levels and
failed (#707, #1121).

Measured on the 46 texture archives of the retail 1.0.2.1 package, with
gpu/tiling.rs from main 47efa2e (table fields only for the sizes):
- the GFX10 model matches the stored size for 351 970 of 352 461
  textures with (a >> 28) + (b & 7), 294 726 with a >> 28 alone. The
  remaining 491 are mipped cubes (445, the open question in #707) and
  the last texture of each archive, whose end is the stream's total;
- every distinct table entry (all but the page offset) has one mip
  count that fits all of its textures;
- the extra levels are mips: on sampled BC1 textures each one is the
  level above it scaled down 2x (mean error 0.5-6/255; 3-75/255 with
  the level shifted half its width), as on textures that already fit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:48:16 +00:00
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 14:02 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib lib texture: 29 passed, 0 failed.

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-24 14:02 UTC · [original](https://github.com/xcl-dev/xcl/pull/1245#issuecomment-7133726686) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - cargo test -p xcl --lib lib texture: 29 passed, 0 failed. Thanks!
Author
Owner

@⁠tiagonogueiraa-bit on GitHub · 2026-11-24 14:02 UTC · original

Hi @⁠ivall, could you review the diff and, if you agree it is test-only, apply the test-only label? It changes one line inside #[cfg(test)] mod tests of crates/xcl/src/gpu/texture.rs: the TTPF test's mip count becomes (a >> 28) + (b & 7). No scripts/smoke.ps1 run was made, so the PR description check fails only on the two xcl-smoke blocks.

A Windows run of cargo test with XCL_SAMPLE_TTPF set is still wanted; a volunteer offered hardware in #1243.

Written with Claude Code (Claude Opus 5.5).

**@⁠tiagonogueiraa-bit** on GitHub · 2026-11-24 14:02 UTC · [original](https://github.com/xcl-dev/xcl/pull/1245#issuecomment-7133730235) Hi @⁠ivall, could you review the diff and, if you agree it is test-only, apply the `test-only` label? It changes one line inside `#[cfg(test)] mod tests` of `crates/xcl/src/gpu/texture.rs`: the TTPF test's mip count becomes `(a >> 28) + (b & 7)`. No `scripts/smoke.ps1` run was made, so the `PR description` check fails only on the two `xcl-smoke` blocks. A Windows run of `cargo test` with `XCL_SAMPLE_TTPF` set is still wanted; a volunteer offered hardware in #1243. Written with Claude Code (Claude Opus 5.5).
Author
Owner

@⁠tiagonogueiraa-bit on GitHub · 2026-11-24 14:05 UTC · original

@⁠DavidM1911 thanks for running it! One question so it can count for this change: was XCL_SAMPLE_TTPF set, and to which archive? Without it, retail_ttpf_textures_detile_with_their_mip_chains prints XCL_SAMPLE_TTPF not set – skipping and passes either way. If you have the 1.0.2.1 package, data\ttdb\ui\ttdb_ui.ttpf is a good one to try: on main its first line reads TTPF: the mip chain model size matches for 8115 of 10013 textures, and with this branch it should read 10012 of 10013. The size assertion should pass. The test's other assertions (volumes, ≥ 5 uncompressed mipped textures) still need data\ttdb\graphics\ttdb_graphics.ttpf (#752).

Written with Claude Code (Claude Opus 5.5).

**@⁠tiagonogueiraa-bit** on GitHub · 2026-11-24 14:05 UTC · [original](https://github.com/xcl-dev/xcl/pull/1245#issuecomment-7133831050) @⁠DavidM1911 thanks for running it! One question so it can count for this change: was `XCL_SAMPLE_TTPF` set, and to which archive? Without it, `retail_ttpf_textures_detile_with_their_mip_chains` prints `XCL_SAMPLE_TTPF not set – skipping` and passes either way. If you have the 1.0.2.1 package, `data\ttdb\ui\ttdb_ui.ttpf` is a good one to try: on main its first line reads `TTPF: the mip chain model size matches for 8115 of 10013 textures`, and with this branch it should read 10012 of 10013. The size assertion should pass. The test's other assertions (volumes, ≥ 5 uncompressed mipped textures) still need `data\ttdb\graphics\ttdb_graphics.ttpf` (#752). Written with Claude Code (Claude Opus 5.5).
Author
Owner

@⁠vitor127wt on GitHub · 2026-11-24 15:01 UTC · original

TTPF test report under Wine

Following up on #1243. I ran the CPU archive test on the exact PR head 830bf7898655e6b3d2c26d96393698ab55c511d6 and its parent 47efa2ecea0a12934719ae69b81930cf02a4b1c3, using two Series 1.0.2.1 TTPF archives from my own extraction.

Tested

  • Ryzen 7 9700X, 32 GB DDR5, CachyOS x86-64 (kernel 7.3.5-2-cachyos), Wine 11.22, Rust 1.100.0, cargo-xwin 0.24.1, Windows MSVC debug builds.
  • For each archive and commit I set XCL_SAMPLE_TTPF to that archive's local path and ran cargo xwin test --offline --locked --target x86_64-pc-windows-msvc -p xcl --lib retail_ttpf -- --nocapture --test-threads=1.
Archive Matching sizes on parent Matching sizes on PR Whole test
ttdb_ui.ttpf 8,115 / 10,013 10,012 / 10,013 0 passed, 1 failed on each commit
ttdb_graphics.ttpf 909 / 912 909 / 912 1 passed, 0 failed on each commit

On the UI archive, the parent failed the mip-chain size assertion. The PR passed that assertion and reached the separate minimum-sample assertion. All 3 checked UI textures had matching mips, and the test requires at least 5. The graphics archive checked 6 of 6 matching mipped textures and passed the full test on both commits. All four invocations reported zero ignored tests and ran with the archive set.

Not tested

Native Windows and other TTPF archives. This run covers the focused archive test.

AI use

Codex (GPT-6, exact variant unavailable) cross-built and ran the tests, compared the counts and drafted this report.

**@⁠vitor127wt** on GitHub · 2026-11-24 15:01 UTC · [original](https://github.com/xcl-dev/xcl/pull/1245#issuecomment-7135339434) **TTPF test report under Wine** Following up on #1243. I ran the CPU archive test on the exact PR head `830bf7898655e6b3d2c26d96393698ab55c511d6` and its parent `47efa2ecea0a12934719ae69b81930cf02a4b1c3`, using two Series 1.0.2.1 TTPF archives from my own extraction. **Tested** - Ryzen 7 9700X, 32 GB DDR5, CachyOS x86-64 (kernel `7.3.5-2-cachyos`), Wine 11.22, Rust 1.100.0, cargo-xwin 0.24.1, Windows MSVC debug builds. - For each archive and commit I set `XCL_SAMPLE_TTPF` to that archive's local path and ran `cargo xwin test --offline --locked --target x86_64-pc-windows-msvc -p xcl --lib retail_ttpf -- --nocapture --test-threads=1`. | Archive | Matching sizes on parent | Matching sizes on PR | Whole test | | --- | ---: | ---: | --- | | `ttdb_ui.ttpf` | 8,115 / 10,013 | **10,012 / 10,013** | 0 passed, 1 failed on each commit | | `ttdb_graphics.ttpf` | 909 / 912 | 909 / 912 | **1 passed, 0 failed** on each commit | On the UI archive, the parent failed the mip-chain size assertion. The PR passed that assertion and reached the separate minimum-sample assertion. All 3 checked UI textures had matching mips, and the test requires at least 5. The graphics archive checked 6 of 6 matching mipped textures and passed the full test on both commits. All four invocations reported zero ignored tests and ran with the archive set. **Not tested** Native Windows and other TTPF archives. This run covers the focused archive test. **AI use** Codex (GPT-6, exact variant unavailable) cross-built and ran the tests, compared the counts and drafted this report.
Author
Owner

@⁠tiagonogueiraa-bit on GitHub · 2026-11-24 15:02 UTC · original

Thank you, @⁠vitor127wt: that is exactly the check this change needed, on both archives and both commits. I added it to Tested and marked the PR ready for review.

Written with Claude Code (Claude Opus 5.5).

**@⁠tiagonogueiraa-bit** on GitHub · 2026-11-24 15:02 UTC · [original](https://github.com/xcl-dev/xcl/pull/1245#issuecomment-7135367291) Thank you, @⁠vitor127wt: that is exactly the check this change needed, on both archives and both commits. I added it to **Tested** and marked the PR ready for review. Written with Claude Code (Claude Opus 5.5).
Author
Owner

@⁠Toons29 on GitHub · 2026-11-25 03:18 UTC · original

Regression run of 830bf789 on the retail title, for this PR's Regression run section. Both blocks are from scripts/smoke.ps1 as printed, not edited: main on 4178e888, this PR on its head commit with no uncommitted changes, same title and time.

xcl-smoke v1
commit: 4178e888c0b5be50a2887eda45cdb832763b68a4
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1618 (PresentX 1618)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14831 MB
xcl-smoke v1
commit: 830bf7898655e6b3d2c26d96393698ab55c511d6
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1621 (PresentX 1622)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14812 MB

Against the limits in CONTRIBUTING.md: 100 % of main's frames, 100 % of its peak commit, no crash, no device removal.

AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, cargo build --release -p xcl, 60 s, XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.

AI use: Claude Code (Claude Opus 5.5) built both trees and ran scripts/smoke.ps1; I checked the blocks before posting.

**@⁠Toons29** on GitHub · 2026-11-25 03:18 UTC · [original](https://github.com/xcl-dev/xcl/pull/1245#issuecomment-7151792570) Regression run of `830bf789` on the retail title, for this PR's **Regression run** section. Both blocks are from `scripts/smoke.ps1` as printed, not edited: `main` on `4178e888`, this PR on its head commit with no uncommitted changes, same title and time. ``` xcl-smoke v1 commit: 4178e888c0b5be50a2887eda45cdb832763b68a4 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1618 (PresentX 1618) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 14831 MB ``` ``` xcl-smoke v1 commit: 830bf7898655e6b3d2c26d96393698ab55c511d6 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1621 (PresentX 1622) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14812 MB ``` Against the limits in CONTRIBUTING.md: 100 % of `main`'s frames, 100 % of its peak commit, no crash, no device removal. AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, `cargo build --release -p xcl`, 60 s, `XCL_NETWORK=0`. This is a regression check only: it does not show whether the run reaches the code this PR changes. AI use: Claude Code (Claude Opus 5.5) built both trees and ran `scripts/smoke.ps1`; I checked the blocks before posting.
Author
Owner

@⁠thehollowedone on GitHub · 2026-11-25 07:22 UTC · original

Native Windows integration check of 830bf78. I applied only the PR’s mip-count change to 568e7db.

Tested

  • Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti / 621.35, Rust 1.99.1 MSVC, debug. cargo build --offline --locked --workspace -j 3 passed.
  • cargo test --offline --locked --workspace --no-fail-fast -j 3 -- --nocapture --test-threads=4 reported 1,154 passed, 0 failed, 46 ignored. Separately, 25 runtime skip notices (20 native wave64, three unsupported per-lane forms, one driver-cache disable probe, one no heap windows). The opt-in fixtures were unset for this run.
  • A separate cargo test --offline --locked -p xcl --lib retail_ttpf -j 3 -- --nocapture --test-threads=1 with one local archive set ran the fixture and passed 1/1. The existing layout match count remained 909/912 on that archive, consistent with the PR description.

Not tested
The historical PR checkout as a whole, a title launch, or other GPUs.

AI use
Codex (GPT-6.2 Sol) ran the integration tests and drafted this report.

**@⁠thehollowedone** on GitHub · 2026-11-25 07:22 UTC · [original](https://github.com/xcl-dev/xcl/pull/1245#issuecomment-7155779978) Native Windows integration check of [830bf78](https://github.com/xcl-dev/xcl/commit/830bf7898655e6b3d2c26d96393698ab55c511d6). I applied only the PR’s mip-count change to [568e7db](https://github.com/xcl-dev/xcl/commit/568e7db7729c8fa6c8f0f4b32d798faaf11462bb). **Tested** - Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti / 621.35, Rust 1.99.1 MSVC, debug. `cargo build --offline --locked --workspace -j 3` passed. - `cargo test --offline --locked --workspace --no-fail-fast -j 3 -- --nocapture --test-threads=4` reported 1,154 passed, 0 failed, 46 ignored. Separately, 25 runtime skip notices (20 native wave64, three unsupported per-lane forms, one driver-cache disable probe, one no heap windows). The opt-in fixtures were unset for this run. - A separate `cargo test --offline --locked -p xcl --lib retail_ttpf -j 3 -- --nocapture --test-threads=1` with one local archive set ran the fixture and passed 1/1. The existing layout match count remained 909/912 on that archive, consistent with the PR description. **Not tested** The historical PR checkout as a whole, a title launch, or other GPUs. **AI use** Codex (GPT-6.2 Sol) ran the integration tests and drafted this report.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-26 04:32 UTC · original

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

**@⁠DavidM1911** on GitHub · 2026-11-26 04:32 UTC · [original](https://github.com/xcl-dev/xcl/pull/1245#issuecomment-7182684312) Re-verification on RTX 3060 Ti (Windows 11), new head merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved. Thanks! — Devin
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1245/head:github-bot/gh-1245'
git switch 'github-bot/gh-1245'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1245'
git switch 'github-bot/gh-1245'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1245'
git switch 'github-bot/gh-1245'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1245'
git switch 'main'
git merge --squash 'github-bot/gh-1245'
git switch 'main'
git merge --ff-only 'github-bot/gh-1245'
git switch 'main'
git merge 'github-bot/gh-1245'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.