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

Manually merged
github merged 2 commits from gh-pr/27/head into gh-pr/27/base 2026-11-26 14:42:55 +00:00
Owner

@⁠shabouwcaw on GitHub · 2026-11-26 10:02 UTC · original
shabouwcaw:fix/pixel-prim-mask-bitfield-extract → main · +45 −3 · 3 files · 2 commits · merged 2026-11-26 10:17 UTC

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.

**@⁠shabouwcaw** on GitHub · 2026-11-26 10:02 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/27) `shabouwcaw:fix/pixel-prim-mask-bitfield-extract` → `main` · +45 −3 · 3 files · 2 commits · merged 2026-11-26 10:17 UTC 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 14:42:55 +00:00
github manually merged commit 371c5603e7 into gh-pr/27/base 2026-11-26 14:42:55 +00:00
Author
Owner

@⁠LakshanSivakumar on GitHub · 2026-11-26 10:13 UTC · original · approved these changes

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!

**@⁠LakshanSivakumar** on GitHub · 2026-11-26 10:13 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/27#pullrequestreview-6072193537) · **approved these changes** 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!
This discussion has been locked. Commenting is limited to contributors.
No description provided.