shader: select a named record by decoded container SHA-256 #291

Merged
Vonsek merged 1 commit from upstream-pr/295 into main 2026-11-21 21:26:11 +00:00
Vonsek commented 2026-11-21 21:09:29 +00:00 (Migrated from github.com)

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


Change

Add --container-sha256 to the offline tools/pixel_aot.py CLI. The selector requires one record matching the exact name and the SHA-256 of its full decoded DXBC container. Name-only lookup keeps the existing duplicate rejection. A repeated matching digest remains ambiguous. This lets contributors distinguish two records that carry identical native instructions but different container metadata.

The CLI and Python lookup are the only interfaces changed. The offline pixel shader instructions show how to export and hash the desired DXBC with the existing extractor.

Verification

Tested 112b6f0e1e14c9d299342983988d006b000481dd on x64 Windows build 26200.9974. A clean Visual Studio development-shell configure and build of offscreen_check succeeded. The hardware adapter was an RTX 5080 (driver 32.0.16.1692), and the software adapter was WARP 10.0.26100.9818. The debug layer was unavailable on both.

cmake --preset dev
cmake --build --preset dev --target offscreen_check
ctest --preset dev --no-tests=error --output-on-failure -R '^(pixel_aot_(warp|hardware)|bc7_draw_(warp|hardware)|docs_links)$'
python -B tests/bidi_controls_check.py
git diff --check

All five CTests passed, with no capability skips. The bidi check and Git whitespace check passed.

python -B tests/pixel_aot_check.py binary "<llvm-mc compatible LLVM 15.0.7 clang wrapper>" "<LLVM 15.0.7 llvm-objcopy.exe>" "<LLVM 15.0.7 LLVM-C.dll>"

The control on the original implementation raised TypeError: native_program() got an unexpected keyword argument 'container_sha256'. The updated fixture and CLI passed. The Windows assembler wrapper forwards the input, output and file mode to clang -cc1as -triple amdgcn--amdpal -target-cpu gfx1013 -filetype obj.

Evidence and follow-up

The original MIT-licensed regression assembles the repository shader and wraps its bytes in two source-built DXBC records with identical names and different PRIV bytes. It checks both container digests through the normal CLI and verifies the selected container digest, common native digest and HLSL. The test also covers ambiguous and incorrect digests, a match after 257 same-name candidates, malformed outer frames in both orders and across a claimed extent, and reporting the selected record's nested checksum failure. The documented extractor command produced two separate synthetic DXBC files and each file's digest selected its exact bytes.

A private read-only archive check found two physical records sharing one name and one native program. Both distinct decoded-container hashes selected their respective records using the normal CLI on the original archive. Both translated to identical HLSL and passed dxc -Gis -WX -T ps_6_0 -E main with zero diagnostics. Default lookup rejected the name as ambiguous and the shared native digest failed as a container selector. The archive's SHA-256 was unchanged and temporary outputs were removed. The public fixture verifies the selection behavior without the local archive. Resource binding and draw behavior for those two records remain unverified.

This contribution was AI-assisted.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6534426653 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/295). Originally posted by [Vonsek](https://github.com/Vonsek) on 2026-11-21T21:09:29Z. --- ## Change Add `--container-sha256` to the offline `tools/pixel_aot.py` CLI. The selector requires one record matching the exact name and the SHA-256 of its full decoded DXBC container. Name-only lookup keeps the existing duplicate rejection. A repeated matching digest remains ambiguous. This lets contributors distinguish two records that carry identical native instructions but different container metadata. The CLI and Python lookup are the only interfaces changed. [The offline pixel shader instructions](https://github.com/Vonsek/Xbox2Windows/blob/codex/pixel-container-digest/docs/experiments.md#offline-pixel-shader-recompilation) show how to export and hash the desired DXBC with the existing extractor. ## Verification Tested `112b6f0e1e14c9d299342983988d006b000481dd` on x64 Windows build 26200.9974. A clean Visual Studio development-shell configure and build of `offscreen_check` succeeded. The hardware adapter was an RTX 5080 (driver 32.0.16.1692), and the software adapter was WARP 10.0.26100.9818. The debug layer was unavailable on both. ```powershell cmake --preset dev cmake --build --preset dev --target offscreen_check ctest --preset dev --no-tests=error --output-on-failure -R '^(pixel_aot_(warp|hardware)|bc7_draw_(warp|hardware)|docs_links)$' python -B tests/bidi_controls_check.py git diff --check ``` All five CTests passed, with no capability skips. The bidi check and Git whitespace check passed. ```powershell python -B tests/pixel_aot_check.py binary "<llvm-mc compatible LLVM 15.0.7 clang wrapper>" "<LLVM 15.0.7 llvm-objcopy.exe>" "<LLVM 15.0.7 LLVM-C.dll>" ``` The control on the original implementation raised `TypeError: native_program() got an unexpected keyword argument 'container_sha256'`. The updated fixture and CLI passed. The Windows assembler wrapper forwards the input, output and file mode to `clang -cc1as -triple amdgcn--amdpal -target-cpu gfx1013 -filetype obj`. ## Evidence and follow-up The original MIT-licensed regression assembles the repository shader and wraps its bytes in two source-built DXBC records with identical names and different `PRIV` bytes. It checks both container digests through the normal CLI and verifies the selected container digest, common native digest and HLSL. The test also covers ambiguous and incorrect digests, a match after 257 same-name candidates, malformed outer frames in both orders and across a claimed extent, and reporting the selected record's nested checksum failure. The documented extractor command produced two separate synthetic DXBC files and each file's digest selected its exact bytes. A private read-only archive check found two physical records sharing one name and one native program. Both distinct decoded-container hashes selected their respective records using the normal CLI on the original archive. Both translated to identical HLSL and passed `dxc -Gis -WX -T ps_6_0 -E main` with zero diagnostics. Default lookup rejected the name as ambiguous and the shared native digest failed as a container selector. The archive's SHA-256 was unchanged and temporary outputs were removed. The public fixture verifies the selection behavior without the local archive. Resource binding and draw behavior for those two records remain unverified. This contribution was AI-assisted. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets.
upstream-sync closed this pull request 2026-11-24 06:42:17 +00:00
chatgpt-codex-connector[bot commented 2026-11-24 06:48:02 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T21:09:43Z.


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-21T21:12:30.067211Z 112b6f0 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:7069277936 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/295#issuecomment-7069277936). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-21T21:09:43Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"112b6f0e1e14c9d299342983988d006b000481dd","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-21T21:12:30.067211Z">2026-11-21T21:12:30.067211Z</relative-time> | `112b6f0` | 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>
Vonsek commented 2026-11-24 06:48:02 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T21:17:26Z.


At 112b6f0, two distinct decoded DXBC digests independently selected two same-name records directly from the read-only local archive. Their declared texture and sampler slots differ, but both contain the same 25-instruction native program. Each selection compiled with DXC and matched an independent CPU reference bitwise for all 4,096 pixels and 16,384 color channels on WARP 10.0.26100.9818 and RTX 5080 (32.0.16.1692). A transposed-UV reference failed first at (8, 0) and a red/blue-swapped reference at (0, 0), as predicted on both adapters. The draw used the repository’s synthetic fullscreen, point-clamp, one-mip fixture. The original binding layouts and resources remain unverified. The archive hash was unchanged.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7069368967 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/295#issuecomment-7069368967). Originally posted by [Vonsek](https://github.com/Vonsek) on 2026-11-21T21:17:26Z. --- At `112b6f0`, two distinct decoded DXBC digests independently selected two same-name records directly from the read-only local archive. Their declared texture and sampler slots differ, but both contain the same 25-instruction native program. Each selection compiled with DXC and matched an independent CPU reference bitwise for all 4,096 pixels and 16,384 color channels on WARP 10.0.26100.9818 and RTX 5080 (32.0.16.1692). A transposed-UV reference failed first at `(8, 0)` and a red/blue-swapped reference at `(0, 0)`, as predicted on both adapters. The draw used the repository’s synthetic fullscreen, point-clamp, one-mip fixture. The original binding layouts and resources remain unverified. The archive hash was unchanged.
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!291
No description provided.