mirror of
https://github.com/storytold/cadcraft.git
synced 2026-12-01 18:25:32 -06:00
cadcraft: the device test checks that the read-back is answered
check() takes a read-back with no answer within 10 s as a pass, so the device test that called it couldn't tell an answered read-back from a timeout (it took 10.9 s on the Linux CI runner). Call clear_and_read and require Ok(true) for both passes, naming the adapter and the time taken. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
6dde861d3c
commit
634f7dd58e
@@ -567,9 +567,10 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
/// The read-back check passes on a working device, with and without a stencil buffer. The
|
||||
/// device is made as the app makes it: on Windows DirectX 12 alone with FXC (graphics.rs; an
|
||||
/// AMD driver crashes when OpenGL is created there, #31), and egui's limits for the adapter.
|
||||
/// The read-back is answered and passes on a working device, with and without a stencil
|
||||
/// buffer. The device is made as the app makes it: on Windows DirectX 12 alone with FXC
|
||||
/// (graphics.rs; an AMD driver crashes when OpenGL is created there, #31), and egui's limits for
|
||||
/// the adapter.
|
||||
#[test]
|
||||
fn the_check_passes_on_a_device_that_draws() {
|
||||
let mut options = eframe::NativeOptions::default();
|
||||
@@ -583,8 +584,15 @@ mod tests {
|
||||
eprintln!("no graphics adapter here: the device check is left to machines with one");
|
||||
return;
|
||||
};
|
||||
check(&rs.device, &rs.queue, None).unwrap();
|
||||
check(&rs.device, &rs.queue, Some(wgpu::TextureFormat::Stencil8)).unwrap();
|
||||
let info = rs.adapter.get_info();
|
||||
for stencil in [None, Some(wgpu::TextureFormat::Stencil8)] {
|
||||
// `check` takes no answer as a pass; a working device must answer, or every start on it
|
||||
// would wait for the timeout.
|
||||
let started = std::time::Instant::now();
|
||||
let read = clear_and_read(&rs.device, &rs.queue, stencil);
|
||||
let elapsed = started.elapsed();
|
||||
assert_eq!(read, Ok(true), "{stencil:?} on {} ({:?}, {:?}) after {elapsed:?}", info.name, info.backend, info.device_type);
|
||||
}
|
||||
}
|
||||
|
||||
/// The read-back passes only when every pixel came back cleared: a target the clear never
|
||||
|
||||
Reference in New Issue
Block a user