From ed1e57ed1ea14967d1e3556b33fc068caaf0aeff Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Wed, 18 Nov 2026 16:42:20 -0800 Subject: [PATCH] rt: the depth attachment test counts the first command buffer's move of its new images The draw test's first command buffer recorded 4 barriers on lavapipe (m3-max-48760, ms01), not the 3 it expected: the first command buffer also moves the two new images (the colour target and the depth texture) from undefined to their home layouts, expected Vulkan work. The count is now per command buffer, 4 then 3, and the assertion names why. --- crates/metal2vulkan-rt/src/tests/draw.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/crates/metal2vulkan-rt/src/tests/draw.rs b/crates/metal2vulkan-rt/src/tests/draw.rs index 7e9a718ae..d1cee1a01 100644 --- a/crates/metal2vulkan-rt/src/tests/draw.rs +++ b/crates/metal2vulkan-rt/src/tests/draw.rs @@ -710,9 +710,11 @@ mod on_device { let queue = device.new_command_queue(4).expect("a queue"); let draw = |result: Result<(), Error>| result.unwrap_or_else(|e| panic!("{name}: {e}")); let counters = device.counters(); - for (load, first, color_of) in [ - (crate::LoadAction::Clear, 3, BLUE), - (crate::LoadAction::Load, 6, WHITE), + // The first command buffer records one barrier more than the second: the two new + // images' moves from undefined to their home layouts. + for (load, first, color_of, barriers) in [ + (crate::LoadAction::Clear, 3, BLUE, 4), + (crate::LoadAction::Load, 6, WHITE, 3), ] { settled(&device); let before = counters.metrics(); @@ -733,8 +735,9 @@ mod on_device { after.passes - before.passes, after.bytes_copied - before.bytes_copied, ), - (1, 3, 1, 0), - "{name}: {load:?}: submissions, barriers, passes, bytes copied" + (1, barriers, 1, 0), + "{name}: {load:?}: submissions, barriers (the first command buffer's fourth \ + moves the new images from undefined to home), passes, bytes copied" ); assert_eq!(read(&color, 4), texels(|_, _| color_of), "{name}: {load:?}"); if depth.unit().is_some() {