shader: track helper-lane affine sample coordinates #279

Merged
Vonsek merged 5 commits from upstream-pr/283 into main 2026-11-22 02:38:10 +00:00
Vonsek commented 2026-11-21 20:34:00 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T20:34:00Z.


Change

Track which pre-sample values have definitions on helper lanes. A single entry-mask sample can use paired interpolated coordinates and affine whole-quad results from addition, FMA or legacy multiplication. Two varying multiplication factors, absolute value and saturation are rejected on this path. An entry-only overwrite leaves the new value without a whole-quad definition.

The shared surface is tools/pixel_aot.py::lower and its offscreen test runner. #257 and #279 work on the neighboring scalar/EXEC paths, #176 covers texture sample waits, and #166 tracks a separate offscreen CLI refactor. This patch uses the existing constant descriptor and binding contract and the indexed variant of the same test vertex shader. Full-screen callers retain their original vertex IDs.

Verification

Commit b3cf7839e5ead00527dbe63b02653352259c44e9 on upstream d311159b7ba56f4c75c10c1dd8c4303988c80d99.

  • The source-built affine control fails with Invalid arithmetic operation against unmodified upstream, including after the #273 and #277 merges. The test passes with helper provenance enabled.
  • cmake --preset dev in a Visual Studio x64 shell with the repository venv as INTAKE_PYTHON, then cmake --build --preset dev --target offscreen_check. Passed.
  • ctest --preset dev --no-tests=error -R '^(pixel_aot_(warp|hardware)|bc7_draw_(warp|hardware)|docs_links)$' --output-on-failure. All five tests passed. The affine partial-quad draw matched 64 pixels and 256 channels on both Microsoft WARP 10.0.26100.9818 and RTX 5080 driver 32.0.16.1692. Debug layers were unavailable and neither adapter skipped. The first wrong-coordinate mismatch is at (6, 0), where mip 0 red replaces mip 1 green on both adapters.
  • python -B tests/pixel_aot_check.py binary $asm $objcopy $llvm. Passed with the Windows LLVM 15.0.7 integrated gfx1013 assembler, objcopy and LLVM-C DLL. The wrapper uses clang -cc1as -triple amdgcn--amdpal -target-cpu gfx1013 -filetype obj <source> -o <object>.
  • python -B tests/bidi_controls_check.py and git diff --check upstream/main HEAD. Passed. Missing fixture arguments and an unknown command both return 2.

Evidence and follow-up

The MIT-licensed fixture uses original assembly and two solid-color mips. Its existing four-word scalar buffer read supplies a uniform multiplier. In whole-quad mode the fixture computes a coordinate with twice the horizontal gradient, and implicit-LOD sampling after mask restore reads mip 1. The 8×8 test triangle leaves 36 clear pixels. Replacing helper coordinates with the quad's top-left coordinate instead makes the output come from mip 0 at a covered edge pixel.

The parser controls reject an entry-only value used by whole-quad math, an entry-only write over the sample coordinate, a condition mask, partial interpolation, and a pending uniform. A separate living register definition keeps its helper value even when an identical expression in another register is overwritten. The public fixture checks one desktop sample under the existing resource contract. Experiment notes and reproduction

Checklist

  • This pull request covers one reviewable behavior.
  • I included the test commands and results.
  • I considered a negative control or failure case for the fixture.
  • I updated the experiment documentation for the new capability.
  • I did not include game files, dumps, distribution links or secrets.

This contribution was AI-assisted.

Upstream merge verification

Merged b53bfb0 into this branch at 345855b, preserving the binary fixtures for affine coordinates, ceiling, cube instructions and container selection. The LLVM 15 binary round trip and bidirectional controls check passed. Reconfigured and rebuilt offscreen_check with the dev preset, then ran:

ctest --preset dev --no-tests=error --output-on-failure -R '^(pixel_aot_(warp|hardware)|bc7_draw_(warp|hardware)|gpu_alias_(lookup(_writes)?_)?(warp|hardware)|docs_links)$'

All eleven checks passed, with no capability skips. The private synthetic-binding draw reported above also repeated its two 4,096-pixel matches and first stale-reference mismatch at (0,0) on both adapters. The archive digest was unchanged.

Upstream merge verification

Merged 1292d15 at a823f00. The LLVM 15 binary, bidi and whitespace checks pass. The integrated fixture retains scalar ALU, literal FMA, half conversion and affine sampling. Reconfigured and built the dev preset, then ran:

ctest --preset dev --no-tests=error --output-on-failure -R '^(pixel_aot_(warp|hardware)|bc7_draw_(warp|hardware)|gpu_alias_(lookup(_writes)?_)?(warp|hardware)|docs_links|pso_readiness_check)$'

All twelve checks passed without skips. The private synthetic-binding draw repeated its two bitwise matches and stale-reference failure at (0, 0) on both adapters. The archive digest was unchanged.

Scalar-helper integration review

At e4906ce, the scalar HLSL helper set is distinct from the quad operand provenance. Previously, vector arithmetic before scalar bit-field extract raised an exception. In the reverse order, the HLSL contained a call without its function definition. Both orders now compile under both tracked masks with DXC -Gis -WX -T ps_6_0 -E main.

ctest --preset dev --no-tests=error --output-on-failure -R '^(pixel_aot_(warp|hardware)|bc7_draw_(warp|hardware)|docs_links|pso_readiness_check)$'

All six checks and the LLVM 15 binary and bidi checks passed. The private two-input readback and stale-reference controls repeated their previous results on both adapters.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6534057960 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/283). Originally posted by [Vonsek](https://github.com/Vonsek) on 2026-11-21T20:34:00Z. --- ## Change Track which pre-sample values have definitions on helper lanes. A single entry-mask sample can use paired interpolated coordinates and affine whole-quad results from addition, FMA or legacy multiplication. Two varying multiplication factors, absolute value and saturation are rejected on this path. An entry-only overwrite leaves the new value without a whole-quad definition. The shared surface is `tools/pixel_aot.py::lower` and its offscreen test runner. #257 and #279 work on the neighboring scalar/EXEC paths, #176 covers texture sample waits, and #166 tracks a separate offscreen CLI refactor. This patch uses the existing constant descriptor and binding contract and the indexed variant of the same test vertex shader. Full-screen callers retain their original vertex IDs. ## Verification Commit `b3cf7839e5ead00527dbe63b02653352259c44e9` on upstream `d311159b7ba56f4c75c10c1dd8c4303988c80d99`. - The source-built affine control fails with `Invalid arithmetic operation` against unmodified upstream, including after the #273 and #277 merges. The test passes with helper provenance enabled. - `cmake --preset dev` in a Visual Studio x64 shell with the repository venv as `INTAKE_PYTHON`, then `cmake --build --preset dev --target offscreen_check`. Passed. - `ctest --preset dev --no-tests=error -R '^(pixel_aot_(warp|hardware)|bc7_draw_(warp|hardware)|docs_links)$' --output-on-failure`. All five tests passed. The affine partial-quad draw matched 64 pixels and 256 channels on both Microsoft WARP 10.0.26100.9818 and RTX 5080 driver 32.0.16.1692. Debug layers were unavailable and neither adapter skipped. The first wrong-coordinate mismatch is at (6, 0), where mip 0 red replaces mip 1 green on both adapters. - `python -B tests/pixel_aot_check.py binary $asm $objcopy $llvm`. Passed with the Windows LLVM 15.0.7 integrated gfx1013 assembler, objcopy and LLVM-C DLL. The wrapper uses `clang -cc1as -triple amdgcn--amdpal -target-cpu gfx1013 -filetype obj <source> -o <object>`. - `python -B tests/bidi_controls_check.py` and `git diff --check upstream/main HEAD`. Passed. Missing fixture arguments and an unknown command both return 2. ## Evidence and follow-up The MIT-licensed fixture uses original assembly and two solid-color mips. Its existing four-word scalar buffer read supplies a uniform multiplier. In whole-quad mode the fixture computes a coordinate with twice the horizontal gradient, and implicit-LOD sampling after mask restore reads mip 1. The 8×8 test triangle leaves 36 clear pixels. Replacing helper coordinates with the quad's top-left coordinate instead makes the output come from mip 0 at a covered edge pixel. The parser controls reject an entry-only value used by whole-quad math, an entry-only write over the sample coordinate, a condition mask, partial interpolation, and a pending uniform. A separate living register definition keeps its helper value even when an identical expression in another register is overwritten. The public fixture checks one desktop sample under the existing resource contract. [Experiment notes and reproduction](docs/experiments.md#offline-pixel-shader-recompilation) ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the test commands and results. - [x] I considered a negative control or failure case for the fixture. - [x] I updated the experiment documentation for the new capability. - [x] I did not include game files, dumps, distribution links or secrets. This contribution was AI-assisted. ### Upstream merge verification Merged `b53bfb0` into this branch at `345855b`, preserving the binary fixtures for affine coordinates, ceiling, cube instructions and container selection. The LLVM 15 binary round trip and bidirectional controls check passed. Reconfigured and rebuilt `offscreen_check` with the dev preset, then ran: ```powershell ctest --preset dev --no-tests=error --output-on-failure -R '^(pixel_aot_(warp|hardware)|bc7_draw_(warp|hardware)|gpu_alias_(lookup(_writes)?_)?(warp|hardware)|docs_links)$' ``` All eleven checks passed, with no capability skips. The private synthetic-binding draw reported above also repeated its two 4,096-pixel matches and first stale-reference mismatch at (0,0) on both adapters. The archive digest was unchanged. ### Upstream merge verification Merged `1292d15` at `a823f00`. The LLVM 15 binary, bidi and whitespace checks pass. The integrated fixture retains scalar ALU, literal FMA, half conversion and affine sampling. Reconfigured and built the dev preset, then ran: ```powershell ctest --preset dev --no-tests=error --output-on-failure -R '^(pixel_aot_(warp|hardware)|bc7_draw_(warp|hardware)|gpu_alias_(lookup(_writes)?_)?(warp|hardware)|docs_links|pso_readiness_check)$' ``` All twelve checks passed without skips. The private synthetic-binding draw repeated its two bitwise matches and stale-reference failure at (0, 0) on both adapters. The archive digest was unchanged. ### Scalar-helper integration review At `e4906ce`, the scalar HLSL helper set is distinct from the quad operand provenance. Previously, vector arithmetic before scalar bit-field extract raised an exception. In the reverse order, the HLSL contained a call without its function definition. Both orders now compile under both tracked masks with DXC `-Gis -WX -T ps_6_0 -E main`. ```powershell ctest --preset dev --no-tests=error --output-on-failure -R '^(pixel_aot_(warp|hardware)|bc7_draw_(warp|hardware)|docs_links|pso_readiness_check)$' ``` All six checks and the LLVM 15 binary and bidi checks passed. The private two-input readback and stale-reference controls repeated their previous results on both adapters.
upstream-sync closed this pull request 2026-11-24 06:42:13 +00:00
chatgpt-codex-connector[bot commented 2026-11-24 06:42:13 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T22:10:01Z.

Review: COMMENTED


💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a823f0008f

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6008520055 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/283#pullrequestreview-6008520055). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-21T22:10:01Z. **Review:** COMMENTED --- <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `a823f0008f` <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". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". </details>
Vonsek commented 2026-11-24 06:42:13 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T22:12:56Z.

Review: COMMENTED


No description provided.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6008540309 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/283#pullrequestreview-6008540309). Originally posted by [Vonsek](https://github.com/Vonsek) on 2026-11-21T22:12:56Z. **Review:** COMMENTED --- _No description provided._
Vonsek commented 2026-11-24 06:48:00 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T20:40:14Z.


Local offline check at 55db13d5b641775f558eb92150448e9ed1da8dc7 translated all 33 instructions in one archived pixel program. Named lookup uniquely matched the bytes from the bounded scan. DXC compiled the result with zero warnings. Its DXIL dump showed one implicit texture sample and four color-output stores.

python -B tools/pixel_aot.py $archive $record --llvm $llvm --texture-sgpr $textureSgpr --interp-sgpr $interpSgpr --sampler-words $word0 $word1 $word2 $word3 --constant-descriptor $cbvOffset --output $hlsl
dxc -Gis -T ps_6_0 -E main -Fo $dxil $hlsl
dxc -dumpbin $dxil

The input registers, sampler words and constant descriptor offset were inferred from the decoded load, interpolation and sample operands. The result verifies offline translation and compilation under those inferred arguments. Authentic draw-time resources and title execution remain unverified.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7068921442 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/283#issuecomment-7068921442). Originally posted by [Vonsek](https://github.com/Vonsek) on 2026-11-21T20:40:14Z. --- Local offline check at `55db13d5b641775f558eb92150448e9ed1da8dc7` translated all 33 instructions in one archived pixel program. Named lookup uniquely matched the bytes from the bounded scan. DXC compiled the result with zero warnings. Its DXIL dump showed one implicit texture sample and four color-output stores. ```powershell python -B tools/pixel_aot.py $archive $record --llvm $llvm --texture-sgpr $textureSgpr --interp-sgpr $interpSgpr --sampler-words $word0 $word1 $word2 $word3 --constant-descriptor $cbvOffset --output $hlsl dxc -Gis -T ps_6_0 -E main -Fo $dxil $hlsl dxc -dumpbin $dxil ``` The input registers, sampler words and constant descriptor offset were inferred from the decoded load, interpolation and sample operands. The result verifies offline translation and compilation under those inferred arguments. Authentic draw-time resources and title execution remain unverified.
Vonsek commented 2026-11-24 06:48:00 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T20:50:27Z.


Desktop follow-up at 55db13d5b641775f558eb92150448e9ed1da8dc7. The translated pixel program ran through the existing offscreen_check --check-pixel-case fixture with a synthetic UNORM texture, a point-clamp sampler, and two synthetic constant-buffer inputs.

An independent CPU evaluator of the decoded instructions supplied the expected colors. WARP and RTX 5080 matched all 4,096 pixels and 16,384 channels bitwise for each input. Changing the constant changed all 4,096 expected pixels. Binding the new constant with the old reference failed at (0, 0) on both adapters.

This verifies the translated desktop shader with those synthetic inputs and full-screen, single-mip coverage. The title's draw-time bindings and native execution remain unverified.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7069044389 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/283#issuecomment-7069044389). Originally posted by [Vonsek](https://github.com/Vonsek) on 2026-11-21T20:50:27Z. --- Desktop follow-up at `55db13d5b641775f558eb92150448e9ed1da8dc7`. The translated pixel program ran through the existing `offscreen_check --check-pixel-case` fixture with a synthetic UNORM texture, a point-clamp sampler, and two synthetic constant-buffer inputs. An independent CPU evaluator of the decoded instructions supplied the expected colors. WARP and RTX 5080 matched all 4,096 pixels and 16,384 channels bitwise for each input. Changing the constant changed all 4,096 expected pixels. Binding the new constant with the old reference failed at (0, 0) on both adapters. This verifies the translated desktop shader with those synthetic inputs and full-screen, single-mip coverage. The title's draw-time bindings and native execution remain unverified.
R0Y00 commented 2026-11-24 06:48:01 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T20:57:33Z.


At 55db13d5, only tests/pixel_aot_check.py conflicts after #258. Please retain both the truncation regression and the affine LOD draw and run them together on the updated branch.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7069131416 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/283#issuecomment-7069131416). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-21T20:57:33Z. --- At `55db13d5`, only `tests/pixel_aot_check.py` conflicts after #258. Please retain both the truncation regression and the affine LOD draw and run them together on the updated branch.
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:03:58Z.


@codex review

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7069209272 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/283#issuecomment-7069209272). Originally posted by [Vonsek](https://github.com/Vonsek) on 2026-11-21T21:03:58Z. --- @codex review
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:08:00Z.


Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: b3cf7839e5

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7069257971 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/283#issuecomment-7069257971). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-21T21:08:00Z. --- <!-- codex-review-receipt:v1 --> Codex Review: Didn't find any major issues. Already looking forward to the next diff. **Reviewed commit:** `b3cf7839e5` <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". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". </details>
R0Y00 commented 2026-11-24 06:48:03 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T21:28:14Z.


At b3cf783, the merge conflicts are in tests/pixel_aot_check.py. Please retain the ceiling case and the affine-coordinate draw in the combined tests.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7069496274 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/283#issuecomment-7069496274). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-21T21:28:14Z. --- At `b3cf783`, the merge conflicts are in `tests/pixel_aot_check.py`. Please retain the ceiling case and the affine-coordinate draw in the combined tests.
Vonsek commented 2026-11-24 06:48:03 +00:00 (Migrated from github.com)

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


@codex review

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7069561365 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/283#issuecomment-7069561365). Originally posted by [Vonsek](https://github.com/Vonsek) on 2026-11-21T21:33:47Z. --- @codex review
chatgpt-codex-connector[bot commented 2026-11-24 06:48:04 +00:00 (Migrated from github.com)

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


Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 345855b421

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7069616733 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/283#issuecomment-7069616733). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-21T21:38:32Z. --- <!-- codex-review-receipt:v1 --> Codex Review: Didn't find any major issues. :rocket: **Reviewed commit:** `345855b421` <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". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". </details>
R0Y00 commented 2026-11-24 06:48:05 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T21:58:13Z.


At 345855b the merge conflicts are in tests/pixel_aot_check.py, tools/pixel_aot.py. Keep the affine-coordinate cases alongside the landed scalar and pixel arithmetic controls.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7069846870 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/283#issuecomment-7069846870). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-21T21:58:13Z. --- At `345855b` the merge conflicts are in `tests/pixel_aot_check.py`, `tools/pixel_aot.py`. Keep the affine-coordinate cases alongside the landed scalar and pixel arithmetic controls.
Vonsek commented 2026-11-24 06:48:07 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T22:05:52Z.


@codex review

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7069937127 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/283#issuecomment-7069937127). Originally posted by [Vonsek](https://github.com/Vonsek) on 2026-11-21T22:05:52Z. --- @codex review
Vonsek commented 2026-11-24 06:48:07 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T22:16:13Z.


@codex review

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7070060373 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/283#issuecomment-7070060373). Originally posted by [Vonsek](https://github.com/Vonsek) on 2026-11-21T22:16:13Z. --- @codex review
chatgpt-codex-connector[bot commented 2026-11-24 06:48:08 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T22:19:56Z.


Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: e4906ceda7

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7070105985 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/283#issuecomment-7070105985). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-21T22:19:56Z. --- <!-- codex-review-receipt:v1 --> Codex Review: Didn't find any major issues. Nice work! **Reviewed commit:** `e4906ceda7` <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". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". </details>
chatgpt-codex-connector[bot commented 2026-11-24 06:48:08 +00:00 (Migrated from github.com)

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


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-21T22:19:58.262074Z e4906ce Manual request
ℹ️ 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:7068847725 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/283#issuecomment-7068847725). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-21T20:34:11Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"e4906ceda7084219049983adff2f732a7dd086f3","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-21T22:19:58.262074Z">2026-11-21T22:19:58.262074Z</relative-time> | `e4906ce` | Manual request | <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>
chatgpt-codex-connector[bot commented 2026-11-24 06:50:36 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T22:10:01Z.

Code review location: tools/pixel_aot.py; line 607

@@ -589,11 +595,22 @@ def match(pattern):
             if op == "fmac":
                 tokens.append(dst)
             arity, template = ALU[op]
-            if mask != "entry" or len(tokens) != arity:
+            quad = mask == "quad"
+            if (mask not in ("entry", "quad") or len(tokens) != arity
+                    or (quad and (samples or second_texture_offset is not None
+                                  or op not in ("add", "fma", "mul_legacy")))):
                 raise ValueError("Invalid arithmetic operation")
             if dst in sample_dest:
                 raise ValueError("Write overlaps an outstanding sample")
-            values = [fp_operand(t, scalar, vector, pending, sample_pending) for t in tokens]
+            if quad and (clamp or any("|" in t or "abs(" in t for t in tokens)):
+                raise ValueError("Whole-quad coordinate arithmetic must be affine")
+            helpers = quad_values if quad else None

P1 Badge Keep quad provenance separate from the scalar-helper set

When a shader mixes vector arithmetic with scalar shift/bitfield operations, this overwrites the helpers set used to collect SALU_HELPERS with None (or a dictionary in quad mode). For example, inserting v_add_f32_e32 v12, 0.0, v12 followed by s_bfe_u32 s70, 1, 0x10000 after the sample wait in the existing copy fixture now raises AttributeError at helpers.add(op), although the parent translates it successfully. Reversing those instructions instead silently omits the required HLSL helper definition. Use a separate variable for the fp_operand provenance argument so existing mixed scalar/vector shaders remain translatable.

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4655241491 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/283#discussion_r4655241491). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-21T22:10:01Z. **Code review location:** `tools/pixel_aot.py`; line 607 ~~~~diff @@ -589,11 +595,22 @@ def match(pattern): if op == "fmac": tokens.append(dst) arity, template = ALU[op] - if mask != "entry" or len(tokens) != arity: + quad = mask == "quad" + if (mask not in ("entry", "quad") or len(tokens) != arity + or (quad and (samples or second_texture_offset is not None + or op not in ("add", "fma", "mul_legacy")))): raise ValueError("Invalid arithmetic operation") if dst in sample_dest: raise ValueError("Write overlaps an outstanding sample") - values = [fp_operand(t, scalar, vector, pending, sample_pending) for t in tokens] + if quad and (clamp or any("|" in t or "abs(" in t for t in tokens)): + raise ValueError("Whole-quad coordinate arithmetic must be affine") + helpers = quad_values if quad else None ~~~~ --- **<sub><sub>![P1 Badge](https://img.shields.io/badge/P1-orange?style=flat)</sub></sub> Keep quad provenance separate from the scalar-helper set** When a shader mixes vector arithmetic with scalar shift/bitfield operations, this overwrites the `helpers` set used to collect `SALU_HELPERS` with `None` (or a dictionary in quad mode). For example, inserting `v_add_f32_e32 v12, 0.0, v12` followed by `s_bfe_u32 s70, 1, 0x10000` after the sample wait in the existing copy fixture now raises `AttributeError` at `helpers.add(op)`, although the parent translates it successfully. Reversing those instructions instead silently omits the required HLSL helper definition. Use a separate variable for the `fp_operand` provenance argument so existing mixed scalar/vector shaders remain translatable. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
Vonsek commented 2026-11-24 06:50:36 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T22:12:56Z.

Code review location: tools/pixel_aot.py; line 607

@@ -589,11 +595,22 @@ def match(pattern):
             if op == "fmac":
                 tokens.append(dst)
             arity, template = ALU[op]
-            if mask != "entry" or len(tokens) != arity:
+            quad = mask == "quad"
+            if (mask not in ("entry", "quad") or len(tokens) != arity
+                    or (quad and (samples or second_texture_offset is not None
+                                  or op not in ("add", "fma", "mul_legacy")))):
                 raise ValueError("Invalid arithmetic operation")
             if dst in sample_dest:
                 raise ValueError("Write overlaps an outstanding sample")
-            values = [fp_operand(t, scalar, vector, pending, sample_pending) for t in tokens]
+            if quad and (clamp or any("|" in t or "abs(" in t for t in tokens)):
+                raise ValueError("Whole-quad coordinate arithmetic must be affine")
+            helpers = quad_values if quad else None

Fixed in e4906ce by separating the quad operand provenance from the scalar HLSL helper set. I reproduced the entry-arithmetic-first exception and the scalar-first missing function on the previous head. The added controls cover both orders under entry and quad masks. All four emitted sources compile with DXC -WX. The LLVM round trip and six targeted CTests also pass.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4655257476 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/283#discussion_r4655257476). Originally posted by [Vonsek](https://github.com/Vonsek) on 2026-11-21T22:12:56Z. **Code review location:** `tools/pixel_aot.py`; line 607 ~~~~diff @@ -589,11 +595,22 @@ def match(pattern): if op == "fmac": tokens.append(dst) arity, template = ALU[op] - if mask != "entry" or len(tokens) != arity: + quad = mask == "quad" + if (mask not in ("entry", "quad") or len(tokens) != arity + or (quad and (samples or second_texture_offset is not None + or op not in ("add", "fma", "mul_legacy")))): raise ValueError("Invalid arithmetic operation") if dst in sample_dest: raise ValueError("Write overlaps an outstanding sample") - values = [fp_operand(t, scalar, vector, pending, sample_pending) for t in tokens] + if quad and (clamp or any("|" in t or "abs(" in t for t in tokens)): + raise ValueError("Whole-quad coordinate arithmetic must be affine") + helpers = quad_values if quad else None ~~~~ --- Fixed in `e4906ce` by separating the quad operand provenance from the scalar HLSL helper set. I reproduced the entry-arithmetic-first exception and the scalar-first missing function on the previous head. The added controls cover both orders under entry and quad masks. All four emitted sources compile with DXC `-WX`. The LLVM round trip and six targeted CTests also pass.
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!279
No description provided.