diff --git a/crates/metal2vulkan/src/tests/engine_mesh.rs b/crates/metal2vulkan/src/tests/engine_mesh.rs index 44a313d7c..cee96db06 100644 --- a/crates/metal2vulkan/src/tests/engine_mesh.rs +++ b/crates/metal2vulkan/src/tests/engine_mesh.rs @@ -256,3 +256,60 @@ fn without_any_one_mesh_feature_mesh_stages_are_refused_naming_it() { } } } + +/// On every committed profile whose device lists `VK_EXT_mesh_shader` with all of +/// [`MESH_FEATURES`], mesh_draws' mesh render pipeline compiles under the identity domains, with +/// and without its object function, rasterizing into two `RGBA32Uint` colors, and each of its +/// stages passes L3 (`spirv-val` and requirements within the profile). +#[test] +fn a_mesh_pipeline_compiles_under_the_identity_domains() { + use crate::budget::Budget; + use crate::library::Library; + use crate::pipeline::descriptor::{ + ColorAttachmentDescriptor, FunctionDescriptor, MeshPipelineDescriptor, StageSource, + }; + use crate::spirv::testing::check_words_valid; + let Some(draws) = fixture("mesh_draws") else { + return; + }; + let library = Library::from_air(&draws).expect("library"); + let stage = |name: &str| { + StageSource::Function(FunctionDescriptor::new( + library.function(name).expect("function"), + )) + }; + let stems: Vec = threadgroup_profiles() + .expect("committed profiles") + .into_iter() + .map(|(stem, _)| stem) + .filter(|stem| lists_mesh_shader(stem)) + .collect(); + assert!( + !stems.is_empty(), + "no committed profile lists the extension" + ); + for stem in &stems { + let dev = device(stem); + for object in [None, Some("mesh_draws_object")] { + let what = format!("{stem} object {object:?}"); + let mut d = MeshPipelineDescriptor::new(stage(match object { + Some(_) => "mesh_draws_mesh", + None => "mesh_draws_grid", + })); + d.object = object.map(stage); + d.fragment = Some(stage("mesh_draws_fragment")); + for slot in d.color_attachments.iter_mut().take(2) { + *slot = Some(ColorAttachmentDescriptor::new( + crate::metal::PixelFormat::RGBA32Uint, + )); + } + let p = dev + .compile_mesh_pipeline(&d, &Budget::standard()) + .unwrap_or_else(|e| panic!("{what}: {e}")); + for m in &p.stages { + check_words_valid(&m.spirv, &p.requirements, dev.profile()) + .unwrap_or_else(|e| panic!("{what} {:?}: L3: {e}", m.stage)); + } + } + } +}