Tests: a device without any one of the four mesh features refuses mesh stages by name (red)
What: engine_mesh.rs, on every committed profile whose device lists VK_EXT_mesh_shader, with one
of taskShader, meshShader, multiDrawIndirect and drawIndirectCount removed from its description.
Every object function and mesh function of the owned fixtures mesh_order and mesh_outputs, and
mesh_draws' mesh render pipeline with and without its object function, must be refused as
Unsupported{MeshShading} needing exactly the removed feature.
Why: object and mesh functions run only where the device enables all four together with the
extension: an object function's draws need the mesh stage, a mesh function's pipeline may take
an object stage, and a mesh draw's pieces take multiDrawIndirect and drawIndirectCount. Today an
object function needs only taskShader and a mesh function only meshShader, and neither needs the
two draw features, so such a device reaches the identity domains' refusal of the stage instead.
Verified: see the job named below; the test fails at this commit.
This commit is contained in:
1 parent
f514d6f283
commit
aea7564c29
1 file changed
+93
@@ -161,3 +161,96 @@ fn without_the_extension_a_mesh_pipeline_is_refused() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The features a device enables with `VK_EXT_mesh_shader` for object and mesh functions, needed
|
||||
/// all together: `taskShader` and `meshShader`, and `multiDrawIndirect` and `drawIndirectCount`,
|
||||
/// which a mesh draw's pieces take.
|
||||
const MESH_FEATURES: [VkFeature; 4] = [
|
||||
VkFeature::TaskShader,
|
||||
VkFeature::MeshShader,
|
||||
VkFeature::MultiDrawIndirect,
|
||||
VkFeature::DrawIndirectCount,
|
||||
];
|
||||
|
||||
/// The device of committed profile `stem` without `feature`.
|
||||
fn device_without(stem: &str, feature: VkFeature) -> crate::device::Device {
|
||||
let mut desc = crate::pipeline::testing::description(stem).unwrap_or_else(|e| panic!("{e}"));
|
||||
assert!(
|
||||
desc.features.remove(&feature),
|
||||
"{stem} lists no {feature:?}"
|
||||
);
|
||||
crate::device::Device::from_queries(desc).unwrap_or_else(|e| panic!("{stem}: {e}"))
|
||||
}
|
||||
|
||||
/// On every committed profile whose device lists `VK_EXT_mesh_shader`, a device without any one of
|
||||
/// [`MESH_FEATURES`] refuses every object function, every mesh function and every mesh render
|
||||
/// pipeline, with or without an object function (`Unsupported{MeshShading}`), needing the one it
|
||||
/// lacks.
|
||||
#[test]
|
||||
fn without_any_one_mesh_feature_mesh_stages_are_refused_naming_it() {
|
||||
use crate::budget::Budget;
|
||||
use crate::library::Library;
|
||||
use crate::pipeline::descriptor::{FunctionDescriptor, MeshPipelineDescriptor, StageSource};
|
||||
let (Some(order), Some(outputs), Some(draws)) = (
|
||||
fixture("mesh_order"),
|
||||
fixture("mesh_outputs"),
|
||||
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<String> = 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 {
|
||||
for feature in MESH_FEATURES {
|
||||
let dev = device_without(stem, feature);
|
||||
let want = Needs::AnyOf(vec![vec![Capability::Feature(feature)]]);
|
||||
for (bc, entry) in [
|
||||
(&order, "mesh_order_solo"),
|
||||
(&order, "mesh_order_object"),
|
||||
(&order, "mesh_order_mesh"),
|
||||
(&outputs, "mesh_outputs_lines"),
|
||||
] {
|
||||
let what = format!("{stem} without {feature:?}: {entry}");
|
||||
match compile(bc, entry, dev.profile()) {
|
||||
Err(Error::Unsupported(u)) => assert_eq!(
|
||||
(u.feature, &u.needs),
|
||||
(Feature::MeshShading, &want),
|
||||
"{what}"
|
||||
),
|
||||
other => panic!("{what}: {:?}", other.map(|_| ())),
|
||||
}
|
||||
}
|
||||
for object in [None, Some("mesh_draws_object")] {
|
||||
let what = format!("{stem} without {feature:?}: pipeline, object {object:?}");
|
||||
let mut d = MeshPipelineDescriptor::new(stage(match object {
|
||||
Some(_) => "mesh_draws_mesh",
|
||||
None => "mesh_draws_grid",
|
||||
}));
|
||||
d.object = object.map(stage);
|
||||
d.rasterization_enabled = false;
|
||||
match dev.compile_mesh_pipeline(&d, &Budget::standard()) {
|
||||
Err(Error::Unsupported(u)) => assert_eq!(
|
||||
(u.feature, &u.needs),
|
||||
(Feature::MeshShading, &want),
|
||||
"{what}"
|
||||
),
|
||||
other => panic!("{what}: {:?}", other.map(|_| ())),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user