Shaders: a rectangle's corners match within a tolerance, not bit for bit #90
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/90"
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 fxceless/victory-fork. Originally posted by T0ns1 on 2026-11-24T21:24:01Z.
Summary
The rectangle-list geometry shader (
emit/rect.rs) completes a console rectangle only when one vertex shares x with one of the others and y with the other exactly, and when every w is exactly the same (OEQ). Otherwise "three that differ in w, or are not such corners, stay the triangle they make".A vertex shader that computes each corner (a scale and an offset per vertex) can leave the corners a few bits apart. Such a rectangle then stays the one triangle it arrives as and draws half of itself, cut along its diagonal.
Corners now match within
1e-4of the first vertex's w (RECT_TOLERANCE, under a fifth of a pixel at 3840 pixels across), for the corner test, the "no two vertices in one place" test and the equal-w test. Exact matches behave as before.What is in it
same(OEQ) becomesclose(a, b, tol):-tol <= a - b <= tol, withtol = w0 * RECT_TOLERANCE. A negative or NaNtolmakes nothing close, so a non-positive w still stays a triangle, as before.rectangles_are_drawn_wholegets a case whose corners are a few bits apart:(-1, 1), (-1.00001, -1), (1, -0.99999).Tested
Windows 11 Pro 26300, RTX 5070 Ti 16 GB (driver 32.0.16.2140, 32-lane waves), Ryzen 7 9800X3D, Rust 1.98.1 MSVC (the pinned toolchain).
cargo test --release -p victory-shader: 210 passed, 0 failed, 2 ignored.RECT_TOLERANCEset to0.0(the old exact comparison), the new case fails:corner second, a few bits apart: texel 0 is [0.0, 0.0, 0.0, 0.0], not [-0.875, 0.875, 0.0, 1.0]. With1e-4it passes.Not tested
AI use: Claude Code (Claude Opus 5.5) found the exact comparison, wrote the change and the test, and ran the tests.
Imported from fxceless/victory-fork. Originally posted by adriaespii on 2026-11-24T21:37:18Z.
Independent test run on commit
6cf8f8c(AMD RDNA4):x86_64-pc-windows-msvc)cargo clippy --workspace --all-targets -- -D warnings: 0 warningscargo test --workspace: 496 passed, 0 failed, 7 ignored (victory-shader: 210 passed, 0 failed, 2 ignored;victory-gpu: 110 passed, 0 failed, 1 ignored)AI use: Antigravity (Gemini 4 Neon) ran clippy/tests locally and wrote this report.
Imported from fxceless/victory-fork. Originally posted by arminkhaleghirod on 2026-11-24T22:23:55Z.
Merged onto main
90228a7and ranvictory translate --validateover the full title (26,148 programs) on Windows 11 / RTX 4080.No change: every failure count matches main, and no new reason appears. What it changes at run time isn't covered by this check.
Pull request closed