[Tests] Retail TTPF texture detile failure on the retail title data #1121

Open
opened 2026-11-26 04:44:06 +00:00 by github-bot · 5 comments
Owner

@⁠KunasuC on GitHub · 2026-11-24 12:03 UTC · original

Context: I ran the test suite with XCL_SAMPLE_TTPF pointing to my textures.rpf from the retail title (v1.0.2.1). The goal was to check if the texture decoder handles real game data.

Result: 684 passed, 1 failed.

Failed test: gpu::texture::tests::retail_ttpf_textures_detile_with_their_mip_chains

Error output:
Test summary: 684 passed, 1 failed. GPU tests were skipped (no GPU detected by the script).

rapport_tests_xcl.txt

report.json
xcl.log

**@⁠KunasuC** on GitHub · 2026-11-24 12:03 UTC · [original](https://github.com/xcl-dev/xcl/issues/1121) Context: I ran the test suite with `XCL_SAMPLE_TTPF` pointing to my `textures.rpf` from the retail title (v1.0.2.1). The goal was to check if the texture decoder handles real game data. Result: 684 passed, 1 failed. Failed test: `gpu::texture::tests::retail_ttpf_textures_detile_with_their_mip_chains` Error output: Test summary: 684 passed, 1 failed. GPU tests were skipped (no GPU detected by the script). [rapport_tests_xcl.txt](https://github.com/user-attachments/files/35329658/rapport_tests_xcl.txt) [report.json](https://github.com/user-attachments/files/35329665/report.json) [xcl.log](https://github.com/user-attachments/files/35329664/xcl.log)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:44:08 +00:00
Author
Owner

@⁠shzyjbr06-dev on GitHub · 2026-11-24 12:35 UTC · original

Tested retail_ttpf_textures_detile_with_their_mip_chains at 47efa2e against several retail .ttpf archives (note: XCL_SAMPLE_TTPF expects an RDS5 .ttpf file rather than textures.rpf):

  1. data\ttdb\graphics\ttdb_graphics.ttpf: passes (909 of 912 match; 6 of 6 mip textures pass).
  2. data\ttdb\peds\peds_loose.ttpf: 6198 of 6204 match (99.9%), 1 of 1 mip texture passes (0.13/255 vs 88.22/255), only fails the checked >= 5 threshold in the test assertion.
  3. data\ttdb\ui\ttdb_ui.ttpf: reproduces the 8115 / 10013 mismatch seen in this issue.
    Inspecting the RDS5 directory table (at = 0x17500, count = 10013), almost every mismatched entry (1,897 of 1,898) shares the exact same bit pattern:
    • (b >> 24) == 2 and (c >> 21) != 0 (0x164 or 0x102)
    • All of them are 256x256 (a >> 28 == 1), where end - start is 20 pages (80 KB) for 1 B/px formats (dxgi=99/98/65) or 10 pages (40 KB) for 0.5 B/px formats (dxgi=80/71), instead of 16 / 8 pages.
    • Breakdown in ttdb_ui.ttpf:
      • b>>24 == 0, c>>21 == 0: 5365
      • b>>24 == 1, c>>21 == 0: 2751
      • b>>24 == 2, c>>21 == 0x164: 1834 (20 pages for 256x256)
      • b>>24 == 2, c>>21 == 0x102: 63 (10 pages for 256x256)
**@⁠shzyjbr06-dev** on GitHub · 2026-11-24 12:35 UTC · [original](https://github.com/xcl-dev/xcl/issues/1121#issuecomment-7131642781) Tested `retail_ttpf_textures_detile_with_their_mip_chains` at `47efa2e` against several retail `.ttpf` archives (note: `XCL_SAMPLE_TTPF` expects an `RDS5` `.ttpf` file rather than `textures.rpf`): 1. `data\ttdb\graphics\ttdb_graphics.ttpf`: **passes** (`909 of 912` match; `6 of 6` mip textures pass). 2. `data\ttdb\peds\peds_loose.ttpf`: `6198 of 6204` match (`99.9%`), `1 of 1` mip texture passes (`0.13/255` vs `88.22/255`), only fails the `checked >= 5` threshold in the test assertion. 3. `data\ttdb\ui\ttdb_ui.ttpf`: **reproduces the `8115 / 10013` mismatch** seen in this issue. Inspecting the `RDS5` directory table (`at = 0x17500`, `count = 10013`), almost every mismatched entry (`1,897` of `1,898`) shares the exact same bit pattern: - `(b >> 24) == 2` and `(c >> 21) != 0` (`0x164` or `0x102`) - All of them are `256x256` (`a >> 28 == 1`), where `end - start` is `20` pages (`80 KB`) for 1 B/px formats (`dxgi=99/98/65`) or `10` pages (`40 KB`) for 0.5 B/px formats (`dxgi=80/71`), instead of `16` / `8` pages. - Breakdown in `ttdb_ui.ttpf`: - `b>>24 == 0, c>>21 == 0`: `5365` - `b>>24 == 1, c>>21 == 0`: `2751` - `b>>24 == 2, c>>21 == 0x164`: `1834` (`20` pages for `256x256`) - `b>>24 == 2, c>>21 == 0x102`: `63` (`10` pages for `256x256`)
Author
Owner

@⁠tiagonogueiraa-bit on GitHub · 2026-11-24 13:01 UTC · original

claiming: decoding the extra mip levels in the RDS5 texture table (the c >> 21 / d & 0xF fields from here and #707), so the test reads the mip count every archive stores instead of only the 912-texture one's. I have the 1.0.2.1 archives locally; I'll report the rule here with counts per archive (table fields only, no texture data), then open a test-only PR. Written with Claude Code (Claude Opus 5.5).

**@⁠tiagonogueiraa-bit** on GitHub · 2026-11-24 13:01 UTC · [original](https://github.com/xcl-dev/xcl/issues/1121#issuecomment-7132251521) claiming: decoding the extra mip levels in the RDS5 texture table (the `c >> 21` / `d & 0xF` fields from here and #707), so the test reads the mip count every archive stores instead of only the 912-texture one's. I have the 1.0.2.1 archives locally; I'll report the rule here with counts per archive (table fields only, no texture data), then open a test-only PR. Written with Claude Code (Claude Opus 5.5).
Author
Owner

@⁠tiagonogueiraa-bit on GitHub · 2026-11-24 13:35 UTC · original

Found the missing field. A texture's stored mip count is (dword0 >> 28) + (dword1 & 7). Bits 0–2 of dword 1 sit below the DXGI format ((b & 0x3ff) >> 3), and the test never read them.

I checked this against all 46 .ttpf archives of retail 1.0.2.1, using table fields only and gpu/tiling.rs from main 47efa2e:

mip count used model size matches the slot
a >> 28 (main) 294 726 / 352 461
(a >> 28) + (b & 7) 351 970 / 352 461
  • What still fails: 445 mipped cubes (the open question in #707) and the last texture of each archive (46), whose end is the stream total. No mip count fits either group.
  • Why ttdb_graphics.ttpf passed anyway: 104 of its 912 textures set the bits, but their extra levels all fall inside the mip-tail block, which takes the same space. This is also why (c >> 21) / dword3 looked related: they correlate with the texture class, but b & 7 alone decides the count. Every distinct entry (all fields but the page offset) has a single count that fits all of its textures.
  • The extra levels are real mips: on sampled BC1 textures, each extra level is the one above it scaled down 2× (0.5–6/255). Shifted half a width, the same comparison gives 3–75/255, the same as on textures that already fit.
  • The test's four checks on each archive, main → fix. I ran the test body on macOS with the same tiling code; only the archive reader was changed, to read by byte range. This is not cargo test.
    • The size check passes on 10 → 44 of 46 archives. Still failing: lighting.ttpf (cubes) and platform.ttpf (one texture).
    • The mip check passes on 13 → 23. Where it still fails, all but one archive have fewer than 5 uncompressed mipped textures. The exception, ttdb_props_1_3.ttpf, has 5 of 6 close.
    • The volume check still needs ttdb_graphics.ttpf, since the other archives have no 3D LUTs (#752).

For ttdb_ui.ttpf from the report above, the size check goes from 8115 / 10013 to 10012 / 10013. The one left is the archive's last entry. The b>>24 == 2, c>>21 == 0x164 / 0x102 groups are 256×256 textures with a >> 28 = 1 and b & 7 = 1, so 2 levels, which explains the 20 / 10 pages.

The change is one line in the test's Ttpf::open. The PR will follow as a draft. It needs a Windows run of cargo test with XCL_SAMPLE_TTPF, which I can't do from macOS; @⁠shzyjbr06-dev, would you be up for it?

Written with Claude Code (Claude Opus 5.5).

**@⁠tiagonogueiraa-bit** on GitHub · 2026-11-24 13:35 UTC · [original](https://github.com/xcl-dev/xcl/issues/1121#issuecomment-7133061277) **Found the missing field.** A texture's stored mip count is `(dword0 >> 28) + (dword1 & 7)`. Bits 0–2 of dword 1 sit below the DXGI format (`(b & 0x3ff) >> 3`), and the test never read them. I checked this against all 46 `.ttpf` archives of retail 1.0.2.1, using table fields only and `gpu/tiling.rs` from main 47efa2e: | mip count used | model size matches the slot | |---|---| | `a >> 28` (main) | 294 726 / 352 461 | | `(a >> 28) + (b & 7)` | **351 970 / 352 461** | - **What still fails:** 445 mipped cubes (the open question in #707) and the last texture of each archive (46), whose `end` is the stream total. No mip count fits either group. - **Why `ttdb_graphics.ttpf` passed anyway:** 104 of its 912 textures set the bits, but their extra levels all fall inside the mip-tail block, which takes the same space. This is also why `(c >> 21)` / `dword3` looked related: they correlate with the texture class, but `b & 7` alone decides the count. Every distinct entry (all fields but the page offset) has a single count that fits all of its textures. - **The extra levels are real mips:** on sampled BC1 textures, each extra level is the one above it scaled down 2× (0.5–6/255). Shifted half a width, the same comparison gives 3–75/255, the same as on textures that already fit. - **The test's four checks** on each archive, main → fix. I ran the test body on macOS with the same tiling code; only the archive reader was changed, to read by byte range. This is not `cargo test`. - The size check passes on 10 → 44 of 46 archives. Still failing: `lighting.ttpf` (cubes) and `platform.ttpf` (one texture). - The mip check passes on 13 → 23. Where it still fails, all but one archive have fewer than 5 uncompressed mipped textures. The exception, `ttdb_props_1_3.ttpf`, has 5 of 6 close. - The volume check still needs `ttdb_graphics.ttpf`, since the other archives have no 3D LUTs (#752). For `ttdb_ui.ttpf` from the report above, the size check goes from 8115 / 10013 to 10012 / 10013. The one left is the archive's last entry. The `b>>24 == 2, c>>21 == 0x164 / 0x102` groups are 256×256 textures with `a >> 28 = 1` and `b & 7 = 1`, so 2 levels, which explains the 20 / 10 pages. The change is one line in the test's `Ttpf::open`. The PR will follow as a draft. It needs a Windows run of `cargo test` with `XCL_SAMPLE_TTPF`, which I can't do from macOS; @⁠shzyjbr06-dev, would you be up for it? Written with Claude Code (Claude Opus 5.5).
Author
Owner

@⁠KunasuC on GitHub · 2026-11-24 20:36 UTC · original

Update : I re-ran the test suite on the latest commit (b9b6ea6) with XCL_REQUIRE_GPU=1 to force GPU tests.
The texture test still fails (as expected, PR #... is pending), but a new GPU test failure appeared :

thread 'gpu::recomp::heap_window_tests::gpu_raw_window_view_reaches_its_top' panicked at crates\xcl\src\gpu\recomp\heap_window_tests.rs:100:14:
STFCalled "result::unwrap()" on an 'Err' value: Error { code: HRESULT(0x80070057), message: "Paramètre incorrect." }

This error seems to be related to the VCRUNTIME140.dll crash I experienced when launching the game (see report.json from the previous run). The game crashes with 0xc0000005 after calling ID3D12GraphicsCommandList10::#101.

Test summary : 838 passed, 2 failed. GPU tests were forced (XCL_REQUIRE_GPU=1).

Attached: rapport_complet_xcl.txt (new full log).

rapport_complet_xcl.txt

**@⁠KunasuC** on GitHub · 2026-11-24 20:36 UTC · [original](https://github.com/xcl-dev/xcl/issues/1121#issuecomment-7143801512) Update : I re-ran the test suite on the latest commit (b9b6ea6) with XCL_REQUIRE_GPU=1 to force GPU tests. The texture test still fails (as expected, PR #... is pending), but a new GPU test failure appeared : ``` thread 'gpu::recomp::heap_window_tests::gpu_raw_window_view_reaches_its_top' panicked at crates\xcl\src\gpu\recomp\heap_window_tests.rs:100:14: STFCalled "result::unwrap()" on an 'Err' value: Error { code: HRESULT(0x80070057), message: "Paramètre incorrect." } ``` This error seems to be related to the VCRUNTIME140.dll crash I experienced when launching the game (see report.json from the previous run). The game crashes with 0xc0000005 after calling ID3D12GraphicsCommandList10::#101. Test summary : 838 passed, 2 failed. GPU tests were forced (XCL_REQUIRE_GPU=1). Attached: rapport_complet_xcl.txt (new full log). [rapport_complet_xcl.txt](https://github.com/user-attachments/files/35374165/rapport_complet_xcl.txt)
Author
Owner

@⁠KunasuC on GitHub · 2026-11-24 21:47 UTC · original

Correction to my earlier comments:

  • The heap_window_tests::gpu_raw_window_view_reaches_its_top failure came from my environment, not from
    the project: on Windows 10 22H2 cargo test did not find the Agility SDK, so the inbox D3D12Core (SM 6.5)
    refused the compute PSO with E_INVALIDARG. With XCL_D3D12_DIR pointing at the Agility SDK it passes.
    I have no evidence that it is related to the VCRUNTIME140 crash (#101), please disregard that link.
  • My XCL_SAMPLE_TTPF was pointing at a file that is not an RDS5 .ttpf, so the texture failure I reported
    was a setup error on my side. Please disregard it.

Drafted with Claude (Claude Sonnet 5.5).

**@⁠KunasuC** on GitHub · 2026-11-24 21:47 UTC · [original](https://github.com/xcl-dev/xcl/issues/1121#issuecomment-7145402547) Correction to my earlier comments: - The heap_window_tests::gpu_raw_window_view_reaches_its_top failure came from my environment, not from the project: on Windows 10 22H2 cargo test did not find the Agility SDK, so the inbox D3D12Core (SM 6.5) refused the compute PSO with E_INVALIDARG. With XCL_D3D12_DIR pointing at the Agility SDK it passes. I have no evidence that it is related to the VCRUNTIME140 crash (#101), please disregard that link. - My XCL_SAMPLE_TTPF was pointing at a file that is not an RDS5 .ttpf, so the texture failure I reported was a setup error on my side. Please disregard it. Drafted with Claude (Claude Sonnet 5.5).
This discussion has been locked. Commenting is limited to contributors.
No description provided.