d3d12: post-divide NDC dot-product corner selection and exact fourth corner for rectangle lists (RT-RECT-LIST-CORNER) #2478
Closed
lixonik wants to merge 5 commits from
upstream-pr/2478 into main
pull from: upstream-pr/2478
merge into: ProjectLeonida:main
ProjectLeonida:main
ProjectLeonida:claude/loop-total
ProjectLeonida:claude/pops-collision-seed
ProjectLeonida:claude/dstorage-hold-page-reads
ProjectLeonida:claude/host-image-copy-switch
ProjectLeonida:feat/gdk-lifecycle-window-hook
ProjectLeonida:claude/d16s8-uav-nvidia-fallback
ProjectLeonida:feat/mfplat-offline-shim
ProjectLeonida:claude/gameinput-slow-reader
ProjectLeonida:fix/rt-null-barrier-clear
ProjectLeonida:claude/depth-resolve-sample-positions
ProjectLeonida:integration/palmetto-parity
ProjectLeonida:claude/valu-literal-sext
ProjectLeonida:claude/slot74-pool-handle
ProjectLeonida:claude/rgb9e5-uint-alias-view
ProjectLeonida:claude/fssm-root-layout-tables
ProjectLeonida:feat/gdk-speech-display-lifecycle
ProjectLeonida:asset-audio-skip-current
ProjectLeonida:qemmhd/old-9940-rectangle-quad-lists
ProjectLeonida:feat/ws2-offline-shim
ProjectLeonida:qemmhd/rt-d16-unorm-uav
ProjectLeonida:feat/xs-device-stops-7-9
ProjectLeonida:qemmhd/rt-depth-same-base-shapes
ProjectLeonida:qemmhd/rt-lazy-attachment-variant
ProjectLeonida:feat/acphal-xma2-decoder
ProjectLeonida:asset-audio-skip
ProjectLeonida:codex/coord-claim-check-20261124-7e48
ProjectLeonida:feat/xs-frame-pacing-presentx
ProjectLeonida:feat/xs-device-vm-options
ProjectLeonida:old-pr/9844
ProjectLeonida:old-pr/9978
ProjectLeonida:old-pr/9815
ProjectLeonida:old-pr/10057
ProjectLeonida:old-pr/9874
ProjectLeonida:old-pr/9965
ProjectLeonida:old-pr/9863
ProjectLeonida:old-pr/10068
ProjectLeonida:old-pr/10066
ProjectLeonida:old-pr/10067
ProjectLeonida:old-pr/10007
ProjectLeonida:old-pr/10061
ProjectLeonida:old-pr/10065
ProjectLeonida:old-pr/10059
ProjectLeonida:old-pr/10063
ProjectLeonida:old-pr/10055
ProjectLeonida:old-pr/10062
ProjectLeonida:old-pr/10042
ProjectLeonida:old-pr/10041
ProjectLeonida:old-pr/10049
ProjectLeonida:old-pr/10047
ProjectLeonida:old-pr/10046
ProjectLeonida:old-pr/10045
ProjectLeonida:old-pr/10056
ProjectLeonida:old-pr/10043
ProjectLeonida:old-pr/10036
ProjectLeonida:old-pr/10034
ProjectLeonida:old-pr/9984
ProjectLeonida:old-pr/10052
ProjectLeonida:old-pr/10038
ProjectLeonida:old-pr/10033
ProjectLeonida:old-pr/10028
ProjectLeonida:old-pr/10050
ProjectLeonida:old-pr/9891
ProjectLeonida:old-pr/9889
ProjectLeonida:old-pr/10051
ProjectLeonida:old-pr/10019
ProjectLeonida:old-pr/10027
ProjectLeonida:old-pr/10029
ProjectLeonida:old-pr/10031
ProjectLeonida:old-pr/10026
ProjectLeonida:old-pr/9941
ProjectLeonida:old-pr/10030
ProjectLeonida:old-pr/10040
ProjectLeonida:old-pr/9990
ProjectLeonida:old-pr/10021
ProjectLeonida:old-pr/9962
ProjectLeonida:old-pr/10022
ProjectLeonida:old-pr/10020
ProjectLeonida:old-pr/10015
ProjectLeonida:old-pr/10025
ProjectLeonida:old-pr/9886
ProjectLeonida:old-pr/10048
ProjectLeonida:old-pr/10014
ProjectLeonida:old-pr/10011
ProjectLeonida:old-pr/9861
ProjectLeonida:old-pr/10010
ProjectLeonida:old-pr/10008
ProjectLeonida:old-pr/9860
ProjectLeonida:old-pr/10006
ProjectLeonida:old-pr/9920
ProjectLeonida:old-pr/9995
ProjectLeonida:old-pr/10000
ProjectLeonida:old-pr/10016
ProjectLeonida:old-pr/10004
ProjectLeonida:old-pr/10023
ProjectLeonida:old-pr/9982
ProjectLeonida:old-pr/9981
ProjectLeonida:old-pr/9983
ProjectLeonida:old-pr/9970
ProjectLeonida:old-pr/9969
ProjectLeonida:old-pr/9968
ProjectLeonida:old-pr/9971
ProjectLeonida:old-pr/9972
ProjectLeonida:old-pr/9942
ProjectLeonida:old-pr/9963
ProjectLeonida:old-pr/9960
ProjectLeonida:old-pr/9964
ProjectLeonida:old-pr/9985
ProjectLeonida:old-pr/9973
ProjectLeonida:old-pr/9862
ProjectLeonida:old-pr/9953
ProjectLeonida:old-pr/10017
ProjectLeonida:old-pr/9952
ProjectLeonida:old-pr/9955
ProjectLeonida:old-pr/9946
ProjectLeonida:old-pr/9954
ProjectLeonida:old-pr/9938
ProjectLeonida:old-pr/9956
ProjectLeonida:old-pr/9856
ProjectLeonida:old-pr/9947
ProjectLeonida:old-pr/9924
ProjectLeonida:old-pr/9961
ProjectLeonida:old-pr/9927
ProjectLeonida:old-pr/9979
ProjectLeonida:old-pr/10032
ProjectLeonida:old-pr/9926
ProjectLeonida:old-pr/5237
ProjectLeonida:old-pr/9951
ProjectLeonida:old-pr/9931
ProjectLeonida:old-pr/9902
ProjectLeonida:old-pr/9921
ProjectLeonida:old-pr/9994
ProjectLeonida:old-pr/9775
ProjectLeonida:old-pr/9768
ProjectLeonida:old-pr/9905
ProjectLeonida:old-pr/9936
ProjectLeonida:old-pr/9901
ProjectLeonida:old-pr/9904
ProjectLeonida:old-pr/9906
ProjectLeonida:old-pr/9988
ProjectLeonida:old-pr/9908
ProjectLeonida:old-pr/9909
ProjectLeonida:old-pr/9911
ProjectLeonida:old-pr/9912
ProjectLeonida:old-pr/9913
ProjectLeonida:old-pr/9887
ProjectLeonida:old-pr/9916
ProjectLeonida:old-pr/9919
ProjectLeonida:old-pr/9925
ProjectLeonida:old-pr/9933
ProjectLeonida:old-pr/9935
ProjectLeonida:old-pr/9918
ProjectLeonida:old-pr/9879
ProjectLeonida:old-pr/9880
ProjectLeonida:old-pr/9881
ProjectLeonida:old-pr/9996
ProjectLeonida:old-pr/9876
ProjectLeonida:old-pr/9892
ProjectLeonida:old-pr/9899
ProjectLeonida:old-pr/9915
ProjectLeonida:old-pr/9914
ProjectLeonida:old-pr/9872
ProjectLeonida:old-pr/9869
ProjectLeonida:old-pr/9866
ProjectLeonida:old-pr/9819
ProjectLeonida:old-pr/10012
ProjectLeonida:old-pr/9857
ProjectLeonida:old-pr/9893
ProjectLeonida:old-pr/9897
ProjectLeonida:old-pr/9928
ProjectLeonida:old-pr/9868
ProjectLeonida:old-pr/9917
ProjectLeonida:old-pr/9940
ProjectLeonida:old-pr/9873
ProjectLeonida:old-pr/9816
ProjectLeonida:old-pr/10009
ProjectLeonida:old-pr/9900
ProjectLeonida:old-pr/9966
ProjectLeonida:old-pr/9859
ProjectLeonida:old-pr/9843
ProjectLeonida:old-pr/9991
ProjectLeonida:old-pr/10058
ProjectLeonida:old-pr/9883
ProjectLeonida:old-pr/9838
ProjectLeonida:old-pr/9835
ProjectLeonida:old-pr/9959
ProjectLeonida:old-pr/9895
ProjectLeonida:old-pr/9837
ProjectLeonida:old-pr/9858
ProjectLeonida:old-pr/9865
ProjectLeonida:old-pr/9864
ProjectLeonida:old-pr/9840
ProjectLeonida:old-pr/9820
ProjectLeonida:old-pr/4669
ProjectLeonida:old-pr/9848
ProjectLeonida:old-pr/9850
ProjectLeonida:old-pr/9810
ProjectLeonida:old-pr/9799
ProjectLeonida:old-pr/9853
ProjectLeonida:old-pr/9875
ProjectLeonida:old-pr/9831
ProjectLeonida:old-pr/9796
ProjectLeonida:old-pr/9801
ProjectLeonida:old-pr/9813
ProjectLeonida:old-pr/9794
ProjectLeonida:old-pr/7417
ProjectLeonida:old-pr/9781
ProjectLeonida:old-pr/9806
ProjectLeonida:old-pr/9958
ProjectLeonida:old-pr/9809
ProjectLeonida:old-pr/9791
ProjectLeonida:old-pr/9792
ProjectLeonida:old-pr/10053
ProjectLeonida:old-pr/9784
ProjectLeonida:old-pr/9789
ProjectLeonida:old-pr/9849
ProjectLeonida:old-pr/9846
ProjectLeonida:old-pr/9773
ProjectLeonida:old-pr/9785
ProjectLeonida:old-pr/9803
ProjectLeonida:old-pr/9826
ProjectLeonida:old-pr/9839
ProjectLeonida:old-pr/9922
ProjectLeonida:old-pr/9948
ProjectLeonida:old-pr/7189
ProjectLeonida:old-pr/9957
ProjectLeonida:old-pr/9823
ProjectLeonida:old-pr/9807
ProjectLeonida:old-pr/9851
ProjectLeonida:old-pr/9774
ProjectLeonida:old-pr/9830
ProjectLeonida:old-pr/9836
ProjectLeonida:old-pr/9822
ProjectLeonida:old-pr/9783
ProjectLeonida:old-pr/9833
ProjectLeonida:old-pr/9890
ProjectLeonida:old-pr/9770
ProjectLeonida:old-pr/9769
ProjectLeonida:old-pr/9772
ProjectLeonida:old-pr/9787
ProjectLeonida:old-pr/9852
ProjectLeonida:old-pr/9834
ProjectLeonida:old-pr/9845
ProjectLeonida:old-pr/9871
ProjectLeonida:old-pr/9771
ProjectLeonida:old-pr/9776
ProjectLeonida:old-pr/10005
ProjectLeonida:old-pr/9949
ProjectLeonida:old-pr/9923
ProjectLeonida:old-pr/9805
ProjectLeonida:old-pr/9829
ProjectLeonida:old-pr/9790
ProjectLeonida:old-pr/9827
ProjectLeonida:old-pr/9929
ProjectLeonida:old-pr/9855
ProjectLeonida:old-pr/9934
ProjectLeonida:old-pr/9907
ProjectLeonida:old-pr/9910
ProjectLeonida:old-pr/9779
ProjectLeonida:old-pr/9780
ProjectLeonida:old-pr/9885
ProjectLeonida:old-pr/9882
ProjectLeonida:old-pr/9877
ProjectLeonida:old-pr/9998
ProjectLeonida:old-pr/4251
ProjectLeonida:old-pr/9987
ProjectLeonida:old-pr/9989
ProjectLeonida:old-pr/9950
ProjectLeonida:old-pr/9777
ProjectLeonida:old-pr/10044
ProjectLeonida:old-pr/9884
ProjectLeonida:old-pr/2906
ProjectLeonida:old-pr/5076
ProjectLeonida:old-pr/9937
ProjectLeonida:old-pr/9986
ProjectLeonida:old-pr/3014
ProjectLeonida:old-pr/9943
ProjectLeonida:old-pr/9939
ProjectLeonida:old-pr/4682
ProjectLeonida:old-pr/4765
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
ProjectLeonida/mandy!2478
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2478"
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 ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-27T16:10:25Z.
Fixes the rectangle-list fourth-corner selection and reconstruction in
runtime/src/rect_list_geometry.hfor packageRT-RECT-LIST-CORNER(#2464 Part B; builds on @kevincommits's numerical analysis in https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7219710234).Root cause removed
rect_list_geometry()picked the corner opposite the longest edge using pre-divide clip-space squared lengthsdx^2 + dy^2. That failed on:dx^2 + dy^2 == dx^2in float32 breaks the tie-break and flips the rectangle);w(e.g.,w = 1e20, wheredx^2 + dy^2overflows to+Inf);wacross vertices (where pre-divide distances pick the wrong corner).Computing post-divide NDC
(x/w, y/w)and selecting the vertex with the minimum signed incident-edge dot product (equivalently maxdot(e_in, e_out), unordered>=soNaN/w == 0deterministically falls back tov1) is algebraically identical to opposite-the-longest-side by the law of cosines for all triangles (including rotated rectangles, near-square, obtuse/acute, and degenerate) while keeping exact0.0dot product at any axis-aligned right angle.(((v0 + v1) + v2) - corner) - cornerwith direct(other_a, other_b, corner)selection and per-component bit-equality checks (OpBitcast+OpIEqual), preserving axis-aligned coordinates and constant/flat attributes bit-exact (0 ULP drift) while keeping the documented clip-spaceother_a + other_b - cornerrule uniformly forPositionand all interpolants (docs/d3d12_vulkan.md).for (const Corners& c : corners)loop header intact (git merge-treewith #1970 is conflict-free).Testing
main(ec91d695c):d3d12_rect_list_corner_testfails on 7 corner-rule cases (w=1e20 corner v2: 2080/4096 off plane;differing w=(1.875,1,1) corner v0&w=(1,1,1.875) corner v2: 2080/4096 missed each;thin strip 5000:1 corner v2&v1: 2048/4096 missed each;flat non-dyadic exact: 4096/4096 pixels drifted;differing w=(1.875,1,1) flat color: 2080/4096 missed).220aa322e):ctest -R "^(d3d12_rect_list_corner|indirect_topology_and_stats)$": 2/2 passed (d3d12_rect_list_corner_test: all 17 cases passed, 0.27 s).python -I tests/test_ctest_registration.py -v: 6/6 passed.python -I scripts/check_no_game_data.py ...andgit diff --check: clean.VK_LAYER_KHRONOS_validationnot installed locally;d3d12_rect_list_corner_testis self-contained withoutllvm-mcand skips with 77 whengeometryShaderor Vulkan is unavailable).AI-assisted (Antigravity, Gemini).
Imported from ubiquitarianism/leonida. Originally posted by djrolfes on 2026-11-27T17:15:01Z.
Independent Linux/Wine + NVIDIA check at head
4283e3ffa(merged cleanly ontoorigin/mainc0201a806alongside#2480,#2477,#2476,#2474).7.2.15,wine-11.22,clang-cl+xwincross-build, NVIDIA GeForce RTX 3070 Ti 8 GB, driver620.73.04, Ryzen 7 5800X, 32 GB RAM. No game files.d3d12_rect_list_cornerpassed (6.31 s) on RTX 3070 Ti under Wine.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-27T18:40:52Z.
Tested for #2464 as Aslanek asked: unit tests and a game run on my machine; CI ignored for now as asked.
Reading (marked):
Limits: one machine, one run for the PR, one run for each main witness.
AI-assisted (Claude Code, Claude Opus 5.5)
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-27T18:56:30Z.
Review of head
4283e3ffa(read against main43a9d562d, which containsec91d695c). The game run is in my RUN above. I suggest splitting this PR into two:Ready to merge on its own: picking the corner in NDC with the dot product (I checked that it matches "longest side" through the law of cosines) and copying the vertices bit for bit. Both look sound to me.
Needs a source or a separate PR:
runtime/src/rect_list_geometry.h:273-287: whenwdiffers, the fourth corner is extrapolated in NDC and in 1/w.docs/d3d12_vulkan.md:3112still says the hardware uses "v2 + v3 - v1 for the position and every interpolant", and this PR keeps that line while its new text in the bullet just below describes the NDC and 1/w rule, so the doc now states both. I found no hardware measurement behind the new rule, so the test checks behaviour that the PR itself defines. Could you either drop this path from the PR or point to a console reference that confirms it?runtime/src/rect_list_geometry.h:281-283: when1/w4 <= 0, the position falls back tow4 = 1, but the attributes stay linearly extrapolated in clip space. Position and attributes then follow two different models. Thediffering w=(1,2,2)case (d3d12_rect_list_corner_test.cpp:253) uses a constant colour, so it checks coverage but not how varying attributes are extrapolated.Minor points:
for (std::size_t vi ...loop (rect_list_geometry.h:291) has a content conflict with #1970, which is still open, although the description says "orthogonal to #1970". The conflict is trivial:emitted.reserveagainst the indexed loop.d3d12_rect_list_corner_test.cpp:17announces a case 7 "tile 160x90" that is not in the list of cases.AI-assisted (Claude Code, Claude Opus 5.5)
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-27T20:04:59Z.
@MoonEyes Thanks for the thorough review and testing! Addressed all four points in
220aa322e:1/wfourth-corner path (and its1/w4 <= 0->w4 = 1fallback):rect_list_geometry()now appliesexact_fourth(other_a, other_b, corner)uniformly to bothPositionand every interpolant, matchingdocs/d3d12_vulkan.md(v2 + v3 - v1) with no mixed position/attribute model and a much smaller SPIR-V body. Updateddocs/d3d12_vulkan.mdto note that differing-wfourth-corner behavior beyondv2 + v3 - v1is unmeasured on console hardware.for (const Corners& c : corners)verbatim; verifiedgit merge-treeagainst #1970 exits 0 with no conflicts.d3d12_rect_list_corner_test.cpp: Removed the stale case-7 tile note from the header comment and updated the differing-wcases tow = (1.875, 1, 1)(cornerv0) andw = (1, 1, 1.875)(cornerv2), where pre-divide clip-space lengths onmainpick the wrong corner while post-divide NDC picks the right corner and clip-spaceother_a + other_b - cornerproduces positivew4 = 0.125.Re-tested on RTX 5070 (Windows 11, driver 610.88, Vulkan 1.4.341,
VK_LAYER_KHRONOS_validationnot installed locally):main(rect_list_geometry.h): 7/17 cases fail (w=1e20, both differing-wsolid cases, both 5000:1 thin strips,flat non-dyadic exact, and differing-wflat color).220aa322e:d3d12_rect_list_corner(17/17 cases, 0.27 s) andindirect_topology_and_stats(0.03 s) both pass;test_ctest_registration.py(6/6) andcheck_no_game_data.pyclean.AI-assisted (Antigravity, Gemini).
Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-28T02:02:13Z.
Reviewed at head
220aa322eon Windows 11 (MSVC 202219.44) with dual-GPU Vulkan validation (LEONIDA_VK_VALIDATION=1, Vulkan SDK1.4.363.0).Verification
d3d12_rect_list_corner_test.d3d12_rect_list_corner_test(LEONIDA_VK_VALIDATION=1): all 17 corner-rule cases passed with 0 validation errors on both NVIDIA GeForce RTX 5080 (616.64) and AMD Radeon(TM) Graphics (25.10.30.02).Notes (non-blocking)
other_a + other_b - cornersynthesis (rect_list_geometry.h:191-194,245-267) look clean and address the earlier1/wreview note.docs/d3d12_vulkan.md:3113;rect_list_geometry.h:221-243): The doc states degenerate/zero-W inputs fall back to the first vertex, but the shader divides bywwithout a zero-W guard (e.g.,(2,1,0), (0,0,1), (0.5,0.5,1)yields(-Inf,-Inf,+Inf)selecting vertex 2 under IEEE infinities, and Vulkan leaves division by zero unspecified; collinear(-1,0,1)also selects the middle vertex). Either guard zero-W explicitly or qualify the doc statement.Approve.
AI-assisted review + local MSVC/dual-GPU verification.
Imported from ubiquitarianism/leonida. Originally posted by tiguan26 on 2026-11-28T02:11:29Z.
Review: APPROVED
Approving. Merged onto current main (
431ceba4f) with no conflicts, cross-built (clang-cl 19 + xwin) and ran under Wine 11.22 on llvmpipe:d3d12_rect_list_cornerpasses, and so does the existingd3d12_rect_list(the console's rectangle and quad lists through the translated vs_m15 / ps_m15), so the rewrite keeps the real translated draws right. As a negative check I built the new test against main'srect_list_geometry.h: it fails, starting with thew=1e20case drawing the wrong colour (corner v2: pixel (0,0) got 0.5,0.125,0.25,0.5).I checked the math rather than the comment. With s_k the dot of the two edges at vertex k as the code forms them, the law of cosines gives s_k = c_k^2 - (a^2 + b^2 + c^2)/2, where c_k is the side opposite k: the sum term is the same for all three vertices, so the largest s_k is exactly the vertex opposite the longest side, as the comment says, without the old squared-length comparisons' tie losses. The unordered compares send NaN (w == 0) to v1 as documented.
exact_fourthis right per component: if a component of one non-corner vertex equals the corner's bits,a + b - cis exactly the other vertex's value, so returning it bit for bit only removes rounding. Theother_a/other_bpicks give (v2, v3), (v1, v3), (v1, v2) for corners v1, v2, v3, and the emitted triangles are unchanged. The new opcode numbers (OpBitcast 124, OpFDiv 136, OpIEqual 170, OpFUnordGreaterThanEqual 191) are right.One thing worth stating in the docs line, not a blocker: the corner is now chosen in post-divide NDC rather than clip-space x/y. That only changes the choice when the three w differ, which a screen-space rectangle shouldn't have, but it is a behaviour change for such input.
AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T10:28:28Z.
VERIFY-2478-VEGA20-RADV: the same 17-cased3d12_rect_list_cornerfixture gave 7 failures on main33db04a70and 17/17 passes on220aa322emerged with that main, under Wine on gfx906 / RADV Mesa 26.0.8. All draws completed; Red was a pixel mismatch, not a build or feature skip.On main, each 5,000:1 strip missed 2,048 of 4,096 pixels. Each differing-
wcorner case missed 2,080, and the uniform large-wcase had 2,080 off-plane pixels. A constant non-dyadic color drifted in 1,024 pixels at uniformw; it was bit-exact on the merge. The adjacentd3d12_rect_listreadbacks passed on both trees.Captured geometry modules matched the corresponding main and merged emitters byte for byte. The CPU topology/statistics control also passed on both. Khronos synchronization validation was active: zero validation errors or sync hazards across the four hardware runs. Synthetic only.
AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-29T01:07:11Z.
Review: COMMENTED
Static audit of
220aa322eonly. No builds, tests, or GPU runs were performed for this review. The emitted vertex order preserves the first vertex for flat shading and keeps the documented homogeneous fourth-corner reconstruction.runtime/src/rect_list_geometry.h:225divides by W before enforcing the fallback indocs/d3d12_vulkan.md:3113. Clip-space(x, y, w)values(1/8, 1/4, 0),(-1/2, 0, 1), and(0, 1/2, 1)yield(-Inf, -Inf, +Inf)on IEEE division and select v3. Base selects v1 and emits no geometry below NDC Y = 0. Please guard signed zero before dividing and add a mixed-W coverage case. The all-zero-W fixture atruntime/test/d3d12_rect_list_corner_test.cpp:276cannot distinguish the corner choices, and the collinear fixture selects the middle vertex, so the general degenerate-fallback wording also needs qualification.runtime/src/rect_list_geometry.h:231can overflow the products even with finite NDC. With clip-space XY(1, 1),(0, 0),(1, -1)and commonw = 2^-65, separate float32 operations can produce(-Inf, NaN, -Inf)and pick v1 over the right angle at v2. A common power-of-two scale on projected XY before forming the edges would preserve the ordering and keep the products finite for this case.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-29T02:11:44Z.
@timbot103 I reproduced both corner-selection issues on the current head
220aa322e471cbfb2fd90ba711341163a1f9302d. On RTX 5070 (NVIDIA 610.88, Windows 10, Vulkan validation 1.4.363.1), I captured the six positions emitted by the generated geometry shader in each case. Both mixed signed-zero-W cases and the large finite-NDC case with the axes swapped emitted the wrong corner in all three fresh runs. Plain main02944d4ca1and main with a local correction each passed all six cases in three fresh runs.The local correction selects v1 for zero or non-finite W or non-finite projection. For large finite projected coordinates it scales both axes by the same power of two before calculating the edge dot products. The correction is still local because GitHub rejected the push under its commit-email protection. The new D3D12 raster assertions still need a CTest run with Windows SDK 10.0.26100 or newer.
AI-assisted. Codex (GPT-6).
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-29T02:28:36Z.
I also ran the D3D12 raster fixture on RTX 5070 (610.88) with Khronos validation. I used the same extended fixture in both builds, with the pinned Agility SDK headers and a static CRT on Windows 10/MSVC 19.29.
220aa322e471cbfb2fd90ba711341163a1f9302d: 17/18 cases passed. The mixed-zero-W draw wrote 85 pixels below NDC Y = 0, where the target should stay clear.The permanent raster case checks positive zero. Negative zero and the large finite-NDC inputs were checked by capturing geometry-stage output in the separate probe above. The correction is still local.
AI-assisted. Codex (GPT-6).
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-29T05:41:42Z.
Pushed the corner-selection fix from the checks above as
2171766479(re-committed with my GitHub noreply address so the fork accepts the push).python -I scripts/check_no_game_data.py: passed.git merge-tree --write-tree main HEAD: clean againstef32995848.AI-assisted (Antigravity, Gemini).
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T07:04:53Z.
Verified by OreoFR — READY
ef3299584+ this PR (head217176647) merged with --no-ffd3d12_rect_list_cornerfails on main in 7 cases. Examples:w=1e20 corner v2: 2080 of 4096 pixels off plane, the two differing-w fills, the two 5000:1 thin strips, and the two exact-constant cases. The test's CMake registration was kept for the red run. The newmixed W with zerocase passes on main as well, since main also falls back to v1 there. It guards against the regression found on220aa322erather than reproducing a main bug.d3d12_rect_list_cornerpasses (18 cases); ctest (Ninja RelWithDebInfo, all targets, gta6rt launchers excluded) on main + this PR alone: 498 tests, new failures vs main: none (main alone: 497 tests, 1 failure: xbox_present, which fails here too)LEONIDA_CARGO=OFF,LEONIDA_XMA2_DECODER_LIBempty), main + this PR; imports unchanged vs main (655 functions, no new DLL, no WS2_32)217176647): no issue. Checked the following:w, or a non-finite projected coordinate, selects v1. NaN bits compare above the infinity bits in the unsigned max.220aa322e(same 7 cases) and zmasi's VEGA20 result. The new head addresses the signed-zero-w case lixonik reproduced after timbot103's audit.AI-assisted (Claude Code, Claude Opus 5.5), run for OreoFR.
Imported from ubiquitarianism/leonida. Originally posted by ammonium231 on 2026-11-30T14:16:05Z.
RTX 3090 / 621.40, validation on,
217176647merged onto main20fe0c754: d3d12_rect_list_corner 18/18 pass (not on main); indirect_topology_and_stats pass (main pass). No validation errors.Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T16:45:08Z.
Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (
d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools,d3d12/, or general docs), please feel free to reopen it.Pull request closed