Shaders: lower pixel shader SV_Coverage input via dx.op.coverage #1530
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory#1530
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@davi713albano-coder on GitHub · 2026-11-24 18:49 UTC · original
Summary
io::raisealready liftsSPI_PS_INPUT_ADDRbit 14 (sample_coverage) toInput::SampleCoverage, butemit::lowerfell through toVal::Missing("a pixel system input").This branch lowers
Input::SampleCoveragein pixel shaders via DXILdx.op.coverage.i32(opcode91,Attr::ReadNone), and stripsSV_Coverage(kind == 14) from pixelISG1inemit::emitif a console container lists it there (in DXILSV_CoverageisNotInSigas a pixel input).Changes (
shader/ps-coverage-input, commitc0f6d69)crates/victory-shader/src/emit/lower.rs: handleInput::SampleCoverageininput()viadx.op.coverage.i32(91).crates/victory-shader/src/emit/mod.rs: stripkind == 14(SV_Coverage) from pixelinputsbefore emission so DXILISG1stays valid when a console container includes it.crates/victory-shader/src/emit/valu_tests.rs: add synthetic pixel shader testps_sample_coverage_input_reads_coverage_maskcoveringSPI_PS_INPUT_ADDRbit 14,ISG1stripping,dxil.dllvalidation + container hash check, and live D3D12 graphics draw readback on a 1x render target (asserting coverage mask1.0across all covered pixels).Branch & Verification
main(ffe310e): https://github.com/Marvisak/VIctory/compare/main...davi713albano-coder:VIctory:shader/ps-coverage-inputwindows-latest): https://github.com/davi713albano-coder/VIctory/actions/runs/45461479524cargo clippy --workspace --all-targets --locked -- -D warnings: passedcargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passedcargo test --workspace --locked(includingxtaskasset-policy check,dxil.dllvalidation, and D3D12 WARP draw test): 343 passed, 0 failed (emit::valu_tests::ps_sample_coverage_input_reads_coverage_mask ... ok)(No game data used. AI-assisted.)
@studiostephe on GitHub · 2026-11-25 04:18 UTC · original
io::raisealready liftsSPI_PS_INPUT_ADDRbit 14 toInput::SampleCoverage, butemit::lower::inputfell through toVal::Missing("a pixel system input"), so any pixel shader that reads the coverage input failed to lower. DXIL has noSV_Coveragepixel input — the coverage mask is read with thedx.op.coverageintrinsic — so this both lowers the input and drops the (console-only)SV_Coveragerow from the pixelISG1.Verified:
pixel_sample_coverage_input_uses_the_coverage_intrinsicbuilds a pixel shader withSPI_PS_INPUT_ADDRbit 14 set that reads the input VGPR, lowers it, and asserts the emitted DXIL containsdx.op.coverage.i32and noSV_Coveragesignature string. Before the fix the same shader returnsUnsupported a pixel system input(the new arm is the only path that handles bit 14).cargo check -p victory-shader --profile test --target x86_64-pc-windows-msvc: clean (the test lives insynthetic_tests,#[cfg(all(test, windows))]because that module imports the D3D12host).cargo clippy -p victory-shader --profile test --target x86_64-pc-windows-msvc: 0 warnings.cargo test -p victory-shader --locked(the 144 non-Windows tests): 144 passed, 0 failed, 2 ignored — no regression from thelower.rs/shader.rschanges.Not covered: I could not execute the new test against
dxil.dll/WARP (no Windows here), and the pre-existing fmt drift elsewhere inlower.rs/shader.rsis left as-is; my added lines are fmt-clean.Local commit
7567b34on a clean940d32f(three files).qwen3.8_27b running locally on an M1 Mac
shout out to Digital Debris Los Angeles
@Marvisak on GitHub · 2026-11-25 10:25 UTC · original
Automated triage for the maintainers.
Confirmed in
main.io::raisemapsSPI_PS_INPUT_ADDRbit 14 toInput::SampleCoverage(crates/victory-shader/src/io.rs), butLower::inputincrates/victory-shader/src/emit/lower.rshas no arm for it. It falls through toVal::Missing("a pixel system input"), so a pixel program that reads coverage is not translated.Pull requests are open to everyone now, and two open PRs already carry this change: #1686 (the older one) and #1886. Please compare your branch (
shader/ps-coverage-input,c0f6d69) with those and post any difference, such as the WARP draw readback test, as a review there instead of opening a third.The patch in the latest comment also changes
v_cmp_f/v_cmp_ton 64-bit operands, which is unrelated to coverage. That part needs its own PR.Generated by Claude Code