gpu: pin rectlist placement and winding refusal in rectlist_topology check #1818
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1825"
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 Asimmimx on 2026-11-24T19:18:34Z.
Change
tests/rectlist_topology_check.pychecked counts and the first rectangle, but not where the rest of the output lands. A hand-applied mutation probe oftools/rectlist_topology.pyshowed that six single-point mutants passed the existing check:expand_rectanglesread the wrong corners for every rectangle after the first.test_expand_rectangles_multipleasserted onlylen == 12.expand_rectangles(..., validate_winding=True)was called only with a counter-clockwise input. Dropping the validation, or passingrequire_ccw=False, went undetected.expand_indiceswas called only withbase_vertex=0.rect_raster_oraclewas checked only by its foreground count. Flipping either axis moved the quadrant and kept 256 foreground pixels.The new assertions go into the existing test methods, so the check still runs 14 tests. They check that:
test_expand_rectangles_multipleexpands to[-0.5,-0.5], [0.5,-0.5], [0.5,0.5], [-0.5,-0.5], [0.5,0.5], [-0.5,0.5], with v3 = (-0.5,-0.5) + (0.5,0.5) - (0.5,-0.5);expand_rectangles([v2, v1, v0], validate_winding=True)raises the counter-clockwise precondition error, and the same corners still expand to 6 vertices without the flag;expand_indices(2, base_vertex=8)returns[8, 9, 10, 8, 10, 11, 12, 13, 14, 12, 14, 15];x >= 16 and y < 16(row 0 is +y and column 0 is -x). Pixel x = 16 has x_ndc = 1/32 and y = 15 has y_ndc = 1/32; x = 15 and y = 16 fall at -1/32.abs(area) < tolerance-><=v2 - v0instead ofv2 - v1abs(dot)droppedexpand_rectanglesdrops itsvalidate_corner_ordercallexpand_rectanglesvalidates withrequire_ccw=False(v0, v3, v2)expand_indicesignoresbase_vertexexpand_indicesstride 3 instead of 4y_ndcnot flipped (row 0 = bottom)x_ndcflipped<instead of<=)v0 = vertices[i]instead ofvertices[3 * i + 0]v3 = v0 + v1 - v2area < 0.0->area <= 0.0Refs #870
Verification
Based on
origin/mainat813045b3c13f7bad20d8577557b621ee869ccbba. Windows 11 Pro 26300.9974, Python 3.12.10 (out/pe-env). No build is needed; I ran no GPU tests and did not run the--drawpath, which this change does not touch.For the mutation table, a local probe script (not committed) applied each mutant to
tools/rectlist_topology.pyin turn, ranpython -B tests/rectlist_topology_check.py, recorded killed or survived from the exit status and restored the file. I ran it against the existing check and again with the new cases.Evidence and follow-up
tolerancecounts as degenerate. M11 is whether pixel centers that lie exactly on a rectangle edge are covered; the oracle is inclusive, which is not the D3D top-left rule. Pinning either would fix behavior that may be unintended, so I left both open.docs/experiments.mdstays accurate.Checklist
AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T19:29:17Z.
Review: COMMENTED
Reviewed at commit
f7226c220d993501b58bf15f47394657c6e3a646(no P1/P2 defects found).Verification
git diff --check origin/main...HEAD: passpython -B tests/bidi_controls_check.py: pass (Checked 1320 tracked source, script and build/CI files: no bidirectional controls.)python -B tests/rectlist_topology_check.py: pass (Ran 14 tests in 0.014s, OK)--preset dev):cmake --build --preset dev --target rectlist_draw_check -- -j 8):0.10sctest --preset dev -R '^(rectlist_draw_warp|rectlist_topology)$' --parallel 6 --no-tests=error --output-on-failure): 2/2 passed (0.32s:rectlist_topology0.13s,rectlist_draw_warp0.24s)/O2(--preset release):cmake --build --preset release --target rectlist_draw_check -- -j 8):0.10sctest --preset release -R '^(rectlist_draw_warp|rectlist_topology)$' --parallel 6 --no-tests=error --output-on-failure): 2/2 passed (0.34s:rectlist_topology0.14s,rectlist_draw_warp0.26s)python -B tests/rectlist_topology_check.pyon mutatedtools/rectlist_topology.py, then restored cleanly):if validate_winding:inexpand_rectangles-> failed as expected (rc=1)base_vertexoffset inexpand_indices-> failed as expected (rc=1)AI-assisted; commands listed were executed locally.