textures: verify fixed lanes using supplied BCPack refills #214

Manually merged
github merged 1 commit from gh-pr/214/head into gh-pr/214/base 2026-11-26 21:34:51 +00:00
Owner

@⁠Vonsek on GitHub · 2026-11-21 18:29 UTC · original
Vonsek:codex/bcpack-complete-refills → main · +63 −19 · 3 files · 1 commits · merged 2026-11-21 18:42 UTC

Change

Extend the fixed-symbol BCPack diagnostic to report when the proposed read masks supply all byte refills for a lane and forward decoding reaches the terminal state. The new verified_constant_lane_with_supplied_refills status includes the zero-based symbol indices that consumed the bytes. Missing, corrupt or surplus supplied reads keep the existing header_match diagnostic for a lane that requires refills. Refs #15.

Verification

Base d5c6f9f, change 1430f36, Windows 11 x64, Python 3.12.10. From a fresh worktree:

python -m venv out/pe-env
.\out\pe-env\Scripts\python.exe -m pip install -r requirements-dev.txt
. ./tools/dev.ps1
$probePython = (Resolve-Path out/pe-env/Scripts/python.exe).Path
cmake --preset dev "-DINTAKE_PYTHON=$probePython"
.\out\pe-env\Scripts\python.exe -B tests/bcpack_check.py -v
ctest --preset dev --no-tests=error -R '^bcpack_prefix_and_mip_tail$' -V

On the base implementation, python -B tests/bcpack_check.py TextureChecks.test_forward_decode_supplied_refills -v failed because a valid two-refill lane still reported header_match. With the change, all eight Python tests and the focused CTest passed.

Evidence and follow-up

The original MIT-licensed fixture uses a header obtained by reverse-encoding 100,000 identical symbols in mode DD from state 2²⁴. That gives header state 0x030B87C1 and decoder refill bytes 93 E3. The test assigns them to lane 3 at packet offsets 49 and 50. Forward decoding consumes them at symbol indices 9,129 and 54,564 and returns to 2²⁴. Changing E3 to E2 yields header_match and a false second-refill comparison. A separate 50,000-symbol case verifies the first read can occur in round two.

To reproduce the CLI comparison:

from pathlib import Path
prefix = bytearray(48)
prefix[3::8] = bytes.fromhex("dd 05 03 0b 87 c1")
for name, rounds in (("matched", "aa 93 e3 bb"), ("wrong", "aa 93 e2 bb")):
    Path("out", name + ".bin").write_bytes(prefix + bytes.fromhex(rounds))
python -B tools/bcpack_probe.py out/matched.bin --blocks 100000 --prefetch-mask 0x09 --next-mask 0x18
python -B tools/bcpack_probe.py out/wrong.bin --blocks 100000 --prefetch-mask 0x09 --next-mask 0x18

Verification is conditional on the supplied lane assignments and block count. The fixture uses the existing fixed-symbol model. The variable-symbol model and lane-to-BC7-field mapping remain open. AI-assisted contribution.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for the fixture checks.
  • I considered a negative control or failure case for a new fixture.
  • I updated the experiment notes for the new diagnostic.
  • I did not include game files, dumps, distribution links or secrets.
**@⁠Vonsek** on GitHub · 2026-11-21 18:29 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/214) `Vonsek:codex/bcpack-complete-refills` → `main` · +63 −19 · 3 files · 1 commits · merged 2026-11-21 18:42 UTC ## Change Extend the fixed-symbol BCPack diagnostic to report when the proposed read masks supply all byte refills for a lane and forward decoding reaches the terminal state. The new `verified_constant_lane_with_supplied_refills` status includes the zero-based symbol indices that consumed the bytes. Missing, corrupt or surplus supplied reads keep the existing `header_match` diagnostic for a lane that requires refills. Refs #15. ## Verification Base `d5c6f9f`, change `1430f36`, Windows 11 x64, Python 3.12.10. From a fresh worktree: ```powershell python -m venv out/pe-env .\out\pe-env\Scripts\python.exe -m pip install -r requirements-dev.txt . ./tools/dev.ps1 $probePython = (Resolve-Path out/pe-env/Scripts/python.exe).Path cmake --preset dev "-DINTAKE_PYTHON=$probePython" .\out\pe-env\Scripts\python.exe -B tests/bcpack_check.py -v ctest --preset dev --no-tests=error -R '^bcpack_prefix_and_mip_tail$' -V ``` On the base implementation, `python -B tests/bcpack_check.py TextureChecks.test_forward_decode_supplied_refills -v` failed because a valid two-refill lane still reported `header_match`. With the change, all eight Python tests and the focused CTest passed. ## Evidence and follow-up The original MIT-licensed fixture uses a header obtained by reverse-encoding 100,000 identical symbols in mode DD from state 2²⁴. That gives header state 0x030B87C1 and decoder refill bytes 93 E3. The test assigns them to lane 3 at packet offsets 49 and 50. Forward decoding consumes them at symbol indices 9,129 and 54,564 and returns to 2²⁴. Changing E3 to E2 yields `header_match` and a false second-refill comparison. A separate 50,000-symbol case verifies the first read can occur in round two. To reproduce the CLI comparison: ```python from pathlib import Path prefix = bytearray(48) prefix[3::8] = bytes.fromhex("dd 05 03 0b 87 c1") for name, rounds in (("matched", "aa 93 e3 bb"), ("wrong", "aa 93 e2 bb")): Path("out", name + ".bin").write_bytes(prefix + bytes.fromhex(rounds)) ``` ```powershell python -B tools/bcpack_probe.py out/matched.bin --blocks 100000 --prefetch-mask 0x09 --next-mask 0x18 python -B tools/bcpack_probe.py out/wrong.bin --blocks 100000 --prefetch-mask 0x09 --next-mask 0x18 ``` Verification is conditional on the supplied lane assignments and block count. The fixture uses the existing fixed-symbol model. The variable-symbol model and lane-to-BC7-field mapping remain open. AI-assisted contribution. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for the fixture checks. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated the experiment notes for the new diagnostic. - [x] I did not include game files, dumps, distribution links or secrets.
A matching header does not establish which bytes a proposed lane reads. Decode every symbol using the supplied bytes and retain the refill symbol indices when the lane returns to its terminal state.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 21:34:50 +00:00
github manually merged commit 1430f36394 into gh-pr/214/base 2026-11-26 21:34:51 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-21 18:29 UTC · original · edited 2026-11-21 18:31 UTC

Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-21T18:31:32.264633Z 1430f36 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review" or "@⁠codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-21 18:29 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/214#issuecomment-7067290055) · edited 2026-11-21 18:31 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"1430f363948f66cf2d0ba8b560791220767fabc3","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-21T18:31:32.264633Z">2026-11-21T18:31:32.264633Z</relative-time> | `1430f36` | PR opened | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review" or "@⁠codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
Author
Owner

@⁠MarlomMedeiros on GitHub · 2026-11-21 18:54 UTC · original

Related evidence posted on #15 that bears directly on this check's real-lane coverage:

  • Mode 0xde verifies at K=16 on lane 7 (373 corpus chunks) rather than K=32; the inherited EXCEPTIONS table only covers the lane-2..6 K=32 case, so this decode path cannot verify real lane-7 constant lanes yet.
  • Mode 0xdb verifies at K=2 on lanes 0-1 (184 chunks); it is absent from EXCEPTIONS entirely.
  • Endpoint lanes encode 2*blocks symbols, not blocks, so callers calibrating blocks from the BC7 block count need the doubling for those lanes to reach the terminal state.
  • On real streams, refill bytes do not all arrive in the early rounds: escapes past decode step 0 consume their byte mid-stream at a demand point, so a supplied-masks test against real data needs the demand offsets, not just Round 6/7 slots.

None of this blocks the synthetic coverage here; just flagging which parts of the model the corpus evidence extends, since it may shape what blocks and masks a real-packet caller supplies.

**@⁠MarlomMedeiros** on GitHub · 2026-11-21 18:54 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/214#issuecomment-7067598988) Related evidence posted on https://git.gtahub.st/github/R0Y00--Xbox2Windows/issues/15 that bears directly on this check's real-lane coverage: - Mode `0xde` verifies at K=16 on lane 7 (373 corpus chunks) rather than K=32; the inherited `EXCEPTIONS` table only covers the lane-2..6 K=32 case, so this decode path cannot verify real lane-7 constant lanes yet. - Mode `0xdb` verifies at K=2 on lanes 0-1 (184 chunks); it is absent from `EXCEPTIONS` entirely. - Endpoint lanes encode `2*blocks` symbols, not `blocks`, so callers calibrating `blocks` from the BC7 block count need the doubling for those lanes to reach the terminal state. - On real streams, refill bytes do not all arrive in the early rounds: escapes past decode step 0 consume their byte mid-stream at a demand point, so a supplied-masks test against real data needs the demand offsets, not just Round 6/7 slots. None of this blocks the synthetic coverage here; just flagging which parts of the model the corpus evidence extends, since it may shape what `blocks` and masks a real-packet caller supplies.
This discussion has been locked. Commenting is limited to contributors.
No description provided.