diff --git a/crates/metal2vulkan-validation/src/candidate/runtime_case.rs b/crates/metal2vulkan-validation/src/candidate/runtime_case.rs index 4228c4e5a..1afd44036 100644 --- a/crates/metal2vulkan-validation/src/candidate/runtime_case.rs +++ b/crates/metal2vulkan-validation/src/candidate/runtime_case.rs @@ -463,6 +463,26 @@ impl Messages { true } + /// How many failing messages are kept so far: the mark [`Messages::drop_failing_since`] takes. + pub fn failing_kept(&self) -> usize { + self.0 + .lock() + .unwrap_or_else(|p| p.into_inner()) + .failing + .len() + } + + /// Drop the failing messages kept since `mark` ([`Messages::failing_kept`]): those a device + /// making delivered that the runtime lane makes again, the driver having refused the device, + /// or its queue plan, for want of what other processes' devices hold. The loader reports each + /// refused `vkCreateDevice` as two errors ("terminator_CreateDevice: Failed in ICD ... + /// vkCreateDevice call", "vkCreateDevice: Failed to create device chain."), which the making + /// the test keeps does not deliver (`runtime_lane/device_room.rs`). + pub fn drop_failing_since(&self, mark: usize) { + let mut reported = self.0.lock().unwrap_or_else(|p| p.into_inner()); + reported.failing.truncate(mark); + } + /// Put `notices`, taken earlier, back before those delivered since: the runtime lane's device /// constructor takes a new device's creation notices apart from those a test has not read. pub fn restore_notices(&self, mut notices: Vec) { diff --git a/crates/metal2vulkan-validation/src/runtime_lane.rs b/crates/metal2vulkan-validation/src/runtime_lane.rs index 9223d215c..5820cfc57 100644 --- a/crates/metal2vulkan-validation/src/runtime_lane.rs +++ b/crates/metal2vulkan-validation/src/runtime_lane.rs @@ -1084,6 +1084,7 @@ pub fn validated_device_with( let options = lane_device_options(messages, cache, adjust); let (device, made) = device_room::with_room(std::thread::sleep, || { let pending = messages.take_notices(); + let failing = messages.failing_kept(); let device = open_device(device_type, options.clone()); let made = messages.take_notices(); messages.restore_notices(pending); @@ -1091,6 +1092,10 @@ pub fn validated_device_with( Ok(_) => device_room::least_plan_taken(&made), Err(error) => device_room::refused_for_room(error), }; + // The loader's errors about the refused `vkCreateDevice` of a making made again. + if short.is_some() { + messages.drop_failing_since(failing); + } ((device, made), short) }); messages.device_made(&made); @@ -1113,11 +1118,16 @@ pub(crate) fn made_lane_device( ) -> Result { let options = lane_device_options(messages, cache, adjust); device_room::with_room(std::thread::sleep, || { + let failing = messages.failing_kept(); let device = open_device(device_type, options.clone()); let short = device .as_ref() .err() .and_then(device_room::refused_for_room); + // The loader's errors about the refused `vkCreateDevice` of a making made again. + if short.is_some() { + messages.drop_failing_since(failing); + } (device, short) }) .map_err(|error| no_lane_device(device_type, &error))