fix(shader): reconstruct fourth corner and instance ids for SV_VertexID rectangle lists #372
No reviewers
Labels
No labels
accessibility
bug
claimed
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
tester report
urgent
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LakshanSivakumar--Native-Victory-macOS!372
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-369"
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?
@Sheffy007 on GitHub · 2026-11-27 14:26 UTC · original
Sheffy007:fix/rect-list-vertex-id-corners→main· +731 −115 · 6 files · 1 commits · merged 2026-11-27 16:04 UTCSummary
Fixes
Options::rect_listtranslation for guessed vertex programs that compute corner positions or varyings fromSV_VertexID(v0) rather than solely viaVERTEX_TABLEstage-in fetches (the free item noted on #339).Lower::rect_vertex_id(crates/victory-shader/src/emit/lower/rect.rs): Detects guessedOptions::rect_listvertex programs whereReg::V(0)(Input::VertexId) is read outside the ignored vertex-index operand of an indexedVERTEX_TABLEstage-in fetch. Pure vertex-bufferrect_listprograms and allrect_list: falseprograms take the existing single-pass path unchanged.Lower::run_rect_by_id: Evaluates the vertex program body for the rectangle's three console vertex IDs3 * SV_InstanceID + 0..2(keepingReg::V(3)Input::InstanceIdat0as on the console's non-instanced rectangle list, and refusing UAV-writing programs rather than replaying side effects), finds the right-angle corner opposite the longestSV_Position.xyside, extrapolates the fourth cornerp + q - racross every exported float channel (preserving bitwise-equal shared values exactly), selects(p, r, fourth, q)by the host strip vertex ID0..3, and emits allstoreOutputcalls back to back (#181).Verification
victory-gpunative::tests::mesh_tests::a_rectangle_of_a_vertex_id_program_covers_half_its_rectangle:RECT_BY_IDnow lights all 64 of 64 texels (was 28 of 64) on Metal, for both direct draws andExecuteIndirect(an_indirect_rectangle_list_draws_its_records_as_a_direct_one).victory-gpunative::tests::mesh_tests::vertex_id_rectangle_lists_draw_half_tiles_multiple_rects_and_interpolated_params: Metal execution test verifying a half-size tile (32 of 64 texels), a two-rectangle draw (vertices = 6, 48 of 64 texels, both direct anddraw_rects_indirect) with differing right-angle corner indices, and linearTEXCOORDinterpolation across the extrapolated fourth corner.victory-shaderemit::export_tests::a_vertex_id_rect_list_export_makes_every_value_before_its_first_store: verifies all output values precede the firststoreOutputof their element.cargo test -p victory-hle -p victory -p victory-gpu -p victory-metal -p victory-shader -p xtask, both Windowsclippypasses (-- -D warnings), andcargo xtask policypass.Closes #363
Refs #258, #16
@LakshanSivakumar on GitHub · 2026-11-27 16:05 UTC · original
Merged in
be7dc1b5with the other shader PRs from tonight. Ran the tests (native arm64), Windows clippy, the policy check and a release build on the merged tree, and swept my full corpus of 21,600 shaders before and after: 0 lost, 352 newly translated, every changed output accounted for. I have not run the game on it yet. Thanks.