From 959a4ccbcd1535b922e28f6c0ae6d04fd4ee8626 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Fri, 27 Nov 2026 03:39:14 -0800 Subject: [PATCH] Runtime tests: OpenGL mode's rasterizing void vertex function is refused, a known gap The GL-mode half of the old runtime's void-vertex test. Metal on an Apple M3 Max (macOS 27.0.1, probe conformance/probes/opengl_mode.m) makes, under the private OpenGL mode, a rasterizing state whose vertex function returns void: its draw runs the vertex function and rasterizes nothing. The runtime refuses it in either mode, as the translator's link does (pipeline/link.rs, check_stages: DescriptorError::RasterizedVoidVertex whatever the mode). The consumer counted the refusal over 812 runtime boots, 221 with guest GL-renderer content and 160 with a browser 3D scene: 0, while 737 of those logs carry other runtime refusal lines. On that zero the planner ruled the refusal a known gap rather than a build: the test asserts today's typed refusal with the mode on, Metal's answer stays in its doc as the difference, and the runtime's README lists it under Known gaps of render pipeline states, as a guest meets it. The refusal test without the mode now shares the assertion through one helper. Verified: the same refusal, "invalid descriptor: RasterizedVoidVertex" with the mode on, was what the Metal-valued form of this test met on lavapipe (job m3-max-76678), the Iris Xe (m3-max-76684), a Radeon 780M (m3-max-76687) and an RTX 2080 (m3-max-76688); this form reruns on lavapipe at the branch tip, reported to main with its job. --- crates/metal2vulkan-runtime/README.md | 5 ++ .../src/tests/opengl_mode.rs | 79 ++++++++++++------- 2 files changed, 56 insertions(+), 28 deletions(-) diff --git a/crates/metal2vulkan-runtime/README.md b/crates/metal2vulkan-runtime/README.md index 8b0b15ae4..5906031a5 100644 --- a/crates/metal2vulkan-runtime/README.md +++ b/crates/metal2vulkan-runtime/README.md @@ -4313,6 +4313,11 @@ cache is answered compile-required on both. The states-only plays of the 35 replay streams on lavapipe refuse none of their render or compute states (jobs m3-max-63105 to 63108, and m3-max-63132 and m3-max-63156 for the two streams that ran past those jobs' 300-second limit). +- Under the private OpenGL mode (`PrivateRenderState::open_gl_mode_enabled`), a render pipeline + whose vertex function returns `void` with rasterization enabled is refused, an + `Error::Translation` naming `RasterizedVoidVertex`, where Metal makes a state that runs the + vertex function and rasterizes nothing (an Apple M3 Max, macOS 27.0.1, the probe + `metal2vulkan-conformance/probes/opengl_mode.m`). - On a device that does not list `VK_EXT_shader_stencil_export`, a fragment function's `[[stencil]]` output is drawn by bits (`RuntimeFact::StencilBitDraws`). Each draw through its state is drawn once under the stencil reference 0, then once for each bit of the low 8 of the write masks of diff --git a/crates/metal2vulkan-runtime/src/tests/opengl_mode.rs b/crates/metal2vulkan-runtime/src/tests/opengl_mode.rs index 823ccfbc4..4a03c549a 100644 --- a/crates/metal2vulkan-runtime/src/tests/opengl_mode.rs +++ b/crates/metal2vulkan-runtime/src/tests/opengl_mode.rs @@ -1,12 +1,13 @@ -//! OpenGL mode (`PrivateRenderState::open_gl_mode_enabled`) makes the two render states Metal -//! refuses without it, each drawing as an Apple M3 Max draws it (probe -//! `conformance/probes/opengl_mode.m`, macOS 27.0.1): a fragment function writing depth without a -//! depth attachment draws its colors as with one; a rasterizing state whose vertex function returns -//! `void` runs the vertex function and rasterizes nothing. Without the mode Metal refuses the -//! second ("RasterizationEnabled is true but the vertex shader's return type is void"), as the -//! translator's link does (`DescriptorError::RasterizedVoidVertex`). The first only the M3 Max's -//! driver refuses ("depthAttachmentPixelFormat is not valid and shader writes to depth"), and the -//! runtime makes it in either mode (docs/API.md, accepted differences). +//! OpenGL mode (`PrivateRenderState::open_gl_mode_enabled`) makes two render states Metal refuses +//! without it, as an Apple M3 Max draws them (probe `conformance/probes/opengl_mode.m`, macOS +//! 27.0.1): a fragment function writing depth without a depth attachment draws its colors as with +//! one; a rasterizing state whose vertex function returns `void` runs the vertex function and +//! rasterizes nothing. The runtime draws the first as Metal does, and makes it without the mode +//! too, where only the M3 Max's driver refuses it ("depthAttachmentPixelFormat is not valid and +//! shader writes to depth"; docs/API.md, accepted differences). It refuses the second in either +//! mode, as the translator's link does (`DescriptorError::RasterizedVoidVertex`): without the mode +//! as Metal does ("RasterizationEnabled is true but the vertex shader's return type is void"), and +//! with it a known gap (the runtime's README, Known gaps of render pipeline states). //! //! Device tests, under a device cfg on every device of the cfg's kind. The functions are those of //! the owned fixture `validation/fixtures/public/examples/icb_linked_arguments.ll`; `llvm-as` @@ -40,7 +41,7 @@ mod on_device { use metal2vulkan_devtools::fixtures_dir; /// The texel `tint` holds at (1, 0), which the depth-writing fragment function writes as its - /// depth and the `void` vertex function stores. + /// depth. const TEXEL: [f32; 4] = [0.25, 0.5, 0.75, 1.0]; /// The index `tint` takes. @@ -163,6 +164,29 @@ mod on_device { }); } + /// Asserts that `device` refuses a rasterizing state of the `void` vertex function as the + /// translator's link does, in OpenGL mode where `gl`, with or without a fragment function. + fn refuses_the_void_vertex_function(name: &str, device: &Device, library: &Library, gl: bool) { + for fragment in [None, Some("inputless_fragment")] { + let functions = ("void_store_vertex", fragment); + let refused = device.new_render_pipeline_state( + &descriptor(library, functions, gl), + crate::tests::no_constexpr_samplers, + ); + match refused { + Err(Error::Translation { + error: + metal2vulkan::error::Error::InvalidDescriptor( + DescriptorError::RasterizedVoidVertex, + ), + .. + }) => {} + Err(other) => panic!("{name}: {fragment:?}: another error: {other:?}"), + Ok(_) => panic!("{name}: {fragment:?}: made"), + } + } + } + /// Without the mode, a rasterizing state whose vertex function returns `void` is refused /// with Metal's error, with or without a fragment function. #[test] @@ -171,25 +195,24 @@ mod on_device { return; }; each_device("opengl_mode_void_refused", |name, _, device| { - for fragment in [None, Some("inputless_fragment")] { - let functions = ("void_store_vertex", fragment); - let refused = device.new_render_pipeline_state( - &descriptor(&library, functions, false), - crate::tests::no_constexpr_samplers, - ); - match refused { - Err(Error::Translation { - error: - metal2vulkan::error::Error::InvalidDescriptor( - DescriptorError::RasterizedVoidVertex, - ), - .. - }) => {} - Err(other) => panic!("{name}: {fragment:?}: not Metal's error: {other:?}"), - Ok(_) => panic!("{name}: {fragment:?}: made"), - } - } + refuses_the_void_vertex_function(name, &device, &library, false); println!("{name}: a rasterizing void vertex function refused without OpenGL mode"); }); } + + /// With the mode too, a rasterizing state whose vertex function returns `void` is refused, + /// with or without a fragment function, as the translator's link refuses it whatever the + /// mode. Metal makes it there (an Apple M3 Max, macOS 27.0.1, the probe): a state whose draw + /// runs the vertex function, its three stores landing, and rasterizes nothing. The difference + /// is a known gap (the runtime's README, Known gaps of render pipeline states). + #[test] + fn opengl_mode_refuses_a_rasterizing_void_vertex_function() { + let Some(library) = examples() else { + return; + }; + each_device("opengl_mode_void", |name, _, device| { + refuses_the_void_vertex_function(name, &device, &library, true); + println!("{name}: a rasterizing void vertex function refused in OpenGL mode"); + }); + } }