textures: verify fixed lanes using supplied BCPack refills #211

Merged
Vonsek merged 1 commit from upstream-pr/214 into main 2026-11-21 18:42:49 +00:00
Vonsek commented 2026-11-21 18:29:04 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T18:29:04Z.


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.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6532753691 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/214). Originally posted by [Vonsek](https://github.com/Vonsek) on 2026-11-21T18:29:04Z. --- ## 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.
upstream-sync closed this pull request 2026-11-24 06:41:50 +00:00
chatgpt-codex-connector[bot commented 2026-11-24 06:47:49 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T18:29:13Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7067290055 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/214#issuecomment-7067290055). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-21T18:29:13Z. --- <!-- 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>
MarlomMedeiros commented 2026-11-24 06:47:51 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by MarlomMedeiros on 2026-11-21T18:54:06Z.


Related evidence posted on https://github.com/R0Y00/Xbox2Windows/issues/15#issuecomment-7067597230 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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7067598988 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/214#issuecomment-7067598988). Originally posted by [MarlomMedeiros](https://github.com/MarlomMedeiros) on 2026-11-21T18:54:06Z. --- Related evidence posted on https://github.com/R0Y00/Xbox2Windows/issues/15#issuecomment-7067597230 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.
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
R0Y00/Xbox2Windows!211
No description provided.