shader: track helper-lane affine sample coordinates #279
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/283"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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::lowerand 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
b3cf7839e5ead00527dbe63b02653352259c44e9on upstreamd311159b7ba56f4c75c10c1dd8c4303988c80d99.Invalid arithmetic operationagainst unmodified upstream, including after the #273 and #277 merges. The test passes with helper provenance enabled.cmake --preset devin a Visual Studio x64 shell with the repository venv asINTAKE_PYTHON, thencmake --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 usesclang -cc1as -triple amdgcn--amdpal -target-cpu gfx1013 -filetype obj <source> -o <object>.python -B tests/bidi_controls_check.pyandgit 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 contribution was AI-assisted.
Upstream merge verification
Merged
b53bfb0into this branch at345855b, 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 rebuiltoffscreen_checkwith the dev preset, then ran: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
1292d15ata823f00. 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: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.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.
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
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".
Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T22:12:56Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T20:40:14Z.
Local offline check at
55db13d5b641775f558eb92150448e9ed1da8dc7translated 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.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.
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 existingoffscreen_check --check-pixel-casefixture 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.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T20:57:33Z.
At
55db13d5, onlytests/pixel_aot_check.pyconflicts after #258. Please retain both the truncation regression and the affine LOD draw and run them together on the updated branch.Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T21:03:58Z.
@codex review
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
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".
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T21:28:14Z.
At
b3cf783, the merge conflicts are intests/pixel_aot_check.py. Please retain the ceiling case and the affine-coordinate draw in the combined tests.Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T21:33:47Z.
@codex review
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
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".
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T21:58:13Z.
At
345855bthe merge conflicts are intests/pixel_aot_check.py,tools/pixel_aot.py. Keep the affine-coordinate cases alongside the landed scalar and pixel arithmetic controls.Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T22:05:52Z.
@codex review
Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T22:16:13Z.
@codex review
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
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".
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.
e4906ceℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
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 607When a shader mixes vector arithmetic with scalar shift/bitfield operations, this overwrites the
helpersset used to collectSALU_HELPERSwithNone(or a dictionary in quad mode). For example, insertingv_add_f32_e32 v12, 0.0, v12followed bys_bfe_u32 s70, 1, 0x10000after the sample wait in the existing copy fixture now raisesAttributeErrorathelpers.add(op), although the parent translates it successfully. Reversing those instructions instead silently omits the required HLSL helper definition. Use a separate variable for thefp_operandprovenance argument so existing mixed scalar/vector shaders remain translatable.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T22:12:56Z.
Code review location:
tools/pixel_aot.py; line 607Fixed in
e4906ceby 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.