From 0a69fd88a404a9747a0cd026ed01a490a0b3eba4 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Sun, 8 Nov 2026 19:08:13 -0800 Subject: [PATCH] line_widths: the refused band's lines run through pixel centres, where Metal's width-0 lines draw On Iris Xe (ANV, RPL-P) a_refused_band_draws_at_the_nearest_width failed at round 0's line: 'drew nothing'. The line ran from (4, 4) to (28, 4), along pixel edges. ANV's lineWidthRange starts at 0, so the nearest width to Metal's width 0 is 1/16, which ANV draws as it is: a band 1/16 pixel wide around y = 4 holds no pixel centre. Metal draws none there either: its probe's 'horizontal y=16 width 0 (through no centre)' is 0 pixels, and 'horizontal y=16.5 x 4.5 to 27.5 width 0' 23. Devices whose nearest width is 1, or whose thin lines cover more, drew something, which is why the case passed elsewhere. The triangle's corners now lie on pixel centres, so each line and edge runs through centres, where Metal's lines at width 0 draw; the test still asserts the draw drew, routed to the nearest width and announced. Verified: built and run on Iris in the job that carries this commit (reported with the tip). (cherry picked from commit d733ab2c25d0fd177ecfd9f2f202ebaf3214e525) --- .../metal2vulkan-validation/src/runtime_lane/line_widths.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/metal2vulkan-validation/src/runtime_lane/line_widths.rs b/crates/metal2vulkan-validation/src/runtime_lane/line_widths.rs index 28951d6a5..a8ce83ceb 100644 --- a/crates/metal2vulkan-validation/src/runtime_lane/line_widths.rs +++ b/crates/metal2vulkan-validation/src/runtime_lane/line_widths.rs @@ -1980,6 +1980,10 @@ fn edges_draw_as_bands_or_at_the_nearest_width() { /// barycentric weights) draws its lines and its triangle's edges at width 0, which no device's own /// lines draw, by the device's lines at the nearest width they draw, announced at each draw with /// why and counted, its draws not refused; on a device that tessellates, the refusal is the why. +/// The triangle's corners lie on pixel centres, so its edges run through centres, where Metal's +/// lines at width 0 draw (its `horizontal y=16.5 x 4.5 to 27.5 width 0`, 23 pixels): a line along +/// pixel edges draws nothing on Metal (`horizontal y=16 width 0 (through no centre)`, none) nor on +/// a device whose lines draw 1/16 as it is (ANV on the Iris Xe of RPL-P, `lineWidthRange` from 0). #[test] fn a_refused_band_draws_at_the_nearest_width() { let cache = ScratchCache::new().unwrap(); @@ -1992,7 +1996,7 @@ fn a_refused_band_draws_at_the_nearest_width() { let name = device.name().to_owned(); let facts = LineFacts::of(&device); let mut lane = Lane::new(device); - let triangle = [4.0, 4.0, 28.0, 4.0, 16.0, 28.0]; + let triangle = [4.5, 4.5, 27.5, 4.5, 16.5, 27.5]; for round in 0..2 { for draw in [ Draw::line(PrimitiveType::Line, &triangle[..4], 0.0),