Fix forward of 4e3a6a3555: the translator's floor tests take shaderOutputLayer as the floor's

4e3a6a3555 put `shaderOutputLayer` in the runtime-floor profile (the floor requires it), and
five translator tests still read that profile as a device without it. Development's suites at
0dc56519c9 (m3-max-61646) failed them, and m3-max-61671 printed each failure:
- a_profile_without_shader_output_layer_draws_or_refuses_every_amplification: its first assert,
  that runtime-floor lacks the feature;
- amplification_draws_refuse_what_the_variant_cannot_be: the layered variant compiled (Ok) where
  the test expected Unsupported(VertexAmplification);
- on_the_floor_a_read_is_zero_and_a_selected_slice_needs_either_feature: amp_fragment_layer's zero
  indices were [] (the floor declares Layer), not [Layer];
- feature_dependent_entries_name_their_capability: stage_io_vertex_layer compiled on the floor;
- fragment_layer_and_viewport_inputs_take_the_enabled_alternatives: the floor's zero indices were
  [ViewportIndex], not [Layer, ViewportIndex].

Each test meant a device without the output, which the translator still serves for its own
consumers, so each now takes runtime-floor without `shaderOutputLayer` ("below the floor") for
that half: a new `below_the_floor()` in engine_amplification, a withheld feature in
engine_selected_indices (its test renamed below_the_floor_...), and `profile_without` in the two
stage_io files. Where the floor's own answer changed, the test asserts it: stage_io_vertex_layer
compiles on the floor, and a fragment there reads Layer through its builtin under ShaderLayer
and only ViewportIndex as 0. Two doc comments named lunarg-desktop-baseline-2023 for the
profile; they name the one used.

The selected-indices test's dropped-layer variant and the amplification test's geometry-stage
half test forms cutxlate's queue deletes; they go with those forms.

Test-only. Verified: m3-max-61699 (msi) at b143b912be, the four files' 41 tests
(engine_amplification, engine_selected_indices, engine_stage_io, engine_stage_io_tail) pass.
This commit is contained in:
Anees Iqbal committed 2026-11-20 21:37:51 -08:00
1 parent f3418eacb9
commit 55e5dcfd98
4 files changed
+64 -19

No files matched your search

@@ -838,13 +838,14 @@ fn a_variant_draws_each_amplification_with_its_push_fields() {
}
/// The variant's layered `Layer` needs `shaderOutputLayer` or `geometryShader`, which
/// `lunarg-desktop-baseline-2023` both lacks; and a tessellation pipeline is drawn amplified only as views (`lavapipe` has
/// `runtime-floor` without `shaderOutputLayer` (below the runtime's floor) both lacks; and a
/// tessellation pipeline is drawn amplified only as views (`lavapipe` has
/// `multiviewTessellationShader`).
#[test]
fn amplification_draws_refuse_what_the_variant_cannot_be() {
let Some(bc) = fixture() else { return };
let budget = Budget::standard();
let dev = device("runtime-floor");
let dev = below_the_floor();
let d = render(&bc, "amp_vertex_store", None, 2);
let p = dev.compile_render_pipeline(&d, &budget).expect("base");
let state = amplified(2, &[(0, 1), (0, 0)]);
@@ -876,6 +877,15 @@ fn amplification_draws_refuse_what_the_variant_cannot_be() {
}
}
/// `runtime-floor` without `shaderOutputLayer`, which the runtime's floor requires: a device below
/// the floor, with neither the output nor `geometryShader`.
fn below_the_floor() -> Device {
let mut desc = description("runtime-floor");
assert!(desc.features.remove(&F::ShaderOutputLayer));
assert!(!desc.features.contains(&F::GeometryShader));
Device::from_queries(desc, DevicePolicy::default()).expect("device")
}
/// What a variant that stores a layered amplification's slice needs on a device without
/// `shaderOutputLayer`: the feature, or the geometry stage that stores the slice instead.
fn output_layer_or_geometry() -> Needs {
@@ -892,20 +902,22 @@ fn output_layer_or_geometry() -> Needs {
/// Metal probe case `amp2_len1` on the M3 Max and an M4); and in a pass of more layers, whose
/// variant must store the amplification's slice as `Layer`, through the synthesized geometry
/// stages where the device has `geometryShader` (`lavapipe` without the output), and otherwise
/// (`lunarg-desktop-baseline-2023`) `Unsupported(VertexAmplification)` needing either feature.
/// (`runtime-floor` without `shaderOutputLayer`) `Unsupported(VertexAmplification)` needing either
/// feature.
#[test]
fn a_profile_without_shader_output_layer_draws_or_refuses_every_amplification() {
let Some(bc) = fixture() else { return };
let budget = Budget::standard();
let lunarg = "runtime-floor";
assert!(!description(lunarg).features.contains(&F::ShaderOutputLayer));
assert!(!description(lunarg).features.contains(&F::GeometryShader));
let mut lavapipe = description("lavapipe");
assert!(lavapipe.features.remove(&F::ShaderOutputLayer));
assert!(lavapipe.features.contains(&F::GeometryShader));
let lavapipe = Device::from_queries(lavapipe, DevicePolicy::default()).expect("device");
for (stem, dev, geometry) in [
(lunarg, device(lunarg), false),
(
"runtime-floor without shaderOutputLayer",
below_the_floor(),
false,
),
("lavapipe without shaderOutputLayer", lavapipe, true),
] {
let d = render(&bc, "amp_vertex_store", None, 2);
@@ -259,17 +259,18 @@ fn one_geometry_stage_serves_the_weights_the_primitive_and_the_slice() {
}
/// A fragment function that reads the slice or viewport no stage writes reads 0 on a device that
/// cannot declare the builtin, which it lists; on the floor a vertex function that selects its slice
/// is refused needing either feature, and its variant for a pass of one layer compiles.
/// cannot declare the builtin, which it lists; below the floor (`runtime-floor` without
/// `shaderOutputLayer`, which the floor requires) a vertex function that selects its slice is
/// refused needing either feature, and its variant for a pass of one layer compiles.
#[test]
fn on_the_floor_a_read_is_zero_and_a_selected_slice_needs_either_feature() {
fn below_the_floor_a_read_is_zero_and_a_selected_slice_needs_either_feature() {
let Some(layered) = assemble("rt6_layered.ll") else {
return;
};
let Some(amp) = assemble("vertex_amplification.ll") else {
return;
};
let floor = device("runtime-floor", &[]);
let floor = device("runtime-floor", &[F::ShaderOutputLayer]);
for (entry, zero) in [
("amp_fragment_layer", vec![StageBuiltin::Layer]),
("amp_fragment", vec![StageBuiltin::ViewportIndex]),
@@ -302,7 +303,10 @@ fn on_the_floor_a_read_is_zero_and_a_selected_slice_needs_either_feature() {
let one = floor
.compile_render_variant(&d, &key, &budget)
.expect("dropped variant");
assert_eq!(geometry_stages(&one, &floor, "floor, one layer"), 0);
assert_eq!(
geometry_stages(&one, &floor, "below the floor, one layer"),
0
);
}
/// A vertex function whose slice and viewport index differ among the vertices of a primitive
@@ -254,8 +254,8 @@ fn locations_are_relocation_only() {
/// The refusals of the fixture's feature-dependent entries name the capability (the primitive id's
/// too), and the invariant position compiles with its `Invariant` decoration. The floor states
/// clip distances, sample-rate shading and dual-source blending, so each of those refusals is on
/// `runtime-floor` without its feature (below the runtime's floor).
/// clip distances, sample-rate shading, dual-source blending and the vertex `Layer` output, so each
/// of those refusals is on `runtime-floor` without its feature (below the runtime's floor).
#[test]
fn feature_dependent_entries_name_their_capability() {
use crate::device::requirements::VkFeature as F;
@@ -282,7 +282,14 @@ fn feature_dependent_entries_name_their_capability() {
F::ShaderClipDistance,
);
// A vertex `Layer` takes the output feature or a geometry stage that writes it.
match compile(&bc, "stage_io_vertex_layer", &floor) {
compile(&bc, "stage_io_vertex_layer", &floor).expect("the floor's Layer output");
let below = profile_without(
"runtime-floor",
&[F::ShaderOutputLayer],
DevicePolicy::default(),
)
.expect("below the runtime's floor");
match compile(&bc, "stage_io_vertex_layer", &below) {
Err(Error::Unsupported(u)) => {
assert_eq!(u.feature, Feature::LayeredRendering);
assert_eq!(
@@ -215,9 +215,11 @@ fn a_fragment_primitive_id_takes_the_enabled_alternative() {
validate(&a, &floor);
}
/// Fragment `Layer` and `ViewportIndex` inputs take their enabled alternatives. On the floor, which
/// can declare neither, no stage can have written either, so the function reads both as 0, Metal's
/// value with no vertex write (`StageIo::zero_indices`), and declares neither.
/// Fragment `Layer` and `ViewportIndex` inputs take their enabled alternatives. The floor declares
/// `Layer` through `shaderOutputLayer` and cannot declare `ViewportIndex`, so no stage can have
/// written the viewport index and the function reads it as 0, Metal's value with no vertex write
/// (`StageIo::zero_indices`). Below the floor, without `shaderOutputLayer`, it reads both as 0 and
/// declares neither.
#[test]
fn fragment_layer_and_viewport_inputs_take_the_enabled_alternatives() {
let Some(bc) = fixture() else { return };
@@ -239,6 +241,26 @@ fn fragment_layer_and_viewport_inputs_take_the_enabled_alternatives() {
let floor = prof("runtime-floor");
let a = compile(&bc, "tail_fragment_layer", &floor).expect("floor");
let io = &a.interface.io;
assert_eq!(io.zero_indices, [StageBuiltin::ViewportIndex]);
assert!(io.builtins.contains(&StageBuiltin::Layer));
assert!(!io.builtins.contains(&StageBuiltin::ViewportIndex));
assert!(a
.requirements
.spirv_capabilities
.contains(&spirv_cap(Cap::ShaderLayer)));
assert!(!a
.requirements
.spirv_capabilities
.contains(&spirv_cap(Cap::MultiViewport)));
validate(&a, &floor);
let below = profile_without(
"runtime-floor",
&[F::ShaderOutputLayer],
DevicePolicy::default(),
)
.expect("below the runtime's floor");
let a = compile(&bc, "tail_fragment_layer", &below).expect("below the floor");
let io = &a.interface.io;
assert_eq!(
io.zero_indices,
[StageBuiltin::Layer, StageBuiltin::ViewportIndex]
@@ -249,7 +271,7 @@ fn fragment_layer_and_viewport_inputs_take_the_enabled_alternatives() {
.requirements
.spirv_capabilities
.contains(&spirv_cap(Cap::MultiViewport)));
validate(&a, &floor);
validate(&a, &below);
}
/// `[[barycentric_coord]]` reads `BaryCoordKHR` (perspective) or `BaryCoordNoPerspKHR`, through