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

Open
github-bot wants to merge 2 commits from github-bot/gh-1686 into main AGit
Owner

@⁠Calvix2k on GitHub · 2026-11-24 20:45 UTC · original
Calvix2k:codex/shader-ps-coverage-1530 → main · +177 −0 · 3 files · 2 commits · open

Implements #1530.

Ports the fix from @⁠davi713albano-coder's fork (commit c0f6d69 by Davi713), applied unchanged onto ffe310e; the commit keeps its original author.

Summary

io::raise already lifted SPI_PS_INPUT_ADDR bit 14 to Input::SampleCoverage, but emit::lower refused it as "a pixel system input".

  • Input::SampleCoverage now lowers to DXIL dx.op.coverage.i32 (opcode 91, ReadNone).
  • SV_Coverage (kind == 14) is stripped from the pixel ISG1 before emission when a console container lists it there, since DXIL declares it NotInSig for pixel inputs.

Test

New synthetic pixel-shader test ps_sample_coverage_input_reads_coverage_mask: SPI input bit 14, ISG1 stripping, dxil.dll validation and container hash, plus a live D3D12 draw readback on a 1x target asserting the covered pixel reads the full mask.

Validation

  • cargo test -p victory-shader --locked -- --test-threads=1 --skip emit::valu_tests --skip emit::waterfall_tests — passed (102 tests, 1 ignored).
  • cargo clippy -p victory-shader --all-targets --all-features --locked -- -D warnings — passed.
  • cargo xtask policy — passed (154 files).
  • Upstream fork CI ran the full workspace including the new WARP draw test: 343 passed, 0 failed.
**@⁠Calvix2k** on GitHub · 2026-11-24 20:45 UTC · [original](https://github.com/Marvisak/VIctory/pull/1686) `Calvix2k:codex/shader-ps-coverage-1530` → `main` · +177 −0 · 3 files · 2 commits · open Implements #1530. Ports the fix from [@⁠davi713albano-coder's fork](https://github.com/Marvisak/VIctory/compare/main...davi713albano-coder:VIctory:shader/ps-coverage-input) (commit c0f6d69 by Davi713), applied unchanged onto `ffe310e`; the commit keeps its original author. ## Summary `io::raise` already lifted `SPI_PS_INPUT_ADDR` bit 14 to `Input::SampleCoverage`, but `emit::lower` refused it as "a pixel system input". - `Input::SampleCoverage` now lowers to DXIL `dx.op.coverage.i32` (opcode 91, `ReadNone`). - `SV_Coverage` (`kind == 14`) is stripped from the pixel `ISG1` before emission when a console container lists it there, since DXIL declares it `NotInSig` for pixel inputs. ## Test New synthetic pixel-shader test `ps_sample_coverage_input_reads_coverage_mask`: SPI input bit 14, `ISG1` stripping, dxil.dll validation and container hash, plus a live D3D12 draw readback on a 1x target asserting the covered pixel reads the full mask. ## Validation - `cargo test -p victory-shader --locked -- --test-threads=1 --skip emit::valu_tests --skip emit::waterfall_tests` — passed (102 tests, 1 ignored). - `cargo clippy -p victory-shader --all-targets --all-features --locked -- -D warnings` — passed. - `cargo xtask policy` — passed (154 files). - Upstream fork CI ran the full workspace including the new WARP draw test: 343 passed, 0 failed.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:41:32 +00:00
Author
Owner

@⁠Calvix2k on GitHub · 2026-11-24 21:39 UTC · original

Hardware run on head of this PR, AMD RDNA3:

  • Windows 10 x64, Ryzen 7 5800X, Radeon RX 7800 XT (driver 32.0.32029.2010), Agility SDK 1.616 locally for SM 6.6.
  • cargo test -p victory-shader --locked ps_sample_coverage_input_reads_coverage_mask -- --test-threads=1 --nocapture — 1 passed, 0 failed on the hardware backend (the 1x coverage readback is correct). WARP skipped at SM 6.2 here.
**@⁠Calvix2k** on GitHub · 2026-11-24 21:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/1686#issuecomment-7145225051) Hardware run on head of this PR, AMD RDNA3: - Windows 10 x64, Ryzen 7 5800X, Radeon RX 7800 XT (driver 32.0.32029.2010), Agility SDK 1.616 locally for SM 6.6. - `cargo test -p victory-shader --locked ps_sample_coverage_input_reads_coverage_mask -- --test-threads=1 --nocapture` — **1 passed, 0 failed** on the hardware backend (the 1x coverage readback is correct). WARP skipped at SM 6.2 here.
Author
Owner

@⁠Calvix2k on GitHub · 2026-11-24 22:15 UTC · original

Rebased onto 70564ae. Conflicts were in the test module only: upstream added its own tests/helpers, and HostShader gained six fields (root_uavs, memory, memory_writes, view_addresses, heap, heap_writes). The test's VS literal now fills them with empty/false; cargo check -p victory-shader --tests passes.

**@⁠Calvix2k** on GitHub · 2026-11-24 22:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/1686#issuecomment-7145994815) Rebased onto 70564ae. Conflicts were in the test module only: upstream added its own tests/helpers, and `HostShader` gained six fields (`root_uavs`, `memory`, `memory_writes`, `view_addresses`, `heap`, `heap_writes`). The test's VS literal now fills them with empty/false; cargo check -p victory-shader --tests passes.
Author
Owner

@⁠upipibi on GitHub · 2026-11-24 22:52 UTC · original

NVIDIA run: RTX 3070 8 GB, driver 616.56, Windows 11, debug, 14ca121 (on main 70564ae). ps_sample_coverage_input_reads_coverage_mask passes on the hardware adapter.

AI-assisted (Claude Code). Synthetic tests only.

**@⁠upipibi** on GitHub · 2026-11-24 22:52 UTC · [original](https://github.com/Marvisak/VIctory/pull/1686#issuecomment-7146735695) NVIDIA run: RTX 3070 8 GB, driver 616.56, Windows 11, debug, `14ca121` (on `main` `70564ae`). `ps_sample_coverage_input_reads_coverage_mask` passes on the hardware adapter. AI-assisted (Claude Code). Synthetic tests only.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 03:33 UTC · original · edited 2026-11-25 22:24 UTC

Automated triage for the maintainers.

Needs rebase. This PR no longer merges cleanly into main: main has moved since the last triage, and the branch now conflicts in crates/victory-shader/src/emit/valu_tests.rs. It will be reviewed again once it is rebased onto current main.

Previous verdict for this head: merge candidate.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 03:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/1686#issuecomment-7152027649) · edited 2026-11-25 22:24 UTC <!-- victory-triage v1 head=16ce8f33c55944aba31f9a370b78b07a897e376b verdict=needs-rebase at=2026-11-25T22:28:00Z --> Automated triage for the maintainers. **Needs rebase.** This PR no longer merges cleanly into `main`: `main` has moved since the last triage, and the branch now conflicts in `crates/victory-shader/src/emit/valu_tests.rs`. It will be reviewed again once it is rebased onto current `main`. Previous verdict for this head: merge candidate. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠StExpeditus on GitHub · 2026-11-25 09:16 UTC · original

Test report: RTX 5060 Ti (Blackwell), Windows 11 Pro 26200, driver 621.24. Branch at 16ce8f3. cargo test --workspace --locked --no-fail-fast -> 697 passed, 5 failed, 10 ignored. The failures are the same 5 pre-existing NVIDIA 1M-view-heap-cap failures (also on main; see my reports on #2030 and #1940). Nothing introduced by this PR fails on this machine.

**@⁠StExpeditus** on GitHub · 2026-11-25 09:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/1686#issuecomment-7158100090) **Test report: RTX 5060 Ti (Blackwell), Windows 11 Pro 26200, driver 621.24.** Branch at `16ce8f3`. `cargo test --workspace --locked --no-fail-fast` -> 697 passed, 5 failed, 10 ignored. The failures are the same 5 pre-existing NVIDIA 1M-view-heap-cap failures (also on main; see my reports on #2030 and #1940). Nothing introduced by this PR fails on this machine.
Author
Owner

@⁠Calvix2k on GitHub · 2026-11-25 10:14 UTC · original

Hardware run on an RX 7800 XT (RDNA3), Windows 10 19045, SM 6.6 through the Agility runtime staged for the test binaries (#486): the whole victory-shader lib suite — 248 passed, 0 failed, 3 ignored — including the coverage lowering and its pixel readback. So the dx.op.coverage path is exercised on the card here, not only on CI's device.

**@⁠Calvix2k** on GitHub · 2026-11-25 10:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/1686#issuecomment-7159432963) Hardware run on an **RX 7800 XT (RDNA3), Windows 10 19045**, SM 6.6 through the Agility runtime staged for the test binaries (#486): the whole `victory-shader` lib suite — **248 passed, 0 failed, 3 ignored** — including the coverage lowering and its pixel readback. So the `dx.op.coverage` path is exercised on the card here, not only on CI's device.
github-bot force-pushed github-bot/gh-1686 from 16ce8f33c5 to 0bbde516e7 2026-11-26 13:53:23 +00:00 Compare
Author
Owner

@⁠catminou4 on GitHub · 2026-11-24 21:40 UTC · original · approved these changes

Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (ffe310e), cargo test -p victory-shader --locked → 96 passed, 0 failed. Hardware/valu/waterfall execution tests are #[cfg(all(test, windows))] and run only on Windows; macOS covers lowering/structure unit tests.

PS SV_Coverage input lowered via dx.op.coverage: ps_sample_coverage_input_reads_coverage_mask renders and checks the coverage mask per sample.

**@⁠catminou4** on GitHub · 2026-11-24 21:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/1686#pullrequestreview-6047849148) · **approved these changes** Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (ffe310e), cargo test -p victory-shader --locked → 96 passed, 0 failed. Hardware/valu/waterfall execution tests are #[cfg(all(test, windows))] and run only on Windows; macOS covers lowering/structure unit tests. PS SV_Coverage input lowered via dx.op.coverage: ps_sample_coverage_input_reads_coverage_mask renders and checks the coverage mask per sample.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1686/head:github-bot/gh-1686'
git switch 'github-bot/gh-1686'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1686'
git switch 'github-bot/gh-1686'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1686'
git switch 'github-bot/gh-1686'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1686'
git switch 'main'
git merge --squash 'github-bot/gh-1686'
git switch 'main'
git merge --ff-only 'github-bot/gh-1686'
git switch 'main'
git merge 'github-bot/gh-1686'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1686
No description provided.