From 217c03089eeb78feb07fba04dcfc4972eb2cd220 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Tue, 10 Nov 2026 00:37:10 -0800 Subject: [PATCH] Test: an unattached color input is refused on the keyed path too The runtime's creation asks Device::render_variant_key first and compiles each stage under the inputs it names; there a dead color 1 input beside a pipeline of color 0 alone was made (the color_groups lane on the M3, job m3-max-13261), though the compile refused it. a_color_input_without_an_attachment_is_refused_dead_or_live now checks both paths. This commit adds the check alone. (cherry picked from commit bc8e7e6adf8908bd7dc3570ee2ff0624a1d5357c) --- .../src/tests/engine_dead_reads.rs | 32 +++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/crates/metal2vulkan/src/tests/engine_dead_reads.rs b/crates/metal2vulkan/src/tests/engine_dead_reads.rs index 6aa2a28a1..c98230f0c 100644 --- a/crates/metal2vulkan/src/tests/engine_dead_reads.rs +++ b/crates/metal2vulkan/src/tests/engine_dead_reads.rs @@ -22,12 +22,14 @@ use std::collections::BTreeMap; use crate::budget::Budget; +use crate::cache::VariantKey; use crate::device::requirements::VkFeature; use crate::device::{Device, DevicePolicy}; use crate::error::{DescriptorError, Error, Feature}; use crate::library::{FunctionConstantValue, FunctionConstantValues, Library}; use crate::metal::{DataType, PixelFormat}; use crate::pipeline::artifact::RenderPipeline; +use crate::pipeline::compile::StageEntries; use crate::pipeline::descriptor::{ ColorAttachmentDescriptor, FunctionDescriptor, RenderPipelineDescriptor, StageSource, }; @@ -205,8 +207,9 @@ fn a_raster_order_group_on_an_input_dead_after_specialization_takes_no_interlock /// A color input without an attachment is Metal's pipeline error whether or not the specialized /// body reads it (the module docs): `dfr_lacks` beside a pipeline of color 0 alone is -/// `InvalidDescriptor(ColorAttachment)` at index 1, dead and live, on `lavapipe` and `moltenvk-m3`. -/// With color 1 in the pipeline, the dead read compiles. +/// `InvalidDescriptor(ColorAttachment)` at index 1, dead and live, on `lavapipe` and `moltenvk-m3`, +/// compiled and keyed (`Device::render_variant_key`, which a runtime's creation asks first). With +/// color 1 in the pipeline, the dead read compiles. #[test] fn a_color_input_without_an_attachment_is_refused_dead_or_live() { let (Some(vs), Some(fs)) = (fixture("color_groups"), fixture("dfk_dead_rog")) else { @@ -222,13 +225,24 @@ fn a_color_input_without_an_attachment_is_refused_dead_or_live() { if reads { "live" } else { "dead" } ); let d = specialized(&vs, &fs, "dfr_lacks", &[0], reads); - match dev.compile_render_pipeline(&d, &budget) { - Err(Error::InvalidDescriptor(DescriptorError::ColorAttachment { index: 1 })) => {} - Ok(_) => misses.entry("made".into()).or_default().push(what), - Err(e) => misses - .entry(format!("refused: {e}")) - .or_default() - .push(what), + // The compile, and the keys a runtime's creation asks for first, which compiles each + // stage under the inputs they name. + let keys = dev + .render_variant_key(&d, &VariantKey::new(), &budget, &StageEntries::new()) + .map(|_| ()); + let compiled = dev.compile_render_pipeline(&d, &budget).map(|_| ()); + for (how, made) in [("compiled", compiled), ("keyed", keys)] { + let what = format!("{what}, {how}"); + match made { + Err(Error::InvalidDescriptor(DescriptorError::ColorAttachment { + index: 1, + })) => {} + Ok(()) => misses.entry("made".into()).or_default().push(what), + Err(e) => misses + .entry(format!("refused: {e}")) + .or_default() + .push(what), + } } } let d = specialized(&vs, &fs, "dfr_lacks", &[0, 1], false);