Conformance: the two unattached-colour cases hold Metal's recordings to their shapes
metals_recording_draws_colour_0_and_keeps_the_clear_elsewhere holds the recording of pass-pipeline-color-unattached to the case's codes: colour 0 holds the fragment's codes in the scissor's rows and the clear in the others, and the command buffer has no error. metals_recording_writes_colour_1_into_colour_2 holds the recording of pass-pipeline-color-unattached-between to what job m3-max-75934 showed: the lacking pass's colour 0 equals the reference's, its colour 2 holds the reference's colour 1 in the drawn rows (and differs from the reference's colour 2 there), and its clear elsewhere. Verified: a Python reading of both committed recordings gives each assertion true; the Rust tests run in the conformance suite's job that follows.
This commit is contained in:
1 parent
ea0bf79d34
commit
d2d96151a8
2 files changed
+80
No files matched your search
@@ -296,4 +296,48 @@ mod tests {
|
||||
assert!(DRAWN.height < u64::from(SIDE));
|
||||
assert_eq!(ATTACHED, [0, 2]);
|
||||
}
|
||||
|
||||
/// **In Metal's recording the lacking pass's colour 0 is the reference's, and its colour 2
|
||||
/// holds, where the draw ran, the reference's colour 1 byte for byte**, the clear elsewhere:
|
||||
/// plain Metal writes the unset colour's value into the attachment after it, the shape the
|
||||
/// runtime refuses (`DrawKind::AttachmentFormats`).
|
||||
#[test]
|
||||
fn metals_recording_writes_colour_1_into_colour_2() {
|
||||
let recording = crate::recording::read(NAME).expect("Metal's recording of the case");
|
||||
let drawn_bytes = (TEXEL * SIDE) as usize * DRAWN.height as usize;
|
||||
let mut checked = 0;
|
||||
for answer in &recording.answers {
|
||||
for outcome in &answer.outcomes {
|
||||
let drawn = outcome.transcript.root.child("drawn").expect("drawn");
|
||||
let plane = |site: &str| match drawn.child(site).map(|n| &n.observed.value) {
|
||||
Some(Value::Bytes(bytes)) => bytes.clone(),
|
||||
other => panic!("drawn/{site}: {other:?}"),
|
||||
};
|
||||
let (every, lacking) = (
|
||||
[0, 1, 2].map(|which| plane(&format!("every:color{which}"))),
|
||||
ATTACHED.map(|which| plane(&format!("lacking:color{which}"))),
|
||||
);
|
||||
assert_eq!(lacking[0], every[0], "colour 0");
|
||||
assert_eq!(
|
||||
lacking[1][..drawn_bytes],
|
||||
every[1][..drawn_bytes],
|
||||
"colour 2's drawn rows"
|
||||
);
|
||||
assert_ne!(
|
||||
lacking[1][..drawn_bytes],
|
||||
every[2][..drawn_bytes],
|
||||
"colour 2's drawn rows"
|
||||
);
|
||||
assert_eq!(
|
||||
lacking[1][drawn_bytes..],
|
||||
every[2][drawn_bytes..],
|
||||
"colour 2's cleared rows"
|
||||
);
|
||||
let error = drawn.child("command-buffer-error").expect("the error");
|
||||
assert_eq!(error.observed.value, Value::unit_variant("None"));
|
||||
checked += 1;
|
||||
}
|
||||
}
|
||||
assert!(checked > 0, "the recording held no outcome");
|
||||
}
|
||||
}
|
||||
@@ -324,4 +324,40 @@ mod tests {
|
||||
assert!(!DRAWN.past([SIDE; 2]));
|
||||
assert!(DRAWN.height < u64::from(SIDE));
|
||||
}
|
||||
|
||||
/// **Metal's recording draws colour 0 where the scissor lets it and keeps the clear
|
||||
/// elsewhere**, and its command buffer completes with no error: plain Metal draws the shape the
|
||||
/// runtime draws through the state without colour 1.
|
||||
#[test]
|
||||
fn metals_recording_draws_colour_0_and_keeps_the_clear_elsewhere() {
|
||||
let recording = crate::recording::read(NAME).expect("Metal's recording of the case");
|
||||
let want: Vec<u8> = (0..SIDE * SIDE)
|
||||
.flat_map(|at| {
|
||||
let (x, y) = (at % SIDE, at / SIDE);
|
||||
match u64::from(y) < DRAWN.height {
|
||||
true => drawn_texel(x, y),
|
||||
false => clear_texel(),
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
let mut checked = 0;
|
||||
for answer in &recording.answers {
|
||||
for outcome in &answer.outcomes {
|
||||
let drawn = outcome.transcript.root.child("drawn").expect("drawn");
|
||||
let color0 = drawn.child("color0").expect("drawn/color0");
|
||||
let Value::Bytes(bytes) = &color0.observed.value else {
|
||||
panic!("drawn/color0: {:?}", color0.observed.value);
|
||||
};
|
||||
assert_eq!(bytes, &want, "drawn/color0");
|
||||
let error = drawn.child("command-buffer-error").expect("the error");
|
||||
assert_eq!(
|
||||
error.observed.value,
|
||||
Value::unit_variant("None"),
|
||||
"drawn/command-buffer-error"
|
||||
);
|
||||
checked += 1;
|
||||
}
|
||||
}
|
||||
assert!(checked > 0, "the recording held no outcome");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user