From 530fb4ea4ca4e70404c8f31dbcb2285860ae2bd7 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Wed, 2 Dec 2026 16:26:31 -0800 Subject: [PATCH] Validation: the runtime route refuses no patch draw through index buffers, which no case makes The engine candidate's runtime route required a patch draw to name no patch or control-point index buffer, and refused one that did as executor_not_implemented. No case reaches that refusal: the case mapping (graphics::patch_draw) names neither buffer for every patch draw, the case schema has no field for them, and the AIR states nothing about a draw's index buffers. The conformance suite's tessellation-patch-indices case compares drawIndexedPatches and patch index buffers against Metal. The route now takes every patch draw, its refusal message and VALIDATION.md's sentence drop the clause, and the routing test drops its patch draw through a patch index buffer. The runtime platform's draw keeps its own check of the translator's DrawCall fields, which fails a draw that names an index buffer visibly. --- .../src/candidate/engine.rs | 24 +++++++------------ .../src/candidate/engine/tests.rs | 12 ++++------ docs/VALIDATION.md | 9 ++++--- 3 files changed, 16 insertions(+), 29 deletions(-) diff --git a/crates/metal2vulkan-validation/src/candidate/engine.rs b/crates/metal2vulkan-validation/src/candidate/engine.rs index 2abe64092..372fae8aa 100644 --- a/crates/metal2vulkan-validation/src/candidate/engine.rs +++ b/crates/metal2vulkan-validation/src/candidate/engine.rs @@ -675,12 +675,12 @@ pub struct RuntimeKernel<'a> { /// too), function constants and linked functions, its vertex buffers, its color targets and a depth/stencil /// attachment of one aspect, or none (a fragment case's pass of no attachment is the oracle's 1x1 /// at its samples), layered or not (`RenderCase::render_target_array_length`), the encoder's depth-stencil state, cull mode and winding, and -/// one direct or indexed draw of primitives or one patch draw with no patch or control-point index -/// buffer (a post-tessellation vertex function's, its factors bound as the tessellation factor -/// buffer), observing a buffer, a texture, an argument-buffer member, a color target, the -/// depth/stencil attachment's aspect or nothing, whose out-of-bounds targets, if any, are attribute -/// buffers -/// (`runtime_bounds::drawn` reads their facts). Decided by the case's structure alone: +/// one direct or indexed draw of primitives or one patch draw (a post-tessellation vertex +/// function's, its factors bound as the tessellation factor buffer; the case's mapping names no +/// patch or control-point index buffer, `graphics::patch_draw`), observing a buffer, a texture, +/// an argument-buffer member, a color target, the depth/stencil attachment's aspect or nothing, +/// whose out-of-bounds targets, if any, are attribute buffers (`runtime_bounds::drawn` reads their +/// facts). Decided by the case's structure alone: /// every field the mapping fills is named here, so a new one is decided when it is added. pub fn runs_render_through_runtime(case: &graphics::RenderCase) -> bool { let graphics::RenderCase { @@ -715,14 +715,7 @@ pub fn runs_render_through_runtime(case: &graphics::RenderCase) -> bool { ( graphics::Assembly::Primitives(_), DrawCall::Primitives { .. } | DrawCall::Indexed { .. } - ) | ( - graphics::Assembly::Patches { .. }, - DrawCall::Patches { - patch_index: None, - control_point_index: None, - .. - } - ) + ) | (graphics::Assembly::Patches { .. }, DrawCall::Patches { .. }) ) && out_of_bounds .iter() @@ -1506,8 +1499,7 @@ fn run_prepared(prepared: &PreparedCase) -> RunAttempt { } Mapped::Render(_) => RunAttempt::of(Err(NotSupported::NotImplemented( "engine candidate: a draw the runtime route does not make: a depth/stencil attachment \ - of both aspects, a patch draw through a patch or control-point index buffer, or an \ - out-of-bounds target other than an attribute buffer" + of both aspects or an out-of-bounds target other than an attribute buffer" .into(), ) .into())), diff --git a/crates/metal2vulkan-validation/src/candidate/engine/tests.rs b/crates/metal2vulkan-validation/src/candidate/engine/tests.rs index 612ee69f5..576456329 100644 --- a/crates/metal2vulkan-validation/src/candidate/engine/tests.rs +++ b/crates/metal2vulkan-validation/src/candidate/engine/tests.rs @@ -910,7 +910,7 @@ fn a_plain_draw_and_only_one_runs_through_the_runtime() { ..plain.clone() }; assert!(runs_render_through_runtime(&unrasterized)); - let patches = |patch_index| RenderCase { + let patches = RenderCase { assembly: graphics::Assembly::Patches { tessellation: metal2vulkan::pipeline::TessellationDescriptor::default(), factors: vec![0; 12], @@ -919,14 +919,14 @@ fn a_plain_draw_and_only_one_runs_through_the_runtime() { control_points: 3, patch_start: 0, patch_count: 1, - patch_index, + patch_index: None, instance_count: 1, base_instance: 0, control_point_index: None, }, ..plain.clone() }; - assert!(runs_render_through_runtime(&patches(None))); + assert!(runs_render_through_runtime(&patches)); // An attribute buffer's out-of-bounds target draws through the runtime, whose facts refuse or // run it (`runtime_bounds::drawn`); no other target does (an index buffer's case carries the // runtime's limit, `index_buffer_past_end`, which stops it before either context). @@ -1077,12 +1077,8 @@ fn a_plain_draw_and_only_one_runs_through_the_runtime() { OutOfBoundsResource::IndexBuffer, ContainmentForm::IndexBuffer, ), - patches(Some(( - metal2vulkan::bind::IndexBufferRef::new(graphics::INDEX_BUFFER_TOKEN, 4), - 0, - ))), RenderCase { - draw: patches(None).draw, + draw: patches.draw, ..plain.clone() }, ]; diff --git a/docs/VALIDATION.md b/docs/VALIDATION.md index b01b0d7b8..f7f11869e 100644 --- a/docs/VALIDATION.md +++ b/docs/VALIDATION.md @@ -587,11 +587,10 @@ cargo run -p metal2vulkan-validation --release --bin corpus-vulkan -- \ `not_supported{uncontained:unchecked vertex_input}`. A rasterization-disabled vertex case renders into the oracle's 1x1 `R8Unorm` attachment, and a fragment case of no attachment into the oracle's pass of none: `renderTargetWidth` and `renderTargetHeight` 1, `defaultRasterSampleCount` - the case's samples. A depth/stencil attachment of both aspects, a patch draw through a patch or - control-point index buffer, or an out-of-bounds target other than an attribute buffer is refused - `not_supported{executor_not_implemented}`: the runtime route makes no such draw. A vertex - buffer's dynamic stride carries `dynamic_vertex_stride` and a fragment - function's imageblock `fragment_imageblock`, each the runtime's limit. An indexed + the case's samples. A depth/stencil attachment of both aspects or an out-of-bounds target other + than an attribute buffer is refused `not_supported{executor_not_implemented}`: the runtime + route makes no such draw. A vertex buffer's dynamic stride carries `dynamic_vertex_stride` and a + fragment function's imageblock `fragment_imageblock`, each the runtime's limit. 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