shader: preserve the direction of dynamic SCC1 mesh branches #2434
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2442"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T16:56:29Z.
Fixes #2435.
When a constant-buffer comparison sets SCC, its value is known only at draw time. The bounded mesh lowerer already evaluated both descriptor arms for
s_cbranch_scc0. It now does the same fors_cbranch_scc1, selecting the branch target when the predicate is true. Each arm still goes through the existing checks for unsupported instructions and changes to EXEC, VCC or M0.The fixture reverses the arms and the branch sense together. The two forms produce the same HLSL for a material descriptor and a null descriptor. A new draw selects depth 1.625, clipping the triangle. Picking the other table gives depth 0.5 and covers all 1,024 pixels.
On
b442b57f, I measured four failures: for the nonzero selector the SCC1 shader drew all 1,024 pixels on RTX 4060 and WARP, with and without a trace UAV. Both traced runs also reported the wrong vertex exports. The equivalent SCC0 shader passed. With this change all 16 of those comparison draws passed. The expandedtests/mesh_join_descriptor_check.pyalso passed on both backends (18 matching draws per backend and its existing wrong-index controls). The dynamic mesh, geometry and lane-spill host checks passed.AI-assisted with Codex + GPT-6.2 Astra (xhigh).
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T18:25:23Z.
Review: COMMENTED
Review of head
6e90807e. No blocking findings.What I checked:
join_armsruns the fall-through arm first, then the taken arm. Fors_cbranch_scc0that is (true, false). Fors_cbranch_scc1the taken arm is the true one, so reversing the outcomes is correct.tools/mesh_entry_aot.py:765. Removing the unusedoffsetargument is safe.Commands run locally (Linux, in a clean worktree):
python3 tests/mesh_join_descriptor_check.py-> okpython3 tests/docs_links_check.py-> okpython3 tests/bidi_controls_check.py-> okgit diff --check origin/main...HEAD-> cleanbranch_on_truereversal.assert build(PER_MATERIAL_SCC1) == sourcefails as expected. Reverted afterwards.Not checked: the GPU draw cases (RTX / WARP readback) need Windows. I did not run them here, and I did not see author-posted Windows results tied to this head SHA in the PR comments. The author's description reports them on
b442b57f. The branch is 24 commits behind main, so a Windows run on the current head is still needed before merge.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-25T18:29:46Z.
Five mutations, all caught — the direction of a dynamic
scc1is properly pinnedBaseline:
mesh join descriptor lowering and refusals: ok, exit 0.join_arms/ its one calleroutcomes.reverse()dropped (anscc1join built likescc0)if not branch_on_true)s_cbranch_scc1no longer routed to the dynamic joinbranch_on_truehard-wiredFalsebranch_on_truehard-wiredTrueThe two hard-wired variants are the ones I most wanted to see: a boolean parameter that is only ever passed one value at a call site is invisible to most fixtures, and here both constants are caught, so the parameter is genuinely exercised in both directions.
What the change gets right, and why the comment matters
select(c, a, b)takes the condition's true arm first, while the join collects arms in fall-through-then-taken order — so fors_cbranch_scc1the two are already swapped relative to the condition's meaning, and forscc0they are not. Collapsing that into one comment on the parameter is the right place, because the mistake is not in the reversal itself but in which branch needs it. The inverted-reverse mutation being caught confirms the fixture distinguishes the two, rather than merely asserting "aselectappears".One note on naming:
branch_on_truereads as "the branch is taken when the condition is true", which is exactly what it means forop == "s_cbranch_scc1". Good as is; I mention it only because a reader who has the ISA's "SCC1 branches when SCC is 1" in mind may briefly read it as "the branch condition is the true arm", which is the opposite thing the reverse handles.What I checked beyond the diff
tests/mesh_join_descriptor_check.pygrows by 12 lines and the docs entry by 3 — the refusal side is unchanged, which matches a change that only reorders arms. Bothscc0andscc1dynamic joins are now covered where previously onlyscc0reached the dynamic path (theelifgained the second opcode), so the fixture had to grow in exactly that place; that it did is the reason the third mutation is caught.AI-assisted; the five mutations were run locally on Windows 11 build 26300.9974.
Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T18:48:17Z.
I reran the GPU checks at
6e90807ebf5c0eea3391d3f5edc73f66df871bf1, the exact head reviewed here. Windows Server 2025 WARP passedctest --preset dev -V --no-tests=error -R '^mesh_join_descriptor_warp$'and the same command with--preset release, after buildingoffscreen_checkin each configuration. Each preset recorded 18 matching 1,024-pixel images. Build and CTest logs.On Windows 11 build 26100.9711, the same checkout also passed
python -B tests/mesh_join_descriptor_check.py <dxc> <offscreen_check> hardwareon RTX 4060 (32.0.15.9579) and thewarpinvocation on WARP 10.0.26100.9711. Each returned 0 with all 18 images matching. The local debug layer was unavailable.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T20:07:32Z.
Review: COMMENTED
Review of head
c9fc20ee(main merged in, PR's own diff unchanged).Findings: none blocking.
join_armstakes outcomes in fall-through/taken order and reverses them fors_cbranch_scc1, so the select is (true, false) as before.s_cbranch_scc1goes through the same EXEC/VCC/M0 checks as scc0 (new refusal case in the check).join_armsis the scc0/scc1 branch inexec_range; no other table or opcode list needed an edit.Commands run in a worktree at
c9fc20ee:python3 tests/mesh_join_descriptor_check.py-> okpython3 tests/docs_links_check.py,python3 tests/bidi_controls_check.py,git diff --check origin/main...HEAD-> passThis does not claim to advance game startup; no executable results are claimed. Win2025 WARP receipt follows separately.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T20:11:22Z.
Win2025 WARP receipt for head
c9fc20eeafter updating with main.Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
c9fc20ee475d85f5176c80d089485b3b6d13f3ec:--preset dev):cmake --build --preset dev -- -j 2):0.00s(configure0.00s)ctest --preset dev -R '^mesh_join_descriptor_' --parallel 2 --no-tests=error --output-on-failure): 2/2 passed (3.03s:mesh_join_descriptor_hardware2.78s,mesh_join_descriptor_warp2.82s)/O2(--preset release):cmake --build --preset release -- -j 2):0.00s(configure0.00s)ctest --preset release -R '^mesh_join_descriptor_' --parallel 2 --no-tests=error --output-on-failure): 2/2 passed (3.06s:mesh_join_descriptor_hardware2.81s,mesh_join_descriptor_warp2.87s)tests/mesh_clip_cull_check.pyok (8.4s),tests/mesh_dynamic_aot_check.pyok (1.6s),tests/mesh_dynamic_geometry_check.pyok (0.4s),tests/mesh_join_descriptor_check.pyok (0.5s),tests/mesh_lane_spill_check.pyok (0.3s),tests/startup_ngg_slice_check.pyok (0.6s)sccache: 0/14 hits; wall25.3sAI-assisted; commands listed were executed locally.