Validation: separate depth and stencil attachments are the runtime's limit

A fragment case whose depth/stencil attachment holds both aspects is
drawn by the Metal oracle into Metal's separate Depth32Float and
Stencil8 textures, attached to one pass: plain Metal on every Mac. The
runtime does not build that form yet. It renders into no separate depth
and stencil textures in one pass (Gap::RenderPass of DepthStencilViews,
and its pipeline state Gap::RenderPipeline of DepthStencilFormats), both
among the known gaps its README states. The planner's ruling: record
these rows as the runtime's limit with that typed gap, by the
function-table mechanism; the doc comment states the gap as unbuilt in
the runtime, not as Metal's.

ToolingRequirement::SeparateDepthStencil ("separate_depth_stencil"):
Limit::Runtime, it stops the engine's candidate and keeps its cases
Metal-qualified (qualifies_on_metal). The case checker raises it from
the case's literals (executor_contract::case_requirements: a vertex or
fragment case's depth/stencil attachment with both initial aspects),
never from a source's structure, so no census row carries it.
executor_contract.rs is a classifier input, so every cached triage
recomputes. If the runtime builds the form, the requirement goes in the
same commit.

What lost execution: of the committed cases, 5 fragment cases hold
both aspects: the 3 of family G (one sample, observing stencil) and 2
multisampled ones (family H), all of which ran on the old executor
until now.

Tests: requirement.rs's
a_separate_depth_stencil_attachment_stops_only_the_candidate and both
requirement lists; executor_contract's case test (a fragment case's
attachment of one aspect raises nothing, of both raises it alone).

Verified: cargo fmt; the compile gate follows as a potluck job.
This commit is contained in:
Anees Iqbal committed 2026-11-20 21:27:21 -08:00
1 parent cca476549f
commit 6af76cf309
3 files changed
+75 -23

No files matched your search

@@ -806,8 +806,9 @@ pub fn engine_source_requirements(reflection: &ShaderInterface) -> BTreeSet<Tool
/// ([`mesh::mesh_requirements`]); each of them a case authors is also named here, so a case that
/// was checked against an older reflection is refused all the same. A depth outside `[0, 1]` the
/// case gives a depth image is the runtime's limit on every device
/// ([`depth_range::depth_range_requirement`]), and so is an indexed draw past its index buffer
/// (its out-of-bounds target, [`ToolingRequirement::IndexBufferPastEnd`]).
/// ([`depth_range::depth_range_requirement`]), and so are an indexed draw past its index buffer
/// (its out-of-bounds target, [`ToolingRequirement::IndexBufferPastEnd`]) and a depth/stencil
/// attachment of both aspects ([`ToolingRequirement::SeparateDepthStencil`]).
pub fn case_requirements(case: &AuthoredCase) -> BTreeSet<ToolingRequirement> {
let render = matches!(case.stage, Stage::Vertex | Stage::Fragment);
let drawn = render || case.stage.is_mesh_pipeline_stage();
@@ -865,6 +866,14 @@ pub fn case_requirements(case: &AuthoredCase) -> BTreeSet<ToolingRequirement> {
}),
ToolingRequirement::IndexBufferPastEnd,
),
(
render
&& case.depth_stencil.as_ref().is_some_and(|attachment| {
attachment.initial_depth_b64.is_some()
&& attachment.initial_stencil_b64.is_some()
}),
ToolingRequirement::SeparateDepthStencil,
),
]
.into_iter()
.filter_map(|(present, requirement)| present.then_some(requirement))
@@ -2989,6 +2998,16 @@ entry:
state: None,
});
only(&vertex, ToolingRequirement::VertexDepthStencilAttachment);
// A fragment case's attachment of one aspect runs; of both, the oracle's two textures in
// one pass, it is the runtime's limit.
let mut aspects = kernel.clone();
aspects.stage = Stage::Fragment;
aspects.depth_stencil = vertex.depth_stencil.clone();
assert!(case_requirements(&aspects).is_empty());
if let Some(attachment) = &mut aspects.depth_stencil {
attachment.initial_stencil_b64 = Some("qw==".into());
}
only(&aspects, ToolingRequirement::SeparateDepthStencil);
let mut disabled = kernel.clone();
disabled.stage = Stage::Vertex;
disabled.render_targets.push(RenderTargetResource {
@@ -210,6 +210,17 @@ pub enum ToolingRequirement {
/// is the runtime's ([`Limit::Runtime`]) and the engine's candidate does not run the case. The
/// Metal oracle runs it, so a case of it stays Metal-qualified ([`Self::qualifies_on_metal`]).
UlongTextureAtomic,
/// A depth/stencil attachment of both aspects (`executor_contract::case_requirements`), which
/// the Metal oracle makes as Metal's separate `Depth32Float` and `Stencil8` textures, both
/// attached to one pass: plain Metal on every Mac. The runtime does not build that form yet: it
/// renders into no separate depth and stencil textures in one pass
/// (`metal2vulkan_runtime::Gap::RenderPass` of `DepthStencilViews`, and its pipeline state
/// `Gap::RenderPipeline` of `DepthStencilFormats`, known gaps its README states, which are its
/// guard), so the limit is the runtime's ([`Limit::Runtime`]) and the engine's candidate does
/// not run the case. The case checker raises it from the case's literals, never a source's
/// structure, so no census row carries it. The Metal oracle draws it, so a case of it stays
/// Metal-qualified ([`Self::qualifies_on_metal`]).
SeparateDepthStencil,
}
/// Every executor (the requirement leaves no case to author, or none to observe).
@@ -217,7 +228,7 @@ const AUTHORING: &[Executor] = &Executor::ALL;
const ENGINE: &[Executor] = &[Executor::EngineCandidate];
impl ToolingRequirement {
pub const ALL: [Self; 29] = [
pub const ALL: [Self; 30] = [
Self::FunctionConstantLiteral,
Self::VertexAttributeLiteral,
Self::TessellationAttributeLiteral,
@@ -247,6 +258,7 @@ impl ToolingRequirement {
Self::RenderFunctionTable,
Self::IndexBufferPastEnd,
Self::UlongTextureAtomic,
Self::SeparateDepthStencil,
];
pub const fn as_str(self) -> &'static str {
@@ -282,6 +294,7 @@ impl ToolingRequirement {
Self::RenderFunctionTable => "render_function_table",
Self::IndexBufferPastEnd => "index_buffer_past_end",
Self::UlongTextureAtomic => "ulong_texture_atomic",
Self::SeparateDepthStencil => "separate_depth_stencil",
}
}
@@ -304,9 +317,10 @@ impl ToolingRequirement {
/// [`ToolingRequirement::ReplayedTemplateResources`]), and a texture buffer an argument
/// buffer or a texture-handle array holds ([`ToolingRequirement::TextureBufferMember`]),
/// and a sequentially consistent fence, a render function's function table, an indexed draw
/// past its index buffer and a 64-bit texture atomic, which the runtime refuses
/// ([`ToolingRequirement::SeqCstFence`], [`ToolingRequirement::RenderFunctionTable`],
/// [`ToolingRequirement::IndexBufferPastEnd`], [`ToolingRequirement::UlongTextureAtomic`]).
/// past its index buffer, a 64-bit texture atomic and separate depth and stencil attachments,
/// which the runtime refuses ([`ToolingRequirement::SeqCstFence`],
/// [`ToolingRequirement::RenderFunctionTable`], [`ToolingRequirement::IndexBufferPastEnd`],
/// [`ToolingRequirement::UlongTextureAtomic`], [`ToolingRequirement::SeparateDepthStencil`]).
///
/// The requirements that stopped only the old engine's candidate were retired with it.
pub const fn stops(self) -> &'static [Executor] {
@@ -339,7 +353,8 @@ impl ToolingRequirement {
| Self::SeqCstFence
| Self::RenderFunctionTable
| Self::IndexBufferPastEnd
| Self::UlongTextureAtomic => ENGINE,
| Self::UlongTextureAtomic
| Self::SeparateDepthStencil => ENGINE,
}
}
@@ -349,8 +364,8 @@ impl ToolingRequirement {
/// refuses it, typed. Only [`ToolingRequirement::MeshRenderPipeline`],
/// [`ToolingRequirement::TextureBufferMember`], [`ToolingRequirement::DepthOutsideUnitRange`],
/// [`ToolingRequirement::SeqCstFence`], [`ToolingRequirement::RenderFunctionTable`] and
/// [`ToolingRequirement::IndexBufferPastEnd`] and [`ToolingRequirement::UlongTextureAtomic`]:
/// their cases are qualified on Metal.
/// [`ToolingRequirement::IndexBufferPastEnd`], [`ToolingRequirement::UlongTextureAtomic`] and
/// [`ToolingRequirement::SeparateDepthStencil`]: their cases are qualified on Metal.
pub const fn qualifies_on_metal(self) -> bool {
matches!(
self,
@@ -361,6 +376,7 @@ impl ToolingRequirement {
| Self::RenderFunctionTable
| Self::IndexBufferPastEnd
| Self::UlongTextureAtomic
| Self::SeparateDepthStencil
)
}
@@ -368,8 +384,9 @@ impl ToolingRequirement {
/// [`ToolingRequirement::KernelMinLodClamp`], which Apple's compiler cannot build a pipeline
/// for, and [`ToolingRequirement::SeqCstFence`], [`ToolingRequirement::TextureBufferMember`],
/// [`ToolingRequirement::DepthOutsideUnitRange`], [`ToolingRequirement::MeshRenderPipeline`],
/// [`ToolingRequirement::RenderFunctionTable`], [`ToolingRequirement::IndexBufferPastEnd`] and
/// [`ToolingRequirement::UlongTextureAtomic`], which the runtime refuses.
/// [`ToolingRequirement::RenderFunctionTable`], [`ToolingRequirement::IndexBufferPastEnd`],
/// [`ToolingRequirement::UlongTextureAtomic`] and [`ToolingRequirement::SeparateDepthStencil`],
/// which the runtime refuses.
pub const fn limit(self) -> Limit {
match self {
Self::KernelMinLodClamp => Limit::Metal,
@@ -379,7 +396,8 @@ impl ToolingRequirement {
| Self::MeshRenderPipeline
| Self::RenderFunctionTable
| Self::IndexBufferPastEnd
| Self::UlongTextureAtomic => Limit::Runtime,
| Self::UlongTextureAtomic
| Self::SeparateDepthStencil => Limit::Runtime,
_ => Limit::Tooling,
}
}
@@ -534,7 +552,8 @@ mod tests {
ToolingRequirement::SeqCstFence,
ToolingRequirement::RenderFunctionTable,
ToolingRequirement::IndexBufferPastEnd,
ToolingRequirement::UlongTextureAtomic
ToolingRequirement::UlongTextureAtomic,
ToolingRequirement::SeparateDepthStencil
]
);
}
@@ -606,6 +625,19 @@ mod tests {
assert_eq!("ulong_texture_atomic".parse(), Ok(requirement));
}
/// Separate depth and stencil attachments: the Metal oracle draws them, so their cases stay
/// Metal-qualified; the runtime does not build that pass yet, so the engine's candidate runs
/// none, the runtime's limit, which closes its rows.
#[test]
fn a_separate_depth_stencil_attachment_stops_only_the_candidate() {
let requirement = ToolingRequirement::SeparateDepthStencil;
assert_eq!(requirement.stops(), [Executor::EngineCandidate]);
assert_eq!(requirement.limit(), Limit::Runtime, "{requirement}");
assert!(!requirement.blocks_closure(), "{requirement}");
assert!(requirement.qualifies_on_metal(), "{requirement}");
assert_eq!("separate_depth_stencil".parse(), Ok(requirement));
}
/// Every requirement stops some executor, and an executor's name is as stable as a
/// requirement's. A requirement that stops the Metal oracle stops every executor: when Metal
/// cannot run a case, no candidate has an observation to be compared with. Only a tooling gap
@@ -656,7 +688,8 @@ mod tests {
ToolingRequirement::SeqCstFence,
ToolingRequirement::RenderFunctionTable,
ToolingRequirement::IndexBufferPastEnd,
ToolingRequirement::UlongTextureAtomic
ToolingRequirement::UlongTextureAtomic,
ToolingRequirement::SeparateDepthStencil
]
);
for executor in Executor::ALL {
+9 -9
View File
@@ -494,15 +494,15 @@ cargo run -p metal2vulkan-validation --release --bin corpus-moltenvk -- \
runtime device's own translator: the runtime's floor enables no buffer robustness, so a
fixed-function vertex fetch past its buffer is checked nowhere and the case is refused as
`not_supported{uncontained:unchecked vertex_input}`. A rasterization-disabled vertex case renders
into the oracle's 1x1 `R8Unorm` attachment. A depth/stencil attachment of both aspects (the
oracle's two textures, which the runtime renders into in no one pass: `Gap::RenderPass` of
`DepthStencilViews`), more samples, layered rendering, a dynamic vertex stride, an
argument-buffer member, tessellation, an imageblock, a rasterization-rate map, an out-of-bounds
target other than an attribute buffer or a fragment pass with no attachment (the runtime makes
no pass without one) keeps the case on the executor's own context. An
indexed draw past its index buffer, which the runtime refuses as Metal's validation does
(`Refusal::IndexBufferOffset`), carries `index_buffer_past_end`, the runtime's limit, and runs
on Metal alone. Its device worker enables the
into the oracle's 1x1 `R8Unorm` attachment. More samples, layered rendering, a dynamic vertex
stride, an argument-buffer member, tessellation, an imageblock, a rasterization-rate map, an
out-of-bounds target other than an attribute buffer or a fragment pass with no attachment (the
runtime makes no pass without one) keeps the case on the executor's own context. An indexed
draw past its index buffer, which the runtime refuses as Metal's validation does
(`Refusal::IndexBufferOffset`), carries `index_buffer_past_end`, and a depth/stencil attachment
of both aspects, the oracle's two textures, which the runtime renders into in no one pass yet
(`Gap::RenderPass` of `DepthStencilViews`), carries `separate_depth_stencil`: each the runtime's
limit, run on Metal alone. Its device worker enables the
validation layer through the loader's and the layer's variables, and any message the layer logs
fails the row. The pipeline state's make is held to 500 MiB of peak live allocations and 20 s.
Its row records the state's precision notes, the runtime's fingerprint and an out-of-bounds