From 2a36291a80950f9c60dba00e052d32d63b77e6b3 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Fri, 20 Nov 2026 23:32:19 -0800 Subject: [PATCH] rt test: the raster test's Lines viewport lies off the diamonds' ties What: under Lines the test drew the triangle through a viewport 0.5 pixels right of and above the target's corner, so the edges inside the target ran through texel centers: x 0.5 down column 0 and y 7.5 along row 7. On lavapipe the line along row 7 drew no pixel (m3-max-62049, lvp leg), since a line through centers ties at every diamond's corners under Bresenham's diamond-exit rule. The viewport is now 0.4 right and 0.3 above. The edges lie at x 0.4 and y 7.7, inside each pixel's diamond away from its corners, and both start at (0.4, 7.7), strictly inside the corner pixel's diamond. The pattern expected is unchanged: column 0 and row 7. Verified by the lavapipe and GPU legs that follow this commit. --- crates/metal2vulkan-runtime/src/tests/raster.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/crates/metal2vulkan-runtime/src/tests/raster.rs b/crates/metal2vulkan-runtime/src/tests/raster.rs index 6b69c6e38..155163845 100644 --- a/crates/metal2vulkan-runtime/src/tests/raster.rs +++ b/crates/metal2vulkan-runtime/src/tests/raster.rs @@ -7,9 +7,12 @@ //! `Clip` and every texel under `Clamp`, which keeps it at the near plane (the conformance case //! `render-state-depth-clip`). //! - Under `Lines`, where the device has `fillModeNonSolid`, the triangle at z 0.5 through a -//! viewport half a pixel right of and above the target's corner draws the two edges that lie -//! inside the target through texel centers, column 0 and row 7, and nothing inside them; without -//! the feature the mode is `DrawKind::FillMode` and the encoder's mode stays `Fill`. +//! viewport 0.4 pixels right of and 0.3 above the target's corner draws the two edges that lie +//! inside the target, column 0 and row 7, and nothing inside them; without the feature the mode +//! is `DrawKind::FillMode` and the encoder's mode stays `Fill`. Each edge crosses its pixels' +//! diamonds off their centers and corners, and both start strictly inside the corner pixel's, so +//! Bresenham's diamond-exit rule draws them on every device: a line through texel centers ties +//! at each diamond's corners, where lavapipe drew row 7 not at all (m3-max-62049). //! - The first draw under each raster state makes one pipeline, a first-use wait of the raster //! site; a later encoder's draw under the same state makes none. @@ -97,10 +100,11 @@ mod on_device { (other, _) => panic!("{name}: {fill:?}: {other:?}"), } if lines && non_solid { - // Clip space's left and bottom edges through texel centers. + // Clip space's left and bottom edges at x 0.4 and y 7.7, inside column 0's + // and row 7's diamonds. draw(encoder.set_viewport(Viewport { - origin_x: 0.5, - origin_y: -0.5, + origin_x: 0.4, + origin_y: -0.3, width: f64::from(SIDE), height: f64::from(SIDE), znear: 0.0,