Skip to content

Name unsupported hardware SGPR inputs in shader diagnostics - #2440

Closed
DoubleD17 wants to merge 1 commit into
Marvisak:mainfrom
DoubleD17:port/fxceless-941
Closed

DoubleD17 wants to merge 1 commit into
Marvisak:mainfrom
DoubleD17:port/fxceless-941

Conversation

@DoubleD17

Copy link
Copy Markdown
Contributor

When the original translator rejects a hardware SGPR input, the diagnostic omits the register. Report the register when attribution is clear, keep the consumer offset and failure category, and keep the generic message at ambiguous joins. The adaptation preserves the original's pixel SGPR initialization and primitive-ordered pixel shading rules. Synthetic CPU tests on Windows x64 with Rust 1.98.1 MSVC passed 3 of 3 on 46dd398, covering s5 and s7 at the same consumer, both input orders at a dynamic join, and identical DXIL for the dead-read control. The existing POPS control passed, preserving rasterizer-ordered output and identifying s10 in the refusal outside ordered mode. The diagnostics CLI compiled and its grouping was checked by code review. The tests cover host diagnostics and synthetic translation. Adapted from fxceless/victory-fork #941.

AI-assisted.

@oni-swr

oni-swr commented Nov 25, 2026

Copy link
Copy Markdown

Verification — head 46dd398ff87600aa66a1b103a6ce4ba611bd872f

Environment: Windows 11 Pro 10.0.26200, rustc/cargo 1.98.1, DXC/dxil 1.8.2502.11 (Windows Kits 10.0.26100.0 x64). origin/main = 940d32f69b22265690a0b5a15d6ded572ba33baf; the PR is one commit set on top of it (merge-base = main), so the exact head was tested with no merge needed.

  • cargo test -p victory-shader --lib: 250 passed, 0 failed, 3 ignored. New tests hardware_sgpr_input_refusal_names_the_register_at_the_export (s5/s7 named), ..._at_a_dynamic_join_stays_generic and ..._read_without_a_consumer_still_translates all ran and passed.
  • cargo clippy -p victory-shader -p victory --all-targets -- -D warnings: clean. cargo xtask policy: ok.
  • Caveat: the victory-shader GPU tests (emit::valu_tests etc.) iterate over a hardware adapter and WARP and ignore VICTORY_D3D12_WARP, so this run was not WARP-only; they passed on both.
  • Note: touches emit/lower.rs like Shaders: truncate s_buffer_load offset terms independently #2438 but in different hunks.

Read the full diff first: no process, network or filesystem code beyond what the PR describes; no game data, dumps, shader names or retail hashes involved.

Verified by Claude Code (Claude Sonnet 5.5), an AI assistant; this is a test report, not a code review or approval.

@DenRakEiw DenRakEiw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified against origin/main (940d32f) on Windows 11 + NVIDIA GeForce RTX 5090:

  • Naming unsupported hardware SGPR inputs in shader diagnostics while keeping dynamic joins generic and ignoring unconsumed inputs is clean and well-tested.
  • cargo test -p victory-shader emit::tests: 19/19 passed (including hardware_sgpr_input_refusal_names_the_register_at_the_export, hardware_sgpr_input_refusal_at_a_dynamic_join_stays_generic, and hardware_sgpr_input_read_without_a_consumer_still_translates).
  • cargo test -p victory translate::tests: 1/1 passed.
  • cargo clippy -p victory-shader -p victory --all-targets -- -D warnings: 0 warnings.
  • cargo xtask policy: 183 files ok.

AI-assisted (Gemini 4 Neon).

@catminou4 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Names unsupported hardware SGPR inputs in shader diagnostics (apps+shader). The shader-side enum addition looks consistent; the translate.rs error arm matches the existing pattern. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. (victory-shader tests not run here — the crate compiles Windows-only paths in this PR's touch area.)

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Merge candidate. This changes diagnostics only. When the lowering in crates/victory-shader/src/emit/lower.rs refuses a program for reading an SGPR the host has no value for, the error now names the register (new ShaderError::UnsupportedHardwareSgprInput). At a join of two such inputs it stays the generic "a hardware SGPR input". victory translate keeps grouping these under the same reason, with the register added to the example. I checked that only the emit stage can produce the new variant, so the other ShaderError::Unsupported arms in apps/victory/src/translate.rs are unaffected, and that the POPS collision-id test in synthetic_tests.rs still covers the ordered/unordered split. CI (check) passes.

Style note for the maintainer: the register travels as a string ("hardware SGPR input s<n>") through Val::Missing and is parsed back in unsupported with an expect. That works, but a typed reason would be cleaner if the maintainer prefers it. This is a recommendation to look, not an approval.


Generated by Claude Code

@Marvisak

Copy link
Copy Markdown
Owner

Automated triage for the maintainers, second look (a review against current main, with builds and tests where they could change the verdict).

Closing because no title program reaches this refusal on main (hardware SGPR inputs already read as defined values there), so the message it improves is never shown. It also adds a public error variant and a string round trip that panics on a malformed reason.

If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.

@Marvisak Marvisak closed this Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants