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 withd261d6ed46. 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. Atb23d78eb50it 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)
This commit is contained in:
1 parent
8bc4fef06d
commit
aa474a944f
2 files changed
+13
-1
No files matched your search
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user