Shaders: lower SV_RenderTargetArrayIndex and SV_ViewportArrayIndex exports #1417
No reviewers
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!1417
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1417/head"
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?
@fuzeofficlal on GitHub · 2026-11-24 17:54 UTC · original
fuzeofficlal:feat/shader-rtai-vpai-exports-914→main· +518 −72 · 5 files · 1 commits · closed without mergingFixes #914.
Summary
SV_RenderTargetArrayIndex(bits 0..15,kind == 4) andSV_ViewportArrayIndex(bits 16..31,kind == 5) from RDNA2'sexp pos1.zmisc vector when declared in the output signature.SV_ClipDistanceandSV_CullDistanceexports topos2..=pos3whenever the misc vector is present (first_clip = 2).Constant(interp = 1) in signatures and set DXILVIEWPORT_RT_INDEX(ShaderFlagsbit 9,SFI00x2000) for non-mesh rasterizer stages.Verification
Texture2DArrayRTV + dual-viewport draw readback tests covering standaloneRTAI, standaloneVPAI, packedRTAI + VPAI + shifted SV_ClipDistance0(+1.0pass /-1.0clipped):dxil.dllvalidation: passedcargo clippy --workspace --all-featuresandcargo xtask policy: passed.@geiyiliyabumo on GitHub · 2026-11-24 17:59 UTC · original
Independent verification of \3296002\ on Windows 11 / AMD Radeon RX 9060 XT (RDNA4, \gfx1200) / Rust 1.98.1 MSVC:
AI-assisted; synthetic tests only, no game files.
@sinan-cmyk on GitHub · 2026-11-24 20:44 UTC · original
Offline measurement on a retail dump, and the shader tests on Ada
Result: no count change against
main.Offline. I merged head 3296002 onto
mainffe310e(clean merge) and ranvictory translate --validate --listonshaders.rpf(1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result withmainprogram by program (25,889 programs). Validated: 21,724 onmain, 21,724 with this PR.No program changes its failure reason either. That is the expected result for a fix whose instructions sit behind the earlier failures on
main. The count shows that the change rejects nothing. It does not show whether the output is right.Tests: with the same merge,
cargo test --locked -p victory-shader --libpassed 121, failed 0. The bitcode benchmark is ignored, as onmain, where 120 pass. The run was on an RTX 4070 SUPER (Ada, 32-lane waves, driver 32.0.16.1088), the default adapter, withVICTORY_WARPunset.No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
@Marvisak on GitHub · 2026-11-25 01:26 UTC · original · edited 2026-11-25 06:28 UTC
Automated triage for the maintainers.
Merge candidate. It now merges cleanly with
main. Main refused vertex-stage exports ofSV_RenderTargetArrayIndex/SV_ViewportArrayIndex("render-target or viewport index exports").emit/lower.rsnow takes them from the misc vectorexp pos1.z(layer in the low 16 bits, viewport index in the high 16) and shifts clip/cull distances topos2..pos3when that vector is present.emit/mod.rsandshader.rsmark both semantics constant-interpolated and set theVIEWPORT_RT_INDEXshader flag. The misc-vector packing and the position-export shift match what Mesa's public RDNA export code does, and other channels ofpos1(point size) are still refused rather than guessed. The tests draw into aTexture2DArraywith two viewports and read back each slice. The newHostDevice::adaptersenumeration is test-only.CI: passing (
check).Generated by Claude Code
@Marvisak on GitHub · 2026-11-25 22:12 UTC · original
Automated triage for the maintainers, second look (a review against current
main, with builds and tests where they could change the verdict).Closing because it does not translate what the console compiler emits. Two vertex shaders writing
SV_RenderTargetArrayIndex(one alsoSV_ViewportArrayIndexand a clip distance), compiled with the console compiler, pack(viewport << 16) | layerinto pos1.z as assumed here, but export pos1 with all four channels enabled (zeros in x, y and w). TheTarget::Position(1) if has_miscarm refuses any channel but z, so both containers still fail with this PR; only the refusal reason changes. The GPU test passes because it hand-writes an export with only z enabled. No title program reaches this path onmain.If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.
@andrewpozdnakov7-jpg on GitHub · 2026-11-26 03:01 UTC · original
I reproduced the full-mask case from the closing review with a synthetic vertex shader. The fixture enables all four
pos1channels and writes(0, 0, packed, 0). On2a60d82, translation stops at that export with the clip, cull or point-size error.f7c2aac extends that exact head and keeps its Git author. It accepts the other enabled channels only when proven zero. The same test still rejects a nonzero constant and an unknown vertex input in those channels.
Six paired Windows/WARP runs agreed. The patched shader draws into slice 2/viewport 0 for layer only, slice 0/viewport 1 for viewport only, and slice 1/viewport 1 for both. A negative clip distance still leaves all slices clear. The same test passes with the branch merged onto
63bcca4. The VALU, semantics and lowerer suites and strict shader Clippy passed.Could you revisit #1417 with this case? Please retain the follow-up's Git author if you cherry-pick it. If you combine the fix or fixture with another commit, please include:
Co-authored-by: andrewpozdnakov7-jpg [email protected]
AI-assisted with Codex. Synthetic inputs only.
Pull request closed