shader: add a compute fallback for indexed mesh draws #600
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/606"
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 Jess-Doit on 2026-11-22T15:34:37Z.
Change
Add
--compute-fallbackto the bounded mesh translator. An SM 6.0 compute dispatch writes positions, primitive indices and optional PARAM0 to a buffer. A vertex shader follows the generated indices and passes interpolated attributes to the translated pixel shader. This lets the source-built single-triangle fixture run on adapters without Mesh Shader Tier 1. Refs #498 and #546.Verification
Tested
7477928overf1f95cfon Windows 10 22H2 build 19045.6456 with MSVC 19.44.35230, SDK 10.0.26100.0 and DXC 1.9.2602.17. On GTX 1060 6 GB (32.0.15.6094) and in-box WARP (10.0.19041.5794), all six positive cases matched all 128 export bytes and all 1,024 pixels in Debug and Release, including independent changes to compute b0 and b1. The controls found a wrong guard at byte 76 with zero pixel differences, a collapsed index at byte 72 with 276 pixel differences, and a stale palette with 992 pixel differences and exact exports. The fallback reported zero D3D12 debug warnings and errors.Each preset had 8 passes and 18 native-mesh capability skips. The existing partial pixel-output checks each reported one D3D12 warning. With app-local Agility SDK 1.620.2 and WARP 1.0.22, all ten selected tests passed. The compute-produced texture fixture from #658 matched both palettes and caught the stale SRV at 276 pixels. The native depth fixture also passed its color and depth controls.
The RTX 5070 and WARP review covers the pre-rebase commit
42d1b3d. On the original submission951194c, freezing either compute binding caused the corresponding depth check to fail. The assembled indexed input produced identical fallback HLSL with the Windows LLVM disassembler, and DXC built it for an exact partial draw on both adapters.Evidence and follow-up
The fixture uses existing source-built MIT-licensed inputs and validates the bounded one-group, one-triangle specialization. It compares full pixel and geometry readbacks with the existing CPU references.
Checklist
AI-assisted implementation and verification.
Imported from R0Y00/Xbox2Windows. Originally posted by MarlomMedeiros on 2026-11-22T17:58:19Z.
Review: COMMENTED
Community review + independent run on a newer adapter and OS than the reported GTX 1060 / Windows 10 setup.
Environment
42d1b3don base8f57366(current main at review time)ctest --preset dev --no-tests=error -R '^mesh_(indexed_fallback|indexed_draw|descriptor_swap)_(warp|hardware)$' -V: 6/6 passeddebug_errors=0 debug_warnings=0mesh_indexed_fallback_hardware:mesh_exports bytes=128 matched=1,pixels=1024 mismatches=0on every positive draw; wrong-guard, collapsed-index and stale-palette controls reported their expected mismatchesReview notes
emit_compute_drawkeeps the same expression lowering and cbuffer bindings as the mesh path (b0/b1,float4deduplicated between both emitters); the compute stage reproduces the native trace layout at stride 128 with optional PARAM0 attributes after byte 80, and the vertex shader replays the generated index buffer via SV_VertexID.t1, and the capability probe printsmesh_fallback_shader_model=unsupportedrather than silently succeeding.No blockers found. This lands on a clean base and does not overlap the exec-masked-region work in #651.
AI-assisted: yes. All reported checks ran locally on the adapter and driver listed.
Imported from R0Y00/Xbox2Windows. Originally posted by RonLogic on 2026-11-22T16:45:58Z.
Independent verification on the submitted head
951194c1d804e7bc9d0df7a82da944daf37f4fd2. I tested Windows 11 build 26300.9974 with x64 MSVC 19.52.37029.0, Windows SDK 10.0.26100.0, and the D3D12 debug layer enabled. The adapters were RTX 4070 (32.0.16.2124) and WARP (10.0.26100.9818).All six tests passed in Debug and all six passed in Release (/O2), with zero skips. In both configurations, the negative controls detected the wrong guard at byte 76 with zero pixel differences, the collapsed index at byte 72 with 276 pixel differences, and the stale palette with 992 pixel differences and matching mesh exports.
I also tested the same six positive inputs through
--mesh-indexedand--mesh-indexed-fallback, using the same source program and compiled pixel shader on both paths. This covered full and partial rasterization, independent b0/b1 changes, and both attribute palettes. On each adapter and in both configurations, each path matched all 1,024 reference pixels and its expected export trace. Those runs reported zero D3D12 debug errors or warnings. This verifies parity for the bounded, source-built profile.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-22T16:56:24Z.
Independent AMD (RDNA4) result on
951194c. Not a code change; measurements only.Environment
dev,XBOX2WINDOWS_ADAPTER='AMD Radeon RX 9070 XT'debug_layer=unavailable(Tools.Graphics.DirectXisNotPresent), so the negative controls ran without a clean debug layer — as the PR body already notes, they require one only when available.requirements-dev.txtinstalls cleanly; the repository asks for 3.11 or newer).Clean worktree of the PR head
951194cover3f398b1.Commands
Observed — hardware, 9 cases, all as expected
Observed — WARP in the same build
Same nine cases,
adapter=Microsoft Basic Render Driver vendor=1414 device=008c, driver 10.0.26100.9711: identical export bytes and pixel counts, including 276 forcollapsed-indexand 992 forstale-palette.mesh_indexed_fallback_warpPassed 1.10 sec.Conclusion
On RDNA4 the compute + vertex fallback draws the source-built indexed triangle and matches the CPU reference on all 1,024 pixels in each of the four positive cases. The three negative controls reproduce exactly the byte offsets (76, 72) and pixel counts (0, 276, 992) reported on the GTX 1060, on a different vendor — so they detect the same faults rather than an adapter-specific artefact.
The run went through
--compute-fallback, so it did not exercise the mesh pipeline: nomesh_shader_tierline appears in the log. This result therefore does not say whether this adapter supports Mesh Shader Tier 1.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by Jess-Doit on 2026-11-22T18:50:56Z.
Rebased onto
f1f95cfand resolved the draw-fixture overlap with #658. On7477928, the indexed fallback passes in Debug and Release on the GTX 1060 and Windows 10 in-box WARP. App-local WARP passes all 10 selected tests, including both GPU-produced palettes and the 276-pixel stale SRV control. The PR description has the updated commands and results. Thanks for the independent checks on the earlier heads.Imported from R0Y00/Xbox2Windows. Originally posted by rwZephyr on 2026-11-22T19:02:11Z.
Independent run on the rebased head
747792888426d3ef5b9b2d9e1fb00ed72c9bf031(parentf1f95cf). Windows 10 22H2 build19045.6466, MSVC19.44.35230, Windows SDK10.0.26100.0, DXC1.8.2502.11, Debug with/MTd. D3D12 debug layer unavailable on both adapters.10de:2414), driver621.24(32.0.16.2124via DXGI). Both fallback and native indexed CTests passed.1414:008c), driver10.0.19041.5794. Fallback passed.mesh_indexed_draw_warp, withmesh_shader_tier=unsupported.On both adapters the fallback matched all 128 export bytes and 1,024 pixels in each of the six positive cases. Controls gave the expected results: wrong guard at byte 76 with zero pixel mismatches, collapsed index at byte 72 with 276 pixel mismatches, and stale palette with 992 pixel mismatches and matching exports.
I also used
mesh_fallback_check.indexed_program()and its full and partial inputs to compare--mesh-indexed-fallbackwith traced--mesh-indexedon the RTX 3060 Ti, sharing the compiled pixel shader and using each path’s expected trace layout. Both paths matched the same 1,024-pixel references for both inputs and exited 0.AI-assisted. All reported tests ran locally.