shader: draw a per-vertex VCC across a vertex-stage join (Refs #2906) #2914
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2914"
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 Not-Saii on 2026-11-26T19:32:59Z.
Refs #2906. Part of #870 and #2618.
What this adds
A draw fixture for a per-vertex VCC that crosses a two-arm join in a translated gfx1013 vertex stage, registered as
native_graphics_vertex_vcc_join_warpandnative_graphics_vertex_vcc_join_hardware. No translator change was needed: both shapes below already lower correctly at40365770.Two source-built vertex programs are drawn:
SV_VertexIDcompare into VCC and writes its own constant. After the join a CNDMASK selects that constant or 0.5 per vertex. Both branch outcomes are drawn. The test also checks that the emitted IR joins two different compares in aphithat feeds the select.phiis in shape 1.The pixel stage is desktop HLSL that reads the three vertex values with
GetAttributeAtVertex. I chose that so each pixel reports every vertex without interpolation and the comparison with the per-vertex CPU model is bit-exact. If you want a guest PS throughgfx1013-container-pairinstead, say so and I will rework the readback.Negative controls
Each control redraws a changed program against the unchanged reference and must report
8 of 8 pixels differ:v0 == v0compare overwrites the joined mask, for both arms of shape 1 and for shape 2.Reproduction
Result
Revision
95f01361, Windows 11 build 26300, Debug build. Three tests ran, three passed, no capability skips.native_graphics_interface_librarynative_graphics_vertex_vcc_join_warpnative_graphics_vertex_vcc_join_hardwareOutput, identical on both adapters:
Limits
docs/experiments/native-vertex-vcc-join.md.🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-26T19:41:04Z.
Review: APPROVED
Review of head
95f01361oncpp-migration40365770. The PR changes no C++, so I ran its check against a release build of the base.Encodings: I decoded each hand-written word against the gfx1013 formats, and they match the comments:
v_cmp_{eq,ne}_u32compares (0x7d040081,0x7d040082,0x7d0a0082, and0x7d040100forv0 == v0);v_cndmask_b32withS1taken on VCC;v_mul_f32 v8, -1.0, v4;s_mov_b32literal,s_xor_b32 s4, s4, s0,s_cmp_eq_i32 s4, 0,s_cbranch_scc0 +3,s_branch +2;s_and_saveexec_b64 s[8:9], vcc,s_cbranch_execz,s_andn2_b64 exec, s[8:9], exec,s_mov_b64 exec, s[8:9];The branch offsets land on the commented instructions, and
reference()and the per-vertex table follow from them. The controls fit the claim. Dropping arm B's compare leaves the staleid == 2mask on that edge only, and arm A still passes. The uniformv0 == v0overwrite differs at all 8 pixels in all three places.Run: Windows 11 build 26300.9974, release preset, Windows SDK 10.0.26100 DXC.
offscreen_check.exeexits0xC0000005with no output. This is the same crash class as #2915, where 6 of the base branch'snative_*_hardwaretests crash this way on this adapter,native_graphics_wqm_hardwarethrough the sameoffscreen_checkpath among them.native_buffered_vertex_hardwareandnative_sampled_pixel_hardwarepass here. So this is not caused by this PR, butnative_graphics_vertex_vcc_join_hardwarewill fail on AMD until #2915 is understood.Checks:
docs_links_checkpassed (30 files, 546 links),bidi_controls_checkpassed andgit diff --checkis clean. The fragment and the topic note followtests/cmake/README.mdanddocs/experiments/README.md.Nit: the description and the note say a root word supplied at draw time picks the arm. In
program()the arm is the literal fromint(arm_b), and it is XORed withs0, which the harness supplies as 0. So the root word keeps the branch from being known at compile time, but the literal picks the arm. One sentence would fix this. Not blocking.CI:
.github/workflows/windows.ymlruns only for pull requests intomain, so this PR has no CI result. The evidence is the local runs above and @Not-Saii's.AI-assisted; the commands above were run locally.
Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-26T20:58:26Z.
Review: COMMENTED
Test + doc only — no source changes. The fixture tests per-vertex VCC crossing a two-arm join in the direct DXIL frontend.
The test fixture covers three scenarios nicely:
The control cases are well-structured: dropping arm B's compare to check stale mask propagation, and inserting a uniform v0==v0 compare to verify mask overwrite. The IR verification via dxc -dumpbin phi/select checks is a nice touch — it ensures the frontend emits the expected structure rather than relying on a @dx.op.wave directive.
One small note: the
native_direct_container_checkandnative_scalar_lds_checkimports suggest this shares infrastructure with other native tests. That's good for consistency. If the DXIL frontend gets anative_vertex_vcc_joinvariant, those tests could be reused with a different container format. Otherwise no concerns.Looks ready.
Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-26T21:17:58Z.
hand merging under my own discretion for us to further the work while Royoo is out.
Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-26T22:18:24Z.
Hardware and WARP result for head
95f013614f1a9481be4772a7d7723f61bff7ae28(base40365770): bothnative_graphics_vertex_vcc_jointests pass on an RTX 4070 Ti and on WARP, and every negative control is detected.Environment: Windows 11 25H2 (26200), MSVC 19.42, Windows SDK 10.0.26100 DXC, NVIDIA GeForce RTX 4070 Ti, driver 621.35 (32.0.16.2135). WARP is Microsoft Basic Render Driver 10.0.26100.8521. Clean worktree at the PR head, fresh
out/pe-env,devpreset (Debug, so the D3D12 debug layer is on). Tests run serially.Commands
Result (measured, 2 runs, same both times): 2 tests: 2 passed, 0 failed, 0 skipped. ctest exit 0 both times.
native_graphics_interface_libraryalso passed once (exit 0).native_graphics_vertex_vcc_join_warpnative_graphics_vertex_vcc_join_hardwareOutput, identical on both adapters and in both runs:
Control: The fixture does not exist at
40365770, so there is no base run. Its own four negative controls ran inside each test and all four were detected (each must report 8 of 8 pixels differ, and the test only passes if they do): the uniform mask after the per-vertex arms, the dropped arm B contribution, and the uniform mask after the join for arm A and for arm B.AI-Assisted