Shaders/lower: fix mesh all-lane barriers, SMEM UAV loads, same-target branch edges, and readfirstlane offsets #714
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!714
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-714"
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?
@AscilCH on GitHub · 2026-11-25 05:20 UTC · original
AscilCH:fix/shader-lower-mesh-barrier-smem-uav-edges-and-readfirstlane→main· +338 −32 · 1 files · 1 commits · openSummary
Fixes four DXIL lowering bugs in
crates/victory-shader/src/emit/lower.rs:no_barrierstripped all barriers on all-laneGS_ALLOC_REQ:Lower::newpreviously collected every block containings_sendmsg(GS_ALLOC_REQ)intoallocand added every block it dominated tono_barrier. WhenGS_ALLOC_REQsits in an all-lane block (e.g. entry block0), it dominates the entire CFG and deleted everys_barrierin the mesh shader.allocwithall_lane_blocks(x.st)(!a[b]) so only divergent single-laneGS_ALLOC_REQblocks suppress dominated barriers.smem/descriptor_data) mishandled UAVs as CBVs:smem()previously only checkedResourceType::Srv, falling through to CBVcbufferLoadLegacy(props = (13, 0x1_0000)) forResourceType::Uav(corrupting table UAV reads and rejecting root UAVs with"a typed root view").descriptor_data()similarly rejected UAVs read only bySmem.ResourceType::Srv | ResourceType::Uavwith raw SRV/UAV handles ((if uav { 0x100b } else { 11 }, 0)/((11 | u, 0), None)).Lower::edgesentry:CondBrhadtaken == not_taken, the secondself.edge(b, not_taken)call overwroteself.edges[(b, to)], causingfill_phis,descriptor_phi, andlane_heap_indexto emit duplicate predecessor blocks and omit the first edge block.Lower::edgesis now keyed by(from, to, second)so both critical-edge blocks are tracked distinctly.waveReadLaneFirst.i32for VGPR inputs/phis andSource::Builtdynamic offsets:resource.rsunwrapsv_readfirstlane_b32back to its VGPR source inAddress::dynamic.code_smem()only checked instruction writes (missing program-input VGPRs and VGPR phis), andbuilt_offset()never emittedwaveReadLaneFirst.i32at all.is_vgpr_value()(checkingp.inputs,phi_at, anddef_block) andscalar_dynamic(), used by bothcode_smem()andbuilt_offset().Verification
cargo test -p victory-shader --locked -- emit::lower::tests emit::diff_tests emit::waterfall_tests emit::wave64_tests: 31 passed, 0 failed, 1 ignored (including 4 new regression tests:all_lane_mesh_gs_alloc_req_preserves_lds_barrier,smem_uav_uses_raw_buffer_load_not_cbuffer,same_target_conditional_branch_keeps_both_edge_blocks, andscalar_dynamic_offset_wraps_vgpr_input_and_phi_in_wave_read_lane_first)cargo clippy -p victory-shader --all-targets --all-features --locked -- -D warnings: clean (0 warnings)cargo xtask policy:169 files ok(AI-assisted; synthetic unit tests only, no game data.)
@ArturoWolff on GitHub · 2026-11-25 05:35 UTC · original
Linux coverage check: #714 produced byte-identical DXIL for all 725 distinct shader hashes named in the operation records from our frame 2256 (323 compute, 102 vertex, 202 pixel, 98 mesh). This is the frame where we saw geometry in intermediate targets but not in the presented image in #599.
I matched each recorded hash against the full source container, then built separate native translators and Cargo targets from clean
310c6eband PR head2491d55. Each calledemit::translatedirectly with host max wave 32; no disk shader cache. All 725 emitted on both revisions; I compared the actual DXIL files, and Microsoft's Linuxdxvaccepted all 725 PR outputs. The PR head's fullvictory-shader --libsuite also passed locally: 175 passed, 0 failed, 2 ignored, including the four new tests.The synthetic tests and this result answer different questions. The fixes have focused coverage, but none changed the shader bytes in this recorded set. I wouldn't use a rerun of this frame as the first visual test of #714. The list excludes shaders that were never recorded (including earlier dropped draws); it does not cover the whole title, host pipeline creation, execution, or the contents of the composite input.
AI disclosure: Hermes Agent ran the offline comparison and tests and wrote this comment on ArturoWolff’s behalf.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.