shader: recognize bit-field extraction in pixel primitive masks #27

Merged
shabouwcaw merged 2 commits from upstream-pr/27 into main 2026-11-26 10:17:30 +00:00
shabouwcaw commented 2026-11-26 10:02:57 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by shabouwcaw on 2026-11-26T10:02:57Z.


A guessed pixel shader that extracts its primitive mask with s_bfe_u32 before moving it to M0 is rejected as a hardware SGPR input. Recognize unsigned bit-field extraction alongside the existing scalar mask/shift operations, retaining the checks that the value is used only for interpolation and that SCC has no observable consumer.

The hand-assembled regression fails before the change and passes with both wave32_host settings afterward. Negative cases retain rejection when the original mask, extracted mask, or SCC affects output. The guessed-path assumption and validation limits are documented in docs/native-host.md.

Related to #4. This covers a synthetic instance of the hardware-SGPR refusal; it has not been verified against the seven reported game shaders and does not claim to close the issue. No game data is included.

Validation on the current main base:

  • cargo test -j6 --locked -p victory-shader -p xtask: 222 passed, 2 ignored benchmarks.
  • cargo clippy -j6 --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings: passed.
  • cargo xtask policy: passed (363 files).
  • git diff --check: passed.

Broader local checks attempted before rebasing were limited by missing host dependencies: GPU tests abort when libmetalirconverter.dylib cannot be loaded; HLE native-probe integration tests cannot build without Homebrew LLVM's llvm-dlltool. The 122 HLE unit tests passed. Full CI and maintainer review remain required.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:6624189054 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/27). Originally posted by [shabouwcaw](https://github.com/shabouwcaw) on 2026-11-26T10:02:57Z. --- A guessed pixel shader that extracts its primitive mask with `s_bfe_u32` before moving it to M0 is rejected as `a hardware SGPR input`. Recognize unsigned bit-field extraction alongside the existing scalar mask/shift operations, retaining the checks that the value is used only for interpolation and that SCC has no observable consumer. The hand-assembled regression fails before the change and passes with both `wave32_host` settings afterward. Negative cases retain rejection when the original mask, extracted mask, or SCC affects output. The guessed-path assumption and validation limits are documented in `docs/native-host.md`. Related to #4. This covers a synthetic instance of the hardware-SGPR refusal; it has not been verified against the seven reported game shaders and does not claim to close the issue. No game data is included. Validation on the current main base: - `cargo test -j6 --locked -p victory-shader -p xtask`: 222 passed, 2 ignored benchmarks. - `cargo clippy -j6 --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings`: passed. - `cargo xtask policy`: passed (363 files). - `git diff --check`: passed. Broader local checks attempted before rebasing were limited by missing host dependencies: GPU tests abort when `libmetalirconverter.dylib` cannot be loaded; HLE native-probe integration tests cannot build without Homebrew LLVM's `llvm-dlltool`. The 122 HLE unit tests passed. Full CI and maintainer review remain required.
LakshanSivakumar commented 2026-11-26 10:13:02 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T10:13:02Z.

Review: APPROVED


Reviewed and tested merged with current main: victory-shader/victory-gpu/xtask tests (incl. the new extraction regression) and policy pass. Small, well-guarded change with good negative cases. Thanks, and welcome!

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:review:6072193537 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/27#pullrequestreview-6072193537). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-26T10:13:02Z. **Review:** APPROVED --- Reviewed and tested merged with current main: victory-shader/victory-gpu/xtask tests (incl. the new extraction regression) and policy pass. Small, well-guarded change with good negative cases. Thanks, and welcome!
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
LakshanSivakumar/Native-Victory-macOS!27
No description provided.