From aa474a944ffa3de30bdbd9b3cd5bb71ae7073c7a Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Thu, 5 Nov 2026 06:35:45 -0800 Subject: [PATCH] Restore the line continuations of the subpixel snap notice's cost `Degradation::DeviceSubpixelSnap`'s cost string (degradation.rs) continued onto three more lines without a `\`, so the announced cost held a newline and a 13-space indent after "grid is", after "so a pixel" and after "or left", which every relayed notice line carried. It came in with d261d6ed46. It is now written as its neighbours are, with `\` continuations, and reads with single spaces. `tests::degradation::codes_are_distinct_and_decode`, which walks every `Degradation` kind, now also holds that no kind's name (its `Debug`), code or cost contains two consecutive spaces, a newline or a tab. At b23d78eb50 it fails on this cost and on no other kind; after the fix it passes (runs in the branch report). The runtime-sources pin moves with degradation.rs; it is re-pinned in the stack, not here. (cherry picked from commit fd1029d6c984a25a9aedff6a3dbb4e342ab041a2) --- crates/metal2vulkan-runtime/src/degradation.rs | 5 ++++- crates/metal2vulkan-runtime/src/tests/degradation.rs | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/crates/metal2vulkan-runtime/src/degradation.rs b/crates/metal2vulkan-runtime/src/degradation.rs index 376bb621f..012803af3 100644 --- a/crates/metal2vulkan-runtime/src/degradation.rs +++ b/crates/metal2vulkan-runtime/src/degradation.rs @@ -2193,7 +2193,10 @@ degradations! { /// pixel, are snapped by the device's rasterizer, where Metal snaps the endpoints up first, /// so the two differ only where an endpoint lies half a step off the grid. DeviceSubpixelSnap = "device-subpixel-snap", Precision, - "a line's band whose endpoint lies half a 1/256-pixel step off the subpixel grid is snapped the way the device rounds, where Metal rounds the endpoint up, so a pixel whose centre lies within that half step of the band's edge can be drawn, or left out, a row or a column from Metal's"; + "a line's band whose endpoint lies half a 1/256-pixel step off the subpixel grid is \ + snapped the way the device rounds, where Metal rounds the endpoint up, so a pixel \ + whose centre lies within that half step of the band's edge can be drawn, or left \ + out, a row or a column from Metal's"; /// A draw of lines, or an emulated mesh draw of lines, under Apple's last provoking vertex /// (`setProvokingVertexMode:` 1), of a pipeline state that reads it (a flat input, or a /// slice or viewport its vertex function selects), on a device without diff --git a/crates/metal2vulkan-runtime/src/tests/degradation.rs b/crates/metal2vulkan-runtime/src/tests/degradation.rs index c0aa3c851..0218cc0c4 100644 --- a/crates/metal2vulkan-runtime/src/tests/degradation.rs +++ b/crates/metal2vulkan-runtime/src/tests/degradation.rs @@ -56,6 +56,15 @@ fn codes_are_distinct_and_decode() { assert_eq!(seen.insert(code, kind), None, "{code} names two kinds"); assert_eq!(Degradation::from_code(code), Some(kind)); assert!(!kind.cost().is_empty(), "{kind:?}"); + // Its name, code and cost read with single spaces: a string literal continued onto the + // next line without a `\` keeps the line's break and indent, which every relayed notice + // line would carry. + for text in [format!("{kind:?}"), code.to_owned(), kind.cost().to_owned()] { + assert!( + !text.contains(" ") && !text.contains(['\n', '\t']), + "{kind:?}: {text:?} holds two spaces, a newline or a tab" + ); + } } assert_eq!(Degradation::from_code("metal2vulkan-degrade-"), None); }