gpu: lower translated indexed indirect rectangle lists #2251
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2259"
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 R0Y00 on 2026-11-25T08:27:53Z.
Refs #1759 and #1999. Stacked on #2252. #2173 covers the non-indexed command.
Allow topology 0x11 for the translated single-record indexed indirect route. The existing GPU validator checks the original index and argument ranges and supplies the base vertex. A resource-free geometry shader runs after the translated vertex shader, finds the shared corner, and emits two triangles in the original winding. It reconstructs float interpolants for the fourth corner and uses the first original vertex's flat values. Desktop rasterization applies the existing clip volume and scissor.
The geometry shader accepts finite positions with a common positive clip-space w and three distinct, axis-aligned corners. Other shapes emit no geometry. It supports the startup translator's SV_Position, float PARAM and unsigned flat FPARAM linkage and refuses other signatures. Direct draws and native indirect routes retain their existing topology handling.
Head
89ff1960on #2252 headab83bffd. Windows build 26200.9974, Release MSVC 19.51.36244.0, debug layer enabled on WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656.21/21 CTests passed with zero skips. The new R16 and R32 cases check permuted indices, nonzero start and base, both corner orders, decoded half-float UVs, flat values, clipped/scissored pixels and all original GPU argument words. Bad indices, a trailing incomplete rectangle, varying w and non-rectangle corners leave all pixels clear. Replacing the DLL with the #2252 base gave a topology refusal and a black first expected pixel on both adapters.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T08:31:37Z.
Review: COMMENTED
Review of head
89ff1960ea1cb7e40ab408d53bf30db626d1d100(comment only, no approval).Scope check
origin/mainalso carries the stacked base (#2252: GPU validator + translated indexed route). Rectangle-list part isindexed_rect_geometry.h, theindexed_rectPSO key/GS ind3d12_draw.inl, and the topology 0x11 gate ind3d12_xs_device.cpp.Logic read-through
a + b - corner. Winding is kept:(v0,v1,v2)is the cycle(corner,a,b), and(a,fourth,b)has the same orientation. OK.wis required, so linear reconstruction of thePARAMinterpolants is exact. Non-finite or non-axis-aligned input emits nothing.SV_Position/PARAMfloat /FPARAMuint, and checks that the PS inputs are covered by the VS outputs. OK.args.x % 3 == 0, so each triangle is one rect. Index range, base vertex overflow andstart_instanceare checked on the GPU. Scratch buffers are held on the allocator and cleared on reset. OK.Findings
indexed_rect_geometry.h,flat +=lines): flat values come fromv[0], the first emitted vertex. This matches the PR text, but a test that makes flat values differ per vertex (not only per draw) would pin the rule. Please check thattranslated-indexed-rectdoes this.d3d12_draw.inl, geometry compile failure path): the log is emitted once per translation, and later draws returnnullptrsilently. That is fine, but the refusal reason shown to the guest-side counters is generic.Commands executed locally (Linux)
git diff --stat origin/main...HEAD: 7 files, +619/-61.python3 tests/docs_links_check.py:Checked 18 Markdown files and 428 links.python3 tests/bidi_controls_check.py:no bidirectional controls.git diff --check origin/main...HEAD: clean.Windows verification
python3 x2w_pipe.py win2025 2259 --targets startup_indirect_draw_indexed --regex '^startup_indirect_(translated_indexed(_rect)?|draw_indexed)_warp$' --skip-releasestartup_indirect_translated_indexed_warp,startup_indirect_translated_indexed_rect_warp,startup_indirect_draw_indexed_warp).Mutation
a/bin the second triangle. The test should then fail on winding or coverage.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T08:46:36Z.
Review: COMMENTED
Re-review of head
7faa82ccaf1d48e835c5bf14359befc2f39bfb61(previous review was at89ff1960).What changed: the new head merges main and drops the already-merged prerequisites.
git diff --stat origin/main...HEADis now 6 files, +245/-24: CMakeLists.txt, docs/experiments.md,d3d12_draw.inl,d3d12_xs_device.cpp, newindexed_rect_geometry.h,tests/startup_indirect_draw_indexed.cpp. The rectangle-list slice is isolated. No logic change in the geometry shader or the draw path beyond the rebase.Re-checked in the new diff
indexed_rect = rect && indexed && indirect: only the GPU-written indexed indirect path opens the rectangle topology. Direct indexed rectangle draws are still refused.indexed_rect, so the GS and non-GS PSOs cannot collide.indexed_rect_geometry_attempted, gives a refusal string, and does not retry per draw.rectuser-data is 0 on this path, as intended. The VS keeps the original index and base vertex.a + b - cornerare correct. Triangle(a, fourth, b)keeps the winding of(corner, a, b). FlatFPARAMcomes from vertex 0. Non-finite positions, a non-commonw, or a non-axis-aligned shape emit nothing, and the tests cover these (rect_bad_w,rect_bad_shape,rect_bad_index,rect_bad_count).Commands run locally
git diff --check origin/main...HEAD: cleanpython3 tests/docs_links_check.py: pass (18 files, 432 links)python3 tests/bidi_controls_check.py: pass7faa82cc:python3 x2w_pipe.py win2025 2259 --targets startup_indirect_draw_indexed --regex '^startup_indirect_(translated_indexed(_rect)?|mesh|draw)'startup_indirect_translated_indexed_rect_warpandstartup_indirect_translated_indexed_warp. The*_hardwarevariants skip on this VM (capability skip, not a pass).Mutation: not run. The change is D3D12/C++ only, so I can't build it on Linux, and I did not rebuild a mutated GS on Windows. Please note that the
rect_bad_*cases give negative-control coverage for the shape andwguards, but I have not shown that they fail when the guards are removed.Findings
compile_indexed_rect_geometryreturnsE_INVALIDARGfor every unsupported signature, and the log line only prints the HRESULT. A short reason string (which semantic or mask was rejected) would make field diagnosis easier.AI-assisted; commands listed were executed locally.