Validation: the stencil rule's Counting clause has nothing to read in the case schema

The runtime's BitDraws rule refuses a draw through a [[stencil]] output drawn by bits in two
places: a face whose compare is other than Always and Never (DrawDepthStencil::
stencil_reference_face reads it), and, where the state replaces a stencil bit, a draw inside a
Counting visibility result's segment. The second needs a visibility result mode, and the case
schema has no way to state one:

- crates/metal2vulkan-validation/src/case.rs:19-21, AuthoredCase: #[serde(deny_unknown_fields)],
  and none of its fields is a visibility result mode, offset or buffer;
- src/case.rs:1819-1821, Draw (primitive, vertex_start, vertex_count, instance_count,
  index_buffer, base_vertex, base_instance): deny_unknown_fields, no visibility field;
- src/case.rs:1388-1390, DepthStencilResource, and src/case.rs:1406-1408,
  DepthStencilStateLiteral: deny_unknown_fields, no visibility field;
- neither executor sets a mode or gives its pass a visibility result buffer: no "visibility" in
  src/metal/ or src/candidate/ (grep -rni visibility), and runtime_render.rs's Targets::pass
  (line 661) builds the pass from its attachments, array length and default size alone.

A manifest naming such a field is refused at parse, so no case's draw is in a segment and the
classifier carries no clause for it. When the schema grows a visibility result mode, the clause
belongs beside the compare rule, with its own classification test. The doc comment of
stencil_reference_face and docs/VALIDATION.md now say this instead of "a case sets no mode".

Verified at this commit: cargo fmt; doc comment and docs only, no code changed.
This commit is contained in:
Anees Iqbal committed 2026-11-25 13:24:41 -08:00
1 parent 7d8d96f65e
commit db3a88526b
2 files changed
+7 -4

No files matched your search

@@ -128,8 +128,10 @@ impl DrawDepthStencil {
/// `metal::state::depth_stencil_state`): it refuses a draw whose test the output decides
/// (`Gap::Draw` of `DrawKind::StencilOutput`). It refuses one more draw: where the state
/// replaces a stencil bit, one inside a `Counting` visibility result's segment, whose count
/// each of its draws would add to. A case sets no visibility result mode, so none of its draws
/// is in a segment, and that clause decides none.
/// each of its draws would add to. That clause has nothing to read: the case schema expresses
/// no visibility result mode (no field of `AuthoredCase`, its `Draw` or its
/// `DepthStencilResource` names one, and each refuses an unknown field), and neither executor
/// sets one or gives its pass a visibility result buffer, so no case's draw is in a segment.
pub fn stencil_reference_face(&self) -> Option<(&'static str, CompareFunction)> {
let state = self.vulkan();
if !state.stencil_test_enable {
+3 -2
View File
@@ -569,8 +569,9 @@ cargo run -p metal2vulkan-validation --release --bin corpus-vulkan -- \
function other than `Always` and `Never` on a face, which the output decides as its reference
(`Gap::Draw` of `StencilOutput`): such a case records `not_enabled` there, naming the extension
and the face, read from its function's live outputs and its depth-stencil state once the state is
made (`DrawDepthStencil::stencil_reference_face`). A case sets no visibility result mode, so the
runtime's other refusal of such a draw, inside a `Counting` segment, meets none. Its device
made (`DrawDepthStencil::stencil_reference_face`). The case schema expresses no visibility
result mode, and neither executor sets one, so the runtime's other refusal of such a draw,
inside a `Counting` segment, meets none. 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.