Support absolute-value operands in pixel shader translation #88

Merged
RonLogic merged 5 commits from upstream-pr/89 into main 2026-11-21 16:54:15 +00:00
RonLogic commented 2026-11-21 15:48:11 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by RonLogic on 2026-11-21T15:48:11Z.


Summary

The pixel shader lowerer rejected the AMDGPU absolute-value source modifier on an otherwise supported floating-point instruction. This change translates both |v12| and abs(v12) to HLSL abs and reuses the existing operand validation.

The synthetic fixture computes abs(0.5 - red) from a sampled texture. The reference covers inputs on both sides of 0.5. The renderer reports a pixel mismatch when the modifier is removed from the fixture. The new fixture also runs through the existing LLVM 15 assembly and disassembly test in CI.

Verification

ctest --test-dir out/build/shader-native-prompt --no-tests=error -R '^pixel_aot_(warp|hardware)$' -V

Both tests passed on Windows with an RTX 4070 (driver 32.0.16.2124) and Microsoft WARP. Each backend matched all four channels of 4,096 pixels exactly. The fixture is generated from source and uses no game data.

AI-assisted. The Windows results were verified locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6530968108 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/89). Originally posted by [RonLogic](https://github.com/RonLogic) on 2026-11-21T15:48:11Z. --- ## Summary The pixel shader lowerer rejected the AMDGPU absolute-value source modifier on an otherwise supported floating-point instruction. This change translates both `|v12|` and `abs(v12)` to HLSL `abs` and reuses the existing operand validation. The synthetic fixture computes `abs(0.5 - red)` from a sampled texture. The reference covers inputs on both sides of 0.5. The renderer reports a pixel mismatch when the modifier is removed from the fixture. The new fixture also runs through the existing LLVM 15 assembly and disassembly test in CI. ## Verification ```powershell ctest --test-dir out/build/shader-native-prompt --no-tests=error -R '^pixel_aot_(warp|hardware)$' -V ``` Both tests passed on Windows with an RTX 4070 (driver `32.0.16.2124`) and Microsoft WARP. Each backend matched all four channels of 4,096 pixels exactly. The fixture is generated from source and uses no game data. AI-assisted. The Windows results were verified locally.
upstream-sync closed this pull request 2026-11-24 06:41:16 +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!88
No description provided.