shader: lower RDNA2 32-bit scalar complement logic in pixel_aot #555

Merged
stan495 merged 1 commit from upstream-pr/561 into main 2026-11-22 12:58:01 +00:00
stan495 commented 2026-11-22 12:20:25 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-22T12:20:25Z.


Change

Translate RDNA2 32-bit scalar complement logic instructions s_nand_b32, s_nor_b32, and s_xnor_b32 in tools/pixel_aot.py. Each operation inverts the 32-bit bitwise AND, OR, or XOR of its scalar operands and updates SCC when the result is nonzero, matching the existing SCALAR table definitions and mirroring the 64-bit complement forms in #400.

Add scanner recognition in tools/scan_unsupported_shaders.py and tests/rdna2_tools_check.py. Add draw fixture steps, mutation checks, and negative controls in tests/pixel_aot_check.py verifying that mutating s_nand_b32, s_nor_b32, or s_xnor_b32 to uncomplemented forms produces a pixel mismatch.

Verification

Tested commit a1b0312 on Windows 11 Build 26100, AMD Ryzen 7 7800X3D + AMD Radeon RX 7900 XTX (driver 32.0.32029.2010), debug layer enabled, and Microsoft Basic Render Driver (WARP, driver 10.0.26100.9711).

Commands:

python -B tests/script_state_check.py
python -B tests/form_coverage_check.py
python -B tests/rdna2_tools_check.py
python -B tests/docs_links_check.py
ctest --preset dev --no-tests=error -R '^pixel_aot_'

Results:

  • Platform checks passed: 13 script state checks OK, form coverage OK, 37 rdna2 scanner tests OK, 116 doc links checked.
  • CTest pixel_aot_hardware and pixel_aot_warp: 18/18 tests passed (100%), 0 errors, 0 warnings.
  • Draw cases matched 4,096 pixels across all 4 channels with max_absolute_error=0.
  • Mutations s_nand_b32 -> s_and_b32, s_nor_b32 -> s_or_b32, and s_xnor_b32 -> s_xor_b32 each triggered a verified pixel_mismatch.

Evidence and follow-up

The draw fixture extends SCALAR_VALUES in tests/pixel_aot_check.py using synthetic constants, checking both output values and SCC updates across constant sets, and verifying negative controls under mutations to uncomplemented forms. The public reproduction command is unchanged: ctest --preset dev --no-tests=error -R '^pixel_aot_'.

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.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6542292686 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/561). Originally posted by [stan495](https://github.com/stan495) on 2026-11-22T12:20:25Z. --- ## Change Translate RDNA2 32-bit scalar complement logic instructions `s_nand_b32`, `s_nor_b32`, and `s_xnor_b32` in `tools/pixel_aot.py`. Each operation inverts the 32-bit bitwise AND, OR, or XOR of its scalar operands and updates SCC when the result is nonzero, matching the existing `SCALAR` table definitions and mirroring the 64-bit complement forms in #400. Add scanner recognition in `tools/scan_unsupported_shaders.py` and `tests/rdna2_tools_check.py`. Add draw fixture steps, mutation checks, and negative controls in `tests/pixel_aot_check.py` verifying that mutating `s_nand_b32`, `s_nor_b32`, or `s_xnor_b32` to uncomplemented forms produces a pixel mismatch. ## Verification Tested commit `a1b0312` on Windows 11 Build 26100, AMD Ryzen 7 7800X3D + AMD Radeon RX 7900 XTX (driver 32.0.32029.2010), debug layer enabled, and Microsoft Basic Render Driver (WARP, driver 10.0.26100.9711). Commands: ```powershell python -B tests/script_state_check.py python -B tests/form_coverage_check.py python -B tests/rdna2_tools_check.py python -B tests/docs_links_check.py ctest --preset dev --no-tests=error -R '^pixel_aot_' ``` Results: - Platform checks passed: 13 script state checks OK, form coverage OK, 37 rdna2 scanner tests OK, 116 doc links checked. - CTest `pixel_aot_hardware` and `pixel_aot_warp`: 18/18 tests passed (100%), 0 errors, 0 warnings. - Draw cases matched 4,096 pixels across all 4 channels with `max_absolute_error=0`. - Mutations `s_nand_b32 -> s_and_b32`, `s_nor_b32 -> s_or_b32`, and `s_xnor_b32 -> s_xor_b32` each triggered a verified `pixel_mismatch`. ## Evidence and follow-up The draw fixture extends `SCALAR_VALUES` in `tests/pixel_aot_check.py` using synthetic constants, checking both output values and SCC updates across constant sets, and verifying negative controls under mutations to uncomplemented forms. The public reproduction command is unchanged: `ctest --preset dev --no-tests=error -R '^pixel_aot_'`. ## 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. AI-assisted.
upstream-sync closed this pull request 2026-11-24 06:43:42 +00:00
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!555
No description provided.