Shaders: lower pixel shader SV_Coverage input via dx.op.coverage #657

Open
davi713albano-coder wants to merge 1 commit from upstream-pr/657 into main
davi713albano-coder commented 2026-11-25 04:08:22 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by davi713albano-coder on 2026-11-25T04:08:22Z.


Summary

  • Lower Input::SampleCoverage (SPI_PS_INPUT_ADDR bit 14) in crates/victory-shader/src/emit/lower.rs via dx.op.coverage.i32 (opcode 91, Attr::ReadNone), instead of falling through to Val::Missing.
  • Strip SV_Coverage (kind == 14, NotInSig in DXIL) from pixel shader ISG1 in crates/victory-shader/src/emit/mod.rs if a console container lists it there.
  • Add synthetic D3D12 test ps_sample_coverage_input_reads_coverage_mask in crates/victory-shader/src/emit/valu_tests.rs verifying DXIL validation, container hash, graphics pipeline creation, and Host::draw readback (coverage mask 1 on a 1x target).

Verification

  • Verified cargo clippy --workspace --all-targets --locked -- -D warnings, --all-features, and cargo test --workspace --locked on windows-latest (ps_sample_coverage_input_reads_coverage_mask passes DXIL validation and D3D12 draw readback).

No title data used. AI-assisted.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6596995138 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/657). Originally posted by [davi713albano-coder](https://github.com/davi713albano-coder) on 2026-11-25T04:08:22Z. --- ### Summary - Lower `Input::SampleCoverage` (`SPI_PS_INPUT_ADDR` bit 14) in `crates/victory-shader/src/emit/lower.rs` via `dx.op.coverage.i32` (opcode `91`, `Attr::ReadNone`), instead of falling through to `Val::Missing`. - Strip `SV_Coverage` (`kind == 14`, `NotInSig` in DXIL) from pixel shader `ISG1` in `crates/victory-shader/src/emit/mod.rs` if a console container lists it there. - Add synthetic D3D12 test `ps_sample_coverage_input_reads_coverage_mask` in `crates/victory-shader/src/emit/valu_tests.rs` verifying DXIL validation, container hash, graphics pipeline creation, and `Host::draw` readback (coverage mask `1` on a 1x target). ### Verification - Verified `cargo clippy --workspace --all-targets --locked -- -D warnings`, `--all-features`, and `cargo test --workspace --locked` on `windows-latest` (`ps_sample_coverage_input_reads_coverage_mask` passes DXIL validation and D3D12 draw readback). No title data used. AI-assisted.
JRamos1993 commented 2026-11-25 06:06:38 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by JRamos1993 on 2026-11-25T05:27:26Z.


Offline check on the retail shader pack: no program of the title reaches this path. The change is neutral for it.

victory translate --validate --list over the title's full shader pack (26,084 programs) on an RTX 5090, main 310c6eb against this head merged onto it:

  • Validated: 25,382 in both, none lost.
  • DXIL: with a local hash on each validated line, 0 programs' DXIL differs (two runs of one build hash the same; the hash catches real changes).
  • Failures: none of the 507 failing programs on main fails on pixel shaders reading SV_Coverage.

So this fix doesn't change anything for this title's shaders as the batch tool translates them. It may still matter for other programs or titles.

AI use: Claude Code with Claude Opus 5.5 ran the pack and wrote this. Nothing from the title is in it.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7153793268 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/657#issuecomment-7153793268). Originally posted by [JRamos1993](https://github.com/JRamos1993) on 2026-11-25T05:27:26Z. --- **Offline check on the retail shader pack: no program of the title reaches this path. The change is neutral for it.** `victory translate --validate --list` over the title's full shader pack (26,084 programs) on an RTX 5090, `main` `310c6eb` against this head merged onto it: - **Validated:** 25,382 in both, none lost. - **DXIL:** with a local hash on each validated line, **0 programs' DXIL differs** (two runs of one build hash the same; the hash catches real changes). - **Failures:** none of the 507 failing programs on `main` fails on pixel shaders reading `SV_Coverage`. So this fix doesn't change anything for this title's shaders as the batch tool translates them. It may still matter for other programs or titles. AI use: Claude Code with Claude Opus 5.5 ran the pack and wrote this. Nothing from the title is in it.
HAL9000RELOADED commented 2026-11-25 20:09:27 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by HAL9000RELOADED on 2026-11-25T19:29:51Z.


RX 7900 XTX (RDNA3), Windows 10 + #402 for SM 6.6, main d510ee4: the new test ps_sample_coverage_input_reads_coverage_mask passes on the card with this PR, and fails with the test alone on the base. No other test changed. Run table: #129 (https://github.com/fxceless/victory-fork/pull/129#issuecomment-7172358511).

<!-- greyfinch-sync:fxceless/victory-fork:comment:7172378336 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/657#issuecomment-7172378336). Originally posted by [HAL9000RELOADED](https://github.com/HAL9000RELOADED) on 2026-11-25T19:29:51Z. --- RX 7900 XTX (RDNA3), Windows 10 + #402 for SM 6.6, main `d510ee4`: the new test `ps_sample_coverage_input_reads_coverage_mask` passes on the card with this PR, and fails with the test alone on the base. No other test changed. Run table: #129 (https://github.com/fxceless/victory-fork/pull/129#issuecomment-7172358511).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/657:upstream-pr/657'
git switch 'upstream-pr/657'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/657'
git switch 'upstream-pr/657'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/657'
git switch 'upstream-pr/657'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/657'
git switch 'main'
git merge --squash 'upstream-pr/657'
git switch 'main'
git merge --ff-only 'upstream-pr/657'
git switch 'main'
git merge 'upstream-pr/657'
git push origin 'main'
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
fxceless/victory-fork!657
No description provided.