diff --git a/crates/metal2vulkan-runtime/src/tests/recorded_at_the_call.rs b/crates/metal2vulkan-runtime/src/tests/recorded_at_the_call.rs index 77f975f17..d30401c9a 100644 --- a/crates/metal2vulkan-runtime/src/tests/recorded_at_the_call.rs +++ b/crates/metal2vulkan-runtime/src/tests/recorded_at_the_call.rs @@ -4,11 +4,20 @@ //! moves at the call itself, before the encoder ends and before the commit, where a command //! logged for a later recording would move it only after the commit. //! +//! That count is the whole device's, whatever the thread: the queue-switch check +//! (`queue_switch_check.rs`, started by the device's first command queue) records its rounds' +//! openings, fills of a scratch buffer of its own, on its thread. So the test waits for that check +//! to end before it counts. +//! //! Device tests: compiled only under the validation crate's GPU safety cfgs (`m2v_gpu`, //! `m2v_cpu_icd`). use super::blit_holds::{device, Scratch, WAIT}; use crate::{CommandBufferStatus, CommandsRecorded, ResourceOptions}; +use std::time::Duration; + +/// How long the device's queue-switch check may take to end. +const SETTLE: Duration = Duration::from_secs(120); /// The fills recorded so far, each one `vkCmdFillBuffer` (`word_fill.rs`). fn fills(counts: &CommandsRecorded) -> u64 { @@ -17,12 +26,17 @@ fn fills(counts: &CommandsRecorded) -> u64 { /// A blit encoder's fill of a buffer's word is in the driver's command buffer as the call /// returns: the count of fills recorded rose by one at the call, the encoder still open and the -/// command buffer uncommitted, and by no more at its end and commit. The bytes are the fill's. +/// command buffer uncommitted, and by no more at its end and commit, the device's queue-switch +/// check ended before (the module docs). The bytes are the fill's. #[test] fn a_fill_is_recorded_at_its_call() { let scratch = Scratch::new("recorded-at-the-call"); let device = device(&scratch.0); let queue = device.new_command_queue().unwrap(); + assert!( + device.settle_queue_switch_check(SETTLE), + "the device's queue-switch check ended" + ); let buffer = (device.new_buffer(16, ResourceOptions::shared())).unwrap(); let command_buffer = queue.command_buffer().unwrap(); let mut blit = command_buffer.blit_command_encoder().unwrap();