victory-shader: honor unwritten OSG1 channels and output modes in rectangle_gs #1907
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!1907
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1907"
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?
@mgunes1311-lab on GitHub · 2026-11-25 00:32 UTC · original
mgunes1311-lab:shader-rect-gs-signatures→main· +299 −20 · 1 files · 7 commits · openSummary
Fixes two signature bugs in
victory_shader::emit::rectangle_gswhen generating host geometry shaders for console rectangle-list pipelines:OSG1channels and elements (E_INVALIDARGon D3D12 PSO linkage):rectangle_gspreviously sete.usage = (1 << e.cols) - 1and emittedloadInput/storeOutputacross every declared component of every register-allocatedOSG1row. Whenever a vertex shader declared a vector output and wrote only a subset of its channels (e.g..xyor.xzof afloat4) or kept an unwritten output row inOSG1,GS.ISG1declaredReadWriteMaskbits thatVS.OSG1marked inNeverWrites_Mask, causingID3D12Device::CreateGraphicsPipelineStateto fail withE_INVALIDARGon both hardware adapters and WARP.rectangle_gsnow derivese.usagefromMask & !NeverWrites_Mask(OSG1bytes24..26), emitsloadInput, fourth-corner completion, andstoreOutputonly for written channels, preservesVS.OSG1byte-for-byte inGS.OSG1, and rejects containers with no written outputs.rectangle_gslefte.interp = 0(Undefined) on allGSoutputs instead of assigning DXC's output interpolation modes (LinearNoperspectiveforSV_Position,Linearfor float attributes/clip/cull,Constantfor integers andSV_IsFrontFace) and unifying shared rows viasame_mode_per_row.GSinputs stayUndefined(0),GSoutputs now receive consistent per-row modes inPSV0and!dx.entryPoints, while keepingmain's(va, vb, v3)completing-triangle behaviour (preservingvaas its provoking value for flat/integer outputs).Verification
cargo test -p victory-shader --target x86_64-pc-windows-msvc --locked -- rect(validated throughdxil.dllIDxcValidatorand executed end-to-end viaHost::pipeline_gs+Host::drawon both D3D12 hardware and WARP withVICTORY_D3D12_DEBUG=1)cargo clippy --workspace --all-targets --target x86_64-pc-windows-msvc --locked -- -D warnings(default and--all-features)cargo doc --workspace --no-deps --target x86_64-pc-windows-msvc --lockedcargo run -p xtask --target x86_64-pc-windows-msvc --locked -- policy --staged&cargo test -p xtask --target x86_64-pc-windows-msvc --locked@upipibi on GitHub · 2026-11-25 00:40 UTC · original
Ran on Windows 11 with an RTX 3070 (Ampere, driver 616.56), debug build, at
a64b6c6:cargo test -p victory-shader --lockedgives 208 passed, 3 failed, 2 ignored. The 3 are #1744's NVIDIA failures onmain(the twostride_testsheap-buffer reads andgathers_at_a_level_match_the_hardware), and the new tests pass. Not run: a title.AI-assisted (Claude Code).
@Headache3318 on GitHub · 2026-11-25 02:09 UTC · original
Tested on Linux (Arch, kernel 7.3.5, 3× RTX 4090 driver 620.73.04), Rust 1.98.1 (pinned). PR head
a64b6c6applied cleanly onto currentmainccfb029.cargo test -p victory-shader --locked: 118 passed, 0 failed, 1 ignored. All tests pass.cargo clippy -p victory-shader --all-targets -- -D warnings: 3 errors (vs 4 on main). The PR net-reduces clippy errors by fixing unused imports.Not tested: Windows MSVC build, the title itself. AI-assisted.
@Marvisak on GitHub · 2026-11-25 08:19 UTC · original · edited 2026-11-25 20:20 UTC
Automated triage for the maintainers.
Merge candidate.
rectangle_gs(crates/victory-shader/src/emit/rect.rs) now takes each element's written channels from the vertex shader'sOSG1(mask minus never-writes mask, bytes 24-25 of the 32-byte row, shifted by the element's start column). It loads and stores only those channels, requires a written position x and y, and gives the GS outputs DXIL interpolation modes, withsame_mode_per_rowmaking a row that shares a float with an integer flat. I checked the byte offsets againstsignature()inemit/container.rs, which writes the never-writes mask as!used & 0xffor outputs, so the round trip gives back the written channels. The new tests validate VS, GS and PS, check that the GSOSG1matches the VS one and check thePSV0modes, then draw all three right-angle orders on hardware and WARP.Reply to the author: thanks. Since
9a47b2c, the completing triangle(va, vb, v3)is the same as onmainagain. Flat and integer outputs keepva's value, and the draw test expects exactly that per order. That was the only open point, so the provoking-vertex question can go in its own PR with evidence. sinan-cmyk's offline count (no change in validated programs) shows the change rejects nothing on real data. The linkage fix itself shows up at pipeline creation, which that count does not cover.CI: passing (
check).Generated by Claude Code
@sinan-cmyk on GitHub · 2026-11-25 11:34 UTC · original
Offline measurement on a retail dump
Result: no count change against
main.I merged head
a47859d1ontomain940d32f(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: 23,918 onmain, 23,918 with this PR.No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right.
No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
@upipibi on GitHub · 2026-11-25 14:02 UTC · original
@mgunes1311-lab The new commit
6a0a1e4breaks this PR's own test on my machine. RTX 3070 (616.56) plus WARP, Windows 11, debug,cargo test -p victory-shader --lockedat6a0a1e4(as-is, onmain940d32f): 245 passed, 4 failed.Three failures are #1744's NVIDIA failures that
mainhas too. The fourth is new:emit::rect::tests::unwritten_channels_and_flat_outputs_link_and_drawfails validation before anything runs.At
a64b6c6the same suite passed here (my run above).6a0a1e4only changesrect.rs, to flattenSV_ViewportArrayIndex/SV_RenderTargetArrayIndex. So my guess, not checked, is that writing those outputs from the GS now makes the validator expect a shader flag (actual=512) thatrectangle_gsdoesn't declare. One run only. It's a validation error rather than a GPU result, so I'd expect it on any host with the same validator.AI-assisted (Claude Code). Synthetic tests only.
@upipibi on GitHub · 2026-11-25 14:27 UTC · original
@mgunes1311-lab Re-run at
3ea75eb(as-is, onmain940d32f), RTX 3070 (616.56) plus WARP, Windows 11, debug,cargo test -p victory-shader --locked: the validation failure is gone.emit::rect::tests::unwritten_channels_and_flat_outputs_link_and_drawpasses.The suite gives 247 passed, 3 failed, 3 ignored, with no
SKIPPEDlines. The 3 are #1744's NVIDIA failures thatmainhas too (a_heap_buffer_read_where_no_buffer_view_is_reads_zeros,a_heap_buffer_read_by_element_takes_the_views_stride,gathers_at_a_level_match_the_hardware).One run only.
AI-assisted (Claude Code). Synthetic tests only.
@mgunes1311-lab on GitHub · 2026-11-25 16:55 UTC · original
Merged
main(67e8ae1) to combine with8ff7913(right_anglecorner selection):(va, vb, v3)viapickandva + vb - vc, while flat outputs (e.interp == 1or integer) keepv0on the completing triangle's provoking vertex so flat values stay uniform across both triangles in every right-angle vertex order.SV_Positionrequires writtenxandy(e.usage & 0b11 == 0b11).unwritten_channels_and_flat_outputs_link_and_drawto verify all three right-angle vertex orders on both hardware and WARP.@mgunes1311-lab on GitHub · 2026-11-25 19:02 UTC · original
Updated crates/victory-shader/src/emit/rect.rs to keep main's (va, vb, v3) values on the completing triangle (preserving va as its provoking value for flat/integer outputs) so this PR only fixes unwritten OSG1 channel masks, position x/y validation, and DXIL output interpolation modes.
@catminou4 on GitHub · 2026-11-25 02:47 UTC · original · approved these changes
Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main
940d32f69b,cargo test -p victory-shader --locked.144 passed / 0 failed / 2 ignored. OSG1 unwritten channels/output modes honored in the rect path — rasterizer-state completeness fix.
@fuzeofficlal on GitHub · 2026-11-26 17:01 UTC · original · approved these changes
Verified
9a47b2ce637ae04ca0b78e4f22dc687e1c0d37bbmerged cleanly onto63bcca43on Windows 11 with an RTX 5090, WARP,dxil.dll(Windows SDK 10.0.26100.0), andVICTORY_D3D12_DEBUG=1.Code review
emit::signature()(crates/victory-shader/src/emit/mod.rs:540) preservesOSG1row order 1-to-1 withbase + 32 * i, so derivinge.usage = ((rw[0] & !rw[1] & 0xf) >> e.col) & maskinrectangle_gs(crates/victory-shader/src/emit/rect.rs:44-53) beforeretain(|e| e.row.is_some())cleanly invertscontainer::signature'sNeverWrites_Maskencoding.rect.rs:55-57) and missingSV_Position.xy(rect.rs:97) are rejected cleanly, preventing any panic inside().Undefined(0) while GS outputs receive valid DXIL interpolation modes unified per register row viasame_mode_per_row(&mut elements, false)(rect.rs:58-67), and the completing triangle preservesmain's(va, vb, v3)geometry and flat-output handling.Verification
cargo xtask policy:191 files ok.cargo clippy --locked -p victory-shader --all-targets -- -D warnings(default and--all-features): clean.dxil.dll+VICTORY_D3D12_DEBUG=1:emit::rect::5 passed, 0 failed (includingunwritten_channels_and_flat_outputs_link_and_draw,integer_system_values_make_their_row_constant, andvertex_shaders_without_written_outputs_are_refused).col = 2, cols = 2, usage = 0b10sharing row 1 with a partialcol = 0, cols = 2, usage = 0b01element) passeddxil.dllvalidation for both VS and GS and preservedOSG1byte-for-byte.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.