From 1400c9049f0cf2d8039194baf795c596cc47eba3 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Thu, 22 Oct 2026 21:11:16 +0300 Subject: [PATCH] Resolve a NaN clear as Metal does in a pass whose draw calls draw nothing The steps this packet landed as, in order: - Leave a resolve texture untouched where Metal's tile is not stored into its format - Take setDepthCleared, setStencilCleared and setVertexAmplificationMode as Metal does - Run the private alpha test in the fragment function as Metal tests it - Clamp depth comparison references as Metal's fragmentDepthCompareClampMask says - Take vertexAmplificationMode and explicitVisibilityGroupID as Metal does - Record no restricted depth range where the driver keeps depth values outside [0, 1] - Draw Metal's private logic operation: copy and no-op everywhere, the rest through logicOp - Leave the default alpha test and clamp mask out of the inputs encoding test's derived Debug - Clamp the reference of a depth comparison the shader makes under the clamp mask - Key each Vulkan logic operation's pipeline apart - Refuse a multisampled extended-range resolve naming its format and Metal's rule Content: the tree of `development` at 0231dbbd54, unchanged. --- .../metal2vulkan-runtime/src/amplification.rs | 14 +- crates/metal2vulkan-runtime/src/apple_only.rs | 85 ++-- .../metal2vulkan-runtime/src/clear_value.rs | 62 ++- crates/metal2vulkan-runtime/src/enables.rs | 1 + crates/metal2vulkan-runtime/src/error.rs | 13 + crates/metal2vulkan-runtime/src/nan_clear.rs | 55 +-- .../src/pipeline/graphics.rs | 10 +- crates/metal2vulkan-runtime/src/render.rs | 24 +- .../src/render/late_resolve.rs | 11 +- .../metal2vulkan-runtime/src/render_pass.rs | 29 +- .../metal2vulkan-runtime/src/render_state.rs | 14 + crates/metal2vulkan-runtime/src/resolve.rs | 181 ++++++++- .../src/tests/apple_only.rs | 56 ++- .../fixtures/public/engine/TOOLCHAIN | 1 + .../public/engine/pdc_compare_clamp.air.ll | 163 ++++++++ .../public/engine/pdc_compare_clamp.ll | 161 ++++++++ .../public/engine/pdc_compare_clamp.metal | 45 +++ .../src/candidate/platform/enables.rs | 1 + .../src/runtime_lane.rs | 6 + .../src/runtime_lane/alpha_tests.rs | 237 +++++++++++ .../src/runtime_lane/amplified_draws.rs | 86 +++- .../src/runtime_lane/depth_compare_clamps.rs | 260 ++++++++++++ .../src/runtime_lane/late_resolves.rs | 8 +- .../src/runtime_lane/logic_ops.rs | 310 +++++++++++++++ .../src/runtime_lane/renders.rs | 66 +++- .../src/runtime_lane/resolves.rs | 170 +++++++- crates/metal2vulkan/src/ash_interop/query.rs | 1 + crates/metal2vulkan/src/bind/graphics.rs | 19 + crates/metal2vulkan/src/bind/state.rs | 8 + crates/metal2vulkan/src/cache/codec.rs | 19 +- crates/metal2vulkan/src/device/derive.rs | 6 + crates/metal2vulkan/src/device/enables.rs | 3 +- crates/metal2vulkan/src/device/khronos.rs | 1 + .../metal2vulkan/src/device/requirements.rs | 12 + crates/metal2vulkan/src/error/mod.rs | 27 +- .../src/lower/arith/color_write.rs | 9 + crates/metal2vulkan/src/lower/push.rs | 2 + .../src/lower/sampler/compared.rs | 4 +- crates/metal2vulkan/src/lower/sampler/emit.rs | 26 +- crates/metal2vulkan/src/lower/sampler/mod.rs | 5 + .../metal2vulkan/src/lower/sampler/select.rs | 50 +++ .../metal2vulkan/src/lower/sampler/shared.rs | 2 +- crates/metal2vulkan/src/lower/stage_io/mod.rs | 90 ++++- .../metal2vulkan/src/lower/stage_io/plan.rs | 42 ++ crates/metal2vulkan/src/lower/texture/mod.rs | 5 + crates/metal2vulkan/src/lower/texture/slot.rs | 40 +- crates/metal2vulkan/src/pipeline/api_tests.rs | 4 + crates/metal2vulkan/src/pipeline/artifact.rs | 7 +- crates/metal2vulkan/src/pipeline/compile.rs | 21 + .../metal2vulkan/src/pipeline/compile/api.rs | 27 +- .../metal2vulkan/src/pipeline/compile/key.rs | 21 +- .../src/pipeline/compile/tests.rs | 2 + .../metal2vulkan/src/pipeline/descriptor.rs | 42 +- crates/metal2vulkan/src/pipeline/graphics.rs | 10 + .../src/pipeline/link/graphics.rs | 3 + .../metal2vulkan/src/pipeline/lower_inputs.rs | 17 + .../src/pipeline/private_state.rs | 327 ++++++++++++++- crates/metal2vulkan/src/pipeline/stage_io.rs | 32 ++ crates/metal2vulkan/src/pipeline/sym.rs | 6 + .../src/tests/engine_depth_range.rs | 39 +- .../src/tests/engine_private_render_state.rs | 373 +++++++++++++++++- docs/API.md | 2 +- docs/FAST-PATHS.md | 5 + docs/REFUSALS.md | 224 ++++++----- docs/RUNTIME-PORTING.md | 8 +- scripts/refusal-surface/reach.tsv | 1 + 66 files changed, 3258 insertions(+), 353 deletions(-) create mode 100644 crates/metal2vulkan-validation/fixtures/public/engine/pdc_compare_clamp.air.ll create mode 100644 crates/metal2vulkan-validation/fixtures/public/engine/pdc_compare_clamp.ll create mode 100644 crates/metal2vulkan-validation/fixtures/public/engine/pdc_compare_clamp.metal create mode 100644 crates/metal2vulkan-validation/src/runtime_lane/alpha_tests.rs create mode 100644 crates/metal2vulkan-validation/src/runtime_lane/depth_compare_clamps.rs create mode 100644 crates/metal2vulkan-validation/src/runtime_lane/logic_ops.rs diff --git a/crates/metal2vulkan-runtime/src/amplification.rs b/crates/metal2vulkan-runtime/src/amplification.rs index 9eb4dc7c6..aedb44d29 100644 --- a/crates/metal2vulkan-runtime/src/amplification.rs +++ b/crates/metal2vulkan-runtime/src/amplification.rs @@ -15,7 +15,8 @@ //! into the first slice, the last one's texels kept). One above a maximum of 1 is refused: plain //! Metal stored garbage (probe 13 `amp2_pipeline1`, probe 2 `amp_2_on_1`, `amp_3_on_1`). Metal //! reads `count` mappings from its pointer; a slice of fewer is refused at the setter, and one of -//! more gives its first `count`. +//! more gives its first `count`. `setVertexAmplificationMode:value:` sets the count and keeps the +//! mappings ([`Amplification::with_count`], `apple_only.rs`). use super::capabilities::MAX_VERTEX_AMPLIFICATION; use super::render::DrawProblem; @@ -85,6 +86,17 @@ impl Amplification { Ok(Amplification { count, mappings }) } + /// The amplification of `count` with these view mappings kept + /// (`setVertexAmplificationMode:value:`, `apple_only.rs`): `None` where there are mappings + /// and the count passes them, which Metal's measurements do not reach. + pub(super) fn with_count(&self, count: u64) -> Option { + let mappings = match self.mappings.is_empty() { + true => Vec::new(), + false => self.mappings.get(..usize::try_from(count).ok()?)?.to_vec(), + }; + Some(Amplification { count, mappings }) + } + /// Whether a draw draws nothing: a count of 0 (the module docs). pub(super) fn draws_nothing(&self) -> bool { self.count == 0 diff --git a/crates/metal2vulkan-runtime/src/apple_only.rs b/crates/metal2vulkan-runtime/src/apple_only.rs index 9f62b195d..0f9ce27cd 100644 --- a/crates/metal2vulkan-runtime/src/apple_only.rs +++ b/crates/metal2vulkan-runtime/src/apple_only.rs @@ -10,12 +10,19 @@ //! or 1, `render/provoking.rs`; //! - the call acts on state no runtime object has: Vulkan shows no texture compression, so a //! reinterpretation flush has nothing to flush, and after an invalidation Metal leaves the -//! contents undefined, so keeping them is one of the outcomes Metal allows; and no pipeline the -//! runtime builds has a fixed-function alpha test, so its reference value has no effect, as on -//! Metal with the test off. +//! contents undefined, so keeping them is one of the outcomes Metal allows; +//! - the call sets encoder state a runtime pipeline reads as Metal's does: the alpha test +//! reference, which a pipeline with the private alpha test compares against (`BindState`'s +//! `alpha_test_reference`). //! //! - `setPointSize:`, which Metal measured makes a no-op: the point is the vertex function's -//! `[[point_size]]`. +//! `[[point_size]]`; and `setDepthCleared` and `setStencilCleared`, which change nothing Metal +//! draws (the consumer's suite case on the M3 Max, pixel for pixel). +//! - `setVertexAmplificationMode:value:`, which sets the amplification count +//! `setVertexAmplificationCount:viewMappings:` sets and keeps the view mappings that call set, +//! whichever of the two comes last deciding (the consumer's measurements on the M3 Max, modes 0 +//! to 8, 15, 16, 255 and the largest values): the count is the value's set bits in mode 1 and the +//! value in every other mode, exact from 1 to 8 (`amplification_mode_count`). //! //! A provoking vertex mode past 1, which Metal draws a third way that differs between pipeline //! states, is accepted and drawn as mode 1, announced at the call (`provoking-vertex-unmatched`). @@ -24,8 +31,10 @@ //! - nonzero protection options, whose effect on Metal is not measured (Vulkan's protected //! memory is the nearest form); //! - a line width other than 1 (Apple's wide-line rule is unmeasured, where Vulkan has -//! `wideLines`), and vertex amplification mode, and depth or stencil "cleared", whose meaning -//! or raw values are unmeasured; +//! `wideLines`); +//! - a vertex amplification mode whose count is 0, which draws a number of copies that changes +//! from run to run on Metal, or above 8 (9 draws one copy and 16 and 32 eight, the rest +//! unmeasured), and one whose count passes the view mappings kept (unmeasured); //! - turning the viewport transform off, which Vulkan has no switch for and whose meaning on //! Metal is not measured; //! - a texture over an IOSurface made with `kIOSurfaceClientDirection`, a key in no header of the @@ -44,6 +53,7 @@ use super::blit::BlitCommandEncoder; use super::blit_texture::check_slice_level; +use super::capabilities::MAX_VERTEX_AMPLIFICATION; use super::command_buffer::CommandBuffer; use super::compute::ComputeCommandEncoder; use super::error::Error; @@ -64,12 +74,10 @@ pub enum AppleOnly { LineWidth, /// The viewport transform turned off (`setViewportTransformEnabled:NO`). ViewportTransformDisabled, - /// `setVertexAmplificationMode:value:`. + /// `setVertexAmplificationMode:value:` of a count (the value's set bits in mode 1, else the + /// value) of 0, whose copies change from run to run on Metal, or above 8, or above the view + /// mappings kept. VertexAmplificationMode, - /// `setDepthCleared`. - DepthCleared, - /// `setStencilCleared`. - StencilCleared, /// A texture over an IOSurface made with `kIOSurfaceClientDirection` /// (`newTextureWithDescriptor:iosurface:plane:` of such a surface): IOSurface SPI, a key /// IOSurface.framework exports and no header of the public macOS SDK declares, so the @@ -99,8 +107,6 @@ impl AppleOnly { | Self::LineWidth | Self::ViewportTransformDisabled | Self::VertexAmplificationMode - | Self::DepthCleared - | Self::StencilCleared | Self::SurfaceClientDirection => AppleOnlyGap::Unmeasured, } } @@ -179,7 +185,9 @@ impl AppleOnlyCall { | AppleOnlyCall::CompressedTextureReinterpretationFlush | AppleOnlyCall::SetAlphaTestReferenceValue(_) | AppleOnlyCall::SetPointSize(_) - | AppleOnlyCall::SetProvokingVertexMode(_) => Ok(()), + | AppleOnlyCall::SetProvokingVertexMode(_) + | AppleOnlyCall::SetDepthCleared + | AppleOnlyCall::SetStencilCleared => Ok(()), AppleOnlyCall::SetProtectionOptions(options) => default_or( options == DEFAULT_PROTECTION_OPTIONS, AppleOnly::ProtectedContent, @@ -188,15 +196,24 @@ impl AppleOnlyCall { AppleOnlyCall::SetViewportTransformEnabled(enabled) => { default_or(enabled, AppleOnly::ViewportTransformDisabled) } - AppleOnlyCall::SetVertexAmplificationMode { .. } => { - Err(AppleOnly::VertexAmplificationMode) - } - AppleOnlyCall::SetDepthCleared => Err(AppleOnly::DepthCleared), - AppleOnlyCall::SetStencilCleared => Err(AppleOnly::StencilCleared), + AppleOnlyCall::SetVertexAmplificationMode { mode, value } => default_or( + (1..=MAX_VERTEX_AMPLIFICATION).contains(&lification_mode_count(mode, value)), + AppleOnly::VertexAmplificationMode, + ), } } } +/// The amplification count `setVertexAmplificationMode:value:` sets (the consumer's measurements +/// on the M3 Max): the number of `value`'s set bits in mode 1, and `value` in every other mode. +/// Metal draws that many copies, amplification IDs from 0 up, for a count from 1 to 8. +pub(crate) fn amplification_mode_count(mode: u64, value: u64) -> u64 { + match mode { + 1 => u64::from(value.count_ones()), + _ => value, + } +} + /// `Ok` where the call states Metal's default, else the refusal of `feature`. fn default_or(is_default: bool, feature: AppleOnly) -> Result<(), AppleOnly> { if is_default { @@ -268,7 +285,9 @@ impl RenderLowering { /// The lowering of [`RenderCommandEncoder::set_alpha_test_reference_value`]. pub(crate) fn set_alpha_test_reference_value(&mut self, value: f32) -> Result<(), Error> { self.log(|_| RenderCall::AlphaTestReferenceValue(value)); - answer(AppleOnlyCall::SetAlphaTestReferenceValue(value)) + answer(AppleOnlyCall::SetAlphaTestReferenceValue(value))?; + self.set_alpha_test_reference(value); + Ok(()) } /// The lowering of [`RenderCommandEncoder::set_line_width`]. @@ -303,7 +322,9 @@ impl RenderLowering { value: u64, ) -> Result<(), Error> { self.log(|_| RenderCall::VertexAmplificationMode(mode, value)); - answer(AppleOnlyCall::SetVertexAmplificationMode { mode, value }) + answer(AppleOnlyCall::SetVertexAmplificationMode { mode, value })?; + self.amplify_with_kept_mappings(amplification_mode_count(mode, value)) + .ok_or(Error::AppleOnly(AppleOnly::VertexAmplificationMode)) } /// The lowering of [`RenderCommandEncoder::set_depth_cleared`]. @@ -320,8 +341,10 @@ impl RenderLowering { } impl RenderCommandEncoder { - /// `setAlphaTestReferenceValue:` (SPI): a no-op. No pipeline the runtime builds has a - /// fixed-function alpha test, so the reference has no effect, as on Metal with the test off. + /// `setAlphaTestReferenceValue:` (SPI): the reference a pipeline with the private alpha test + /// (`PrivateRenderState::alpha_test_enabled`) compares its fragments' color 0 alpha against, + /// both as Metal's 8-bit unorm codes; each encoder starts at Metal's 1. Accepted for every + /// value, as on Metal. pub fn set_alpha_test_reference_value(&mut self, value: f32) -> Result<(), Error> { match self.lowers_at_call() { true => self.at_call(|lowering| lowering.set_alpha_test_reference_value(value)), @@ -380,8 +403,14 @@ impl RenderCommandEncoder { } } - /// `setVertexAmplificationMode:value:` (SPI): refused - /// ([`AppleOnly::VertexAmplificationMode`]), its meaning unmeasured. + /// `setVertexAmplificationMode:value:` (SPI): sets the amplification count + /// [`set_vertex_amplification_count`](Self::set_vertex_amplification_count) sets, the number + /// of `value`'s set bits in mode 1 and `value` in every other mode, and keeps the view mappings + /// that call set (none at the encoder's start), as Metal does (the consumer's measurements on + /// the M3 Max). Refused + /// ([`AppleOnly::VertexAmplificationMode`]) for a count of 0, whose copies Metal draws change + /// from run to run, above 8 (unmeasured but for three values), or above the view mappings kept + /// (unmeasured); a refused call keeps the amplification set before. pub fn set_vertex_amplification_mode(&mut self, mode: u64, value: u64) -> Result<(), Error> { match self.lowers_at_call() { true => self.at_call(|lowering| lowering.set_vertex_amplification_mode(mode, value)), @@ -389,7 +418,8 @@ impl RenderCommandEncoder { } } - /// `setDepthCleared` (SPI): refused ([`AppleOnly::DepthCleared`]), its meaning unmeasured. + /// `setDepthCleared` (SPI): a no-op. It changes nothing Metal draws (the consumer's suite case + /// on the M3 Max, pixel for pixel). pub fn set_depth_cleared(&mut self) -> Result<(), Error> { match self.lowers_at_call() { true => self.at_call(|lowering| lowering.set_depth_cleared()), @@ -397,8 +427,7 @@ impl RenderCommandEncoder { } } - /// `setStencilCleared` (SPI): refused ([`AppleOnly::StencilCleared`]), its meaning - /// unmeasured. + /// `setStencilCleared` (SPI): a no-op, as [`set_depth_cleared`](Self::set_depth_cleared) is. pub fn set_stencil_cleared(&mut self) -> Result<(), Error> { match self.lowers_at_call() { true => self.at_call(|lowering| lowering.set_stencil_cleared()), diff --git a/crates/metal2vulkan-runtime/src/clear_value.rs b/crates/metal2vulkan-runtime/src/clear_value.rs index 6d2724917..1139db9a5 100644 --- a/crates/metal2vulkan-runtime/src/clear_value.rs +++ b/crates/metal2vulkan-runtime/src/clear_value.rs @@ -338,12 +338,14 @@ pub(super) fn resolved_nan_texel( /// Where a channel of `value`, the Vulkan clear value [`color`] gives an attachment of `pf` whose /// channels are 32-bit floats, is a NaN: the unsigned-integer format of the texel's size and the -/// clear value that writes the texel's bits, which the device's clear writes too (a `float` -/// converts nothing), for a write of the texel elsewhere (`nan_clear.rs`'s resolves). `None` for -/// another format or a clear without a NaN. +/// clear value that writes, where `kept`, the texel's bits, which the device's clear writes too (a +/// `float` converts nothing), else the texel Metal's resolve stores from samples that each hold +/// it, each NaN channel `0x7fc00000`; for a write of the texel elsewhere (`nan_clear.rs`'s +/// resolves). `None` for another format or a clear without a NaN. pub(super) fn float_nan_texel( pf: PixelFormat, value: &vk::ClearColorValue, + kept: bool, ) -> Option<(Format, vk::ClearColorValue)> { let channels = channels(pf)?; // SAFETY: every member of the union is four 32-bit values; any bits are a valid `f32`. @@ -357,10 +359,11 @@ pub(super) fn float_nan_texel( if !used.iter().any(|v| v.is_nan()) { return None; } - let bytes: Vec = used - .iter() - .flat_map(|v| v.to_bits().to_le_bytes()) - .collect(); + let bits = |v: &f32| match v.is_nan() && !kept { + true => 0x7fc0_0000, + false => v.to_bits(), + }; + let bytes: Vec = used.iter().flat_map(|v| bits(v).to_le_bytes()).collect(); uint_texel(&bytes) } @@ -1198,51 +1201,72 @@ pub(crate) mod tests { /// A 32-bit float NaN clears to the double's sign and top payload bits, quieted, as Metal's /// conversion (`0x7ff0000020000000` stores `0x7fc00001`, `0xfff8...` /// `0xffc00000`, `0x7ffc...` `0x7fe00000`, the signalling `0x7ff0...01` `0x7fc00000`), and - /// `float_nan_texel` gives those bits; a clear without a NaN, or of another format, none. + /// `float_nan_texel` gives those bits where kept, and each NaN channel `0x7fc00000` where + /// not, Metal's resolve of them (its other channels as they are); a clear without a NaN, or of + /// another format, none. #[test] fn float_nan_texels_are_metal_s_conversion() { let nan = f64::from_bits; - let cases: &[(PixelFormat, [f64; 4], &str)] = &[ + // The clear, its kept texel and its resolved one. + let cases: &[(PixelFormat, [f64; 4], &str, &str)] = &[ ( P::R32Float, [nan(0x7ff0_0000_2000_0000), 0.0, 0.0, 0.0], "0100c07f", + "0000c07f", ), ( P::R32Float, [nan(0xfff8_0000_0000_0000), 0.0, 0.0, 0.0], "0000c0ff", + "0000c07f", ), ( P::R32Float, [nan(0x7ffc_0000_0000_0000), 0.0, 0.0, 0.0], "0000e07f", + "0000c07f", ), ( P::R32Float, [nan(0x7ff0_0000_0000_0001), 0.0, 0.0, 0.0], "0000c07f", + "0000c07f", ), ( P::RG32Float, [nan(0x7ff8_0000_0000_0000), 1.0, 0.0, 0.0], "0000c07f0000803f", + "0000c07f0000803f", + ), + ( + P::RGBA32Float, + [ + 0.5, + nan(0xfff8_0000_0000_0000), + -2.0, + nan(0x7ffc_0000_0000_0000), + ], + "0000003f0000c0ff000000c00000e07f", + "0000003f0000c07f000000c00000c07f", ), ]; - for &(pf, c, want) in cases { + for &(pf, c, kept, resolved) in cases { let value = color(pf, c, ClearRoute::ThroughHalf).unwrap(); - let (format, bits) = float_nan_texel(pf, &value).unwrap(); - let format_for = |size: usize| uint_texel(&vec![0; size]).unwrap().0; - assert!(format == format_for(want.len() / 2), "{pf:?}"); - // SAFETY: `float_nan_texel` writes `uint32`. - let words = unsafe { bits.uint32 }; - let bytes: Vec = words.iter().flat_map(|w| w.to_le_bytes()).collect(); - assert_eq!(hex(&bytes[..want.len() / 2]), want, "{pf:?} {c:?}"); + for (keeps, want) in [(true, kept), (false, resolved)] { + let (format, bits) = float_nan_texel(pf, &value, keeps).unwrap(); + let format_for = |size: usize| uint_texel(&vec![0; size]).unwrap().0; + assert!(format == format_for(want.len() / 2), "{pf:?}"); + // SAFETY: `float_nan_texel` writes `uint32`. + let words = unsafe { bits.uint32 }; + let bytes: Vec = words.iter().flat_map(|w| w.to_le_bytes()).collect(); + assert_eq!(hex(&bytes[..want.len() / 2]), want, "{pf:?} {c:?} {keeps}"); + } } let finite = color(P::R32Float, [0.5, 0.0, 0.0, 0.0], ClearRoute::ThroughHalf); - assert!(float_nan_texel(P::R32Float, &finite.unwrap()).is_none()); + assert!(float_nan_texel(P::R32Float, &finite.unwrap(), true).is_none()); let half = color(P::RGBA16Float, [f64::NAN; 4], ClearRoute::ThroughHalf); - assert!(float_nan_texel(P::RGBA16Float, &half.unwrap()).is_none()); + assert!(float_nan_texel(P::RGBA16Float, &half.unwrap(), false).is_none()); } /// Where Metal keeps a NaN clear's sign it keeps the top ten bits of the double's payload diff --git a/crates/metal2vulkan-runtime/src/enables.rs b/crates/metal2vulkan-runtime/src/enables.rs index 704452e15..9e1a4c0dd 100644 --- a/crates/metal2vulkan-runtime/src/enables.rs +++ b/crates/metal2vulkan-runtime/src/enables.rs @@ -639,6 +639,7 @@ members! { Core.core.tessellation_shader => TessellationShader; Core.core.sample_rate_shading => SampleRateShading; Core.core.dual_src_blend => DualSrcBlend; + Core.core.logic_op => LogicOp; Core.core.independent_blend => IndependentBlend; Core.core.shader_clip_distance => ShaderClipDistance; Core.core.shader_cull_distance => ShaderCullDistance; diff --git a/crates/metal2vulkan-runtime/src/error.rs b/crates/metal2vulkan-runtime/src/error.rs index 4d278ced2..7af6657fd 100644 --- a/crates/metal2vulkan-runtime/src/error.rs +++ b/crates/metal2vulkan-runtime/src/error.rs @@ -1499,6 +1499,19 @@ pub enum RuntimeGap { /// The descriptor's pixel format. pixel_format: PixelFormat, }, + /// The multisample resolve (`MultisampleResolve`, `StoreAndMultisampleResolve`) of a color + /// attachment of an extended-range format (`BGRA10_XR`, `BGR10_XR` and their `_sRGB` twins), + /// which Metal makes. The runtime holds such an attachment's raw codes and builds no resolve of + /// them. Metal's, measured on an M3 Max under macOS 27.0.1 at 2 and 4 samples: `BGR10_XR`'s + /// channels and `BGRA10_XR`'s color are the average of the samples' stored 10-bit codes, + /// rounded half up (every texel probed); `BGRA10_XR`'s alpha is near the average of the + /// samples' alphas as `half` values clamped to `[0, 1]`, and the `_sRGB` twins' color near the + /// encoded average of the samples' linear values (not fitted to the code). Both of those read + /// the values the fragment function wrote, which the stored codes do not keep. + ExtendedRangeResolve { + /// The attachment's pixel format. + pixel_format: PixelFormat, + }, /// An unbalanced command-predication record (`ComputeCommandEncoder::encode_end_if` and the /// other ends, or `encode_start_else`, with no block open; `encode_start_if` on a nil buffer /// with none) that is its unit's first record, after dispatches of the unit (of this encoder, diff --git a/crates/metal2vulkan-runtime/src/nan_clear.rs b/crates/metal2vulkan-runtime/src/nan_clear.rs index fc6998a32..e85cc55fa 100644 --- a/crates/metal2vulkan-runtime/src/nan_clear.rs +++ b/crates/metal2vulkan-runtime/src/nan_clear.rs @@ -30,21 +30,25 @@ //! texel, its sign kept, where the sign is kept and Metal also keeps the resolve texture compressed //! (at its level, of the attachment's extent); elsewhere it averages the samples, each NaN counted //! zero ([`clear_value::resolved_nan_texel`]): a `PixelFormatView` or unoptimized resolve texture, -//! a level under 16 a side, or a later pass that loads the attachment and resolves it, alike. No -//! device's resolve gives either (each keeps the NaN, or zeroes it where Metal -//! keeps it: MoltenVK after the copy), so in such a pass the resolve texture's render area is -//! written after the pass's resolve, its copies included, the same way: a scratch image cleared to -//! that texel's bits and copied in. A pass with a draw call resolves by the device -//! (`device-rounded-resolve`). +//! a level under 16 a side, a pass whose draw calls draw nothing (a draw call of no vertices drops +//! the sign as any draw call does), or a later pass that loads the attachment and resolves it, +//! alike. No device's resolve gives either (each keeps the NaN, or zeroes it where Metal keeps it: +//! MoltenVK after the copy), so in a pass whose draws reach no tile, every sample holding the +//! clear, the resolve texture's render area is written after the pass's resolve, its copies +//! included, the same way: a scratch image cleared to that texel's bits and copied in. A pass that +//! draws resolves by the device (`device-rounded-resolve`). //! //! **32-bit floats**. Metal clears a `float` NaN as the double's conversion, its sign and top //! payload bits kept, at every level, as the devices' clears do ([`clear_value::color`] states the //! bits), so such a clear needs nothing before the pass. Its resolve in a pass with no draw call -//! keeps the clear's texel where the `half` NaN's resolve keeps it, and makes `0x7fc00000` -//! elsewhere. The exact resolve (`color_resolve.rs`) makes `0x7fc00000` everywhere, so the kept -//! resolve is written after the pass as the `half` one's is ([`clear_value::float_nan_texel`]), on -//! every device alike: where the device's resolve kept the texel already, the write stores the same -//! bits. +//! keeps the clear's texel where the `half` NaN's resolve keeps it, and makes `0x7fc00000` in each +//! NaN channel elsewhere, a pass whose draw calls draw nothing among them (the consumer's M3 Max: +//! `R32Float`, `RG32Float` and `RGBA32Float` at 2 and 4 samples, 16 a side, cleared to `-NaN`, a +//! draw call of no vertices: `0x7fc00000`). A device's resolve need give neither: MoltenVK's, which +//! is Metal's own resolve, keeps the sign where its pass records no draw. So in a pass whose draws +//! reach no tile the resolve is written after the pass as the `half` one's is, the kept texel or +//! Metal's resolve of it ([`clear_value::float_nan_texel`]), on every device alike: where the +//! device's resolve stored it already, the write stores the same bits. //! //! **Copies that convert NaNs**. A device whose copy into a multisampled float image draws the //! samples through that image's format (`RuntimeDriverDefect::MultisampledCopiesConvertFloatNans`: @@ -153,12 +157,13 @@ struct ViewClear { impl NanClears { /// The clears of `layout`'s attachments, a pass with a draw call where `called` /// (`clear_reach::cleared`), each attachment cleared here then loaded in the pass; then, - /// in a pass without one, the writes of their resolves after the pass (the module docs). - /// `None` for either when there is none; refused as the module docs say. + /// in a pass whose draws reach no tile (`drew` false: no draw call, or draw calls that draw + /// nothing), the writes of their resolves after the pass (the module docs). `None` for either + /// when there is none; refused as the module docs say. pub(super) fn plan( maker: &CommandBuffer, layout: &mut PassLayout, - called: bool, + (called, drew): (bool, bool), ) -> Result<(Option, Option), Error> { let mut before = Writes::default(); let mut after = Writes::default(); @@ -169,8 +174,8 @@ impl NanClears { }; let pixel_format = color.target.texture.pixel_format(); let signed = keeps_nan_sign(&color.target, called); - // The resolve texture's level and slice, where a pass without a draw call resolves - // the samples. + // The resolve texture's level and slice, where the pass's draws reach no tile, so + // every sample holds the clear. let resolves = matches!( color.store, StoreAction::MultisampleResolve | StoreAction::StoreAndMultisampleResolve @@ -178,17 +183,19 @@ impl NanClears { let to = color .resolve .as_ref() - .filter(|_| resolves && !called && color.target.samples > 1) + .filter(|_| resolves && !drew && color.target.samples > 1) .map(|r| r.copy_to.as_ref().unwrap_or(&r.attachment)); let Some(texel) = clear_value::nan_texel(pixel_format, &color.clear, signed) else { // A 32-bit float NaN, which the device clears as Metal does: its resolve written - // with the clear's texel where Metal keeps it, as below (the module docs). - let kept = to.filter(|to| signed && keeps_nan_sign(to, called)); - if let (Some(to), Some(texel)) = ( - kept, - clear_value::float_nan_texel(pixel_format, &color.clear), - ) { - after.add(maker, to, texel, layout.extent)?; + // with the clear's texel where Metal keeps it, else with Metal's resolve of it, as + // below (the module docs). + if let Some(to) = to { + let kept = signed && keeps_nan_sign(to, called); + if let Some(texel) = + clear_value::float_nan_texel(pixel_format, &color.clear, kept) + { + after.add(maker, to, texel, layout.extent)?; + } } continue; }; diff --git a/crates/metal2vulkan-runtime/src/pipeline/graphics.rs b/crates/metal2vulkan-runtime/src/pipeline/graphics.rs index a598541ca..529009b45 100644 --- a/crates/metal2vulkan-runtime/src/pipeline/graphics.rs +++ b/crates/metal2vulkan-runtime/src/pipeline/graphics.rs @@ -322,6 +322,9 @@ pub(crate) struct GraphicsContent { stencil: [vk::StencilOpState; 2], blends: Vec, blend_flags: vk::PipelineColorBlendStateCreateFlags, + /// The pipeline's logic operation (`GraphicsState::logic_op`): Metal's private + /// `logicOperation` where Vulkan's draws it. + logic_op: Option, patch_control_points: Option, /// A mesh pipeline: no vertex input and no input assembly. meshes: bool, @@ -562,6 +565,7 @@ impl GraphicsContent { &graphics.color_attachments, key.fixed.masks_color, key.pass.fetch_inputs, + graphics.logic_op, )) .text(&multisample) .finish(), @@ -703,9 +707,12 @@ impl GraphicsContent { .stencil_test_enable(self.stencil_test) .front(self.stencil[0]) .back(self.stencil[1]); - let blend = vk::PipelineColorBlendStateCreateInfo::default() + let mut blend = vk::PipelineColorBlendStateCreateInfo::default() .attachments(&self.blends) .flags(self.blend_flags); + if let Some(op) = self.logic_op { + blend = blend.logic_op_enable(true).logic_op(op); + } let dynamic = vk::PipelineDynamicStateCreateInfo::default().dynamic_states(&self.dynamic); let tessellation = self.patch_control_points.map(|points| { vk::PipelineTessellationStateCreateInfo::default().patch_control_points(points) @@ -975,6 +982,7 @@ impl VariantObjects { stencil: [face(ds.front), face(ds.back)], blends, blend_flags, + logic_op: graphics.logic_op.map(Into::into), patch_control_points: graphics.tessellation.map(|t| t.patch_control_points), meshes: pipeline .stages diff --git a/crates/metal2vulkan-runtime/src/render.rs b/crates/metal2vulkan-runtime/src/render.rs index b225d5965..df9fb89a1 100644 --- a/crates/metal2vulkan-runtime/src/render.rs +++ b/crates/metal2vulkan-runtime/src/render.rs @@ -3014,6 +3014,21 @@ impl RenderLowering { Ok(()) } + /// Set the alpha test reference (`setAlphaTestReferenceValue:`, `apple_only.rs`), which a + /// pipeline with the private alpha test compares against (`BindState::alpha_test_reference`). + pub(crate) fn set_alpha_test_reference(&mut self, value: f32) { + self.state.set_alpha_test_reference(value); + } + + /// Set the amplification count `count` with the view mappings set before kept + /// (`setVertexAmplificationMode:value:`, `apple_only.rs`); `None`, the amplification kept, + /// where the count passes them ([`Amplification::with_count`]). + pub(crate) fn amplify_with_kept_mappings(&mut self, count: u64) -> Option<()> { + let amplified = self.amplification.with_count(count)?; + *self.amplification = amplified; + Some(()) + } + /// The lowering of [`RenderCommandEncoder::draw_primitives`]. pub(crate) fn draw_primitives( &mut self, @@ -4534,10 +4549,10 @@ impl RenderLowering { // A clear holding a `half` or small-float NaN: written before the pass as Metal writes // it, through a scratch image of an integer format, and loaded in the pass // (`nan_clear.rs`). After the stand-ins' copies, which keep the attachment's own load. - // And, in a pass without a draw call, its resolves written after the pass as Metal's - // resolve stores them (`nan_clear.rs`). + // And, in a pass whose draws reach no tile, its resolves written after the pass as + // Metal's resolve stores them (`nan_clear.rs`). let (nan_clears, nan_resolves) = - NanClears::plan(core.command_buffer(), &mut layout, called)?; + NanClears::plan(core.command_buffer(), &mut layout, (called, drew))?; // A depth whose `Clear` load held a NaN, loaded instead: Metal's word written into its // texture over the clear's reach before the pass, before anything copies the depth out // of it (`nan_clear.rs`). @@ -5605,6 +5620,9 @@ impl RenderLowering { state.viewport_count = self.state.viewport_count(true); // An extended-range blend computed in the shader reads the blend color as push data. state.blend_color = self.state.blend_color(); + // A fragment function that runs the pipeline's private alpha test reads the reference as + // push data. + state.alpha_test_reference = self.state.alpha_test_reference(); // A fragment function that runs the draw's depth test itself clamps its depth as the // encoder's depth clip mode says, read as push data (its range: `draw_resident`). state.depth_clip_mode_clamp = self.state.depth_clip_mode_clamp(); diff --git a/crates/metal2vulkan-runtime/src/render/late_resolve.rs b/crates/metal2vulkan-runtime/src/render/late_resolve.rs index d7aa37059..2013db011 100644 --- a/crates/metal2vulkan-runtime/src/render/late_resolve.rs +++ b/crates/metal2vulkan-runtime/src/render/late_resolve.rs @@ -18,8 +18,9 @@ //! store action where that is known (one that resolves needs a target, and a target one that //! resolves); a late store action that resolves needs the target set when it is, and one that does //! not drops the attachment's resolve, as plain Metal leaves a resolve texture under such an action -//! untouched. Each refusal is the descriptor's, typed, and leaves the target set -//! before. +//! untouched, as is a target of a pixel format Metal does not store the attachment into +//! (`resolve::untouched_across_formats`). Each refusal is the descriptor's, typed, and leaves the +//! target set before. //! //! **The mechanism.** The encoder begins the pass at `end_encoding` (the deferred pass begin, //! `render.rs`), so a target only replaces the attachment's resolve in the pass's layout, and @@ -135,14 +136,18 @@ impl RenderLowering { } _ => {} } + let wanted = wanted(target.as_ref(), color.store); let resolve = resolve::color( CALL, &maker, which, &color.target, - &wanted(target.as_ref(), color.store), + &wanted, (color.load, color.clear), )?; + // A target Metal leaves untouched across formats, as the descriptor's. + color.unresolved_across = + resolve.is_none() && resolve::unresolved_across(&color.target, &wanted); color.resolve = resolve; // A single-sampled attachment's copied resolve is replaced too (a late target of one is // refused, `ResolveSourceSamples`: plain Metal's answer is unmeasured). diff --git a/crates/metal2vulkan-runtime/src/render_pass.rs b/crates/metal2vulkan-runtime/src/render_pass.rs index 01e2c8815..a5fe5c4e5 100644 --- a/crates/metal2vulkan-runtime/src/render_pass.rs +++ b/crates/metal2vulkan-runtime/src/render_pass.rs @@ -627,6 +627,10 @@ pub(super) struct ColorTarget { /// texels copied there after the pass (`resolve::color_copy`), the last instance storing /// them whatever Metal's store action. pub(super) copied_resolve: Option, + /// The descriptor names a resolve texture of a pixel format Metal does not store the + /// multisampled attachment into, which it leaves untouched (`resolve::untouched_across_formats`): + /// the attachment does not resolve, and stores by its action. + pub(super) unresolved_across: bool, /// What `target` stands in for, when an image of the pass stands in for the attachment's /// own (`attachment_stand_in.rs`; the encoder decides it at a draw). pub(super) stand_in: Option, @@ -653,6 +657,7 @@ impl std::fmt::Debug for ColorTarget { ) .field("resolve", &self.resolve) .field("copied_resolve", &self.copied_resolve) + .field("unresolved_across", &self.unresolved_across) .field("stand_in", &self.stand_in) .field("planes", &self.planes) .finish() @@ -662,21 +667,23 @@ impl std::fmt::Debug for ColorTarget { impl ColorTarget { /// Whether the pass clears the attachment and resolves it alone (`MultisampleResolve`) into a /// resolve texture of another pixel format than the attachment's own (its sRGB twin, the only - /// other format the runtime resolves into): pixel format identity, not the twin relation. - /// Where such a pass has no draw call, Metal keeps the samples' earlier texels, its texture - /// compressed or not (`RGBA8Unorm`, `BGRA8Unorm` and the extended-range - /// formats, each way, an Apple M4 under macOS 27.0.1), where a resolve into the attachment's - /// own format leaves the clear in a texture it compresses. The attachment's own texture is its - /// stand-in's where one stands in for it. + /// other format the runtime resolves into, or one Metal leaves untouched, + /// `unresolved_across`): pixel format identity, not the twin relation. Where such a pass has + /// no draw call, Metal keeps the samples' earlier texels, its texture compressed or not + /// (`RGBA8Unorm`, `BGRA8Unorm` and the extended-range formats, each way, an Apple M4 under + /// macOS 27.0.1; `BGRA8Unorm` and `BGRA8Unorm_sRGB` into `RGBA16Float`, `BGR10_XR` and its + /// twin, the consumer's M3 Max), where a resolve into the attachment's own format leaves the + /// clear in a texture it compresses. The attachment's own texture is its stand-in's where one + /// stands in for it. pub(super) fn clears_and_resolves_across_formats(&self) -> bool { let own = self.stand_in.as_ref().map_or(&self.target, |s| &s.own); let into = self .resolve .as_ref() .map(|r| r.copy_to.as_ref().unwrap_or(&r.attachment)); - self.load == LoadAction::Clear - && self.store == StoreAction::MultisampleResolve - && into.is_some_and(|into| into.texture.pixel_format() != own.texture.pixel_format()) + let across = self.unresolved_across + || into.is_some_and(|into| into.texture.pixel_format() != own.texture.pixel_format()); + self.load == LoadAction::Clear && self.store == StoreAction::MultisampleResolve && across } } @@ -1449,6 +1456,9 @@ pub(super) fn layout( None, ), }; + // A resolve texture Metal leaves untouched across formats (`resolve::destination` + // checked it and gave no resolve). + let unresolved_across = resolve.is_none() && resolve::unresolved_across(&target, &wanted); extents[attached] = (target.extent, target.samples); attached += 1; colors.push(Some(ColorTarget { @@ -1461,6 +1471,7 @@ pub(super) fn layout( straight_clear, resolve, copied_resolve, + unresolved_across, stand_in, planes: None, })); diff --git a/crates/metal2vulkan-runtime/src/render_state.rs b/crates/metal2vulkan-runtime/src/render_state.rs index c356256bd..454de44f0 100644 --- a/crates/metal2vulkan-runtime/src/render_state.rs +++ b/crates/metal2vulkan-runtime/src/render_state.rs @@ -193,6 +193,8 @@ pub(super) struct EncoderState { /// What Metal's depth bias, slope scale and clamp do to a triangle's depth. depth_bias: DepthBiasEffect, blend_color: [f32; 4], + /// `setAlphaTestReferenceValue:` (SPI); `None` until set, which Metal's test compares as 1. + alpha_test_reference: Option, fill_mode: TriangleFillMode, clip_mode: DepthClipMode, /// Apple's `setProvokingVertexMode:` at 1: a primitive's flat inputs read its last vertex @@ -230,6 +232,7 @@ impl EncoderState { clamp: 0.0, }, blend_color: [0.0; 4], + alpha_test_reference: None, fill_mode: TriangleFillMode::Fill, clip_mode: DepthClipMode::Clip, provoking_last: false, @@ -367,6 +370,12 @@ impl EncoderState { self.blend_color = color; } + /// `setAlphaTestReferenceValue:` (SPI), which a pipeline with the private alpha test compares + /// its fragments' alpha against (`BindState::alpha_test_reference`). + pub(super) fn set_alpha_test_reference(&mut self, value: f32) { + self.alpha_test_reference = Some(value); + } + /// `setTriangleFillMode:`: `Lines` needs `fillModeNonSolid`. pub(super) fn set_fill_mode( &mut self, @@ -993,6 +1002,11 @@ impl EncoderState { self.blend_color } + /// The alpha test reference; `None` where the encoder never set it. + pub(super) fn alpha_test_reference(&self) -> Option { + self.alpha_test_reference + } + /// Whether the depth clip mode is `Clamp`: whether a fragment function that runs the draw's /// depth test itself clamps its depth to the range (`BindState::depth_clip_mode_clamp`; /// otherwise to `[0, 1]`). diff --git a/crates/metal2vulkan-runtime/src/resolve.rs b/crates/metal2vulkan-runtime/src/resolve.rs index 464dc0c74..88822eeb8 100644 --- a/crates/metal2vulkan-runtime/src/resolve.rs +++ b/crates/metal2vulkan-runtime/src/resolve.rs @@ -21,6 +21,20 @@ //! not): the attachment resolves nowhere. One of the attachment's count takes a copy of its //! samples, which the runtime does not build (refused, `ResolveSamples`), and a depth or //! stencil one a layout pattern (refused). +//! - **A resolve texture of a format the attachment's tile is not stored into** (our probe `xres` +//! on the M3 Max under macOS 27.0.1, plain Metal: 36 non-integer color formats at 2 and 4 +//! samples into 55 color formats, a Private attachment cleared and drawn or not, a Shared +//! resolve texture prefilled; the consumer's M3 Max measurements of `BGRA8Unorm` and +//! `BGRA8Unorm_sRGB` into `RGBA16Float`, `BGR10_XR` and its twin, macOS 26.6.2's Maps among +//! them, over every load action, storage modes, sizes up to 1920 by 1080 and IOSurfaces): Metal +//! holds the samples of an 8-bit norm, sRGB or packed 32-bit format as a word of codes, and of a +//! 16-bit norm format as 16-bit codes, and stores them only into a texture of a format held so +//! (or a 64-bit extended-range one); a resolve into any other format writes nothing +//! ([`untouched_across_formats`]). `MultisampleResolve` then leaves the samples as they were +//! before the pass, as `DontCare` does, and `StoreAndMultisampleResolve` stores them as `Store` +//! does: the runtime does not resolve, and stores the attachment so (in a pass without a draw +//! call that clears it, through a backing its texture keeps, `render.rs`). A half, float, +//! packed 16-bit or extended-range attachment's resolve writes every format measured. //! - **A resolve texture of another pixel format** (probes, an M4 with macOS 27.0.1; Metal's //! validation stops it, "does not match Resolve PixelFormat"): a multisampled attachment //! resolving into its format's sRGB twin keeps its own encoding, a texture or a view alike @@ -30,11 +44,13 @@ //! `BGRA8Unorm` and their twins the rule is one: the attachment's values in its own encoding, in //! the destination's channel order (a texture's or a view's; the four twin pairs measured and six //! of the eight across the orders); the other channel order is not built -//! (`NotImplemented(Render)`). Other pairs follow no one rule: `RGBA8Unorm` into `RGBA8Snorm` -//! writes its bytes (0x80 as 0x81), into `R32Uint`, `R32Float`, `RGBA8Uint` or `RGBA16Float` -//! nothing, `RGBA16Float` into `RGBA8Unorm` converts, `R32Float` into `R32Uint` writes its bits, -//! into `RGBA8Unorm` its red with zeros, and `RGBA16Float` into `RG32Float` a pattern of neither; -//! each stays refused (`ResolveFormat`). An integer format's resolve writes values no sample +//! (`NotImplemented(Render)`). The other pairs Metal writes (the M3 Max and an M4 alike) follow +//! no rule the runtime builds: a word of codes is stored into another such format as its codes +//! in that format's channel order, 0x80 as 0x81 into a snorm channel, a shared-exponent word +//! normalized, into `BGR10A2Unorm` as 10-bit fields swapped (`RGBA8Unorm` into `RGBA8Snorm` +//! writes its bytes, 0x80 as 0x81); `RGBA16Float` into `RGBA8Unorm` converts, `R32Float` into +//! `R32Uint` writes its bits, into `RGBA8Unorm` its red with zeros, and `RGBA16Float` into +//! `RG32Float` a pattern of neither; each stays refused (`ResolveFormat`). An integer format's resolve writes values no sample //! holds, which change from run to run (`RGBA8Uint`, `R32Uint`): refused. Measured over every //! integer color format (an M4 with macOS 27.0.1, without API validation, which //! stops it; the 19 formats, 4 samples, every subset of covered samples over a clear, two runs): @@ -71,7 +87,8 @@ //! without a resolve texture; a memoryless resolve texture (a Metal probe on an M4); a //! single-sampled depth or stencil attachment, or a color one's late target, a multisampled resolve //! texture (but a color one of another sample count, above), another pixel format (but a -//! multisampled color attachment's sRGB twin, above), an integer color format, a level or slice +//! multisampled color attachment's sRGB twin and a format its tile is not stored into, above), an +//! integer color format, a level or slice //! past the resolve texture, and a color level reaching past the attachment after a load other than //! `Clear`; `DepthResolvedSample` without a depth attachment, or with a separate depth texture //! stored beside it; and depth and stencil attachments of one texture that mix storing and @@ -385,13 +402,127 @@ impl<'a> Wanted<'a> { } } -/// The refusal of a resolve from or into a texture of `pf` that the runtime does not model: an -/// extended-range format's, whose resolve in Metal matches no average of its samples' values -/// measured. The format's Resolve capability answers it too (`families::formats`). +/// The refusal of a resolve from or into a texture of `pf` that the runtime does not build: an +/// extended-range format's (`RuntimeGap::ExtendedRangeResolve` states Metal's rule). The format's +/// Resolve capability answers it too (`families::formats`). pub(crate) fn unmodelled_resolve(pf: PixelFormat) -> Option { ExtendedRange::of(pf).map(|_| Unsupported::not_implemented(Feature::Format)) } +/// What Apple's GPU holds of a multisampled color attachment of a pixel format as its resolve +/// stores it, by the formats it stores that into ([`untouched_across_formats`]; our probe `xres`, +/// the M3 Max under macOS 27.0.1, plain Metal: each of the 36 non-integer color formats below at +/// 2 and 4 samples, resolved into a texture of each of the 55 color formats below). +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +enum ResolveTile { + /// A 32-bit word of codes: the 8-bit unorm, sRGB and snorm formats of one, two and four + /// channels and `A8Unorm`, and the packed 32-bit `RGB10A2Unorm`, `BGR10A2Unorm`, + /// `RG11B10Float` and `RGB9E5Float`. Stored into a texture of another such format as its codes + /// (and into `BGRA10_XR` and its twin as a pattern of neither). + Codes32, + /// 16-bit unorm and snorm codes: `R16Unorm`, `RG16Unorm`, `RGBA16Unorm` and their snorm + /// formats. Stored into a texture of another such format as its codes (and into `BGRA10_XR` + /// and its twin as a pattern). + Norm16, + /// Values: the half and float formats, the packed 16-bit ones and the extended-range ones. + /// Stored into a texture of every format measured, converted or as a pattern. + Values, + /// The integer formats, which are no resolve source: as a resolve texture, measured. + Integers, +} + +impl ResolveTile { + /// The tile of `pf`; `None` for a format the probe did not resolve into (a depth, stencil, + /// compressed, three-channel, two-plane or YCbCr format, `R16Float`'s private kin). + fn of(pf: PixelFormat) -> Option { + use PixelFormat as P; + Some(match pf { + P::A8Unorm + | P::R8Unorm + | P::R8UnormSRGB + | P::R8Snorm + | P::RG8Unorm + | P::RG8UnormSRGB + | P::RG8Snorm + | P::RGBA8Unorm + | P::RGBA8UnormSRGB + | P::RGBA8Snorm + | P::BGRA8Unorm + | P::BGRA8UnormSRGB + | P::RGB10A2Unorm + | P::BGR10A2Unorm + | P::RG11B10Float + | P::RGB9E5Float => ResolveTile::Codes32, + P::R16Unorm + | P::R16Snorm + | P::RG16Unorm + | P::RG16Snorm + | P::RGBA16Unorm + | P::RGBA16Snorm => ResolveTile::Norm16, + P::R16Float + | P::RG16Float + | P::RGBA16Float + | P::R32Float + | P::RG32Float + | P::RGBA32Float + | P::B5G6R5Unorm + | P::A1BGR5Unorm + | P::ABGR4Unorm + | P::BGR5A1Unorm + | P::BGR10XR + | P::BGR10XRSRGB + | P::BGRA10XR + | P::BGRA10XRSRGB => ResolveTile::Values, + P::R8Uint + | P::R8Sint + | P::R16Uint + | P::R16Sint + | P::RG8Uint + | P::RG8Sint + | P::R32Uint + | P::R32Sint + | P::RG16Uint + | P::RG16Sint + | P::RGBA8Uint + | P::RGBA8Sint + | P::RGB10A2Uint + | P::RG32Uint + | P::RG32Sint + | P::RGBA16Uint + | P::RGBA16Sint + | P::RGBA32Uint + | P::RGBA32Sint => ResolveTile::Integers, + _ => return None, + }) + } +} + +/// Whether the multisampled color attachment `source` names a resolve texture, as `wanted` +/// states it, that Metal leaves untouched across formats ([`untouched_across_formats`]): its +/// store action resolves or is `Unknown`. [`color`] gives it no resolve. +pub(super) fn unresolved_across(source: &Target, wanted: &Wanted<'_>) -> bool { + source.samples > 1 + && (wanted.store.resolves() || wanted.store == StoreAction::Unknown) + && wanted.texture.is_some_and(|into| { + untouched_across_formats(source.texture.pixel_format(), into.pixel_format()) + }) +} + +/// Whether Metal leaves a resolve texture of pixel format `into` untouched by the resolve of a +/// multisampled color attachment of `from`, another format (the module docs): a word of codes, or +/// 16-bit norm codes ([`ResolveTile`]), into a format of another tile but the 64-bit +/// extended-range ones. Every pair measured gave one answer at 2 and 4 samples, under both +/// resolving store actions, drawn and not. +fn untouched_across_formats(from: PixelFormat, into: PixelFormat) -> bool { + use PixelFormat as P; + let (Some(source), Some(destination)) = (ResolveTile::of(from), ResolveTile::of(into)) else { + return false; + }; + matches!(source, ResolveTile::Codes32 | ResolveTile::Norm16) + && destination != source + && !matches!(into, P::BGRA10XR | P::BGRA10XRSRGB) +} + fn problem(call: &'static str, p: RenderPassProblem) -> Error { invalid(call, Problem::RenderPass(p)) } @@ -465,11 +596,14 @@ pub(super) fn color( ) { return Err(problem(call, RenderPassProblem::ResolveFormat(which))); } - if let Some(unsupported) = [source.texture.pixel_format(), texture.pixel_format()] - .into_iter() - .find_map(unmodelled_resolve) - { - return Err(Error::Unsupported(unsupported)); + // An extended-range attachment's resolve, not built. A resolve texture of such a format is + // the attachment's own or its twin, so of such an attachment, or of another format, which a + // resolve leaves untouched or `destination` refuses. + let pixel_format = source.texture.pixel_format(); + if unmodelled_resolve(pixel_format).is_some() { + return Err(Error::NotImplemented(RuntimeGap::ExtendedRangeResolve { + pixel_format, + })); } // An attachment rendered through the view of its word (`metal::format::WordAttachment`) holds // each sample's stored codes, while Metal resolves its tile's values: not modelled. @@ -974,7 +1108,8 @@ pub(super) fn color_copy( /// The resolve destination of `source` in `texture` at `wanted`'s level, slice and depth plane, /// checked as Metal checks it (but for `source`'s sample count, `single_sampled`); `None` for a /// multisampled color resolve texture of another sample count than a multisampled `source`'s, -/// which plain Metal leaves untouched (the module docs). +/// and for a resolve texture of a format a multisampled `source`'s tile is not stored into +/// ([`untouched_across_formats`]), which plain Metal leaves untouched (the module docs). fn destination( call: &'static str, device: &Device, @@ -1001,10 +1136,15 @@ fn destination( return Err(problem(call, RenderPassProblem::ResolveSamples(which))); } // A multisampled color attachment resolving into its format's sRGB twin keeps its own - // encoding (the module docs): it resolves in the attachment's format. + // encoding (the module docs): it resolves in the attachment's format. One whose tile Metal + // does not store into the resolve texture's format leaves that texture untouched. let pixel_format = source.texture.pixel_format(); let twin = source.samples > 1 && srgb_twin(pixel_format) == Some(facts.pixel_format); - if facts.pixel_format != pixel_format && !twin { + let across = source.samples > 1 + && facts.samples == 1 + && matches!(which, Attachment::Color(_)) + && untouched_across_formats(pixel_format, facts.pixel_format); + if facts.pixel_format != pixel_format && !twin && !across { // The other channel order of the 8-bit four-channel family: measured, not built. if source.samples > 1 && other_channel_order(pixel_format, facts.pixel_format) { return Err(Error::NotImplemented(RuntimeGap::Render)); @@ -1058,9 +1198,10 @@ fn destination( (facts.extent[1] >> level).max(1), ]; // A level of another extent resolves the overlap (`color` refuses a color one reaching past - // the attachment without a clear); one of another sample count is left untouched where - // its extent is the attachment's (measured), and refused elsewhere (unmeasured). - if untouched { + // the attachment without a clear); one of another sample count or a format the attachment's + // tile is not stored into is left untouched where its extent is the attachment's + // (measured), and refused elsewhere (unmeasured). + if untouched || across { return match extent == source.extent { true => Ok(None), false => Err(problem(call, RenderPassProblem::ResolveSize(which))), diff --git a/crates/metal2vulkan-runtime/src/tests/apple_only.rs b/crates/metal2vulkan-runtime/src/tests/apple_only.rs index 3d22ee5c0..390d8d906 100644 --- a/crates/metal2vulkan-runtime/src/tests/apple_only.rs +++ b/crates/metal2vulkan-runtime/src/tests/apple_only.rs @@ -2,14 +2,14 @@ use crate::{AppleOnly, AppleOnlyCall, DEFAULT_PROTECTION_OPTIONS}; -/// The 12 Apple-only calls of the table, each at Metal's default where it has one and at a value +/// The 12 Apple-only calls of the table, each at Metal's default where it has one and at values /// off it, with the runtime's answer. The getter (`protectionOptions`) is /// `no_getter_answers_off_metals_default`'s. A texture's rotation is no longer the table's: the /// runtime builds it. #[test] fn every_apple_only_call_answers_typed() { use AppleOnlyCall as C; - let table: [(&str, AppleOnlyCall, Result<(), AppleOnly>); 25] = [ + let table: [(&str, AppleOnlyCall, Result<(), AppleOnly>); 26] = [ // Compressed-texture controls: no compression is visible on Vulkan. ( "invalidateCompressedTexture:", @@ -97,6 +97,8 @@ fn every_apple_only_call_answers_typed() { C::SetViewportTransformEnabled(false), Err(AppleOnly::ViewportTransformDisabled), ), + // The amplification mode's count: the value's set bits in mode 1, the value otherwise; + // 1 to 8 taken, 0 (copies that change from run to run) and past 8 refused. ( "setVertexAmplificationMode:value:", C::SetVertexAmplificationMode { mode: 0, value: 0 }, @@ -105,18 +107,48 @@ fn every_apple_only_call_answers_typed() { ( "setVertexAmplificationMode:value:", C::SetVertexAmplificationMode { mode: 1, value: 2 }, + Ok(()), + ), + ( + "setVertexAmplificationMode:value:", + C::SetVertexAmplificationMode { + mode: 1, + value: 255, + }, + Ok(()), + ), + ( + "setVertexAmplificationMode:value:", + C::SetVertexAmplificationMode { + mode: 1, + value: 257, + }, + Ok(()), + ), + ( + "setVertexAmplificationMode:value:", + C::SetVertexAmplificationMode { mode: 0, value: 8 }, + Ok(()), + ), + ( + "setVertexAmplificationMode:value:", + C::SetVertexAmplificationMode { + mode: 255, + value: 9, + }, Err(AppleOnly::VertexAmplificationMode), ), ( - "setDepthCleared", - C::SetDepthCleared, - Err(AppleOnly::DepthCleared), - ), - ( - "setStencilCleared", - C::SetStencilCleared, - Err(AppleOnly::StencilCleared), + "setVertexAmplificationMode:value:", + C::SetVertexAmplificationMode { + mode: 1, + value: u64::MAX, + }, + Err(AppleOnly::VertexAmplificationMode), ), + // Depth and stencil "cleared" change nothing Metal draws. + ("setDepthCleared", C::SetDepthCleared, Ok(())), + ("setStencilCleared", C::SetStencilCleared, Ok(())), ( "setAlphaTestReferenceValue:", C::SetAlphaTestReferenceValue(f32::NAN), @@ -131,7 +163,7 @@ fn every_apple_only_call_answers_typed() { selectors.push(selector); } } - // The 12 calls of the table's 21 rows (some calls have several rows). + // The 12 calls of the table's 26 rows (some calls have several rows). assert_eq!(selectors.len(), 12, "{selectors:?}"); } @@ -156,8 +188,6 @@ fn each_apple_only_refusal_names_its_gap() { (AppleOnly::LineWidth, Unmeasured), (AppleOnly::ViewportTransformDisabled, Unmeasured), (AppleOnly::VertexAmplificationMode, Unmeasured), - (AppleOnly::DepthCleared, Unmeasured), - (AppleOnly::StencilCleared, Unmeasured), (AppleOnly::SurfaceClientDirection, Unmeasured), ]; for (feature, gap) in table { diff --git a/crates/metal2vulkan-validation/fixtures/public/engine/TOOLCHAIN b/crates/metal2vulkan-validation/fixtures/public/engine/TOOLCHAIN index 5e1b7cea2..678430023 100644 --- a/crates/metal2vulkan-validation/fixtures/public/engine/TOOLCHAIN +++ b/crates/metal2vulkan-validation/fixtures/public/engine/TOOLCHAIN @@ -209,6 +209,7 @@ fixture ob3_index_buffer: metal: Apple metal version 32023.921 (metalfe-32023.92 fixture ob3_stage_input: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425) fixture ob3_texture_array: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425) fixture ob3_vertex_input: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425) +fixture pdc_compare_clamp: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425) fixture primitive_ids: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425) fixture rch_guarded_effects: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425) fixture rch_helper_branch: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425) diff --git a/crates/metal2vulkan-validation/fixtures/public/engine/pdc_compare_clamp.air.ll b/crates/metal2vulkan-validation/fixtures/public/engine/pdc_compare_clamp.air.ll new file mode 100644 index 000000000..d42f0b158 --- /dev/null +++ b/crates/metal2vulkan-validation/fixtures/public/engine/pdc_compare_clamp.air.ll @@ -0,0 +1,163 @@ +; Generated by scripts/regen-air-fixtures from pdc_compare_clamp.metal (typed pointers; xcrun metal-as reassembles it). Do not edit. +; ModuleID = '-' +source_filename = "-" +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-n8:16:32" +target triple = "air64_v28-apple-macosx26.0.0" + +%struct._depth_2d_t = type opaque +%struct._sampler_t = type opaque +%struct.Arguments = type { %"struct.metal::depth2d", %"struct.metal::sampler" } +%"struct.metal::depth2d" = type { %struct._depth_2d_t addrspace(1)* } +%"struct.metal::sampler" = type { %struct._sampler_t addrspace(2)* } + +@__air_sampler_state = internal addrspace(2) constant [2 x i64] [i64 34901797600559177, i64 0], align 8 + +; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn +define <{ <4 x float> }> @pdc_vertex(i32 noundef %0) local_unnamed_addr #0 { + %2 = shl i32 %0, 1 + %3 = and i32 %2, 2 + %4 = tail call fast float @air.convert.f.f32.u.i32(i32 %3) #5 + %5 = insertelement <2 x float> undef, float %4, i64 0 + %6 = and i32 %0, 2 + %7 = tail call fast float @air.convert.f.f32.u.i32(i32 %6) #5 + %8 = insertelement <2 x float> %5, float %7, i64 1 + %9 = fmul fast <2 x float> %8, + %10 = fadd fast <2 x float> %9, + %11 = shufflevector <2 x float> %10, <2 x float> poison, <4 x i32> + %12 = shufflevector <4 x float> %11, <4 x float> , <4 x i32> + %13 = insertvalue <{ <4 x float> }> undef, <4 x float> %12, 0 + ret <{ <4 x float> }> %13 +} + +; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn +declare float @air.convert.f.f32.u.i32(i32) local_unnamed_addr #1 + +; Function Attrs: convergent mustprogress nofree nounwind readonly willreturn +define <4 x float> @pdc_slot(<4 x float> %0, %struct._depth_2d_t addrspace(1)* %1, %struct._sampler_t addrspace(2)* nocapture readonly %2, <4 x float> addrspace(2)* nocapture noundef readonly "air-buffer-no-alias" %3) local_unnamed_addr #2 { + %5 = load <4 x float>, <4 x float> addrspace(2)* %3, align 16, !alias.scope !39, !noalias !42 + %6 = extractelement <4 x float> %5, i64 0 + %7 = tail call { float, i8 } @air.sample_compare_depth_2d.f32(%struct._depth_2d_t addrspace(1)* nocapture readonly %1, %struct._sampler_t addrspace(2)* nocapture readonly %2, i32 1, <2 x float> , float %6, i1 true, <2 x i32> zeroinitializer, i1 false, float 0.000000e+00, float 0.000000e+00, i32 0) #6, !alias.scope !42, !noalias !39 + %8 = extractvalue { float, i8 } %7, 0 + %9 = extractelement <4 x float> %5, i64 1 + %10 = tail call { <4 x float>, i8 } @air.gather_compare_depth_2d.f32(%struct._depth_2d_t addrspace(1)* nocapture readonly %1, %struct._sampler_t addrspace(2)* nocapture readonly %2, i32 1, <2 x float> , float %9, i1 true, <2 x i32> zeroinitializer, i32 0) #7, !alias.scope !42, !noalias !39 + %11 = extractvalue { <4 x float>, i8 } %10, 0 + %12 = insertelement <4 x float> , float %8, i64 0 + %13 = shufflevector <4 x float> %12, <4 x float> %11, <4 x i32> + ret <4 x float> %13 +} + +; Function Attrs: convergent mustprogress nofree nounwind readonly willreturn +define <4 x float> @pdc_constexpr(<4 x float> %0, %struct._depth_2d_t addrspace(1)* %1, <4 x float> addrspace(2)* nocapture noundef readonly "air-buffer-no-alias" %2) local_unnamed_addr #2 { + %4 = load <4 x float>, <4 x float> addrspace(2)* %2, align 16, !alias.scope !45, !noalias !48 + %5 = extractelement <4 x float> %4, i64 0 + %6 = tail call { float, i8 } @air.sample_compare_depth_2d.f32(%struct._depth_2d_t addrspace(1)* nocapture readonly %1, %struct._sampler_t addrspace(2)* nocapture readonly bitcast ([2 x i64] addrspace(2)* @__air_sampler_state to %struct._sampler_t addrspace(2)*), i32 1, <2 x float> , float %5, i1 true, <2 x i32> zeroinitializer, i1 false, float 0.000000e+00, float 0.000000e+00, i32 0) #6 + %7 = extractvalue { float, i8 } %6, 0 + %8 = extractelement <4 x float> %4, i64 1 + %9 = tail call { <4 x float>, i8 } @air.gather_compare_depth_2d.f32(%struct._depth_2d_t addrspace(1)* nocapture readonly %1, %struct._sampler_t addrspace(2)* nocapture readonly bitcast ([2 x i64] addrspace(2)* @__air_sampler_state to %struct._sampler_t addrspace(2)*), i32 1, <2 x float> , float %8, i1 true, <2 x i32> zeroinitializer, i32 0) #7 + %10 = extractvalue { <4 x float>, i8 } %9, 0 + %11 = insertelement <4 x float> , float %7, i64 0 + %12 = shufflevector <4 x float> %11, <4 x float> %10, <4 x i32> + ret <4 x float> %12 +} + +; Function Attrs: convergent mustprogress nofree nounwind readonly willreturn +define <4 x float> @pdc_argument(<4 x float> %0, %struct.Arguments addrspace(2)* nocapture noundef readonly align 8 dereferenceable(16) "air-buffer-no-alias" %1, <4 x float> addrspace(2)* nocapture noundef readonly "air-buffer-no-alias" %2) local_unnamed_addr #2 { + %4 = getelementptr inbounds %struct.Arguments, %struct.Arguments addrspace(2)* %1, i64 0, i32 1, i32 0 + %5 = load %struct._sampler_t addrspace(2)*, %struct._sampler_t addrspace(2)* addrspace(2)* %4, align 8, !tbaa.struct !50, !alias.scope !55, !noalias !58 + %6 = load <4 x float>, <4 x float> addrspace(2)* %2, align 16, !alias.scope !58, !noalias !55 + %7 = extractelement <4 x float> %6, i64 0 + %8 = getelementptr inbounds %struct.Arguments, %struct.Arguments addrspace(2)* %1, i64 0, i32 0, i32 0 + %9 = load %struct._depth_2d_t addrspace(1)*, %struct._depth_2d_t addrspace(1)* addrspace(2)* %8, align 8, !tbaa !60, !alias.scope !55, !noalias !58 + %10 = tail call { float, i8 } @air.sample_compare_depth_2d.f32(%struct._depth_2d_t addrspace(1)* nocapture readonly %9, %struct._sampler_t addrspace(2)* nocapture readonly %5, i32 1, <2 x float> , float %7, i1 true, <2 x i32> zeroinitializer, i1 false, float 0.000000e+00, float 0.000000e+00, i32 0) #6 + %11 = extractvalue { float, i8 } %10, 0 + %12 = insertelement <4 x float> , float %11, i64 0 + ret <4 x float> %12 +} + +; Function Attrs: argmemonly convergent mustprogress nofree nounwind readonly willreturn +declare { float, i8 } @air.sample_compare_depth_2d.f32(%struct._depth_2d_t addrspace(1)* nocapture readonly, %struct._sampler_t addrspace(2)* nocapture readonly, i32, <2 x float>, float, i1, <2 x i32>, i1, float, float, i32) local_unnamed_addr #3 + +; Function Attrs: argmemonly mustprogress nofree nounwind readonly willreturn +declare { <4 x float>, i8 } @air.gather_compare_depth_2d.f32(%struct._depth_2d_t addrspace(1)* nocapture readonly, %struct._sampler_t addrspace(2)* nocapture readonly, i32, <2 x float>, float, i1, <2 x i32>, i32) local_unnamed_addr #4 + +attributes #0 = { mustprogress nofree nosync nounwind readnone willreturn "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="0" "no-builtins" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" } +attributes #1 = { mustprogress nofree nosync nounwind readnone willreturn } +attributes #2 = { convergent mustprogress nofree nounwind readonly willreturn "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="128" "no-builtins" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" } +attributes #3 = { argmemonly convergent mustprogress nofree nounwind readonly willreturn } +attributes #4 = { argmemonly mustprogress nofree nounwind readonly willreturn } +attributes #5 = { nounwind readnone willreturn } +attributes #6 = { argmemonly convergent nounwind readonly willreturn } +attributes #7 = { argmemonly nounwind readonly willreturn } + +!llvm.module.flags = !{!0, !1, !2, !3, !4, !5, !6, !7, !8} +!air.vertex = !{!9} +!air.fragment = !{!14, !22, !26} +!air.compile_options = !{!32, !33, !34} +!air.sampler_states = !{!35} +!llvm.ident = !{!36} +!air.version = !{!37} +!air.language_version = !{!38} + +!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 27, i32 0]} +!1 = !{i32 1, !"wchar_size", i32 4} +!2 = !{i32 7, !"frame-pointer", i32 2} +!3 = !{i32 7, !"air.max_device_buffers", i32 31} +!4 = !{i32 7, !"air.max_constant_buffers", i32 31} +!5 = !{i32 7, !"air.max_threadgroup_buffers", i32 31} +!6 = !{i32 7, !"air.max_textures", i32 128} +!7 = !{i32 7, !"air.max_read_write_textures", i32 8} +!8 = !{i32 7, !"air.max_samplers", i32 16} +!9 = !{<{ <4 x float> }> (i32)* @pdc_vertex, !10, !12} +!10 = !{!11} +!11 = !{!"air.position", !"air.arg_type_name", !"float4", !"air.arg_name", !"position"} +!12 = !{!13} +!13 = !{i32 0, !"air.vertex_id", !"air.arg_type_name", !"uint", !"air.arg_name", !"id"} +!14 = !{<4 x float> (<4 x float>, %struct._depth_2d_t addrspace(1)*, %struct._sampler_t addrspace(2)*, <4 x float> addrspace(2)*)* @pdc_slot, !15, !17} +!15 = !{!16} +!16 = !{!"air.render_target", i32 0, i32 0, !"air.arg_type_name", !"float4"} +!17 = !{!18, !19, !20, !21} +!18 = !{i32 0, !"air.position", !"air.center", !"air.no_perspective", !"air.arg_type_name", !"float4", !"air.arg_name", !"position", !"air.arg_unused"} +!19 = !{i32 1, !"air.texture", !"air.location_index", i32 1, i32 1, !"air.sample", !"air.arg_type_name", !"depth2d", !"air.arg_name", !"d"} +!20 = !{i32 2, !"air.sampler", !"air.location_index", i32 2, i32 1, !"air.arg_type_name", !"sampler", !"air.arg_name", !"s"} +!21 = !{i32 3, !"air.buffer", !"air.location_index", i32 0, i32 1, !"air.read", !"air.address_space", i32 2, !"air.arg_type_size", i32 16, !"air.arg_type_align_size", i32 16, !"air.arg_type_name", !"float4", !"air.arg_name", !"refs"} +!22 = !{<4 x float> (<4 x float>, %struct._depth_2d_t addrspace(1)*, <4 x float> addrspace(2)*)* @pdc_constexpr, !15, !23} +!23 = !{!18, !24, !25} +!24 = !{i32 1, !"air.texture", !"air.location_index", i32 0, i32 1, !"air.sample", !"air.arg_type_name", !"depth2d", !"air.arg_name", !"d"} +!25 = !{i32 2, !"air.buffer", !"air.location_index", i32 0, i32 1, !"air.read", !"air.address_space", i32 2, !"air.arg_type_size", i32 16, !"air.arg_type_align_size", i32 16, !"air.arg_type_name", !"float4", !"air.arg_name", !"refs"} +!26 = !{<4 x float> (<4 x float>, %struct.Arguments addrspace(2)*, <4 x float> addrspace(2)*)* @pdc_argument, !15, !27} +!27 = !{!18, !28, !25} +!28 = !{i32 1, !"air.indirect_buffer", !"air.buffer_size", i32 16, !"air.location_index", i32 1, i32 1, !"air.read", !"air.address_space", i32 2, !"air.struct_type_info", !29, !"air.arg_type_size", i32 16, !"air.arg_type_align_size", i32 8, !"air.arg_type_name", !"Arguments", !"air.arg_name", !"a"} +!29 = !{i32 0, i32 8, i32 0, !"depth2d", !"d", !"air.indirect_argument", !30, i32 8, i32 8, i32 0, !"sampler", !"s", !"air.indirect_argument", !31} +!30 = !{i32 0, !"air.texture", !"air.location_index", i32 0, i32 1, !"air.sample", !"air.arg_type_name", !"depth2d", !"air.arg_name", !"d"} +!31 = !{i32 1, !"air.sampler", !"air.location_index", i32 1, i32 1, !"air.arg_type_name", !"sampler", !"air.arg_name", !"s"} +!32 = !{!"air.compile.denorms_disable"} +!33 = !{!"air.compile.fast_math_enable"} +!34 = !{!"air.compile.framebuffer_fetch_enable"} +!35 = !{!"air.sampler_state", [2 x i64] addrspace(2)* @__air_sampler_state} +!36 = !{!"Apple metal version 32023.921 (metalfe-32023.921.6)"} +!37 = !{i32 2, i32 8, i32 0} +!38 = !{!"Metal", i32 4, i32 0, i32 0} +!39 = !{!40} +!40 = distinct !{!40, !41, !"air-alias-scope-arg(3)"} +!41 = distinct !{!41, !"air-alias-scopes(pdc_slot)"} +!42 = !{!43, !44} +!43 = distinct !{!43, !41, !"air-alias-scope-textures"} +!44 = distinct !{!44, !41, !"air-alias-scope-samplers"} +!45 = !{!46} +!46 = distinct !{!46, !47, !"air-alias-scope-arg(2)"} +!47 = distinct !{!47, !"air-alias-scopes(pdc_constexpr)"} +!48 = !{!49} +!49 = distinct !{!49, !47, !"air-alias-scope-textures"} +!50 = !{i64 0, i64 8, !51} +!51 = !{!52, !52, i64 0} +!52 = !{!"__metal_sampler_t", !53, i64 0} +!53 = !{!"omnipotent char", !54, i64 0} +!54 = !{!"Simple C++ TBAA"} +!55 = !{!56} +!56 = distinct !{!56, !57, !"air-alias-scope-arg(1)"} +!57 = distinct !{!57, !"air-alias-scopes(pdc_argument)"} +!58 = !{!59} +!59 = distinct !{!59, !57, !"air-alias-scope-arg(2)"} +!60 = !{!61, !62, i64 0} +!61 = !{!"_ZTSN5metal7depth2dIfLNS_6accessE0ELNS_16memory_coherenceE0EvEE", !62, i64 0} +!62 = !{!"__metal_depth_2d_t", !53, i64 0} diff --git a/crates/metal2vulkan-validation/fixtures/public/engine/pdc_compare_clamp.ll b/crates/metal2vulkan-validation/fixtures/public/engine/pdc_compare_clamp.ll new file mode 100644 index 000000000..5967532af --- /dev/null +++ b/crates/metal2vulkan-validation/fixtures/public/engine/pdc_compare_clamp.ll @@ -0,0 +1,161 @@ +; Generated by scripts/regen-air-fixtures from pdc_compare_clamp.metal (llvm-dis of pdc_compare_clamp.air). Do not edit. +; ModuleID = '' +source_filename = "-" +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-n8:16:32" +target triple = "air64_v28-apple-macosx26.0.0" + +%struct.Arguments = type { %"struct.metal::depth2d", %"struct.metal::sampler" } +%"struct.metal::depth2d" = type { ptr addrspace(1) } +%"struct.metal::sampler" = type { ptr addrspace(2) } + +@__air_sampler_state = internal addrspace(2) constant [2 x i64] [i64 34901797600559177, i64 0], align 8 + +; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) +define <{ <4 x float> }> @pdc_vertex(i32 noundef %0) local_unnamed_addr #0 { + %2 = shl i32 %0, 1 + %3 = and i32 %2, 2 + %4 = tail call fast float @air.convert.f.f32.u.i32(i32 %3) #5 + %5 = insertelement <2 x float> undef, float %4, i64 0 + %6 = and i32 %0, 2 + %7 = tail call fast float @air.convert.f.f32.u.i32(i32 %6) #5 + %8 = insertelement <2 x float> %5, float %7, i64 1 + %9 = fmul fast <2 x float> %8, splat (float 2.000000e+00) + %10 = fadd fast <2 x float> %9, splat (float -1.000000e+00) + %11 = shufflevector <2 x float> %10, <2 x float> poison, <4 x i32> + %12 = shufflevector <4 x float> %11, <4 x float> , <4 x i32> + %13 = insertvalue <{ <4 x float> }> undef, <4 x float> %12, 0 + ret <{ <4 x float> }> %13 +} + +; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) +declare float @air.convert.f.f32.u.i32(i32) local_unnamed_addr #1 + +; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(read) +define <4 x float> @pdc_slot(<4 x float> %0, ptr addrspace(1) %1, ptr addrspace(2) readonly captures(none) %2, ptr addrspace(2) noundef readonly captures(none) "air-buffer-no-alias" %3) local_unnamed_addr #2 { + %5 = load <4 x float>, ptr addrspace(2) %3, align 16, !alias.scope !39, !noalias !42 + %6 = extractelement <4 x float> %5, i64 0 + %7 = tail call { float, i8 } @air.sample_compare_depth_2d.f32(ptr addrspace(1) readonly captures(none) %1, ptr addrspace(2) readonly captures(none) %2, i32 1, <2 x float> splat (float 5.000000e-01), float %6, i1 true, <2 x i32> zeroinitializer, i1 false, float 0.000000e+00, float 0.000000e+00, i32 0) #6, !alias.scope !42, !noalias !39 + %8 = extractvalue { float, i8 } %7, 0 + %9 = extractelement <4 x float> %5, i64 1 + %10 = tail call { <4 x float>, i8 } @air.gather_compare_depth_2d.f32(ptr addrspace(1) readonly captures(none) %1, ptr addrspace(2) readonly captures(none) %2, i32 1, <2 x float> splat (float 5.000000e-01), float %9, i1 true, <2 x i32> zeroinitializer, i32 0) #7, !alias.scope !42, !noalias !39 + %11 = extractvalue { <4 x float>, i8 } %10, 0 + %12 = insertelement <4 x float> , float %8, i64 0 + %13 = shufflevector <4 x float> %12, <4 x float> %11, <4 x i32> + ret <4 x float> %13 +} + +; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(read) +define <4 x float> @pdc_constexpr(<4 x float> %0, ptr addrspace(1) %1, ptr addrspace(2) noundef readonly captures(none) "air-buffer-no-alias" %2) local_unnamed_addr #2 { + %4 = load <4 x float>, ptr addrspace(2) %2, align 16, !alias.scope !45, !noalias !48 + %5 = extractelement <4 x float> %4, i64 0 + %6 = tail call { float, i8 } @air.sample_compare_depth_2d.f32(ptr addrspace(1) readonly captures(none) %1, ptr addrspace(2) readonly captures(none) @__air_sampler_state, i32 1, <2 x float> splat (float 5.000000e-01), float %5, i1 true, <2 x i32> zeroinitializer, i1 false, float 0.000000e+00, float 0.000000e+00, i32 0) #6 + %7 = extractvalue { float, i8 } %6, 0 + %8 = extractelement <4 x float> %4, i64 1 + %9 = tail call { <4 x float>, i8 } @air.gather_compare_depth_2d.f32(ptr addrspace(1) readonly captures(none) %1, ptr addrspace(2) readonly captures(none) @__air_sampler_state, i32 1, <2 x float> splat (float 5.000000e-01), float %8, i1 true, <2 x i32> zeroinitializer, i32 0) #7 + %10 = extractvalue { <4 x float>, i8 } %9, 0 + %11 = insertelement <4 x float> , float %7, i64 0 + %12 = shufflevector <4 x float> %11, <4 x float> %10, <4 x i32> + ret <4 x float> %12 +} + +; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(read) +define <4 x float> @pdc_argument(<4 x float> %0, ptr addrspace(2) noundef readonly align 8 captures(none) dereferenceable(16) "air-buffer-no-alias" %1, ptr addrspace(2) noundef readonly captures(none) "air-buffer-no-alias" %2) local_unnamed_addr #2 { + %4 = getelementptr inbounds %struct.Arguments, ptr addrspace(2) %1, i64 0, i32 1, i32 0 + %5 = load ptr addrspace(2), ptr addrspace(2) %4, align 8, !tbaa.struct !50, !alias.scope !55, !noalias !58 + %6 = load <4 x float>, ptr addrspace(2) %2, align 16, !alias.scope !58, !noalias !55 + %7 = extractelement <4 x float> %6, i64 0 + %8 = getelementptr inbounds %struct.Arguments, ptr addrspace(2) %1, i64 0, i32 0, i32 0 + %9 = load ptr addrspace(1), ptr addrspace(2) %8, align 8, !tbaa !60, !alias.scope !55, !noalias !58 + %10 = tail call { float, i8 } @air.sample_compare_depth_2d.f32(ptr addrspace(1) readonly captures(none) %9, ptr addrspace(2) readonly captures(none) %5, i32 1, <2 x float> splat (float 5.000000e-01), float %7, i1 true, <2 x i32> zeroinitializer, i1 false, float 0.000000e+00, float 0.000000e+00, i32 0) #6 + %11 = extractvalue { float, i8 } %10, 0 + %12 = insertelement <4 x float> , float %11, i64 0 + ret <4 x float> %12 +} + +; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(argmem: read) +declare { float, i8 } @air.sample_compare_depth_2d.f32(ptr addrspace(1) readonly captures(none), ptr addrspace(2) readonly captures(none), i32, <2 x float>, float, i1, <2 x i32>, i1, float, float, i32) local_unnamed_addr #3 + +; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) +declare { <4 x float>, i8 } @air.gather_compare_depth_2d.f32(ptr addrspace(1) readonly captures(none), ptr addrspace(2) readonly captures(none), i32, <2 x float>, float, i1, <2 x i32>, i32) local_unnamed_addr #4 + +attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="0" "no-builtins" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" } +attributes #1 = { mustprogress nofree nosync nounwind willreturn memory(none) } +attributes #2 = { convergent mustprogress nofree nounwind willreturn memory(read) "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="128" "no-builtins" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" } +attributes #3 = { convergent mustprogress nofree nounwind willreturn memory(argmem: read) } +attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: read) } +attributes #5 = { nounwind willreturn memory(none) } +attributes #6 = { convergent nounwind willreturn memory(argmem: read) } +attributes #7 = { nounwind willreturn memory(argmem: read) } + +!llvm.module.flags = !{!0, !1, !2, !3, !4, !5, !6, !7, !8} +!air.vertex = !{!9} +!air.fragment = !{!14, !22, !26} +!air.compile_options = !{!32, !33, !34} +!air.sampler_states = !{!35} +!llvm.ident = !{!36} +!air.version = !{!37} +!air.language_version = !{!38} + +!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 27, i32 0]} +!1 = !{i32 1, !"wchar_size", i32 4} +!2 = !{i32 7, !"frame-pointer", i32 2} +!3 = !{i32 7, !"air.max_device_buffers", i32 31} +!4 = !{i32 7, !"air.max_constant_buffers", i32 31} +!5 = !{i32 7, !"air.max_threadgroup_buffers", i32 31} +!6 = !{i32 7, !"air.max_textures", i32 128} +!7 = !{i32 7, !"air.max_read_write_textures", i32 8} +!8 = !{i32 7, !"air.max_samplers", i32 16} +!9 = !{ptr @pdc_vertex, !10, !12} +!10 = !{!11} +!11 = !{!"air.position", !"air.arg_type_name", !"float4", !"air.arg_name", !"position"} +!12 = !{!13} +!13 = !{i32 0, !"air.vertex_id", !"air.arg_type_name", !"uint", !"air.arg_name", !"id"} +!14 = !{ptr @pdc_slot, !15, !17} +!15 = !{!16} +!16 = !{!"air.render_target", i32 0, i32 0, !"air.arg_type_name", !"float4"} +!17 = !{!18, !19, !20, !21} +!18 = !{i32 0, !"air.position", !"air.center", !"air.no_perspective", !"air.arg_type_name", !"float4", !"air.arg_name", !"position", !"air.arg_unused"} +!19 = !{i32 1, !"air.texture", !"air.location_index", i32 1, i32 1, !"air.sample", !"air.arg_type_name", !"depth2d", !"air.arg_name", !"d"} +!20 = !{i32 2, !"air.sampler", !"air.location_index", i32 2, i32 1, !"air.arg_type_name", !"sampler", !"air.arg_name", !"s"} +!21 = !{i32 3, !"air.buffer", !"air.location_index", i32 0, i32 1, !"air.read", !"air.address_space", i32 2, !"air.arg_type_size", i32 16, !"air.arg_type_align_size", i32 16, !"air.arg_type_name", !"float4", !"air.arg_name", !"refs"} +!22 = !{ptr @pdc_constexpr, !15, !23} +!23 = !{!18, !24, !25} +!24 = !{i32 1, !"air.texture", !"air.location_index", i32 0, i32 1, !"air.sample", !"air.arg_type_name", !"depth2d", !"air.arg_name", !"d"} +!25 = !{i32 2, !"air.buffer", !"air.location_index", i32 0, i32 1, !"air.read", !"air.address_space", i32 2, !"air.arg_type_size", i32 16, !"air.arg_type_align_size", i32 16, !"air.arg_type_name", !"float4", !"air.arg_name", !"refs"} +!26 = !{ptr @pdc_argument, !15, !27} +!27 = !{!18, !28, !25} +!28 = !{i32 1, !"air.indirect_buffer", !"air.buffer_size", i32 16, !"air.location_index", i32 1, i32 1, !"air.read", !"air.address_space", i32 2, !"air.struct_type_info", !29, !"air.arg_type_size", i32 16, !"air.arg_type_align_size", i32 8, !"air.arg_type_name", !"Arguments", !"air.arg_name", !"a"} +!29 = !{i32 0, i32 8, i32 0, !"depth2d", !"d", !"air.indirect_argument", !30, i32 8, i32 8, i32 0, !"sampler", !"s", !"air.indirect_argument", !31} +!30 = !{i32 0, !"air.texture", !"air.location_index", i32 0, i32 1, !"air.sample", !"air.arg_type_name", !"depth2d", !"air.arg_name", !"d"} +!31 = !{i32 1, !"air.sampler", !"air.location_index", i32 1, i32 1, !"air.arg_type_name", !"sampler", !"air.arg_name", !"s"} +!32 = !{!"air.compile.denorms_disable"} +!33 = !{!"air.compile.fast_math_enable"} +!34 = !{!"air.compile.framebuffer_fetch_enable"} +!35 = !{!"air.sampler_state", ptr addrspace(2) @__air_sampler_state} +!36 = !{!"Apple metal version 32023.921 (metalfe-32023.921.6)"} +!37 = !{i32 2, i32 8, i32 0} +!38 = !{!"Metal", i32 4, i32 0, i32 0} +!39 = !{!40} +!40 = distinct !{!40, !41, !"air-alias-scope-arg(3)"} +!41 = distinct !{!41, !"air-alias-scopes(pdc_slot)"} +!42 = !{!43, !44} +!43 = distinct !{!43, !41, !"air-alias-scope-textures"} +!44 = distinct !{!44, !41, !"air-alias-scope-samplers"} +!45 = !{!46} +!46 = distinct !{!46, !47, !"air-alias-scope-arg(2)"} +!47 = distinct !{!47, !"air-alias-scopes(pdc_constexpr)"} +!48 = !{!49} +!49 = distinct !{!49, !47, !"air-alias-scope-textures"} +!50 = !{i64 0, i64 8, !51} +!51 = !{!52, !52, i64 0} +!52 = !{!"__metal_sampler_t", !53, i64 0} +!53 = !{!"omnipotent char", !54, i64 0} +!54 = !{!"Simple C++ TBAA"} +!55 = !{!56} +!56 = distinct !{!56, !57, !"air-alias-scope-arg(1)"} +!57 = distinct !{!57, !"air-alias-scopes(pdc_argument)"} +!58 = !{!59} +!59 = distinct !{!59, !57, !"air-alias-scope-arg(2)"} +!60 = !{!61, !62, i64 0} +!61 = !{!"_ZTSN5metal7depth2dIfLNS_6accessE0ELNS_16memory_coherenceE0EvEE", !62, i64 0} +!62 = !{!"__metal_depth_2d_t", !53, i64 0} diff --git a/crates/metal2vulkan-validation/fixtures/public/engine/pdc_compare_clamp.metal b/crates/metal2vulkan-validation/fixtures/public/engine/pdc_compare_clamp.metal new file mode 100644 index 000000000..9cbb7a3c7 --- /dev/null +++ b/crates/metal2vulkan-validation/fixtures/public/engine/pdc_compare_clamp.metal @@ -0,0 +1,45 @@ +// The functions of the private depth compare clamp lane (validation/src/runtime_lane/ +// depth_compare_clamps.rs), our own MSL: a fullscreen triangle, and fragments that compare a +// `depth2d` at the target's centre against buffer 0's references, `sample_compare` in red +// and `gather_compare`'s first texel in green: through `[[sampler(2)]]` with the texture at +// `[[texture(1)]]`, through a constexpr `less` sampler, and through an argument buffer's sampler. +#include +using namespace metal; + +struct Position { + float4 position [[position]]; +}; + +vertex Position pdc_vertex(uint id [[vertex_id]]) { + float2 p = float2((id << 1) & 2, id & 2); + Position out; + out.position = float4(p * 2.0 - 1.0, 0.0, 1.0); + return out; +} + +fragment float4 pdc_slot(Position in [[stage_in]], depth2d d [[texture(1)]], + sampler s [[sampler(2)]], constant float4 *refs [[buffer(0)]]) { + float r = d.sample_compare(s, float2(0.5), refs[0].x); + float g = d.gather_compare(s, float2(0.5), refs[0].y).x; + return float4(r, g, 0.0, 1.0); +} + +constexpr sampler less_sampler(filter::nearest, address::clamp_to_edge, compare_func::less); + +fragment float4 pdc_constexpr(Position in [[stage_in]], depth2d d [[texture(0)]], + constant float4 *refs [[buffer(0)]]) { + float r = d.sample_compare(less_sampler, float2(0.5), refs[0].x); + float g = d.gather_compare(less_sampler, float2(0.5), refs[0].y).x; + return float4(r, g, 0.0, 1.0); +} + +struct Arguments { + depth2d d [[id(0)]]; + sampler s [[id(1)]]; +}; + +fragment float4 pdc_argument(Position in [[stage_in]], constant Arguments &a [[buffer(1)]], + constant float4 *refs [[buffer(0)]]) { + float r = a.d.sample_compare(a.s, float2(0.5), refs[0].x); + return float4(r, 0.0, 0.0, 1.0); +} diff --git a/crates/metal2vulkan-validation/src/candidate/platform/enables.rs b/crates/metal2vulkan-validation/src/candidate/platform/enables.rs index 639c9ae27..789cd268b 100644 --- a/crates/metal2vulkan-validation/src/candidate/platform/enables.rs +++ b/crates/metal2vulkan-validation/src/candidate/platform/enables.rs @@ -935,6 +935,7 @@ members! { Core.core.tessellation_shader => Some(F::TessellationShader); Core.core.sample_rate_shading => Some(F::SampleRateShading); Core.core.dual_src_blend => Some(F::DualSrcBlend); + Core.core.logic_op => Some(F::LogicOp); Core.core.independent_blend => Some(F::IndependentBlend); Core.core.shader_clip_distance => Some(F::ShaderClipDistance); Core.core.shader_cull_distance => Some(F::ShaderCullDistance); diff --git a/crates/metal2vulkan-validation/src/runtime_lane.rs b/crates/metal2vulkan-validation/src/runtime_lane.rs index 6402df74c..2e88aa9b8 100644 --- a/crates/metal2vulkan-validation/src/runtime_lane.rs +++ b/crates/metal2vulkan-validation/src/runtime_lane.rs @@ -236,6 +236,8 @@ mod address_maps; #[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))] mod alpha_in_red; #[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))] +mod alpha_tests; +#[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))] mod amplified_draws; #[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))] mod anisotropic_filter; @@ -332,6 +334,8 @@ mod denormal_word_fetches; #[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))] mod depth_as_color; #[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))] +mod depth_compare_clamps; +#[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))] mod depth_compare_levels; #[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))] mod depth_compares; @@ -545,6 +549,8 @@ mod level_writes_by_usage; #[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))] mod linear_attachments; #[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))] +mod logic_ops; +#[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))] mod made_at_creation; #[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))] mod math_routines; diff --git a/crates/metal2vulkan-validation/src/runtime_lane/alpha_tests.rs b/crates/metal2vulkan-validation/src/runtime_lane/alpha_tests.rs new file mode 100644 index 000000000..b175fd118 --- /dev/null +++ b/crates/metal2vulkan-validation/src/runtime_lane/alpha_tests.rs @@ -0,0 +1,237 @@ +//! The private alpha test of OpenGL on Metal (`PrivateRenderState::alpha_test_enabled` and +//! `alpha_test_function`, with the encoder's `setAlphaTestReferenceValue:`), on the device the cfg +//! selects, under the validation layer. +//! +//! Metal's rule, measured with our own probes `spi` to `spi4` on an Apple M3 Max under macOS +//! 27.0.1 (4 x 4 targets, `RGBA8Unorm`, `RGBA16Float` and `RGBA32Float`, a fullscreen triangle of +//! one color): color 0's alpha and the reference are each clamped to `[0, 1]`, a NaN taken as 0, +//! and converted to an 8-bit unorm code from the exact product with 255 rounded to nearest; the +//! fragment passes where the function holds between the alpha's code and the reference's, and one +//! that fails writes nothing and counts no visibility. An encoder that never set the reference +//! compares against 1, a reference set in an earlier encoder not kept. The rule matched all 413 +//! probed rows (every function at alphas and references in and past `[0, 1]`, NaNs, both sides of +//! an 8-bit code, ties) and 17 near-tie rows. Each draw here is checked against it: a passing +//! draw's texels and count as the same draw's without the test, a failing draw's as the clear's +//! and 0. + +use super::{buffer_with, read_buffer, validated_device_with, Messages, ScratchCache, WAIT}; +use crate::air_library::AirLibrary; +use crate::gpu::TEST_DEVICE; +use metal2vulkan::metal::{PixelFormat, PrimitiveType, TextureUsage}; +use metal2vulkan::pipeline::{ColorAttachmentDescriptor, RenderPipelineDescriptor, StageSource}; +use metal2vulkan_devtools::{engine_dir, llvm_assemble}; +use metal2vulkan_runtime::{ + ClearColor, CommandQueue, Device, Library, LoadAction, PipelineOptions, Region, + RenderPassDescriptor, RenderPipelineState, ResourceOptions, StoreAction, TextureDescriptor, + VisibilityResultMode, +}; + +/// The target's side. +const SIDE: u64 = 4; + +/// The alphas drawn: inside `[0, 1]`, past it, NaN, and either side of an 8-bit code's edge. +const ALPHAS: [f32; 8] = [0.25, 0.5, 0.75, 1.5, f32::NAN, 0.501_953_1, 0.998, 0.999_9]; + +/// The references set (`None`: never set in the encoder). +const REFERENCES: [Option; 8] = [ + None, + Some(0.0), + Some(0.5), + Some(0.75), + Some(1.0), + Some(f32::NAN), + Some(-0.5), + Some(0.501_953_1), +]; + +/// Metal's 8-bit unorm code of `x` as its alpha test compares it (the module docs): the exact +/// product with 255 of `x` clamped, rounded to nearest (its one tie, at 0.5, to 128). +fn code(x: f32) -> u32 { + let x = if x.is_nan() { 0.0 } else { x.clamp(0.0, 1.0) }; + (f64::from(x) * 255.0).round_ties_even() as u32 +} + +/// Whether Metal's alpha test of `function` (`MTLCompareFunction`'s raw value) passes `alpha` +/// against `reference`. +fn passes(function: u64, alpha: f32, reference: Option) -> bool { + let (a, r) = (code(alpha), code(reference.unwrap_or(1.0))); + match function { + 0 => false, + 1 => a < r, + 2 => a == r, + 3 => a <= r, + 4 => a > r, + 5 => a != r, + 6 => a >= r, + _ => true, + } +} + +struct Lane { + device: Device, + queue: CommandQueue, + /// The owned fixture `a8r_targets`: a fullscreen triangle and a fragment writing buffer 0's + /// color. + library: Library, +} + +impl Lane { + fn new(messages: &Messages, cache: &ScratchCache) -> Lane { + let device = validated_device_with(TEST_DEVICE, messages, cache.path(), |_| {}).unwrap(); + let bitcode = llvm_assemble(&engine_dir().join("a8r_targets.ll")).unwrap(); + Lane { + queue: device.new_command_queue().unwrap(), + library: device.new_library_with_air(&bitcode).unwrap(), + device, + } + } + + fn function(&self, name: &str) -> StageSource { + StageSource::Function( + self.library + .new_function_with_name(name) + .unwrap() + .function_descriptor(), + ) + } + + /// The fullscreen fill into `pf`, the alpha test of `function` on where one is given. + fn pipeline(&self, pf: PixelFormat, function: Option) -> RenderPipelineState { + let mut d = RenderPipelineDescriptor::new(self.function("a8r_vertex")); + d.fragment = Some(self.function("a8r_fill")); + d.color_attachments[0] = Some(ColorAttachmentDescriptor::new(pf)); + if let Some(function) = function { + d.private.alpha_test_enabled = true; + d.private.alpha_test_function = function; + } + self.device + .new_render_pipeline_state(&d, &PipelineOptions::default()) + .unwrap_or_else(|e| panic!("{pf:?} alpha test {function:?}: {e}")) + } + + /// One pass into a `pf` target cleared to zero, drawing `color` through `pipeline` with the + /// reference set where one is given (in an earlier encoder of the command buffer too, where + /// `earlier` is given, which the draw's encoder must not keep): the target's bytes and the + /// visibility count. + fn draw( + &self, + pf: PixelFormat, + pipeline: &RenderPipelineState, + color: [f32; 4], + (reference, earlier): (Option, Option), + ) -> (Vec, u64) { + let texel = match pf { + PixelFormat::RGBA16Float => 8, + _ => 4, + }; + let mut d = TextureDescriptor::texture_2d(pf, SIDE, SIDE, false); + d.usage = TextureUsage::RENDER_TARGET; + d.resource_options = ResourceOptions::shared(); + let target = self.device.new_texture(&d).unwrap(); + let vis = buffer_with(&self.device, &[0xaa; 8]).unwrap(); + let bytes: Vec = color.iter().flat_map(|v| v.to_le_bytes()).collect(); + let color = buffer_with(&self.device, &bytes).unwrap(); + let mut pass = RenderPassDescriptor::new(); + let a = &mut pass.color_attachments[0]; + a.texture = Some(target.clone()); + a.load_action = LoadAction::Clear; + a.clear_color = ClearColor::new(0.0, 0.0, 0.0, 0.0); + a.store_action = StoreAction::Store; + pass.visibility_result_buffer = Some(vis.clone()); + let command_buffer = self.queue.command_buffer().unwrap(); + if let Some(value) = earlier { + let mut e = command_buffer.render_command_encoder(&pass).unwrap(); + e.set_alpha_test_reference_value(value).unwrap(); + e.end_encoding().unwrap(); + } + let mut e = command_buffer.render_command_encoder(&pass).unwrap(); + e.set_render_pipeline_state(pipeline).unwrap(); + e.set_fragment_buffer(Some(&color), 0, 0).unwrap(); + e.set_visibility_result_mode(VisibilityResultMode::Counting, 0) + .unwrap(); + if let Some(value) = reference { + e.set_alpha_test_reference_value(value).unwrap(); + } + e.draw_primitives(PrimitiveType::Triangle, 0, 3, 1, 0) + .unwrap(); + e.end_encoding().unwrap(); + command_buffer.commit().unwrap(); + command_buffer.wait_until_completed_for(WAIT).unwrap(); + assert_eq!(command_buffer.error(), None); + let mut out = vec![0u8; (SIDE * SIDE) as usize * texel]; + target + .get_bytes( + &mut out, + SIDE * texel as u64, + 0, + Region::new_2d(0, 0, SIDE, SIDE), + 0, + 0, + ) + .unwrap(); + let count = u64::from_le_bytes(read_buffer(&vis, 0, 8).unwrap().try_into().unwrap()); + (out, count) + } +} + +/// Every function's test at every alpha of [`ALPHAS`] against every reference of +/// [`REFERENCES`], into `RGBA8Unorm` and `RGBA16Float` (which keeps an alpha past 1): each +/// draw passes or fails as Metal's rule says (the module docs). +#[test] +fn the_alpha_test_keeps_the_fragments_metal_keeps() { + let messages = Messages::default(); + let cache = ScratchCache::new().unwrap(); + let lane = Lane::new(&messages, &cache); + let name = lane.device.name().to_owned(); + let mut wrong = Vec::new(); + let mut checked = 0usize; + for pf in [PixelFormat::RGBA8Unorm, PixelFormat::RGBA16Float] { + let untested = lane.pipeline(pf, None); + let cleared = lane.draw(pf, &untested, [0.0; 4], (None, None)).0; + for function in 0..=7u64 { + let tested = lane.pipeline(pf, Some(function)); + for alpha in ALPHAS { + let color = [0.25, 0.5, 0.75, alpha]; + let (kept, all) = lane.draw(pf, &untested, color, (None, None)); + for reference in REFERENCES { + let got = lane.draw(pf, &tested, color, (reference, None)); + let want = match passes(function, alpha, reference) { + true => (kept.clone(), all), + false => (cleared.clone(), 0), + }; + checked += 1; + if got != want { + wrong.push(format!( + "{pf:?} function {function} alpha {alpha} reference {reference:?}: \ + count {} (want {})", + got.1, want.1 + )); + } + } + } + } + } + // A reference set in an earlier encoder is not kept: the draw compares against 1. + let pf = PixelFormat::RGBA8Unorm; + let less = lane.pipeline(pf, Some(1)); + let (_, count) = lane.draw(pf, &less, [0.25, 0.5, 0.75, 0.5], (None, Some(0.25))); + checked += 1; + if count != SIDE * SIDE { + wrong.push(format!( + "an earlier encoder's reference kept: count {count}" + )); + } + assert!( + wrong.is_empty(), + "{name}: {} of {checked} draws differ from Metal's:\n{}", + wrong.len(), + wrong.join("\n") + ); + eprintln!("{name}: {checked} alpha-tested draws keep Metal's fragments"); + drop(lane); + let reported = messages.take(); + assert!( + reported.is_empty(), + "the validation layer reported: {reported:#?}" + ); +} diff --git a/crates/metal2vulkan-validation/src/runtime_lane/amplified_draws.rs b/crates/metal2vulkan-validation/src/runtime_lane/amplified_draws.rs index 7f016c53f..ad8faf1e6 100644 --- a/crates/metal2vulkan-validation/src/runtime_lane/amplified_draws.rs +++ b/crates/metal2vulkan-validation/src/runtime_lane/amplified_draws.rs @@ -75,18 +75,33 @@ const CLEARED: u32 = 0x11; const DEPTHS: [f32; 2] = [0.75, 1.0]; /// One draw: the amplification count set before it (`None`: none set), its view mappings -/// (`(viewport offset, render target offset)` each; `None` for `nil`), and its instances. +/// (`(viewport offset, render target offset)` each; `None` for `nil`), the +/// `setVertexAmplificationMode:value:` after them (`None`: none), and its instances. #[derive(Clone, Copy)] struct Draw { count: Option, mappings: Option<&'static [(u32, u32)]>, + mode: Option<(u64, u64)>, instances: u32, } +impl Draw { + /// The count the draw takes: the amplification mode's (the value's set bits in mode 1, the + /// value in another mode) where one is set after the count, else the count set. + fn amplification(&self) -> Option { + match self.mode { + Some((1, value)) => Some(u64::from(value.count_ones())), + Some((_, value)) => Some(value), + None => self.count, + } + } +} + /// Probe 13's default draw: two amplifications into the pass's first two layers. const AMP2: Draw = Draw { count: Some(2), mappings: Some(&[(0, 0), (0, 1)]), + mode: None, instances: 1, }; @@ -221,7 +236,7 @@ impl Case { /// of its own and what follows the execution into another (`render/executions.rs`), so its /// pass splits wherever the encoder's own draw would not. fn renders_views(&self) -> bool { - self.draws.iter().any(|d| match d.count { + self.draws.iter().any(|d| match d.amplification() { Some(n) if n > 1 => true, Some(1) => { self.max > 1 @@ -237,7 +252,11 @@ impl Case { /// amplified draws do, and announces `amplification-draws`: a count above 1 (a count of 1 is /// one draw either way). fn amplifies_singly(&self, drawn: Drawn) -> bool { - drawn == Drawn::OneAtATime && self.draws.iter().any(|d| d.count.unwrap_or(1) > 1) + drawn == Drawn::OneAtATime + && self + .draws + .iter() + .any(|d| d.amplification().unwrap_or(1) > 1) } } @@ -529,6 +548,9 @@ impl Lane { }); encoder.set_vertex_amplification_count(count, mappings.as_deref())?; } + if let Some((mode, value)) = draw.mode { + encoder.set_vertex_amplification_mode(mode, value)?; + } if case.indirect { let icb = self.indirect(&pipeline, draw.instances)?; encoder.execute_commands_in_buffer(&icb, 0..1)?; @@ -741,6 +763,7 @@ fn as_views() -> Vec<(Case, Stored)> { Draw { count: Some(1), mappings: None, + mode: None, instances: 2, }, ] @@ -756,6 +779,7 @@ fn as_views() -> Vec<(Case, Stored)> { draws: &[Draw { count: None, mappings: None, + mode: None, instances: 1, }], ..PLAIN @@ -770,6 +794,7 @@ fn as_views() -> Vec<(Case, Stored)> { draws: &[Draw { count: Some(1), mappings: Some(&[(0, 1)]), + mode: None, instances: 1, }], ..PLAIN @@ -786,6 +811,7 @@ fn as_views() -> Vec<(Case, Stored)> { draws: &[Draw { count: Some(1), mappings: Some(&[(0, 1)]), + mode: None, instances: 1, }], ..PLAIN @@ -799,6 +825,7 @@ fn as_views() -> Vec<(Case, Stored)> { draws: &[Draw { count: Some(1), mappings: Some(&[(2, 0)]), + mode: None, instances: 1, }], viewports: Viewports::Columns, @@ -814,6 +841,35 @@ fn as_views() -> Vec<(Case, Stored)> { }, halves([(0x100, C), (0x101, C), (E, E), (E, E)]), ), + // `setVertexAmplificationMode:value:` after the count sets its count, the value's set + // bits in mode 1 and the value in another mode, and keeps the mappings (the consumer's + // M3 Max measurements): as `amp2_len4_rto12`, and as a count of 1 into the first mapping. + ( + Case { + name: "mode1_two_bits_keeps_mappings", + split: true, + length: 4, + draws: &[Draw { + count: Some(2), + mappings: Some(&[(0, 1), (0, 2)]), + mode: Some((1, 0b1010_0000)), + instances: 1, + }], + ..PLAIN + }, + colors([C, 0x100, 0x101, C]), + ), + ( + Case { + name: "mode5_value1_after_amp2", + draws: &[Draw { + mode: Some((5, 1)), + ..AMP2 + }], + ..PLAIN + }, + colors([0x100, C, E, E]), + ), ] } @@ -826,11 +882,13 @@ fn a_count_above_the_pipeline_s_maximum_draws_as_metal() { const THREE: Draw = Draw { count: Some(3), mappings: Some(&[(0, 0), (0, 1), (0, 2)]), + mode: None, instances: 1, }; const FOUR: Draw = Draw { count: Some(4), mappings: Some(&[(0, 0), (0, 1), (0, 2), (0, 3)]), + mode: None, instances: 1, }; Drawn::AsViews.compare(&[ @@ -911,6 +969,22 @@ fn what_multiview_does_not_express_draws_one_amplification_at_a_time() { draws: &[Draw { count: Some(3), mappings: None, + mode: None, + instances: 1, + }], + ..PLAIN + }, + colors([0x102, C, C, C]), + ), + // The same count set by `setVertexAmplificationMode:value:` in mode 0, no mappings set. + ( + Case { + name: "mode0_3_on_2_nil", + length: 4, + draws: &[Draw { + count: None, + mappings: None, + mode: Some((0, 3)), instances: 1, }], ..PLAIN @@ -995,6 +1069,7 @@ fn what_multiview_does_not_express_draws_one_amplification_at_a_time() { draws: &[Draw { count: Some(1), mappings: Some(&[(0, 2)]), + mode: None, instances: 1, }], fragment: "rt6_amplified_slice_fragment", @@ -1077,6 +1152,7 @@ fn what_multiview_does_not_express_draws_one_amplification_at_a_time() { draws: &[Draw { count: Some(1), mappings: Some(&[(2, 0)]), + mode: None, instances: 1, }], viewports: Viewports::Columns, @@ -1139,6 +1215,7 @@ fn a_visibility_result_counts_every_amplification() { draws: &[Draw { count: Some(1), mappings: Some(&[(0, 0)]), + mode: None, instances: 1, }], visibility: Visibility::Before(Counting), @@ -1258,6 +1335,7 @@ fn an_amplified_draw_is_refused_as_typed() { draws: &[Draw { count: Some(3), mappings: Some(&[(0, 0), (0, 1), (0, 2)]), + mode: None, instances: 1, }], ..PLAIN @@ -1271,6 +1349,7 @@ fn an_amplified_draw_is_refused_as_typed() { draws: &[Draw { count: Some(9), mappings: None, + mode: None, instances: 1, }], ..PLAIN @@ -1304,6 +1383,7 @@ fn an_amplified_draw_is_refused_as_typed() { draws: &[Draw { count: Some(0), mappings: None, + mode: None, instances: 1, }], ..PLAIN diff --git a/crates/metal2vulkan-validation/src/runtime_lane/depth_compare_clamps.rs b/crates/metal2vulkan-validation/src/runtime_lane/depth_compare_clamps.rs new file mode 100644 index 000000000..255d86bf6 --- /dev/null +++ b/crates/metal2vulkan-validation/src/runtime_lane/depth_compare_clamps.rs @@ -0,0 +1,260 @@ +//! The private `fragmentDepthCompareClampMask` of OpenGL on Metal +//! (`PrivateRenderState::fragment_depth_compare_clamp_mask`), on the device the cfg selects, under +//! the validation layer, over the owned fixture `pdc_compare_clamp`. +//! +//! Metal's rule, measured with our own probes `spi` to `spi3` on an Apple M3 Max under macOS +//! 27.0.1 (a 4 x 4 `Depth32Float` texture cleared to one depth, a fullscreen triangle comparing it +//! at the centre): bit `s` clamps the reference of a fragment function's comparison through +//! `[[sampler(s)]]` to `[0, 1]`, a NaN taken as 0, whichever texture slot it compares, for +//! `sample_compare` and `gather_compare` alike; bit 31 clamps one through any constexpr sampler; +//! the comparison is then `reference OP texel`, false for a NaN reference left unclamped. The +//! rule matched all 432 probed `sample_compare` rows (depths 0, 0.5 and 1, four functions, masks 0 +//! to 3, nine references among them NaN and the infinities), and the slot, constexpr and gather +//! rows. Each draw here is checked against it. The comparisons are the device's, which announce +//! `restricted-depth-range` only on a device whose depth images may narrow a value outside +//! `[0, 1]` (`degrade_notices::clamps_depth_uploads`). + +use super::degrade_notices::{clamps_depth_uploads, counts}; +use super::{buffer_with, validated_device_with, Messages, ScratchCache, WAIT}; +use crate::air_library::AirLibrary; +use crate::gpu::TEST_DEVICE; +use metal2vulkan::bind::SamplerDescriptor; +use metal2vulkan::metal::{CompareFunction, PixelFormat, PrimitiveType, TextureUsage}; +use metal2vulkan::pipeline::{ColorAttachmentDescriptor, RenderPipelineDescriptor, StageSource}; +use metal2vulkan_devtools::{engine_dir, llvm_assemble}; +use metal2vulkan_runtime::{ + ClearColor, CommandQueue, Degradation, Device, Library, LoadAction, PipelineOptions, Region, + RenderPassDescriptor, RenderPipelineState, ResourceOptions, SamplerState, StoreAction, Texture, + TextureDescriptor, +}; + +/// The textures' side. +const SIDE: u64 = 4; + +/// The depths the compared texture is cleared to. +const DEPTHS: [f32; 3] = [0.0, 0.5, 1.0]; + +/// The references compared: inside `[0, 1]`, past it, NaN and the infinities. +const REFERENCES: [f32; 8] = [ + f32::NAN, + -0.5, + 1.5, + 0.0, + 0.25, + 1.0, + f32::NEG_INFINITY, + f32::INFINITY, +]; + +/// Bit 31: a constexpr sampler's. +const CONSTEXPR: u32 = 1 << 31; + +/// Metal's comparison of `reference` with `texel` under `function`, the reference clamped where +/// `clamped` (the module docs). +fn compares(function: CompareFunction, reference: f32, texel: f32, clamped: bool) -> bool { + let r = match (clamped, reference.is_nan()) { + (true, true) => 0.0, + (true, false) => reference.clamp(0.0, 1.0), + (false, _) => reference, + }; + match function { + CompareFunction::Less => r < texel, + CompareFunction::Equal => r == texel, + CompareFunction::GreaterEqual => r >= texel, + _ => unreachable!("a function the lane does not draw"), + } +} + +struct Lane { + device: Device, + queue: CommandQueue, + library: Library, +} + +impl Lane { + fn new(messages: &Messages, cache: &ScratchCache) -> Lane { + let device = validated_device_with(TEST_DEVICE, messages, cache.path(), |_| {}).unwrap(); + let bitcode = llvm_assemble(&engine_dir().join("pdc_compare_clamp.ll")).unwrap(); + Lane { + queue: device.new_command_queue().unwrap(), + library: device.new_library_with_air(&bitcode).unwrap(), + device, + } + } + + fn function(&self, name: &str) -> StageSource { + StageSource::Function( + self.library + .new_function_with_name(name) + .unwrap() + .function_descriptor(), + ) + } + + fn pipeline(&self, fragment: &str, mask: u32) -> RenderPipelineState { + let mut d = RenderPipelineDescriptor::new(self.function("pdc_vertex")); + d.fragment = Some(self.function(fragment)); + d.color_attachments[0] = Some(ColorAttachmentDescriptor::new(PixelFormat::RGBA8Unorm)); + d.private.fragment_depth_compare_clamp_mask = mask; + self.device + .new_render_pipeline_state(&d, &PipelineOptions::default()) + .unwrap_or_else(|e| panic!("{fragment} mask {mask:#x}: {e}")) + } + + /// A `Depth32Float` texture cleared to `depth`. + fn depth(&self, depth: f32) -> Texture { + let mut d = TextureDescriptor::texture_2d(PixelFormat::Depth32Float, SIDE, SIDE, false); + d.usage = TextureUsage::RENDER_TARGET | TextureUsage::SHADER_READ; + d.resource_options = ResourceOptions::private(); + let texture = self.device.new_texture(&d).unwrap(); + let mut pass = RenderPassDescriptor::new(); + pass.depth_attachment.texture = Some(texture.clone()); + pass.depth_attachment.load_action = LoadAction::Clear; + pass.depth_attachment.store_action = StoreAction::Store; + pass.depth_attachment.clear_depth = depth.into(); + let command_buffer = self.queue.command_buffer().unwrap(); + command_buffer + .render_command_encoder(&pass) + .unwrap() + .end_encoding() + .unwrap(); + command_buffer.commit().unwrap(); + command_buffer.wait_until_completed_for(WAIT).unwrap(); + texture + } + + fn sampler(&self, function: CompareFunction) -> SamplerState { + let mut d = SamplerDescriptor::new(); + d.compare_function = function; + self.device.new_sampler_state(&d).unwrap() + } + + /// One draw through `pipeline` comparing `depth` (at texture slot `texture`, through + /// `sampler` at slot 2 where one is given) against the references `x` (`sample_compare`) and + /// `y` (`gather_compare`): the red and green bytes of the target's first texel. + fn draw( + &self, + pipeline: &RenderPipelineState, + (depth, texture): (&Texture, u32), + sampler: Option<&SamplerState>, + (x, y): (f32, f32), + ) -> [u8; 2] { + let mut d = TextureDescriptor::texture_2d(PixelFormat::RGBA8Unorm, SIDE, SIDE, false); + d.usage = TextureUsage::RENDER_TARGET; + d.resource_options = ResourceOptions::shared(); + let target = self.device.new_texture(&d).unwrap(); + let refs: Vec = [x, y, 0.0, 0.0] + .iter() + .flat_map(|v| v.to_le_bytes()) + .collect(); + let refs = buffer_with(&self.device, &refs).unwrap(); + let mut pass = RenderPassDescriptor::new(); + let a = &mut pass.color_attachments[0]; + a.texture = Some(target.clone()); + a.load_action = LoadAction::Clear; + a.clear_color = ClearColor::new(0.0, 0.0, 0.0, 0.0); + a.store_action = StoreAction::Store; + let command_buffer = self.queue.command_buffer().unwrap(); + let mut e = command_buffer.render_command_encoder(&pass).unwrap(); + e.set_render_pipeline_state(pipeline).unwrap(); + e.set_fragment_buffer(Some(&refs), 0, 0).unwrap(); + e.set_fragment_texture(Some(depth), texture).unwrap(); + if let Some(s) = sampler { + e.set_fragment_sampler_state(Some(s), 2).unwrap(); + } + e.draw_primitives(PrimitiveType::Triangle, 0, 3, 1, 0) + .unwrap(); + e.end_encoding().unwrap(); + command_buffer.commit().unwrap(); + command_buffer.wait_until_completed_for(WAIT).unwrap(); + assert_eq!(command_buffer.error(), None); + let mut out = [0u8; 4]; + target + .get_bytes(&mut out, SIDE * 4, 0, Region::new_2d(0, 0, 1, 1), 0, 0) + .unwrap(); + [out[0], out[1]] + } +} + +/// Every reference of [`REFERENCES`] compared with every depth of [`DEPTHS`], through +/// `[[sampler(2)]]` under `Less`, `Equal` and `GreaterEqual`, and through a constexpr `Less` +/// sampler, under masks that clamp the sampler's comparisons and masks that clamp others: each +/// `sample_compare` and `gather_compare` answers as Metal's rule says (the module docs), and +/// `restricted-depth-range` is announced exactly where the device's depth images may narrow a +/// value outside `[0, 1]`. +#[test] +fn the_depth_compare_clamp_mask_clamps_metal_s_references() { + let messages = Messages::default(); + let cache = ScratchCache::new().unwrap(); + let lane = Lane::new(&messages, &cache); + let name = lane.device.name().to_owned(); + let slot = 1u32 << 2; + let (mut wrong, mut checked) = (Vec::new(), 0usize); + let functions = [ + CompareFunction::Less, + CompareFunction::Equal, + CompareFunction::GreaterEqual, + ]; + let samplers = functions.map(|f| (f, lane.sampler(f))); + // (fragment, the texture's slot, the sampler's bit, masks). + let cases = [ + ("pdc_slot", 1, slot, [0, slot, 1 << 1, u32::MAX]), + ( + "pdc_constexpr", + 0, + CONSTEXPR, + [0, CONSTEXPR, 0x7fff_ffff, u32::MAX], + ), + ]; + for (fragment, texture, bit, masks) in cases { + for mask in masks { + let pipeline = lane.pipeline(fragment, mask); + let clamped = mask & bit != 0; + for depth in DEPTHS { + let held = lane.depth(depth); + let runs: Vec<(CompareFunction, Option<&SamplerState>)> = match bit { + CONSTEXPR => vec![(CompareFunction::Less, None)], + _ => samplers.iter().map(|(f, s)| (*f, Some(s))).collect(), + }; + for (function, sampler) in runs { + for (i, &x) in REFERENCES.iter().enumerate() { + let y = REFERENCES[(i + 3) % REFERENCES.len()]; + let got = lane.draw(&pipeline, (&held, texture), sampler, (x, y)); + let byte = |r| match compares(function, r, depth, clamped) { + true => 0xff, + false => 0, + }; + let want = [byte(x), byte(y)]; + checked += 1; + if got != want { + wrong.push(format!( + "{fragment} mask {mask:#x} {function:?} depth {depth} \ + references ({x}, {y}): {got:02x?}, Metal {want:02x?}" + )); + } + } + } + } + } + } + assert!( + wrong.is_empty(), + "{name}: {} of {checked} comparisons differ from Metal's:\n{}", + wrong.len(), + wrong.join("\n") + ); + eprintln!("{name}: {checked} masked depth comparisons answer as Metal's"); + let restricted = + counts(&messages.take_notices()).contains_key(&Degradation::RestrictedDepthRange); + assert_eq!( + restricted, + clamps_depth_uploads(&lane.device), + "{name}: restricted-depth-range announced" + ); + drop(lane); + let reported = messages.take(); + assert!( + reported.is_empty(), + "the validation layer reported: {reported:#?}" + ); +} diff --git a/crates/metal2vulkan-validation/src/runtime_lane/late_resolves.rs b/crates/metal2vulkan-validation/src/runtime_lane/late_resolves.rs index 297bf75c9..63847314e 100644 --- a/crates/metal2vulkan-validation/src/runtime_lane/late_resolves.rs +++ b/crates/metal2vulkan-validation/src/runtime_lane/late_resolves.rs @@ -431,14 +431,16 @@ fn late_resolve_targets_are_refused_typed() { lane.run(&loading, |l, e, h| { l.draw(e, h, &pipeline, 0.5); for (target, index, problem) in [ + // Formats Metal stores the attachment's codes into (not built); the sRGB twin + // resolves, and a format Metal does not store into is left untouched, as the + // descriptor's. ( - of(PixelFormat::RGBA16Float, SIZE), + of(PixelFormat::RGBA8Snorm, SIZE), 0, RenderPassProblem::ResolveFormat(color), ), - // The sRGB twin resolves, as the descriptor's. ( - of(PixelFormat::R32Uint, SIZE), + of(PixelFormat::R8Unorm, SIZE), 0, RenderPassProblem::ResolveFormat(color), ), diff --git a/crates/metal2vulkan-validation/src/runtime_lane/logic_ops.rs b/crates/metal2vulkan-validation/src/runtime_lane/logic_ops.rs new file mode 100644 index 000000000..b07c53815 --- /dev/null +++ b/crates/metal2vulkan-validation/src/runtime_lane/logic_ops.rs @@ -0,0 +1,310 @@ +//! The private logic operation of OpenGL on Metal (`PrivateRenderState::logic_operation_enabled` +//! and `logic_operation`), on the device the cfg selects, under the validation layer, over the +//! owned fixture `a8r_targets` (a fullscreen triangle and a fragment writing buffer 0's color). +//! +//! Metal's rule, measured with our own probes `spi` and `spi2` on an Apple M3 Max under macOS +//! 27.0.1 (4 x 4 targets cleared to one color, a fullscreen triangle of another, every operation, +//! blended by one and one and not): the low four bits of `logicOperation` choose the operation in +//! Direct3D's order, applied to the fragment's code and the stored one of each normalized and +//! integer channel (`RGBA8Unorm`, `RGBA8Snorm`, `BGRA8Unorm`, `RGB10A2Unorm`, `R16Unorm`, +//! `RGBA8Uint`, `RGBA8Sint`, `R32Uint`), blending ignored; a `RGBA16Float` attachment ignores the +//! operation and blends. Each draw here is checked against that rule, the codes computed as +//! Metal converts the colors, and a float attachment's against the same draw without the +//! operation. Copy and no-op draw on every device; the others where the device has `logicOp`, +//! and are refused naming it elsewhere (MoltenVK). + +use super::{buffer_with, validated_device_with, Messages, ScratchCache, WAIT}; +use crate::air_library::AirLibrary; +use crate::gpu::TEST_DEVICE; +use metal2vulkan::device::VkFeature; +use metal2vulkan::error::{Capability, Feature, Needs, PrivateRenderField}; +use metal2vulkan::metal::{BlendFactor, PixelFormat, PrimitiveType, TextureUsage}; +use metal2vulkan::pipeline::{ColorAttachmentDescriptor, RenderPipelineDescriptor, StageSource}; +use metal2vulkan_devtools::{engine_dir, llvm_assemble}; +use metal2vulkan_runtime::{ + ClearColor, CommandQueue, Device, Error, Library, LoadAction, PipelineOptions, Region, + RenderPassDescriptor, RenderPipelineState, ResourceOptions, StoreAction, TextureDescriptor, +}; + +/// The target's side. +const SIDE: u64 = 4; + +/// The color each target is cleared to (the probes' own). +const CLEARED: [f64; 4] = [0.2, 0.4, 0.6, 0.8]; + +/// The color drawn: no channel's code is a tie in any format here. +const DRAWN: [f32; 4] = [0.25, 0.55, 0.75, 0.65]; + +/// The color drawn into the signed format, two channels negative. +const DRAWN_SIGNED: [f32; 4] = [-0.25, 0.55, -0.75, 0.65]; + +/// The formats drawn: each normalized one's channels (bits, signed) in memory order with the +/// color channel each holds, and the texel's bytes; `None` for the float format. +fn layout(pf: PixelFormat) -> Option<(&'static [(u32, bool, usize)], usize)> { + Some(match pf { + PixelFormat::RGBA8Unorm => ( + &[(8, false, 0), (8, false, 1), (8, false, 2), (8, false, 3)], + 4, + ), + PixelFormat::BGRA8Unorm => ( + &[(8, false, 2), (8, false, 1), (8, false, 0), (8, false, 3)], + 4, + ), + PixelFormat::RGBA8Snorm => (&[(8, true, 0), (8, true, 1), (8, true, 2), (8, true, 3)], 4), + PixelFormat::RGB10A2Unorm => ( + &[ + (10, false, 0), + (10, false, 1), + (10, false, 2), + (2, false, 3), + ], + 4, + ), + PixelFormat::R16Unorm => (&[(16, false, 0)], 2), + _ => return None, + }) +} + +/// The formats the lane draws. +const FORMATS: [PixelFormat; 6] = [ + PixelFormat::RGBA8Unorm, + PixelFormat::BGRA8Unorm, + PixelFormat::RGBA8Snorm, + PixelFormat::RGB10A2Unorm, + PixelFormat::R16Unorm, + PixelFormat::RGBA16Float, +]; + +/// Metal's code of `x` in a channel of `bits` (two's complement where `signed`): the product with +/// the largest code rounded to nearest. +fn code(x: f64, bits: u32, signed: bool) -> u32 { + let mask = (1u64 << bits) as u32 - 1; + match signed { + true => { + let max = f64::from((1u32 << (bits - 1)) - 1); + ((x.clamp(-1.0, 1.0) * max).round() as i32) as u32 & mask + } + false => (x.clamp(0.0, 1.0) * f64::from(mask)).round() as u32, + } +} + +/// Metal's operation `raw` (its low four bits) of source code `s` and stored code `d` in a channel +/// of `bits`. +fn operate(raw: u64, s: u32, d: u32, bits: u32) -> u32 { + let r = match raw & 15 { + 0 => 0, + 1 => !0, + 2 => s, + 3 => !s, + 4 => d, + 5 => !d, + 6 => s & d, + 7 => !(s & d), + 8 => s | d, + 9 => !(s | d), + 10 => s ^ d, + 11 => !(s ^ d), + 12 => s & !d, + 13 => !s & d, + 14 => s | !d, + _ => !s | d, + }; + r & ((1u64 << bits) as u32 - 1) +} + +/// The bytes Metal stores in a texel of normalized format `pf` under operation `raw`. +fn expected(pf: PixelFormat, raw: u64, drawn: [f32; 4]) -> Vec { + let (channels, bytes) = layout(pf).expect("a normalized format"); + let mut word = 0u64; + let mut shift = 0; + for &(bits, signed, channel) in channels { + let s = code(f64::from(drawn[channel]), bits, signed); + let d = code(CLEARED[channel], bits, signed); + word |= u64::from(operate(raw, s, d, bits)) << shift; + shift += bits; + } + word.to_le_bytes()[..bytes].to_vec() +} + +struct Lane { + device: Device, + queue: CommandQueue, + library: Library, +} + +impl Lane { + fn new(messages: &Messages, cache: &ScratchCache) -> Lane { + let device = validated_device_with(TEST_DEVICE, messages, cache.path(), |_| {}).unwrap(); + let bitcode = llvm_assemble(&engine_dir().join("a8r_targets.ll")).unwrap(); + Lane { + queue: device.new_command_queue().unwrap(), + library: device.new_library_with_air(&bitcode).unwrap(), + device, + } + } + + fn function(&self, name: &str) -> StageSource { + StageSource::Function( + self.library + .new_function_with_name(name) + .unwrap() + .function_descriptor(), + ) + } + + /// The fullscreen fill into `pf`, blended by one and one where `blended`, under the logic + /// operation `raw` where one is given. + fn pipeline( + &self, + pf: PixelFormat, + blended: bool, + raw: Option, + ) -> Result { + let mut d = RenderPipelineDescriptor::new(self.function("a8r_vertex")); + d.fragment = Some(self.function("a8r_fill")); + let mut a = ColorAttachmentDescriptor::new(pf); + if blended { + a.blending_enabled = true; + a.source_rgb_blend_factor = BlendFactor::One; + a.destination_rgb_blend_factor = BlendFactor::One; + a.source_alpha_blend_factor = BlendFactor::One; + a.destination_alpha_blend_factor = BlendFactor::One; + } + d.color_attachments[0] = Some(a); + if let Some(raw) = raw { + d.private.logic_operation_enabled = true; + d.private.logic_operation = raw; + } + self.device + .new_render_pipeline_state(&d, &PipelineOptions::default()) + } + + /// One pass into a `pf` target cleared to [`CLEARED`], drawing `color` through `pipeline`: + /// the first texel's bytes. + fn draw(&self, pf: PixelFormat, pipeline: &RenderPipelineState, color: [f32; 4]) -> Vec { + let texel = match pf { + PixelFormat::RGBA16Float => 8, + PixelFormat::R16Unorm => 2, + _ => 4, + }; + let mut d = TextureDescriptor::texture_2d(pf, SIDE, SIDE, false); + d.usage = TextureUsage::RENDER_TARGET; + d.resource_options = ResourceOptions::shared(); + let target = self.device.new_texture(&d).unwrap(); + let bytes: Vec = color.iter().flat_map(|v| v.to_le_bytes()).collect(); + let color = buffer_with(&self.device, &bytes).unwrap(); + let mut pass = RenderPassDescriptor::new(); + let a = &mut pass.color_attachments[0]; + a.texture = Some(target.clone()); + a.load_action = LoadAction::Clear; + a.clear_color = ClearColor::new(CLEARED[0], CLEARED[1], CLEARED[2], CLEARED[3]); + a.store_action = StoreAction::Store; + let command_buffer = self.queue.command_buffer().unwrap(); + let mut e = command_buffer.render_command_encoder(&pass).unwrap(); + e.set_render_pipeline_state(pipeline).unwrap(); + e.set_fragment_buffer(Some(&color), 0, 0).unwrap(); + e.draw_primitives(PrimitiveType::Triangle, 0, 3, 1, 0) + .unwrap(); + e.end_encoding().unwrap(); + command_buffer.commit().unwrap(); + command_buffer.wait_until_completed_for(WAIT).unwrap(); + assert_eq!(command_buffer.error(), None); + let mut out = vec![0u8; texel]; + target + .get_bytes( + &mut out, + SIDE * texel as u64, + 0, + Region::new_2d(0, 0, 1, 1), + 0, + 0, + ) + .unwrap(); + out + } +} + +/// Every operation (raw 0 to 16, 16 taken as its low four bits) into each format of [`FORMATS`], +/// blended by one and one and not: a normalized target stores Metal's operation of the codes, a +/// float one the draw without the operation (the module docs). On a device without `logicOp`, +/// copy and no-op draw so, and every other operation is refused naming the feature. +#[test] +fn the_logic_operation_stores_metal_s_codes() { + let messages = Messages::default(); + let cache = ScratchCache::new().unwrap(); + let lane = Lane::new(&messages, &cache); + let name = lane.device.name().to_owned(); + let has = lane.device.enabled().features.contains(&VkFeature::LogicOp); + let (mut wrong, mut checked, mut refused) = (Vec::new(), 0usize, 0usize); + for pf in FORMATS { + let drawn = match pf { + PixelFormat::RGBA8Snorm => DRAWN_SIGNED, + _ => DRAWN, + }; + let float = layout(pf).is_none(); + for blended in [false, true] { + // A float target's draw without the operation (a normalized one's blend is dropped, + // and lavapipe blends no snorm format). + let without = float.then(|| { + let plain = lane.pipeline(pf, blended, None).unwrap(); + lane.draw(pf, &plain, drawn) + }); + for raw in 0..=16u64 { + let blendless = matches!(raw & 15, 2 | 4); + let pipeline = match lane.pipeline(pf, blended, Some(raw)) { + Ok(p) => p, + // A float attachment that blends under an operation Vulkan's turns off. + Err(Error::Unsupported(u)) if float && blended && !blendless => { + assert_eq!( + (u.feature, u.needs), + ( + Feature::PrivateRenderState(PrivateRenderField::LogicOperation), + Needs::NotImplemented + ), + "{pf:?} {raw}" + ); + refused += 1; + continue; + } + Err(Error::Unsupported(u)) if !has && !blendless => { + assert_eq!( + u, + metal2vulkan::error::Unsupported::needs( + Feature::PrivateRenderState(PrivateRenderField::LogicOperation), + Capability::Feature(VkFeature::LogicOp), + ), + "{pf:?} {raw}" + ); + refused += 1; + continue; + } + Err(e) => panic!("{name}: {pf:?} blended {blended} operation {raw}: {e}"), + }; + let got = lane.draw(pf, &pipeline, drawn); + let want = match &without { + Some(without) => without.clone(), + None => expected(pf, raw, drawn), + }; + checked += 1; + if got != want { + wrong.push(format!( + "{pf:?} blended {blended} operation {raw}: {got:02x?}, Metal {want:02x?}" + )); + } + } + } + } + assert!( + wrong.is_empty(), + "{name}: {} of {checked} draws differ from Metal's:\n{}", + wrong.len(), + wrong.join("\n") + ); + eprintln!("{name}: {checked} logic-operated draws store Metal's texels, {refused} refused"); + drop(lane); + let reported = messages.take(); + assert!( + reported.is_empty(), + "the validation layer reported: {reported:#?}" + ); +} diff --git a/crates/metal2vulkan-validation/src/runtime_lane/renders.rs b/crates/metal2vulkan-validation/src/runtime_lane/renders.rs index c92633f1a..e1f8bef94 100644 --- a/crates/metal2vulkan-validation/src/runtime_lane/renders.rs +++ b/crates/metal2vulkan-validation/src/runtime_lane/renders.rs @@ -972,10 +972,12 @@ fn nans_resolved(pf: PixelFormat, texel: &[u8]) -> Vec { /// A NaN `Clear` of a new `Private` attachment (`nan_clear.rs`) of 4x4, 16x16 and 64x64, 1x and /// 4x, plain (a usage Metal compresses) and with `PixelFormatView` usage (kept uncompressed), -/// in a pass without a draw call and in one whose draw (`rt6_restart`, `clear_reach::Lane`) -/// lies wholly off the target, stores Metal's texel ([`NAN_CLEARS`]): the one with a `half` -/// NaN's sign where Metal keeps it, at a plain level of 16 or more in a pass without a draw -/// call, and without it elsewhere. A 1x attachment is read whole by a blit. Each sample of a 4x one +/// in a pass without a draw call, in one whose draw (`rt6_restart`, `clear_reach::Lane`) lies +/// wholly off the target, and in one whose only draw call draws no vertices, stores Metal's texel +/// ([`NAN_CLEARS`]): the one with a `half` NaN's sign where Metal keeps it, at a plain level of 16 +/// or more in a pass without a draw call, and without it elsewhere (a draw call of no vertices is +/// a draw call: the consumer's M3 Max, `R32Float`, `RG32Float` and `RGBA32Float` at 2 and 4 +/// samples, 16 a side, cleared to `-NaN`, resolves `0x7fc00000`). A 1x attachment is read whole by a blit. Each sample of a 4x one /// is read through an unsigned view of its texel size where its format has one (`RGBA16Float`, /// `R16Float` and `R32Float`, `runtime_samples::encode`): its own with `PixelFormatView` usage, /// else a same-format copy's with it (Metal's and the devices' copies keep every sample's bits, but @@ -984,7 +986,8 @@ fn nans_resolved(pf: PixelFormat, texel: &[u8]) -> Vec { /// read by a blit. In a pass without a draw call Metal's resolve keeps the texel where it keeps the /// sign and stores zero in each small-float NaN channel and `0x7fc00000` in each 32-bit float one /// elsewhere, which the runtime writes on every device (an `R32Float` clear is Metal's conversion -/// of the double at every level). In a pass with a draw Metal's resolve averages the samples, each +/// of the double at every level); so does one whose draw calls draw nothing, its resolve then +/// Metal's texel without the sign. In a pass with a draw Metal's resolve averages the samples, each /// NaN zero: a device's resolve whose NaN channels differ only so is its resolve rule, printed /// (`device-rounded-resolve`), not this clear's. A `BGR10_XR` NaN clear is printed beside them, or /// the device's refusal of the format. Each prints `MSAA-NAN-CLEAR`. @@ -1022,15 +1025,13 @@ fn multisampled_nan_clears_store_metal_s_texel() { let measured = !small.is_empty(); for (side, samples, viewed, drawn) in [4u32, 16, 64] .into_iter() - .flat_map(|side| [(side, 1u64), (side, 4)]) + .flat_map(|side| [(side, 1u64), (side, 2), (side, 4)]) .flat_map(|(side, samples)| [(side, samples, false), (side, samples, true)]) .flat_map(|(side, samples, viewed)| { - [ - (side, samples, viewed, false), - (side, samples, viewed, true), - ] + [Drawn::No, Drawn::OffTarget, Drawn::Nothing] + .map(|drawn| (side, samples, viewed, drawn)) }) - .filter(|&(_, _, _, drawn)| measured || !drawn) + .filter(|&(_, _, _, drawn)| measured || drawn == Drawn::No) { let usage = TextureUsage::RENDER_TARGET | TextureUsage::SHADER_READ; let new = |samples: u64, viewed: bool| { @@ -1050,7 +1051,11 @@ fn multisampled_nan_clears_store_metal_s_texel() { let label = format!( "{pf:?} {color:?} {samples}x {side}x{side}{}{}", if viewed { " PixelFormatView" } else { "" }, - if drawn { " drawn off the target" } else { "" } + match drawn { + Drawn::No => "", + Drawn::OffTarget => " drawn off the target", + Drawn::Nothing => " a draw call of no vertices", + } ); let texture = match new(samples, viewed) { Ok(texture) => texture, @@ -1082,7 +1087,8 @@ fn multisampled_nan_clears_store_metal_s_texel() { }; let [red, green, blue, alpha] = color; target.clear_color = ClearColor::new(red, green, blue, alpha); - let pipeline = drawn.then(|| lane.pipeline(&[pf], (None, None), samples)); + let pipeline = + (drawn != Drawn::No).then(|| lane.pipeline(&[pf], (None, None), samples)); let command_buffer = lane.queue.command_buffer().unwrap(); let encoded = command_buffer .render_command_encoder(&pass) @@ -1090,7 +1096,11 @@ fn multisampled_nan_clears_store_metal_s_texel() { if let Some(pipeline) = &pipeline { encoder.set_render_pipeline_state(pipeline)?; encoder.set_vertex_buffer(Some(&off), 0, 0)?; - encoder.draw_primitives(PrimitiveType::Triangle, 0, 3, 1, 0)?; + let vertices = match drawn { + Drawn::Nothing => 0, + _ => 3, + }; + encoder.draw_primitives(PrimitiveType::Triangle, 0, vertices, 1, 0)?; } encoder.end_encoding() }); @@ -1169,7 +1179,7 @@ fn multisampled_nan_clears_store_metal_s_texel() { continue; } checked += 1; - let signed = side >= 16 && !viewed && !drawn; + let signed = side >= 16 && !viewed && drawn == Drawn::No; let texel = if signed { large } else { small }; let samples_exact = sampled.iter().flatten().all(|sample| sample == texel); let verdict = if samples == 1 { @@ -1194,7 +1204,10 @@ fn multisampled_nan_clears_store_metal_s_texel() { }; match (samples_exact, stored.iter().all(|got| *got == metal)) { (true, true) => Ok("Metal's texel, Metal's resolve".to_owned()), - (true, false) if drawn && stored.iter().all(|got| resolve_rule(got)) => { + (true, false) + if drawn == Drawn::OffTarget + && stored.iter().all(|got| resolve_rule(got)) => + { Ok(format!( "Metal's texel; the device's resolve rule, Metal's resolve \ {metal:02x?}" @@ -1227,6 +1240,17 @@ fn multisampled_nan_clears_store_metal_s_texel() { assert!(wrong.is_empty(), "{wrong:#?}"); } +/// What a pass of [`multisampled_nan_clears_store_metal_s_texel`] draws. +#[derive(Clone, Copy, PartialEq, Eq)] +enum Drawn { + /// No draw call. + No, + /// A triangle wholly off the target. + OffTarget, + /// A draw call of no vertices. + Nothing, +} + /// Each color clear Metal was measured with stores Metal's bytes, depth and stencil clears /// included; a format the device cannot render to is counted, not run. #[test] @@ -1733,15 +1757,15 @@ fn passes_and_draws_are_refused_as_metal_refuses_them() { encoder.set_viewport_transform_enabled(false), apple(AppleOnly::ViewportTransformDisabled) ); + // A count of 0 (no set bits in mode 1) draws a number of copies that changes from run to + // run on Metal: refused, the amplification set before kept. assert_eq!( encoder.set_vertex_amplification_mode(1, 0), apple(AppleOnly::VertexAmplificationMode) ); - assert_eq!(encoder.set_depth_cleared(), apple(AppleOnly::DepthCleared)); - assert_eq!( - encoder.set_stencil_cleared(), - apple(AppleOnly::StencilCleared) - ); + // Depth and stencil "cleared" change nothing Metal draws. + assert_eq!(encoder.set_depth_cleared(), Ok(())); + assert_eq!(encoder.set_stencil_cleared(), Ok(())); // Nothing above drew; a draw of no vertices records nothing. encoder .draw_primitives(PrimitiveType::Triangle, 0, 0, 1, 0) diff --git a/crates/metal2vulkan-validation/src/runtime_lane/resolves.rs b/crates/metal2vulkan-validation/src/runtime_lane/resolves.rs index 39c3fff35..2941e997e 100644 --- a/crates/metal2vulkan-validation/src/runtime_lane/resolves.rs +++ b/crates/metal2vulkan-validation/src/runtime_lane/resolves.rs @@ -1103,14 +1103,15 @@ fn resolves_are_refused_as_metal_refuses_them() { (0, 0), ) }; - // Plain Metal's answer depends on the pair: into `BGRA8Unorm` the - // values in its channel order (not built), into `R32Uint` or `RGBA16Float` nothing; the sRGB - // twin resolves (`a_resolve_into_the_srgb_twin_keeps_the_attachment_s_encoding`). + // Plain Metal's answer depends on the pair: into `BGRA8Unorm` the values in its channel order + // (not built), into `RGBA8Snorm` and `R8Unorm` its codes (not built); into `R32Uint` or + // `RGBA16Float` nothing (`a_resolve_metal_does_not_store_leaves_its_texture_untouched`); the + // sRGB twin resolves (`a_resolve_into_the_srgb_twin_keeps_the_attachment_s_encoding`). assert_eq!( open(&other(&lane.single(PixelFormat::BGRA8Unorm))), Err(Error::NotImplemented(RuntimeGap::Render)) ); - for pf in [PixelFormat::R32Uint, PixelFormat::RGBA16Float] { + for pf in [PixelFormat::RGBA8Snorm, PixelFormat::R8Unorm] { assert_eq!( open(&other(&lane.single(pf))), refused(call, RenderPassProblem::ResolveFormat(c0)), @@ -1501,6 +1502,167 @@ fn a_resolve_into_the_srgb_twin_keeps_the_attachment_s_encoding() { quiet(lane, &messages); } +/// A multisampled extended-range attachment's resolve into its own format, which the runtime does +/// not build, is refused at the pass naming the format (`RuntimeGap::ExtendedRangeResolve`), by +/// both resolving store actions. +#[test] +fn an_extended_range_resolve_is_refused_naming_its_format() { + let (messages, _cache, lane) = lane(); + for pf in [ + PixelFormat::BGRA10XR, + PixelFormat::BGRA10XRSRGB, + PixelFormat::BGR10XR, + PixelFormat::BGR10XRSRGB, + ] { + for store in [ + StoreAction::MultisampleResolve, + StoreAction::StoreAndMultisampleResolve, + ] { + let msaa = lane.msaa(pf); + let resolve = lane.single(pf); + let pass = color_pass(&msaa, Some(&resolve), store, (0, 0)); + match lane.run(&pass, |_, _, _| {}) { + Err(Error::NotImplemented(RuntimeGap::ExtendedRangeResolve { pixel_format })) => { + assert_eq!(pixel_format, pf, "{store:?}") + } + other => panic!("{pf:?} {store:?}: {other:?}"), + } + } + } + quiet(lane, &messages); +} + +/// A multisampled color attachment's resolve into a texture of a pixel format Metal does not store +/// its tile into, which Metal's validation stops, as plain Metal runs it (our probe `xres`, the M3 +/// Max under macOS 27.0.1, 2 and 4 samples): the resolve texture keeps its texels (each byte 0x5a +/// before the pass), and the attachment holds what its store action leaves without the resolve: +/// after `StoreAndMultisampleResolve` the pass's clear and draw, as `Store` leaves them; after +/// `MultisampleResolve` its texels from before the pass, cleared and stored by a pass before it to +/// (0.75, 0.25, 0.5, 1), as Metal's tile store leaves them in every pass measured (on a device +/// that stores a `DontCare` attachment, `DontCare::Stored`, the pass's texels, Metal's answer +/// where its tiler overflows). Read through a resolve of the attachment into its own format by a +/// pass that loads it. Each pass clears to (0.25, 0.5, 0.75, 1) and draws white or nothing. The +/// pairs: `BGRA8Unorm_sRGB` and `BGRA8Unorm` into `RGBA16Float` (the formats macOS 26.6.2's Maps +/// resolves across), `RGBA8Unorm` into `R32Float` and `RGBA8Uint`, `RG16Unorm` into +/// `RGBA8Unorm`, and `RGBA16Snorm` into `RG32Float`. +#[test] +fn a_resolve_metal_does_not_store_leaves_its_texture_untouched() { + let (messages, _cache, lane) = lane(); + let facts = &lane.device.properties().driver_facts; + // A device that stores `DONT_CARE` as Metal's own keeps Metal's answer; one that keeps one of + // Metal's two either; every other one is handed `STORE` (`render_target::DontCare`). + let metals = facts.contains(&DriverFact::DontCareStoreIsMetals); + let one_of = facts.contains(&DriverFact::DontCareStoreIsOneOfMetals); + for (from, into, bytes) in [ + (PixelFormat::BGRA8UnormSRGB, PixelFormat::RGBA16Float, 8u64), + (PixelFormat::BGRA8Unorm, PixelFormat::RGBA16Float, 8), + (PixelFormat::RGBA8Unorm, PixelFormat::R32Float, 4), + (PixelFormat::RGBA8Unorm, PixelFormat::RGBA8Uint, 4), + (PixelFormat::RG16Unorm, PixelFormat::RGBA8Unorm, 4), + (PixelFormat::RGBA16Snorm, PixelFormat::RG32Float, 8), + ] { + let own_bytes = match from { + PixelFormat::RGBA16Snorm => 8, + _ => 4, + }; + let pipeline = lane.pipeline((FULL, WHITE), &[from], (None, None), 4); + for store in [ + StoreAction::MultisampleResolve, + StoreAction::StoreAndMultisampleResolve, + ] { + for drawn in [false, true] { + let label = format!("{from:?} into {into:?}, {store:?}, drawn {drawn}"); + let msaa = lane.msaa(from); + let resolve = lane.texture( + into, + Shape { + shared: true, + ..ONE + }, + TextureUsage::SHADER_READ, + ); + let filled = vec![0x5a; (bytes * SIZE * SIZE) as usize]; + resolve + .replace_region( + Region::new_2d(0, 0, SIZE, SIZE), + 0, + 0, + &filled, + bytes * SIZE, + bytes * SIZE * SIZE, + ) + .unwrap(); + // The texels before the pass. + let mut before = color_pass(&msaa, None, StoreAction::Store, (0, 0)); + before.color_attachments[0].clear_color = ClearColor::new(0.75, 0.25, 0.5, 1.0); + lane.run(&before, |_, _, _| {}).unwrap(); + let mut pass = color_pass(&msaa, Some(&resolve), store, (0, 0)); + pass.color_attachments[0].clear_color = ClearColor::new(0.25, 0.5, 0.75, 1.0); + lane.run(&pass, |l, e, h| { + if drawn { + l.draw(e, h, &pipeline, 0.5); + } + }) + .unwrap_or_else(|e| panic!("{label}: {e}")); + assert_eq!( + lane.read(&resolve, (0, 0), bytes, BlitOption::None), + filled, + "{label}: the resolve texture" + ); + // What the attachment holds, and what each pass would leave there. + let held = lane.single(from); + let mut read = + color_pass(&msaa, Some(&held), StoreAction::MultisampleResolve, (0, 0)); + read.color_attachments[0].load_action = LoadAction::Load; + lane.run(&read, |_, _, _| {}).unwrap(); + let held = lane.read(&held, (0, 0), own_bytes, BlitOption::None); + let reference = |clear: ClearColor, draw: bool| { + let texture = lane.msaa(from); + let own = lane.single(from); + let mut pass = color_pass( + &texture, + Some(&own), + StoreAction::StoreAndMultisampleResolve, + (0, 0), + ); + pass.color_attachments[0].clear_color = clear; + lane.run(&pass, |l, e, h| { + if draw { + l.draw(e, h, &pipeline, 0.5); + } + }) + .unwrap(); + lane.read(&own, (0, 0), own_bytes, BlitOption::None) + }; + let rendered = reference(ClearColor::new(0.25, 0.5, 0.75, 1.0), drawn); + let earlier = reference(ClearColor::new(0.75, 0.25, 0.5, 1.0), false); + // A pass without a draw call renders the attachment through a backing its + // texture keeps, on every device (`render.rs`). + let kept = store == StoreAction::MultisampleResolve && (!drawn || metals); + let either = store == StoreAction::MultisampleResolve && drawn && one_of; + let texels = |v: &[u8]| { + v.chunks(own_bytes as usize) + .map(<[u8]>::to_vec) + .collect::>() + }; + if kept { + assert_eq!(held, earlier, "{label}: the attachment's samples"); + } else if either { + let all = texels(&held) + .iter() + .zip(texels(&earlier)) + .zip(texels(&rendered)) + .all(|((h, e), r)| *h == e || *h == r); + assert!(all, "{label}: the attachment's samples {held:02x?}"); + } else { + assert_eq!(held, rendered, "{label}: the attachment's samples"); + } + } + } + } + quiet(lane, &messages); +} + /// A color texture without `RenderTarget` usage, which Metal's validation stops, renders as plain /// Metal renders it (the probe's `usage_*`, an M4; Metal probe case `usage_missing` on an /// M4), through a stand-in: cleared and drawn white, then stored, it holds the draw; loaded and diff --git a/crates/metal2vulkan/src/ash_interop/query.rs b/crates/metal2vulkan/src/ash_interop/query.rs index 0fd3c4b14..475f961dd 100644 --- a/crates/metal2vulkan/src/ash_interop/query.rs +++ b/crates/metal2vulkan/src/ash_interop/query.rs @@ -628,6 +628,7 @@ feature_sources! { c, x; TessellationShader => on(c.core.tessellation_shader); SampleRateShading => on(c.core.sample_rate_shading); DualSrcBlend => on(c.core.dual_src_blend); + LogicOp => on(c.core.logic_op); IndependentBlend => on(c.core.independent_blend); ShaderClipDistance => on(c.core.shader_clip_distance); ShaderCullDistance => on(c.core.shader_cull_distance); diff --git a/crates/metal2vulkan/src/bind/graphics.rs b/crates/metal2vulkan/src/bind/graphics.rs index 2f392f1e1..4e6a72817 100644 --- a/crates/metal2vulkan/src/bind/graphics.rs +++ b/crates/metal2vulkan/src/bind/graphics.rs @@ -1716,6 +1716,8 @@ fn plan(p: &RenderPipeline, device: &Device, shape: &BindShape) -> Result {} // The encoder's blend color, which instantiation reads from the state. PushField::BlendColor if stage == Stage::Fragment => {} + // The encoder's alpha test reference, which instantiation reads from the state. + PushField::AlphaTestReference if stage == Stage::Fragment => {} PushField::HalfBlendColor if stage == Stage::Fragment => {} // The draw's depth bias, which instantiation reads from the state. PushField::DepthBias if stage == Stage::Fragment => {} @@ -2647,6 +2649,19 @@ fn shadow_stencil_words(t: &ShadowTemplate, state: &BindState) -> Result u32 { + let clamped = match reference.is_nan() { + true => 0.0, + false => f64::from(reference.clamp(0.0, 1.0)), + }; + (clamped * 255.0).round_ties_even() as u32 +} + fn shader_tests_words(state: &BindState) -> FieldBytes { let ds = &state.depth_stencil; let clamp = state.depth_clip_mode_clamp; @@ -4314,6 +4329,10 @@ fn instantiate( state.blend_color, ), ), + // The alpha test reference's code, Metal's 1 where the encoder never set it. + PushField::AlphaTestReference => FieldBytes::of( + &alpha_test_code(state.alpha_test_reference.unwrap_or(1.0)).to_le_bytes(), + ), // The blend color as the encoder set it, which a 16-bit float blend rounds. PushField::HalfBlendColor => state .blend_color diff --git a/crates/metal2vulkan/src/bind/state.rs b/crates/metal2vulkan/src/bind/state.rs index 5963f5523..444406f37 100644 --- a/crates/metal2vulkan/src/bind/state.rs +++ b/crates/metal2vulkan/src/bind/state.rs @@ -272,6 +272,14 @@ pub struct BindState { /// shape. #[cfg_attr(feature = "serde", serde(default))] pub blend_color: [f32; 4], + /// The render encoder's alpha test reference (`setAlphaTestReferenceValue:`, Apple SPI); + /// `None` where the encoder never set it, which Metal's test compares as 1 (each encoder + /// starts there: a reference set in an earlier encoder is not kept). A fragment function that + /// runs the pipeline's private alpha test takes its code as push data + /// (`PushField::AlphaTestReference`). Only a draw's bytes depend on it, so it is not part of + /// the shape. + #[cfg_attr(feature = "serde", serde(default))] + pub alpha_test_reference: Option, /// Viewport 0's depth range `[near, far]` as the encoder set it (`setViewport:`; Metal's /// default viewport has `[0, 1]`), which a fragment function that runs the draw's depth test /// itself clamps its depth to in depth clamp mode (`PushField::ShaderTestsState`). Read only diff --git a/crates/metal2vulkan/src/cache/codec.rs b/crates/metal2vulkan/src/cache/codec.rs index ec02c5cd7..d1d90d4ed 100644 --- a/crates/metal2vulkan/src/cache/codec.rs +++ b/crates/metal2vulkan/src/cache/codec.rs @@ -30,7 +30,7 @@ use crate::device::subgroup::SubgroupRequirement; use crate::library::{FunctionArtifact, FunctionCompileKey, KernelFacts}; use crate::metal; use crate::metal::format::{ExtendedRange, WordAttachment, WordField}; -use crate::metal::TextureWriteRoundingMode; +use crate::metal::{CompareFunction, TextureWriteRoundingMode}; use crate::pipeline::artifact::{ ComputePipeline, ComputePipelineMetalInfo, PrecisionNote, Reconvergence, RenderPipeline, RuntimeDependency, SpecClause, SpecConstant, SpecTest, SpecializationLayout, SpecializedNote, @@ -57,9 +57,9 @@ use crate::pipeline::lower_inputs::{ HalfOutputLane, RotatedBlendForm, VertexFetch, }; use crate::pipeline::stage_io::{ - CoverageLoop, CoverageLoopRefusal, DepthMode, Interpolation as IoInterpolation, IoNumeric, - IoRole, IoType, IoVariable, PulledInput, Sampling as IoSampling, SelectedWrite, StageBuiltin, - StageInFetch, StageInInput, StageIo, + CoverageLoop, CoverageLoopRefusal, DepthCompares, DepthMode, Interpolation as IoInterpolation, + IoNumeric, IoRole, IoType, IoVariable, PulledInput, Sampling as IoSampling, SelectedWrite, + StageBuiltin, StageInFetch, StageInInput, StageIo, }; use crate::pipeline::sym::{ AccelerationStructureLevel, AirUserKey, Axis, CombinedSampler, HandleClass, ImageAccess, @@ -667,6 +667,7 @@ codec_vk_raw!( DynamicState: i32, BlendFactor: i32, BlendOp: i32, + LogicOp: i32, Filter: i32, SamplerMipmapMode: i32, SamplerAddressMode: i32, @@ -847,6 +848,7 @@ codec_enum! { VerticesPerPrimitive, TessellationChunk, MergedDrawAddress, + AlphaTestReference, } Symbol { Binding(f0), DescriptorSet(f0), Location(f0), Component(f0), SpecId(f0) } } @@ -928,7 +930,7 @@ codec_enum! { ShaderTessellationAndGeometryPointSize, MultiviewGeometryShader, AttachmentFeedbackLoopLayout, ExtendedDynamicState3ColorWriteMask, ShaderFmaFloat16, - ProvokingVertexLast, + ProvokingVertexLast, LogicOp, } VkExtension { ExtRobustness2, ExtImageRobustness, ExtShaderAtomicFloat, ExtShaderAtomicFloat2, @@ -979,7 +981,7 @@ codec_enum! { MetalFragmentSimdgroups, MetalVertexSimdgroups, CenterFragCoordDepth, SampleFragCoordDepth, MetalHalfTexelWrites, MetalNormStorageWrites, Unorm8LinearFilter, DeviceSampling, MetalDepth16Stores, MetalDepth16BiasedStores, MetalInterpolation, MetalFirstVertexIndices, - MetalFullQuads, ProvokingVertexModePerPipeline, + MetalFullQuads, ProvokingVertexModePerPipeline, DepthImageKeepsValuesOutsideUnitRange, } VkLimit { MaxComputeWorkGroupSize(f0), MaxComputeWorkGroupCount(f0), MaxComputeWorkGroupInvocations, @@ -1080,7 +1082,9 @@ codec_struct! { half_output_lanes, texture_write_rounding, uniform_outputs, uniform_inputs, instanced_attributes, selected_colors, half_blend_colors, half_fast_colors, float_blend_colors, zero_indices, color_group, word_colors, alpha_in_red_colors, + alpha_test, depth_compares, } + DepthCompares { samplers, clamped } ColorGroup { present, width, group } WordField { shift, bits } SelectedWrite { lanes, rounds, nans } @@ -1130,6 +1134,7 @@ codec_enum! { CaptureForm { Vertices, Indexed(f0) } HalfOutputLane { Float32, Float32Added } TextureWriteRoundingMode { TowardZero, NearestEven } + CompareFunction { Never, Less, Equal, LessEqual, Greater, NotEqual, GreaterEqual, Always } CoverageLoopRefusal { Outputs, EarlyFragmentTests, Discard, QuadOperations, Attachments, InterpolationFunctions, } @@ -1321,7 +1326,7 @@ codec_struct! { reads_position_depth, fragment_writes_memory, color_outputs, sample_mask, shader_tests, color_write_rules, snapshot_reads, - color_group, + color_group, logic_op, } TessellationState { patch_control_points, domain, control_points, factor_step_function, push_offset, diff --git a/crates/metal2vulkan/src/device/derive.rs b/crates/metal2vulkan/src/device/derive.rs index 1ee6defc3..f8c60714b 100644 --- a/crates/metal2vulkan/src/device/derive.rs +++ b/crates/metal2vulkan/src/device/derive.rs @@ -927,6 +927,12 @@ fn enabled_caps( if deviations.contains_key(&DriverDeviation::MetalFullQuads) { properties.insert(VkProperty::MetalFullQuads); } + if desc + .driver_facts() + .contains(&crate::device::DriverFact::DepthImageKeepsValuesOutsideUnitRange) + { + properties.insert(VkProperty::DepthImageKeepsValuesOutsideUnitRange); + } let l = &desc.limits; let sample_counts: [(vk::SampleCountFlags, fn(u32) -> VkProperty); 6] = [ ( diff --git a/crates/metal2vulkan/src/device/enables.rs b/crates/metal2vulkan/src/device/enables.rs index b1fcb23a2..1fe649408 100644 --- a/crates/metal2vulkan/src/device/enables.rs +++ b/crates/metal2vulkan/src/device/enables.rs @@ -197,7 +197,8 @@ exposures! { Core(v(0)) => [ RobustBufferAccess, ShaderInt16, ShaderInt64, ShaderFloat64, VertexPipelineStoresAndAtomics, FragmentStoresAndAtomics, GeometryShader, - TessellationShader, SampleRateShading, DualSrcBlend, IndependentBlend, ShaderClipDistance, + TessellationShader, SampleRateShading, DualSrcBlend, LogicOp, IndependentBlend, + ShaderClipDistance, ShaderCullDistance, DrawIndirectFirstInstance, MultiDrawIndirect, DepthClamp, FillModeNonSolid, ImageCubeArray, ShaderImageGatherExtended, ShaderResourceMinLod, SamplerAnisotropy, ShaderStorageImageMultisample, ShaderStorageImageExtendedFormats, diff --git a/crates/metal2vulkan/src/device/khronos.rs b/crates/metal2vulkan/src/device/khronos.rs index 1ca9c70fe..e3fc867d5 100644 --- a/crates/metal2vulkan/src/device/khronos.rs +++ b/crates/metal2vulkan/src/device/khronos.rs @@ -1386,6 +1386,7 @@ pub(super) const FEATURE_MEMBERS: &[(&str, VkFeature)] = { ("tessellationShader", F::TessellationShader), ("sampleRateShading", F::SampleRateShading), ("dualSrcBlend", F::DualSrcBlend), + ("logicOp", F::LogicOp), ("independentBlend", F::IndependentBlend), ("shaderClipDistance", F::ShaderClipDistance), ("shaderCullDistance", F::ShaderCullDistance), diff --git a/crates/metal2vulkan/src/device/requirements.rs b/crates/metal2vulkan/src/device/requirements.rs index db9c03475..2d188a0d9 100644 --- a/crates/metal2vulkan/src/device/requirements.rs +++ b/crates/metal2vulkan/src/device/requirements.rs @@ -329,6 +329,10 @@ pub enum VkFeature { /// under which a primitive's flat inputs read its last vertex, as Metal's /// `setProvokingVertexMode:` of 1 draws. ProvokingVertexLast, + /// `logicOp` (Vulkan 1.0): `VkPipelineColorBlendStateCreateInfo::logicOpEnable`, a logical + /// operation on the codes of each normalized and integer color attachment. A render pipeline + /// whose private `logicOperation` the device applies requires it (`GraphicsState::logic_op`). + LogicOp, } /// A Vulkan device extension the new core can require. @@ -788,6 +792,14 @@ pub enum VkProperty { /// shading), including "any pipeline already bound when beginning the render pass instance" /// (`VUID-vkCmdBindPipeline-pipelineBindPoint-04881`). ProvokingVertexModePerPipeline, + /// The device's `D32_SFLOAT` images keep each value outside `[0, 1]` without + /// [`VkExtension::ExtDepthRangeUnrestricted`] enabled, as Metal's `Depth32Float` textures do + /// (the runtime's measured driver fact + /// [`DriverFact::DepthImageKeepsValuesOutsideUnitRange`](crate::device::DriverFact::DepthImageKeepsValuesOutsideUnitRange)). + /// No Vulkan query reports it: Vulkan leaves such a value undefined without the extension. A + /// module whose depth comparisons the device makes requires it on a device without the + /// extension in place of recording `PrecisionNote::RestrictedDepthRange`. + DepthImageKeepsValuesOutsideUnitRange, } /// One depth or stencil resolve mode (`VkResolveModeFlagBits`), named by diff --git a/crates/metal2vulkan/src/error/mod.rs b/crates/metal2vulkan/src/error/mod.rs index 61a3e5ef8..13ef07495 100644 --- a/crates/metal2vulkan/src/error/mod.rs +++ b/crates/metal2vulkan/src/error/mod.rs @@ -1444,13 +1444,24 @@ pub enum PrivateRenderField { SampleMask, /// `sampleCoverage` other than 1. SampleCoverage, - /// `alphaTestEnabled`. + /// `alphaTestEnabled` with a test the translation has not built: an `alphaTestFunction` past + /// `MTLCompareFunctionAlways`, a pipeline without a fragment function, a fragment function + /// whose color 0 is not four `float` or `half` lanes (Metal's compiler fails a function that + /// writes no color 0 under the test), or one that loops over its covered samples. AlphaTest, - /// `logicOperationEnabled`. + /// `logicOperationEnabled` with an operation other than copy and no-op: on a device without + /// `logicOp` (`Unsupported::needs` naming it), or where Vulkan's operation is not Metal's (an + /// sRGB attachment, a float attachment that blends, a format whose operation Metal was not + /// measured with, a fragment function that writes an attachment itself). LogicOperation, /// `pointSmoothEnabled`. PointSmooth, - /// `fragmentDepthCompareClampMask` other than 0. + /// `explicitVisibilityGroupID` other than the default in a pipeline whose + /// `maxVertexAmplificationCount` is past 1. + ExplicitVisibilityGroup, + /// `fragmentDepthCompareClampMask` other than 0 in a pipeline whose fragment function makes a + /// depth comparison through an argument buffer's sampler, which no bit of the mask names + /// (Metal's answer unmeasured). FragmentDepthCompareClamp, /// `textureWriteRoundingMode` 2 (`TextureWriteRoundingMode::NearestEven`) in a pipeline whose /// fragment function writes a texel that Metal's mode 2 stores otherwise than its default (a @@ -1653,6 +1664,16 @@ pub enum RuntimeInput { /// or it applies another mask. It was compiled for another pipeline, and is compiled for this /// one again. SampleMask, + /// A fragment function in a render pipeline with the private alpha test on runs the test + /// itself (`LoweringInputs::alpha_test`), as Metal tests its color 0's alpha after it runs; + /// or it runs another comparison. It was compiled for another pipeline, and is compiled for + /// this one again. + AlphaTest, + /// A fragment function in a render pipeline with a private `fragmentDepthCompareClampMask` + /// clamps the references of its depth comparisons through the mask's samplers itself + /// (`LoweringInputs::depth_compare_clamp_mask`), as Metal clamps them; or it clamps others. It + /// was compiled for another pipeline, and is compiled for this one again. + DepthCompareClamp, /// A fragment function reads flat an interpolated varying that its pipeline's vertex function /// does not write the same at every vertex of a primitive: compiled for another vertex /// function, which wrote it so (`LoweringInputs::uniform_varyings`), it would read the diff --git a/crates/metal2vulkan/src/lower/arith/color_write.rs b/crates/metal2vulkan/src/lower/arith/color_write.rs index 2737402ed..cbac7544d 100644 --- a/crates/metal2vulkan/src/lower/arith/color_write.rs +++ b/crates/metal2vulkan/src/lower/arith/color_write.rs @@ -414,6 +414,15 @@ pub(crate) fn round_scaled_product( fb.select(down, r_down, c) } +/// The 8-bit unorm code of `v` (`f32` lanes of form `s`) as Metal converts it to an 8-bit unorm +/// channel, as `f32` lanes holding the integer: NaN is 0, the value is clamped to `[0, 1]`, and +/// the code is the exact product with 255 rounded to nearest ([`round_mersenne_product`]). The +/// private alpha test compares its alpha so (`stage_io::alpha_test`). +pub(crate) fn unorm8_code(fb: &mut FunctionBuilder<'_>, s: Form, v: Value) -> BResult { + let c = clamped(fb, s, v, 0.0, 0.0)?; + round_mersenne_product(fb, s, c, unorm_bits(8)?) +} + /// `v` clamped to `[lo, 1]` with NaN taken as `nan`. fn clamped(fb: &mut FunctionBuilder<'_>, s: Form, v: Value, nan: f64, lo: f64) -> BResult { let is_nan = fb.unary(UnOp::IsNan, v)?; diff --git a/crates/metal2vulkan/src/lower/push.rs b/crates/metal2vulkan/src/lower/push.rs index 4bc0a1ce7..99af1dcc2 100644 --- a/crates/metal2vulkan/src/lower/push.rs +++ b/crates/metal2vulkan/src/lower/push.rs @@ -90,6 +90,8 @@ pub const fn shape(f: PushField) -> FieldShape { PushField::ViewportMirrors => FieldShape::U32, // Which of a snapshot variant's draws runs. PushField::SnapshotPhase => FieldShape::U32, + // The alpha test reference's code. + PushField::AlphaTestReference => FieldShape::U32, // A draw's clamp of each vertex's depth, two `f32`s' bits. PushField::VertexDepthClamp => FieldShape::UVec2, // The blend color and one minus it, four `f32`s' bits each. diff --git a/crates/metal2vulkan/src/lower/sampler/compared.rs b/crates/metal2vulkan/src/lower/sampler/compared.rs index b5615d3c2..2c1e30924 100644 --- a/crates/metal2vulkan/src/lower/sampler/compared.rs +++ b/crates/metal2vulkan/src/lower/sampler/compared.rs @@ -623,7 +623,7 @@ pub(super) fn blended( let l0 = fb.convert(ConvOp::ConvertFToU, whole, t.u32_)?; let l1 = fb.binary(BinOp::IAdd, l0, one)?; let l1 = fb.glsl(GlslOp::UMin, &[l1, last])?; - let dref = cx.operand(fb, c.dref)?; + let dref = super::emit::reference(cx, fb, s, c.dref)?; let test = TapCompare::of(cx, fb, t, (c.function, None), (dref, Bits::Spec(spec)))?; let mut passes = [q; 2]; for (pass, level) in passes.iter_mut().zip([l0, l1]) { @@ -852,7 +852,7 @@ fn passes( bits: Bits, ) -> BResult { let t = Tys::new(fb)?; - let dref = cx.operand(fb, c.dref)?; + let dref = super::emit::reference(cx, fb, s, c.dref)?; let test = TapCompare::of(cx, fb, &t, (c.function, word), (dref, bits))?; match s.op { SampleOp::Gather { .. } => { diff --git a/crates/metal2vulkan/src/lower/sampler/emit.rs b/crates/metal2vulkan/src/lower/sampler/emit.rs index 5b35263ae..b99d2230e 100644 --- a/crates/metal2vulkan/src/lower/sampler/emit.rs +++ b/crates/metal2vulkan/src/lower/sampler/emit.rs @@ -1373,7 +1373,7 @@ pub(super) fn sampled_value( if let Some(g) = &s.cube_gather { let component = *component; let dref = match dref { - Some(r) => Some(cx.operand(fb, *r)?), + Some(r) => Some(reference(cx, fb, s, *r)?), None => None, }; let device = |fb: &mut FunctionBuilder<'_>, si: SValue| match dref { @@ -1434,7 +1434,7 @@ pub(super) fn sampled_value( return texel_value(cx, fb, s, image, (x, TexelOrigin::Computed), None); } let dref = match dref { - Some(r) => Some(cx.operand(fb, *r)?), + Some(r) => Some(reference(cx, fb, s, *r)?), None => None, }; observe(cx, fb, si, &|fb, si, sparse| match (dref, sparse) { @@ -2012,12 +2012,32 @@ pub(super) fn sample_operands( } offset_operands(cx, fb, offset, s.lanes, &mut ops)?; let dref = match dref { - Some(r) => Some(cx.operand(fb, r)?), + Some(r) => Some(reference(cx, fb, s, r)?), None => None, }; Ok((ops, dref, beyond)) } +/// The reference `r` of sampling `s`'s depth comparison as the comparison reads it: clamped to +/// `[0, 1]`, a NaN taken as 0, where the pipeline's `fragmentDepthCompareClampMask` clamps it +/// ([`Sampling::clamp_reference`]), else as computed. +pub(super) fn reference( + cx: &mut EmitCx<'_>, + fb: &mut FunctionBuilder<'_>, + s: &Sampling, + r: ValueId, +) -> BResult { + let r = cx.operand(fb, r)?; + if !s.clamp_reference { + return Ok(r); + } + let zero = f32_const(fb, 0)?; + let one = f32_const(fb, 1.0f32.to_bits())?; + let is_nan = fb.unary(UnOp::IsNan, r)?; + let r = fb.select(is_nan, zero, r)?; + fb.glsl(GlslOp::NClamp, &[r, zero, one]) +} + /// The device's sample at `coord` with comparison `dref` and operands `ops`, from the sampled /// image it is handed, in an arm of a wrapper that reads the texel otherwise elsewhere (a linear /// sample's emulation, a plain or a comparison's fetch, a switch-at-use's candidates). Where a diff --git a/crates/metal2vulkan/src/lower/sampler/mod.rs b/crates/metal2vulkan/src/lower/sampler/mod.rs index 777e47ee1..626b52745 100644 --- a/crates/metal2vulkan/src/lower/sampler/mod.rs +++ b/crates/metal2vulkan/src/lower/sampler/mod.rs @@ -714,6 +714,11 @@ pub struct Sampling { /// device's sample there, filtered codes, decodes through Metal's table /// (`texture::srgb_filtered_texel`), exactly where it read one texel. pub srgb_codes: bool, + /// A fragment function's depth comparison whose reference the pipeline's private + /// `fragmentDepthCompareClampMask` clamps (`LoweringInputs::depth_compare_clamp_mask`): the + /// reference is clamped to `[0, 1]`, a NaN taken as 0, before every comparison + /// ([`emit::reference`]). + pub clamp_reference: bool, } /// The declared result of a sampling whose slot's variant binds a texture of another numeric diff --git a/crates/metal2vulkan/src/lower/sampler/select.rs b/crates/metal2vulkan/src/lower/sampler/select.rs index 8788993e7..ad96bb129 100644 --- a/crates/metal2vulkan/src/lower/sampler/select.rs +++ b/crates/metal2vulkan/src/lower/sampler/select.rs @@ -2632,6 +2632,13 @@ fn select_one( if tangled { cx.tangled.insert(value); } + // A comparison the shader makes alone has left the op (`compared::select`). + let compares = compared.is_some() + || matches!( + op, + SampleOp::Sample { dref: Some(_), .. } | SampleOp::Gather { dref: Some(_), .. } + ); + let clamp_reference = clamps_reference(cx, compares, sampler)?; let sampling = Sampling { source, op, @@ -2665,12 +2672,55 @@ fn select_one( offset_base, anisotropic, srgb_codes, + clamp_reference, }; // The sampling routines it calls, for the census. super::routine::note(&mut cx.families.sampler, &sampling); Ok(sampling) } +/// Whether a fragment function's depth comparison (where `compares`, the device's or the +/// shader's) through `sampler` clamps its reference, as the pipeline's private +/// `fragmentDepthCompareClampMask` says (`LoweringInputs::depth_compare_clamp_mask`; probes on an +/// Apple M3 Max, macOS 27.0.1): bit `s` clamps a +/// comparison through `[[sampler(s)]]`, whichever texture slot it compares, and bit 31 one +/// through any constexpr sampler; the reference is clamped to `[0, 1]`, a NaN taken as 0, for +/// `sample_compare` and `gather_compare` alike. Each comparison's sampler is recorded +/// (`StageIo::depth_compares`); one through an argument buffer's sampler, which no bit names, is +/// refused under a mask other than 0. +fn clamps_reference( + cx: &mut SelectCx<'_>, + compares: bool, + sampler: SamplerArg, +) -> Result { + use crate::pipeline::stage_io::DepthCompares; + if cx.stage != Stage::Fragment || !compares { + return Ok(false); + } + let bit = match sampler { + SamplerArg::Static(SamplerRef::Slot(n), _) if n < 16 => 1u32 << n, + SamplerArg::Static(SamplerRef::Slot(_), _) => { + return Err(cx.invariant("a sampler slot past Metal's 16")) + } + SamplerArg::Static(SamplerRef::Constexpr(_), _) => DepthCompares::CONSTEXPR, + SamplerArg::Heap(_) => DepthCompares::ARGUMENT, + }; + let mask = cx.inputs.depth_compare_clamp_mask; + if bit == DepthCompares::ARGUMENT && mask != 0 { + return Err(Unsupported::not_implemented(Feature::PrivateRenderState( + crate::error::PrivateRenderField::FragmentDepthCompareClamp, + )) + .into()); + } + let compares = &mut cx.families.stage_io.interface.depth_compares; + compares.samplers |= bit; + let clamps = mask & bit != 0; + if clamps { + compares.clamped |= bit; + } + Ok(clamps) +} + /// Where sampling `op` through a sampler of pixel coordinates `pixel` hands the device a /// coordinate scaled by the texture's size whose texels the device's filter decides /// (`PrecisionNote::PixelSamplerScaling`): the clauses of the arms that do (empty: none). diff --git a/crates/metal2vulkan/src/lower/sampler/shared.rs b/crates/metal2vulkan/src/lower/sampler/shared.rs index 5865335a7..94eb2c462 100644 --- a/crates/metal2vulkan/src/lower/sampler/shared.rs +++ b/crates/metal2vulkan/src/lower/sampler/shared.rs @@ -566,7 +566,7 @@ fn snapped( offset_operands(cx, fb, offset, first.lanes, &mut ops)?; let component = *component; let dref = match dref { - Some(r) => Some(cx.operand(fb, *r)?), + Some(r) => Some(super::emit::reference(cx, fb, first, *r)?), None => None, }; let read = |cx: &mut EmitCx<'_>, fb: &mut FunctionBuilder<'_>, a: &Sampling| { diff --git a/crates/metal2vulkan/src/lower/stage_io/mod.rs b/crates/metal2vulkan/src/lower/stage_io/mod.rs index 7bdc19618..e1b4613d5 100644 --- a/crates/metal2vulkan/src/lower/stage_io/mod.rs +++ b/crates/metal2vulkan/src/lower/stage_io/mod.rs @@ -155,7 +155,7 @@ use std::collections::{BTreeMap, BTreeSet}; use crate::air::abi::{Builtin, ParamBinding, ParamRole}; use crate::air::ir::{ArgIdx, InstId, Value, ValueId}; use crate::error::{Error, Feature, LowerFamily, Unsupported}; -use crate::lower::arith::{narrow, ops, Form, Held}; +use crate::lower::arith::{narrow, ops, FloatFmt, Form, Held}; use crate::lower::emit::EmitCx; use crate::lower::select::{Plan, SelectCx}; use crate::pipeline::stage_io::{IoNumeric, StageIo}; @@ -338,6 +338,16 @@ pub struct AmplifiedOutput { pub below: PushField, } +/// The private alpha test a fragment function compiled under `LoweringInputs::alpha_test` runs +/// at each return ([`alpha_test`]): the returned field of its color 0, four `float` lanes (a +/// `half` output held widened), and the comparison. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] +pub struct AlphaTest { + /// The field of a returned struct ([`Returned::Struct`]); 0 for a returned value itself. + pub field: u32, + pub function: crate::metal::CompareFunction, +} + /// The stage-IO part of the per-function plan (`select::FamilyPlans`). #[derive(Clone, Debug, Default, PartialEq, Eq)] pub struct StageIoPlan { @@ -419,6 +429,9 @@ pub struct StageIoPlan { /// (`LoweringInputs::sample_mask`): the `SampleMask` output's object and the mask, which each /// return ANDs into the function's own `[[sample_mask]]` output or stores as it. pub private_mask: Option<(usize, u32)>, + /// The render pipeline's private alpha test the fragment function runs at each return + /// (`LoweringInputs::alpha_test`). + pub alpha_test: Option, /// A fragment function's per-primitive inputs (`StageIo::primitive_inputs`) are flat alone, /// not decorated `PerPrimitiveEXT`: its device does not enable `VK_EXT_mesh_shader`, so the /// pipeline's mesh function is emulated, and its synthesized vertex stage writes a @@ -1560,6 +1573,11 @@ pub fn emit_return( // return stores one, else stored as that output. let private_mask = plan.private_mask; let mut masked = false; + // The private alpha test, before any output is stored: a failing fragment is killed there. + if let (Some(v), Some(test)) = (v, plan.alpha_test) { + let x = cx.operand(fb, v)?; + alpha_test(cx, fb, test, x, returned)?; + } match (v, returned) { (None, Returned::Void) => {} (None, _) => return Err(cx.fail("an entry with outputs returns no value")), @@ -2377,6 +2395,76 @@ enum NanDrop { Record(GlobalId), } +/// Kill the fragment whose returned value `x` fails the pipeline's private alpha test `test` +/// (`LoweringInputs::alpha_test`), as Metal tests it after the function runs (probes on an +/// Apple M3 Max): color 0's alpha and the encoder's reference are each clamped to `[0, 1]`, a NaN +/// taken as 0, and converted to an 8-bit unorm code from the exact product with 255 rounded to +/// nearest, as Metal stores an 8-bit unorm channel, whatever the attachment's format; the codes +/// are compared, and a fragment whose comparison fails writes nothing and counts no visibility. +/// The reference's code is `PushField::AlphaTestReference`, which the binder converts +/// (`bind::alpha_test_code`); `Never` kills every fragment and reads no reference. Inside an +/// interlocked body the failure is recorded in the `discarded` predicate, as a NaN depth's is +/// ([`nan_drop`]). +fn alpha_test( + cx: &mut EmitCx<'_>, + fb: &mut FunctionBuilder<'_>, + test: AlphaTest, + x: SValue, + returned: Returned, +) -> BResult<()> { + use crate::metal::CompareFunction as F; + let Some(drop) = nan_drop(cx)? else { + return Err(cx.fail("an alpha test in a function that loops over its covered samples")); + }; + let fails = match test.function { + F::Never => { + let bool_ = fb.module().ty(SType::Bool)?; + let k = fb.module().constant(Constant::Scalar { + ty: bool_, + bits: ConstBits(1), + })?; + fb.module().const_value(k)? + } + function => { + let color = match returned { + Returned::Struct => fb.composite_extract(x, &[test.field])?, + Returned::Value | Returned::Void => x, + }; + let alpha = fb.composite_extract(color, &[3])?; + let scalar = Form { + held: Held::Float(FloatFmt::F32), + lanes: 1, + }; + let code = crate::lower::arith::color_write::unorm8_code(fb, scalar, alpha)?; + let u32_ = fb.module().ty(SType::Int { + width: 32, + signed: false, + })?; + let code = fb.convert(ConvOp::ConvertFToU, code, u32_)?; + let reference = cx.push_field(fb, PushField::AlphaTestReference)?; + let op = match function { + F::Less => BinOp::UGreaterThanEqual, + F::Equal => BinOp::INotEqual, + F::LessEqual => BinOp::UGreaterThan, + F::Greater => BinOp::ULessThanEqual, + F::NotEqual => BinOp::IEqual, + F::GreaterEqual => BinOp::ULessThan, + _ => return Err(cx.fail("an alpha test of a comparison that tests nothing")), + }; + fb.binary(op, code, reference)? + } + }; + match drop { + NanDrop::Kill(form) => crate::lower::fragment::kill_if(fb, fails, form), + NanDrop::Record(discarded) => { + let p = fb.module().global_value(discarded)?; + let was = fb.load(p, MemAccess::default())?; + let now = fb.binary(BinOp::LogicalOr, was, fails)?; + fb.store(p, now, MemAccess::default()) + } + } +} + /// How the entry's returns drop a positive NaN depth, or `None` in a function looping over its /// covered samples, where a kill would drop every sample's outputs. fn nan_drop(cx: &mut EmitCx<'_>) -> BResult> { diff --git a/crates/metal2vulkan/src/lower/stage_io/plan.rs b/crates/metal2vulkan/src/lower/stage_io/plan.rs index 1ddaf9428..2c9c7d72c 100644 --- a/crates/metal2vulkan/src/lower/stage_io/plan.rs +++ b/crates/metal2vulkan/src/lower/stage_io/plan.rs @@ -2024,6 +2024,25 @@ pub fn entry(cx: &mut SelectCx<'_>) -> Result<(), Error> { if matches!(o.role, OutputRole::PointSize) { point_size = true; } + // The private alpha test reads color 0's alpha as the function returns it, whatever the + // pipeline stores of it. + if let (Stage::Fragment, Some(function)) = (cx.stage, cx.inputs.alpha_test) { + if let OutputRole::RenderTarget { + attachment: AbiInt::Const(0), + index: 0, + .. + } = o.role + { + let f = io_form(cx, ty)?; + if !f.is_float() || f.lanes != 4 { + return Err(alpha_test_refused()); + } + cx.families.stage_io.alpha_test = Some(super::AlphaTest { + field: o.field, + function, + }); + } + } // A `bfloat` color output is not Metal's (its compiler rejects the return type), whether // or not the pass or pipeline has the attachment. if cx.stage == Stage::Fragment && matches!(o.role, OutputRole::RenderTarget { .. }) { @@ -3195,6 +3214,17 @@ pub fn finish(cx: &mut SelectCx<'_>) -> Result<(), Error> { return Err(limit(Feature::InterfaceComponents, lim, n, max)); } } + // The render pipeline's private alpha test, which each return runs on color 0: Metal's + // compiler fails a function that writes no color 0 under the test. + if let (Stage::Fragment, Some(function)) = (cx.stage, cx.inputs.alpha_test) { + if cx.families.stage_io.alpha_test.is_none() { + return Err(alpha_test_refused()); + } + if function != crate::metal::CompareFunction::Never { + cx.push.insert(PushField::AlphaTestReference); + } + cx.families.stage_io.interface.alpha_test = Some(function); + } // The render pipeline's private sample mask a fragment function applies itself: its // `SampleMask` output, the function's own where it writes one, which each return ANDs the // mask into or stores the mask as. @@ -3265,6 +3295,9 @@ pub fn finish(cx: &mut SelectCx<'_>) -> Result<(), Error> { + u64::from(sp.point_size_default.is_some()) // The private sample mask's AND and store. + 2 * u64::from(sp.private_mask.is_some()) + // The alpha test: the alpha's extracts, its clamp and code, the reference, the + // comparison and the kill. + + 40 * u64::from(sp.alpha_test.is_some()) + compensation_stores(sp.compensation) + sp.depth_clamp.map_or(0, |d| match (d.range, d.clamps || d.codes) { // The `[0, 1]` selects, the range's two clamps and the negative NaN's select. @@ -3347,6 +3380,15 @@ fn half_color(e: &crate::air::Entry, ty: AirTypeId) -> bool { matches!(scalar, Some(Type::Half)) } +/// The refusal of a private alpha test the translation has not built (`PrivateRenderField`'s +/// `AlphaTest`): a fragment function under the test that writes no color 0, or one that is not +/// four `float` or `half` lanes. +fn alpha_test_refused() -> Error { + Error::Unsupported(Unsupported::not_implemented(Feature::PrivateRenderState( + crate::error::PrivateRenderField::AlphaTest, + ))) +} + /// Whether `ty` is a `float` color output: a scalar or vector of AIR's `float`. fn float_color(e: &crate::air::Entry, ty: AirTypeId) -> bool { let types = e.module.types(); diff --git a/crates/metal2vulkan/src/lower/texture/mod.rs b/crates/metal2vulkan/src/lower/texture/mod.rs index 563776ad9..a06dbd2c6 100644 --- a/crates/metal2vulkan/src/lower/texture/mod.rs +++ b/crates/metal2vulkan/src/lower/texture/mod.rs @@ -1006,6 +1006,11 @@ pub struct TexturePlan { /// `0x7fc00000` because the device stores that as Metal's (`MetalFloatStorageNans`). The /// module requires them. pub storage_properties: BTreeSet, + /// The function's depth comparisons the device makes read depth images that keep values + /// outside `[0, 1]` without `VK_EXT_depth_range_unrestricted` because the driver's do + /// (`VkProperty::DepthImageKeepsValuesOutsideUnitRange`, [`depth_comparison`]): the module + /// requires that property. + pub kept_depth_range: bool, } impl TexturePlan { diff --git a/crates/metal2vulkan/src/lower/texture/slot.rs b/crates/metal2vulkan/src/lower/texture/slot.rs index 0a6ef43b2..d7ebc4e60 100644 --- a/crates/metal2vulkan/src/lower/texture/slot.rs +++ b/crates/metal2vulkan/src/lower/texture/slot.rs @@ -4,7 +4,7 @@ use crate::air::abi::Access as AbiAccess; use crate::air::intrinsics::{ImageDim, ImageShape}; use crate::device::profile::Containment; -use crate::device::requirements::{VkExtension, VkFeature}; +use crate::device::requirements::{VkExtension, VkFeature, VkProperty}; use crate::error::{Capability, Error, Feature, LowerFamily, RuntimeInput, Unsupported}; use crate::lower::select::{DescriptorCounts, SelectCx}; use crate::memory::contain; @@ -1168,22 +1168,32 @@ fn tiled_shape(shape: ImageShape) -> bool { /// The device compares a depth texture's texels (a sample or gather with comparison the shader /// does not make itself). Metal's `Depth32Float` texels hold any `float`, which a depth image keeps -/// outside `[0, 1]` only where the consumer enabled `VK_EXT_depth_range_unrestricted`; the device's -/// comparison reads a depth image (the texture's own, or its depth twin): without the extension the -/// function records `PrecisionNote::RestrictedDepthRange`. Its reads, samples and gathers, and the -/// comparisons the shader makes of them, read the texels the consumer holds them in, which a colour -/// image keeps, so they record nothing: the interface's `TextureSlot::access` states them, and the -/// consumer announces an upload its own depth image may clamp (`restricted-depth-upload`). No -/// module requires the extension, since every value within `[0, 1]` is exact without it. +/// outside `[0, 1]` where the consumer enabled `VK_EXT_depth_range_unrestricted`, or where its +/// driver is measured to keep them without it +/// (`VkProperty::DepthImageKeepsValuesOutsideUnitRange`, MoltenVK's), which the module then +/// requires; the device's comparison reads a depth image (the texture's own, or its depth twin): +/// on a device with neither the function records `PrecisionNote::RestrictedDepthRange`. Its reads, +/// samples and gathers, and the comparisons the shader makes of them, read the texels the consumer +/// holds them in, which a colour image keeps, so they record nothing: the interface's +/// `TextureSlot::access` states them, and the consumer announces an upload its own depth image may +/// clamp (`restricted-depth-upload`). No module requires the extension, since every value within +/// `[0, 1]` is exact without it. pub(crate) fn depth_comparison(cx: &mut SelectCx<'_>) { - let unrestricted = cx - .profile - .fields() - .enabled + let enabled = &cx.profile.fields().enabled; + if enabled .extensions - .contains(&VkExtension::ExtDepthRangeUnrestricted); - if !unrestricted { - cx.precision.insert(PrecisionNote::RestrictedDepthRange); + .contains(&VkExtension::ExtDepthRangeUnrestricted) + { + return; + } + match enabled + .properties + .contains(&VkProperty::DepthImageKeepsValuesOutsideUnitRange) + { + true => cx.families.texture.kept_depth_range = true, + false => { + cx.precision.insert(PrecisionNote::RestrictedDepthRange); + } } } diff --git a/crates/metal2vulkan/src/pipeline/api_tests.rs b/crates/metal2vulkan/src/pipeline/api_tests.rs index ac4eb7506..b87dc0f58 100644 --- a/crates/metal2vulkan/src/pipeline/api_tests.rs +++ b/crates/metal2vulkan/src/pipeline/api_tests.rs @@ -409,6 +409,8 @@ mod serde_round_trips { addressed_function_tables: true, unattached_colors: BTreeSet::from([5, 7]), sample_mask: Some(0b1010), + alpha_test: Some(metal::CompareFunction::GreaterEqual), + depth_compare_clamp_mask: 0x8000_0005, read_only_tests: true, shader_tests: true, shader_stencil: true, @@ -674,6 +676,7 @@ mod serde_round_trips { width: 4, group: 0, }), + logic_op: Some(vk::LogicOp::EQUIVALENT), }); let mut slots = BTreeMap::new(); slots.insert( @@ -1010,6 +1013,7 @@ mod bind_serde_round_trips { depth_clip_mode_clamp: true, stencil_references: [0x5A, 0xC3], blend_color: [0.25, -0.5, 1.5, 0.75], + alpha_test_reference: Some(0.375), primitive_type: Some(metal::PrimitiveType::TriangleStrip), depth_bias: [1.5 / 65535.0, -2.0, 0.125], depth16_pass: Some(true), diff --git a/crates/metal2vulkan/src/pipeline/artifact.rs b/crates/metal2vulkan/src/pipeline/artifact.rs index 32f268672..bc6fd3d43 100644 --- a/crates/metal2vulkan/src/pipeline/artifact.rs +++ b/crates/metal2vulkan/src/pipeline/artifact.rs @@ -716,7 +716,8 @@ pub enum PrecisionNote { DeviceNanEncoding, /// The device compares a depth texture's texels (a sample or a gather with comparison the /// shader does not make itself) on a device without `VK_EXT_depth_range_unrestricted` enabled - /// (narrowed to comparisons, and to the device's). Metal's `Depth32Float` texels hold any + /// whose driver is not measured to keep depth values outside `[0, 1]` without it (narrowed to + /// comparisons, and to the device's). Metal's `Depth32Float` texels hold any /// `float`, and the device's comparison reads them from a depth image: the texture's own, or /// the depth twin of a texture the consumer holds in an `R32_SFLOAT` image. Vulkan leaves a /// value outside `[0, 1]` uploaded there undefined without the extension @@ -724,7 +725,9 @@ pub enum PrecisionNote { /// Radeon 780M and ANV read 1000.0 back as 1.0, measured) or keep it (MoltenVK and lavapipe /// keep it, measured), so a comparison whose texel and reference both lie outside `[0, 1]` on /// the same side can differ. Values within `[0, 1]`, and every texel on a device with the - /// extension enabled, are exact. A function that reads, samples or gathers a depth texture + /// extension enabled or a driver measured to keep such values without it + /// (`VkProperty::DepthImageKeepsValuesOutsideUnitRange`, which such a module requires + /// instead), are exact. A function that reads, samples or gathers a depth texture /// without comparing, or compares the texels it read without comparison itself (a nearest /// comparison, a comparison gather, a linear comparison the emulation reaches), records /// nothing: its interface's `TextureSlot::access` states the use, and a consumer that uploads a diff --git a/crates/metal2vulkan/src/pipeline/compile.rs b/crates/metal2vulkan/src/pipeline/compile.rs index d73daa995..ce961c447 100644 --- a/crates/metal2vulkan/src/pipeline/compile.rs +++ b/crates/metal2vulkan/src/pipeline/compile.rs @@ -149,6 +149,11 @@ pub struct FragmentPass<'a> { /// (`LoweringInputs::sample_mask`); `None` from a descriptor, set by the compile layer where /// the function compiled without it could tell Vulkan's mask from Metal's. pub(crate) sample_mask: Option, + /// The pipeline's private alpha test (`LoweringInputs::alpha_test`). + pub(crate) alpha_test: Option, + /// The pipeline's private `fragmentDepthCompareClampMask` + /// (`LoweringInputs::depth_compare_clamp_mask`). + pub(crate) depth_compare_clamp_mask: u32, /// The group of the pipeline's color attachments the function writes /// (`LoweringInputs::color_group`), whose variant's descriptor `color_attachments` is /// (`color_group::descriptor`); `None` from a descriptor, set by the compile layer. @@ -168,6 +173,11 @@ impl<'a> From<&'a RenderPipelineDescriptor> for FragmentPass<'a> { max_call_stack_depth: d.max_fragment_call_stack_depth, texture_write_rounding_mode: d.texture_write_rounding_mode, sample_mask: None, + // Refused at the pipeline's creation where the test is not built. + alpha_test: crate::pipeline::private_state::alpha_test(&d.private) + .ok() + .flatten(), + depth_compare_clamp_mask: d.private.fragment_depth_compare_clamp_mask, color_group: None, } } @@ -186,6 +196,8 @@ impl<'a> From<&'a MeshPipelineDescriptor> for FragmentPass<'a> { max_call_stack_depth: 1, texture_write_rounding_mode: d.texture_write_rounding_mode, sample_mask: None, + alpha_test: None, + depth_compare_clamp_mask: 0, color_group: None, } } @@ -1796,6 +1808,8 @@ pub(crate) fn fragment_inputs( out.rotated_factors = crate::pipeline::color_writes::rotated_factors(d.color_attachments, p); out.rotated_blends = crate::pipeline::color_writes::rotated_blends(d.color_attachments, p); out.sample_mask = d.sample_mask; + out.alpha_test = d.alpha_test; + out.depth_compare_clamp_mask = d.depth_compare_clamp_mask; out.half_output_lanes = crate::pipeline::color_writes::half_output_lanes(d.color_attachments); out.texture_write_rounding = d.texture_write_rounding_mode; out.depth16_codes = depth16_codes(d, v, p); @@ -2447,6 +2461,13 @@ fn compile_kept( requirements .properties .extend(plan.families.texture.storage_properties.iter().copied()); + // Depth comparisons the device makes, with no note, because its depth images keep values + // outside `[0, 1]` as Metal's do. + if plan.families.texture.kept_depth_range { + requirements + .properties + .insert(crate::device::requirements::VkProperty::DepthImageKeepsValuesOutsideUnitRange); + } // The set-1 heap's binding flags need their features beside the module's. requirements .features diff --git a/crates/metal2vulkan/src/pipeline/compile/api.rs b/crates/metal2vulkan/src/pipeline/compile/api.rs index 52895e9b7..1c72385a1 100644 --- a/crates/metal2vulkan/src/pipeline/compile/api.rs +++ b/crates/metal2vulkan/src/pipeline/compile/api.rs @@ -297,8 +297,11 @@ impl Device { entries: &StageEntries, ) -> Result { guarded(|| { - crate::pipeline::private_state::check_render(&d.private)?; + crate::pipeline::private_state::check_render(d)?; let p = self.profile(); + // The attachments as the private logic operation draws them (`render_pipeline`). + let (operated, _) = crate::pipeline::private_state::logic_operation(d, p)?; + let d = operated.as_ref(); // A color group's variant is the pipeline of its group's attachments // (`render_pipeline`). let group = color_group::group(d, v, p)?; @@ -733,8 +736,13 @@ impl Device { v: &VariantKey, m: &mut Meter, ) -> Result { - crate::pipeline::private_state::check_render(&d.private)?; + crate::pipeline::private_state::check_render(d)?; let p = self.profile(); + // The attachments as the private logic operation draws them: its normalized and integer + // attachments unblended (unwritten under a no-op), and Vulkan's operation where one is + // needed. + let (operated, logic_op) = crate::pipeline::private_state::logic_operation(d, p)?; + let d = operated.as_ref(); let group = color_group::group(d, v, p)?; let grouped = group.as_ref().map(|g| color_group::descriptor(d, g)); let zeroed = with_zeroed_colors(grouped.as_ref().unwrap_or(d), v)?; @@ -885,6 +893,21 @@ impl Device { fragment.as_ref().map(|f| f.artifact()), &graphics, )?; + crate::pipeline::private_state::alpha_tested(d, fragment.as_ref().map(|f| f.artifact()))?; + crate::pipeline::private_state::depth_compares_clamped( + d, + fragment.as_ref().map(|f| f.artifact()), + )?; + crate::pipeline::private_state::logic_operated( + logic_op, + fragment.as_ref().map(|f| f.artifact()), + &graphics, + )?; + graphics.logic_op = logic_op; + let mut requirements = requirements; + if logic_op.is_some() { + requirements.features.insert(VkFeature::LogicOp); + } let profile = self.profile_fingerprint(); Ok(RenderPipeline { key: pipeline_key( diff --git a/crates/metal2vulkan/src/pipeline/compile/key.rs b/crates/metal2vulkan/src/pipeline/compile/key.rs index f00a9ee83..046c42236 100644 --- a/crates/metal2vulkan/src/pipeline/compile/key.rs +++ b/crates/metal2vulkan/src/pipeline/compile/key.rs @@ -380,6 +380,16 @@ pub fn function_key( h.bytes(b"sample-mask").bytes(&mask.to_le_bytes()); } // Appended only when set. + if let Some(function) = inputs.alpha_test { + h.bytes(b"alpha-test") + .bytes(&function.as_raw().to_le_bytes()); + } + // Appended only when set. + if inputs.depth_compare_clamp_mask != 0 { + h.bytes(b"depth-compare-clamp") + .bytes(&inputs.depth_compare_clamp_mask.to_le_bytes()); + } + // Appended only when set. if inputs.read_only_tests { h.bytes(b"read-only-tests"); } @@ -568,6 +578,8 @@ pub(crate) fn render_descriptor_key( fragment_depth_compare_clamp_mask, depth_stencil_write_disabled, needs_custom_border_color_samplers, + vertex_amplification_mode, + explicit_visibility_group_id, } = private; let mut h = KeyHasher::new(b"metal2vulkan/render-descriptor-key/v1"); h.bytes(profile); @@ -602,8 +614,13 @@ pub(crate) fn render_descriptor_key( {clip_distance_enable_mask} {point_smooth_enabled} {point_coord_lower_left} \ {point_size_output_vs} {two_side_enabled} {vertex_depth_compare_clamp_mask} \ {fragment_depth_compare_clamp_mask} {depth_stencil_write_disabled} \ - {needs_custom_border_color_samplers}", - sample_coverage.to_bits() + {needs_custom_border_color_samplers}{}", + sample_coverage.to_bits(), + // Appended only past Metal's defaults, so every other descriptor keeps its key. + match (*vertex_amplification_mode, *explicit_visibility_group_id) { + (0, u32::MAX) => String::new(), + (mode, group) => format!(" {mode} {group}"), + } ), ]; h.u64(fields.len() as u64); diff --git a/crates/metal2vulkan/src/pipeline/compile/tests.rs b/crates/metal2vulkan/src/pipeline/compile/tests.rs index d1c59c057..e528efcae 100644 --- a/crates/metal2vulkan/src/pipeline/compile/tests.rs +++ b/crates/metal2vulkan/src/pipeline/compile/tests.rs @@ -677,6 +677,8 @@ fn the_inputs_encoding_is_the_earlier_derived_debug() { .replace(", addressed_function_tables: false", "") .replace(", unattached_colors: {}", "") .replace(", sample_mask: None", "") + .replace(", alpha_test: None", "") + .replace(", depth_compare_clamp_mask: 0", "") .replace(", read_only_tests: false", "") .replace(", shader_tests: false", "") .replace(", shader_stencil: false", "") diff --git a/crates/metal2vulkan/src/pipeline/descriptor.rs b/crates/metal2vulkan/src/pipeline/descriptor.rs index 7a3df2a17..2b43b0589 100644 --- a/crates/metal2vulkan/src/pipeline/descriptor.rs +++ b/crates/metal2vulkan/src/pipeline/descriptor.rs @@ -366,14 +366,23 @@ pub struct PrivateRenderState { pub sample_coverage: f32, /// `sampleCoverageInvert` (default off): changes nothing Metal draws. pub sample_coverage_invert: bool, - /// `alphaTestEnabled` (default off; not built: on is refused). + /// `alphaTestEnabled` (default off): the fragment passes where `alpha_test_function` holds + /// between color 0's alpha and the render encoder's reference, each as an 8-bit unorm code + /// (`pipeline::private_state`'s docs); one that fails writes nothing. pub alpha_test_enabled: bool, /// `alphaTestFunction` (default 0, `MTLCompareFunctionNever`), the raw value: read only - /// with the alpha test on. + /// with the alpha test on, where a value past `MTLCompareFunctionAlways` is refused. pub alpha_test_function: u64, - /// `logicOperationEnabled` (default off; not built: on is refused). + /// `logicOperationEnabled` (default off): `logic_operation` applies to the codes of each + /// normalized, sRGB and integer color attachment, which then blends nothing; a float + /// attachment ignores it (`pipeline::private_state`'s docs). Copy and no-op draw on every + /// device; the other operations need the device's `logicOp`, and are refused where an + /// attachment is sRGB, a float attachment blends, or a format was not measured. pub logic_operation_enabled: bool, - /// `logicOperation` (default 0), the raw value: read only with the logic operation on. + /// `logicOperation` (default 0), the raw value: read only with the logic operation on, by its + /// low four bits, in Direct3D's order (0 clear, 1 set, 2 copy, 3 copy inverted, 4 no-op, + /// 5 invert, 6 and, 7 nand, 8 or, 9 nor, 10 xor, 11 equivalent, 12 and reverse, 13 and + /// inverted, 14 or reverse, 15 or inverted). pub logic_operation: u64, /// `clipDistanceEnableMask` (default `0xff`): changes nothing Metal draws; every clip /// distance the vertex function writes clips. @@ -391,14 +400,24 @@ pub struct PrivateRenderState { /// `vertexDepthCompareClampMask` (default 0): changes nothing Metal draws. pub vertex_depth_compare_clamp_mask: u32, /// `fragmentDepthCompareClampMask` (default 0): bit `s` clamps the reference of a fragment - /// function's depth comparison through sampler slot `s` (not built: a mask other than 0 is - /// refused). + /// function's depth comparison through `[[sampler(s)]]` to `[0, 1]`, a NaN taken as 0, and + /// bit 31 one through a constexpr sampler; a comparison through an argument buffer's sampler + /// is refused under a mask other than 0. pub fragment_depth_compare_clamp_mask: u32, /// `depthStencilWriteDisabled` (default off): changes nothing Metal draws. pub depth_stencil_write_disabled: bool, /// `needsCustomBorderColorSamplers` (default off): changes nothing Metal draws; a sampler's /// private custom border color samples transparent black with it or without. pub needs_custom_border_color_samplers: bool, + /// `vertexAmplificationMode` (default 0): 0 and 1 draw alike, the amplification count and view + /// mappings the encoder sets; Metal's descriptor asserts at 2 or more, which is refused as an + /// unknown value. + pub vertex_amplification_mode: u64, + /// `explicitVisibilityGroupID` (default `u32::MAX`, none): changes nothing Metal draws in a + /// pipeline whose `maxVertexAmplificationCount` is 1; any other group is refused where the + /// pipeline amplifies (Metal there draws one copy's color and counts every copy's samples, + /// a rule not built). + pub explicit_visibility_group_id: u32, } impl PrivateRenderState { @@ -421,11 +440,13 @@ impl PrivateRenderState { fragment_depth_compare_clamp_mask: 0, depth_stencil_write_disabled: false, needs_custom_border_color_samplers: false, + vertex_amplification_mode: 0, + explicit_visibility_group_id: u32::MAX, } } /// The fields as plain bits, the coverage by its `f32` bits: what equality compares. - fn bits(&self) -> (u64, u32, [bool; 9], [u64; 2], u8, [u32; 2]) { + fn bits(&self) -> (u64, u32, [bool; 9], [u64; 3], u8, [u32; 3]) { ( self.sample_mask, self.sample_coverage.to_bits(), @@ -440,11 +461,16 @@ impl PrivateRenderState { self.depth_stencil_write_disabled, self.needs_custom_border_color_samplers, ], - [self.alpha_test_function, self.logic_operation], + [ + self.alpha_test_function, + self.logic_operation, + self.vertex_amplification_mode, + ], self.clip_distance_enable_mask, [ self.vertex_depth_compare_clamp_mask, self.fragment_depth_compare_clamp_mask, + self.explicit_visibility_group_id, ], ) } diff --git a/crates/metal2vulkan/src/pipeline/graphics.rs b/crates/metal2vulkan/src/pipeline/graphics.rs index cfe563902..0b591b1c0 100644 --- a/crates/metal2vulkan/src/pipeline/graphics.rs +++ b/crates/metal2vulkan/src/pipeline/graphics.rs @@ -291,6 +291,15 @@ pub struct GraphicsState { /// than one group. `None` where each attachment is at its own index. #[cfg_attr(feature = "serde", serde(default))] pub color_group: Option, + /// `VkPipelineColorBlendStateCreateInfo::logicOp` with `logicOpEnable`: the descriptor's + /// private `logicOperation` + /// ([`PrivateRenderState::logic_operation`](crate::pipeline::PrivateRenderState::logic_operation)), + /// which Metal applies to the codes of each normalized and integer attachment as Vulkan + /// does, in a pipeline whose float attachments do not blend and that has no sRGB + /// attachment; the pipeline's requirements name `logicOp`. Copy and no-op need none: the + /// attachments' states already draw them. `None` with the logic operation off, and for those. + #[cfg_attr(feature = "serde", serde(default))] + pub logic_op: Option, } /// What a consumer and the binder need of a tessellation pipeline. @@ -422,6 +431,7 @@ impl GraphicsState { color_write_rules: Vec::new(), snapshot_reads: false, color_group: None, + logic_op: None, } } diff --git a/crates/metal2vulkan/src/pipeline/link/graphics.rs b/crates/metal2vulkan/src/pipeline/link/graphics.rs index a5ac9cb56..ba3b3beec 100644 --- a/crates/metal2vulkan/src/pipeline/link/graphics.rs +++ b/crates/metal2vulkan/src/pipeline/link/graphics.rs @@ -703,6 +703,9 @@ pub fn graphics_state( color_write_rules, snapshot_reads, color_group: r.color_group.clone(), + // The pipeline's private logic operation, once compile decided it + // (`private_state::logic_operation`). + logic_op: None, }; // The sample count against the attachments' sample counts. state.sample_count_properties(&p.fields().enabled.properties)?; diff --git a/crates/metal2vulkan/src/pipeline/lower_inputs.rs b/crates/metal2vulkan/src/pipeline/lower_inputs.rs index 0989764c1..f8b1acd95 100644 --- a/crates/metal2vulkan/src/pipeline/lower_inputs.rs +++ b/crates/metal2vulkan/src/pipeline/lower_inputs.rs @@ -528,6 +528,23 @@ pub struct LoweringInputs { /// then has no Vulkan sample mask. Any other function compiles as without it. #[cfg_attr(feature = "serde", serde(default))] pub sample_mask: Option, + /// The render pipeline's private alpha test (`alphaTestEnabled`, `alphaTestFunction`), which + /// the fragment function runs itself after its body: each return kills the invocation unless + /// its color 0's alpha passes the comparison against the encoder's reference + /// (`PushField::AlphaTestReference`), both as Metal compares them, 8-bit unorm codes + /// (`StageIo::alpha_test`). `Device::compile_render_pipeline` sets it for a `Function` + /// fragment stage of a pipeline with the test on, for every function but `Always`, which + /// tests nothing. Any other function compiles as without it. + #[cfg_attr(feature = "serde", serde(default))] + pub alpha_test: Option, + /// The render pipeline's private `fragmentDepthCompareClampMask`: a fragment function's depth + /// comparison through `[[sampler(s)]]` where bit `s` is set, or through a constexpr sampler + /// where bit 31 is, clamps its reference to `[0, 1]`, a NaN taken as 0, before comparing, as + /// Metal's does (`StageIo::depth_compares`); one through an argument buffer's sampler is + /// refused under a mask other than 0. `Device::compile_render_pipeline` sets it for a + /// `Function` fragment stage. Any other function compiles as with 0. + #[cfg_attr(feature = "serde", serde(default))] + pub depth_compare_clamp_mask: u32, /// The depth and stencil tests of the draws that run the fragment function write neither /// attachment and count no visibility result (`VariantKey::read_only_tests`): a function that /// stores a color through the interlocked storage form and declares no early tests only diff --git a/crates/metal2vulkan/src/pipeline/private_state.rs b/crates/metal2vulkan/src/pipeline/private_state.rs index 5a9d64924..b5524fbea 100644 --- a/crates/metal2vulkan/src/pipeline/private_state.rs +++ b/crates/metal2vulkan/src/pipeline/private_state.rs @@ -23,9 +23,48 @@ //! (`borderColorSPI` 3 with its four values) samples transparent black, the values ignored, //! with the flag or without: the raw border color 3 the runtime already //! samples so (`sampler_border_color`). -//! - `sampleCoverage`, `alphaTestEnabled`, `logicOperationEnabled`, `pointSmoothEnabled` and -//! `fragmentDepthCompareClampMask` change what Metal draws; until the translation builds one, -//! a value other than Metal's default refuses the pipeline `NotImplemented` +//! - `alphaTestEnabled` tests each fragment after its function runs (probes on an Apple M3 Max, +//! macOS 27.0.1): color 0's alpha and the encoder's reference (`setAlphaTestReferenceValue:`, 1 +//! until set in each encoder) are each clamped to `[0, 1]`, a NaN taken as 0, and converted to an +//! 8-bit unorm code as an 8-bit unorm attachment stores a float, whatever color 0's format; the +//! fragment passes where `alphaTestFunction` holds between the alpha's code and the +//! reference's, and one that fails writes nothing and counts no visibility. The fragment +//! function runs the test itself ([`alpha_test`], `LoweringInputs::alpha_test`); `Always` +//! changes nothing. Metal's compiler fails a function that writes no color 0 under the test, +//! and a function past `Always`, a pipeline without a fragment function and a color 0 other +//! than four `float` or `half` lanes are refused, their answers unmeasured. +//! - `fragmentDepthCompareClampMask` clamps the reference of a fragment function's depth +//! comparison (`sample_compare` and `gather_compare`) to `[0, 1]`, a NaN taken as 0: bit `s` +//! through `[[sampler(s)]]`, whichever texture slot it compares, and bit 31 through any +//! constexpr sampler (probes on an Apple M3 Max, macOS 27.0.1). The fragment function clamps +//! them itself (`LoweringInputs::depth_compare_clamp_mask`, [`depth_compares_clamped`]); a +//! comparison through an argument buffer's sampler, which no bit names, is refused under a mask +//! other than 0. +//! - `vertexAmplificationMode` 0 and 1 draw alike, as the encoder's amplification count and view +//! mappings say, at counts 1 and 2 (probes on an Apple M3 Max); Metal's descriptor asserts at 2 +//! or more (`vertexAmplificationMode value 2 is invalid`), refused as an unknown value. +//! `explicitVisibilityGroupID` changes nothing in a pipeline whose `maxVertexAmplificationCount` +//! is 1; where the pipeline amplifies, a group other than the default draws one copy's color and +//! counts every copy's samples on Metal, a rule not built: refused +//! (`PrivateRenderField::ExplicitVisibilityGroup`). +//! - `logicOperationEnabled` applies `logicOperation` (its low four bits, in Direct3D's order: +//! clear, set, copy, copy inverted, no-op, invert, and, nand, or, nor, xor, equivalent, and +//! reverse, and inverted, or reverse, or inverted) to the codes of each normalized, sRGB and +//! integer color attachment, the fragment's code against the stored one, blending ignored there, +//! and the write mask kept after it; a 16- or 32-bit float attachment ignores it and blends +//! (probes on an Apple M3 Max, macOS 27.0.1: `RGBA8Unorm`, `RGBA8Snorm`, `RGBA8Unorm_sRGB`, +//! `BGRA8Unorm`, `RGB10A2Unorm`, `R16Unorm`, `RGBA8Uint`, `RGBA8Sint`, `R32Uint`, `RGBA16Float`, +//! every operation, blended and not). [`logic_operation`] draws copy and no-op on every device +//! by the attachments' blends and masks, and the rest through Vulkan's `logicOp` +//! ([`GraphicsState::logic_op`]), which applies the same operation to the same codes of a +//! normalized or integer attachment; a device without it refuses them naming the feature, and +//! so is an operation other than copy and no-op where Vulkan's form is not Metal's: an sRGB +//! attachment (Vulkan applies none there), a float attachment that blends (Vulkan's turns +//! every blend off), a format whose operation Metal was not measured with (extended-range, +//! packed small-float, YCbCr), or a function that writes an attachment itself +//! ([`logic_operated`]). +//! - `sampleCoverage` and `pointSmoothEnabled` change what Metal draws; until the translation +//! builds one, a value other than Metal's default refuses the pipeline `NotImplemented` //! ([`Feature::PrivateRenderState`]) naming it. //! - `textureWriteRoundingMode` 2 rounds a fragment function's texture writes to half-float and //! `RG11B10Float` textures to nearest even, which the translation has not built: such a write is @@ -35,11 +74,23 @@ //! //! [`GraphicsState::sample_mask`]: crate::pipeline::GraphicsState::sample_mask -use crate::error::{Error, Feature, PrivateRenderField, RuntimeInput, Unsupported}; +use std::borrow::Cow; + +use crate::device::requirements::VkFeature; +use crate::device::DeviceProfile; +use crate::error::{ + Attachment, Capability, DescriptorError, Error, Feature, PrivateRenderField, RuntimeInput, + Unsupported, +}; use crate::library::FunctionArtifact; +use crate::metal::format::{write_conversion, WriteConversion}; +use crate::metal::{ColorWriteMask, CompareFunction, PixelFormat}; use crate::pipeline::descriptor::{PrivateRenderState, RenderPipelineDescriptor}; -use crate::pipeline::stage_io::StageBuiltin; +use crate::pipeline::lower_inputs::ChannelWrite; +use crate::pipeline::stage_io::{DepthCompares, StageBuiltin}; +use crate::pipeline::sym::SampledType; use crate::pipeline::GraphicsState; +use crate::vk; /// The refusal of `field` at a value the translation has not built. fn refused(field: PrivateRenderField) -> Error { @@ -48,19 +99,27 @@ fn refused(field: PrivateRenderField) -> Error { ))) } -/// `Ok` where every property of `s` is Metal's default or built (the module docs), else the -/// refusal naming the first that is not. -pub(crate) fn check_render(s: &PrivateRenderState) -> Result<(), Error> { +/// `Ok` where every property of the private state of `d` is Metal's default or built (the module +/// docs), else the refusal naming the first that is not. +pub(crate) fn check_render(d: &RenderPipelineDescriptor) -> Result<(), Error> { use PrivateRenderField as F; + let s = &d.private; + alpha_test(s)?; + // Metal's descriptor asserts at a mode of 2 or more. + if s.vertex_amplification_mode > 1 { + return Err(Error::InvalidDescriptor( + DescriptorError::UnknownEnumValue { + ty: "vertexAmplificationMode", + value: u32::try_from(s.vertex_amplification_mode).unwrap_or(u32::MAX), + }, + )); + } + if s.explicit_visibility_group_id != u32::MAX && d.max_vertex_amplification_count > 1 { + return Err(refused(F::ExplicitVisibilityGroup)); + } let unbuilt = [ (s.sample_coverage != 1.0, F::SampleCoverage), - (s.alpha_test_enabled, F::AlphaTest), - (s.logic_operation_enabled, F::LogicOperation), (s.point_smooth_enabled, F::PointSmooth), - ( - s.fragment_depth_compare_clamp_mask != 0, - F::FragmentDepthCompareClamp, - ), ]; match unbuilt.into_iter().find(|(set, _)| *set) { Some((_, field)) => Err(refused(field)), @@ -68,6 +127,64 @@ pub(crate) fn check_render(s: &PrivateRenderState) -> Result<(), Error> { } } +/// The alpha test of the private state `s` its fragment function runs +/// (`LoweringInputs::alpha_test`): the comparison where the test is on, `None` where it is off or +/// `Always`, which keeps every fragment; a function past `Always` is refused +/// (`PrivateRenderField::AlphaTest`), its answer unmeasured. +pub(crate) fn alpha_test(s: &PrivateRenderState) -> Result, Error> { + if !s.alpha_test_enabled { + return Ok(None); + } + let function = u32::try_from(s.alpha_test_function) + .ok() + .and_then(|raw| CompareFunction::try_from(raw).ok()) + .ok_or_else(|| refused(PrivateRenderField::AlphaTest))?; + Ok((function != CompareFunction::Always).then_some(function)) +} + +/// `Ok` where the fragment function `fragment` of the pipeline `d` runs the pipeline's alpha +/// test ([`alpha_test`]) as compiled: a pipeline with the test on and no fragment function is +/// refused (`PrivateRenderField::AlphaTest`, Metal's answer unmeasured), and a function compiled +/// without the test, or for another comparison, is compiled for the pipeline again +/// (`NeedsInput(AlphaTest)`). +pub(crate) fn alpha_tested( + d: &RenderPipelineDescriptor, + fragment: Option<&FunctionArtifact>, +) -> Result<(), Error> { + let wanted = alpha_test(&d.private)?; + match fragment { + None if wanted.is_some() => Err(refused(PrivateRenderField::AlphaTest)), + None => Ok(()), + Some(f) if f.interface.io.alpha_test != wanted => { + Err(Error::NeedsInput(RuntimeInput::AlphaTest)) + } + Some(_) => Ok(()), + } +} + +/// `Ok` where the fragment function `fragment` of the pipeline `d` clamps the references of its +/// depth comparisons as the pipeline's `fragmentDepthCompareClampMask` says +/// (`LoweringInputs::depth_compare_clamp_mask`): one through an argument buffer's sampler under a +/// mask other than 0 is refused (`PrivateRenderField::FragmentDepthCompareClamp`, Metal's answer +/// unmeasured), and one compiled for another mask over its samplers is compiled for the pipeline +/// again (`NeedsInput(DepthCompareClamp)`). +pub(crate) fn depth_compares_clamped( + d: &RenderPipelineDescriptor, + fragment: Option<&FunctionArtifact>, +) -> Result<(), Error> { + let mask = d.private.fragment_depth_compare_clamp_mask; + let Some(c) = fragment.map(|f| f.interface.io.depth_compares) else { + return Ok(()); + }; + if mask != 0 && c.samplers & DepthCompares::ARGUMENT != 0 { + return Err(refused(PrivateRenderField::FragmentDepthCompareClamp)); + } + match c.clamped == mask & c.samplers & !DepthCompares::ARGUMENT { + true => Ok(()), + false => Err(Error::NeedsInput(RuntimeInput::DepthCompareClamp)), + } +} + /// The sample mask Metal applies to the pipeline `d`: the private mask's bits below the sample /// count, where `d` has a fragment function under enabled rasterization; `None` where that keeps /// every sample, or `d` has no fragment stage, which ignores the mask. @@ -141,12 +258,180 @@ pub(crate) fn sample_mask( } } -/// The text the key of the render pipeline `d` appends for its private state: empty at Metal's -/// defaults and wherever only properties that change nothing differ, so every other pipeline -/// keeps its key. -pub(crate) fn render_key_fields(d: &RenderPipelineDescriptor) -> String { - match applied_sample_mask(d) { - Some(mask) => format!(" sample_mask {mask:#x}"), - None => String::new(), +/// Metal's logic operations by the low four bits of `logicOperation` (Direct3D's order), as +/// Vulkan's. +const LOGIC_OPS: [vk::LogicOp; 16] = [ + vk::LogicOp::CLEAR, + vk::LogicOp::SET, + vk::LogicOp::COPY, + vk::LogicOp::COPY_INVERTED, + vk::LogicOp::NO_OP, + vk::LogicOp::INVERT, + vk::LogicOp::AND, + vk::LogicOp::NAND, + vk::LogicOp::OR, + vk::LogicOp::NOR, + vk::LogicOp::XOR, + vk::LogicOp::EQUIVALENT, + vk::LogicOp::AND_REVERSE, + vk::LogicOp::AND_INVERTED, + vk::LogicOp::OR_REVERSE, + vk::LogicOp::OR_INVERTED, +]; + +/// How Metal's logic operation takes a color attachment of a format (the module docs). +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +enum LogicClass { + /// A normalized or integer format: the operation on its codes, blending ignored. + Codes, + /// An 8-bit sRGB format: the operation on its encoded codes, blending ignored. + Srgb, + /// A 16- or 32-bit float format: no operation, the attachment's blend. + Float, + /// A format whose operation Metal was not measured with. + Unmeasured, +} + +/// The class of logic operation an attachment of `pf` takes (the module docs): by the +/// conversion of its channels (`metal::format::write_conversion`). +fn logic_class(pf: PixelFormat) -> LogicClass { + let half = ChannelWrite::FloatTowardZero { + mantissa: 10, + signed: true, + }; + match write_conversion(pf) { + Some(WriteConversion::Exact) => match crate::metal::format::sampled_type(pf) { + Some(SampledType::Uint | SampledType::Sint) => LogicClass::Codes, + _ => LogicClass::Unmeasured, + }, + Some(WriteConversion::Float) => LogicClass::Float, + Some(WriteConversion::Rules(rules)) => { + let rules = rules.iter().flatten(); + if rules.clone().any(|r| *r == ChannelWrite::Srgb) { + LogicClass::Srgb + } else if rules.clone().all(|r| { + matches!( + r, + ChannelWrite::Unorm { .. } + | ChannelWrite::Snorm { .. } + | ChannelWrite::HalfUnorm { .. } + ) + }) { + LogicClass::Codes + } else if rules.clone().all(|r| *r == half) { + LogicClass::Float + } else { + LogicClass::Unmeasured + } + } + _ => LogicClass::Unmeasured, } } + +/// The pipeline `d` draws as on `p` under its private logic operation (the module docs), and +/// the Vulkan logic operation it draws with ([`GraphicsState::logic_op`]): each normalized, sRGB +/// and integer attachment unblended, under a no-op also unwritten, a float attachment as it is. +/// Copy and no-op are then Metal's on every device and need no Vulkan operation; every other +/// operation takes Vulkan's `logicOp`, refused naming the feature on a device without it, and +/// refused `NotImplemented` (`PrivateRenderField::LogicOperation`) where an attachment is sRGB, a +/// float attachment blends, or an attachment's format was not measured. A pipeline without a +/// fragment function writes no color, and takes no operation. +pub(crate) fn logic_operation<'a>( + d: &'a RenderPipelineDescriptor, + p: &DeviceProfile, +) -> Result<(Cow<'a, RenderPipelineDescriptor>, Option), Error> { + if !d.private.logic_operation_enabled || d.fragment.is_none() { + return Ok((Cow::Borrowed(d), None)); + } + let op = LOGIC_OPS[(d.private.logic_operation & 15) as usize]; + let blendless = matches!(op, vk::LogicOp::COPY | vk::LogicOp::NO_OP); + let mut out = d.clone(); + for (index, slot) in out.color_attachments.iter_mut().enumerate() { + let Some(a) = slot + .as_mut() + .filter(|a| a.pixel_format != PixelFormat::Invalid) + else { + continue; + }; + let refused = || { + refused(PrivateRenderField::LogicOperation) + .at_attachment(Attachment::Color(index as u32)) + }; + match (logic_class(a.pixel_format), blendless) { + (LogicClass::Unmeasured, _) => return Err(refused()), + (LogicClass::Float, true) => {} + (LogicClass::Float, false) if a.blending_enabled => return Err(refused()), + (LogicClass::Float, false) => {} + (LogicClass::Srgb, false) => return Err(refused()), + (LogicClass::Codes, _) | (LogicClass::Srgb, true) => { + a.blending_enabled = false; + if op == vk::LogicOp::NO_OP { + a.write_mask = ColorWriteMask::empty(); + } + } + } + } + if blendless { + return Ok((Cow::Owned(out), None)); + } + if !p.fields().enabled.features.contains(&VkFeature::LogicOp) { + return Err(Unsupported::needs( + Feature::PrivateRenderState(PrivateRenderField::LogicOperation), + Capability::Feature(VkFeature::LogicOp), + ) + .into()); + } + Ok((Cow::Owned(out), Some(op))) +} + +/// `Ok` where the linked pipeline `g` draws its Vulkan logic operation `op` +/// ([`logic_operation`]) as Metal's: the operation applies to the color attachments of the +/// subpass alone, so a pipeline whose fragment function writes an attachment itself (a storage +/// attachment, a shadow stencil, an imageblock, or a word it merges with its input attachment's) +/// is refused (`PrivateRenderField::LogicOperation`), Metal's answer there unmeasured. +pub(crate) fn logic_operated( + op: Option, + fragment: Option<&FunctionArtifact>, + g: &GraphicsState, +) -> Result<(), Error> { + if op.is_none() { + return Ok(()); + } + let merges = fragment.is_some_and(|f| { + f.facts.iter().any(|fact| { + matches!( + fact, + crate::pipeline::facts::RuntimeFact::WordInputMerge { .. } + ) + }) + }); + let writes_itself = !g.storage_attachments.is_empty() + || g.shadow_stencil.is_some() + || g.fragment_imageblock.is_some() + || merges; + match writes_itself { + true => Err(refused(PrivateRenderField::LogicOperation)), + false => Ok(()), + } +} + +/// The text the key of the render pipeline `d` appends for its private state: empty at Metal's +/// defaults and wherever only properties that change nothing differ, so every other pipeline +/// keeps its key. A logic operation's attachments are already in `d` as it draws them +/// ([`logic_operation`]), so only Vulkan's operation is added: copy and no-op key as the +/// pipeline of those attachments. +pub(crate) fn render_key_fields(d: &RenderPipelineDescriptor) -> String { + let mut fields = match applied_sample_mask(d) { + Some(mask) => format!(" sample_mask {mask:#x}"), + None => String::new(), + }; + if let Ok(Some(function)) = alpha_test(&d.private) { + fields.push_str(&format!(" alpha_test {}", function.as_raw())); + } + let op = LOGIC_OPS[(d.private.logic_operation & 15) as usize]; + let vulkan = !matches!(op, vk::LogicOp::COPY | vk::LogicOp::NO_OP); + if d.private.logic_operation_enabled && d.fragment.is_some() && vulkan { + fields.push_str(&format!(" logic_op {}", op.as_raw())); + } + fields +} diff --git a/crates/metal2vulkan/src/pipeline/stage_io.rs b/crates/metal2vulkan/src/pipeline/stage_io.rs index 58bcf6464..76f9021c3 100644 --- a/crates/metal2vulkan/src/pipeline/stage_io.rs +++ b/crates/metal2vulkan/src/pipeline/stage_io.rs @@ -287,6 +287,17 @@ pub struct StageIo { /// function. #[cfg_attr(feature = "serde", serde(default))] pub sample_mask: Option, + /// The render pipeline's private alpha test the fragment function runs itself + /// (`LoweringInputs::alpha_test`): its returns kill an invocation whose color 0's alpha fails + /// the comparison against `PushField::AlphaTestReference`. `None` for every other function. + #[cfg_attr(feature = "serde", serde(default))] + pub alpha_test: Option, + /// The samplers a fragment function makes depth comparisons through, and those whose + /// references it clamps (`LoweringInputs::depth_compare_clamp_mask`). Link refuses a function + /// whose clamped samplers are not the pipeline's mask over its samplers + /// (`NeedsInput(DepthCompareClamp)`). Empty for every other function. + #[cfg_attr(feature = "serde", serde(default))] + pub depth_compares: DepthCompares, /// The channels taking a `half` output at `float` precision the function compiled under /// (`LoweringInputs::half_output_lanes`), by color index: those of the attachments it writes /// a `half` output to. Link refuses a stage one of whose entries is not the pipeline's @@ -411,6 +422,27 @@ pub struct SelectedWrite { pub nans: u8, } +/// The samplers a fragment function makes depth comparisons through ([`StageIo::depth_compares`]), +/// as bits of Metal's `fragmentDepthCompareClampMask`: bit `s` for `[[sampler(s)]]` (`s` below +/// 16, Metal's sampler slots), bit 31 for a constexpr sampler, and bit 30 +/// ([`DepthCompares::ARGUMENT`]) for an argument buffer's sampler, which no mask bit names. +#[non_exhaustive] +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct DepthCompares { + /// Every sampler the function compares through. + pub samplers: u32, + /// Those whose references the function clamps: the mask it compiled under over `samplers`. + pub clamped: u32, +} + +impl DepthCompares { + /// The bit of a comparison through an argument buffer's sampler. + pub const ARGUMENT: u32 = 1 << 30; + /// The bit of a comparison through a constexpr sampler (Metal's mask bit 31, measured). + pub const CONSTEXPR: u32 = 1 << 31; +} + /// How a fragment function reads `[[sample_mask]]` where Metal runs it once per covered sample: it /// reads `[[sample_id]]` or a sample-qualified varying, or writes memory. Metal hands each of those /// runs the pixel's whole coverage, and a Vulkan invocation under sample shading sees only its own diff --git a/crates/metal2vulkan/src/pipeline/sym.rs b/crates/metal2vulkan/src/pipeline/sym.rs index f1f21ce1a..88542fceb 100644 --- a/crates/metal2vulkan/src/pipeline/sym.rs +++ b/crates/metal2vulkan/src/pipeline/sym.rs @@ -1134,6 +1134,12 @@ pub enum PushField { /// Metal's; all three are 0 for a draw its bias does not touch (points, lines, a bias the /// draw's viewports take). DepthBias, + /// The render encoder's alpha test reference (`setAlphaTestReferenceValue:`) for a fragment + /// function compiled under `LoweringInputs::alpha_test`: one `u32`, the reference's 8-bit + /// unorm code as Metal's alpha test compares it (`bind::alpha_test_code` of + /// `BindState::alpha_test_reference`), which the function compares its color 0's alpha's code + /// with. + AlphaTestReference, /// The value a draw or dispatch binds for specialization key `key`, carried as data rather /// than specialized: one `u32` holding exactly the value the binder computes for the key's /// specialization constant from the bound textures and samplers (a boolean key as 1 or 0; a diff --git a/crates/metal2vulkan/src/tests/engine_depth_range.rs b/crates/metal2vulkan/src/tests/engine_depth_range.rs index 406766159..baaf0e5c8 100644 --- a/crates/metal2vulkan/src/tests/engine_depth_range.rs +++ b/crates/metal2vulkan/src/tests/engine_depth_range.rs @@ -5,7 +5,9 @@ //! without it, measured). The product reads the extension from the device's description and //! recommends it. A function whose depth comparisons the device makes, which read a depth image, //! compiled for a device without it enabled records `PrecisionNote::RestrictedDepthRange` (narrowed -//! from every depth read to the device's comparisons): a read, a sample and a gather read the +//! from every depth read to the device's comparisons), unless the device's driver is measured to +//! keep such values without it (`VkProperty::DepthImageKeepsValuesOutsideUnitRange`, MoltenVK's), +//! which the module then requires instead: a read, a sample and a gather read the //! texels the consumer holds, which a colour image keeps, and record nothing, their use stated by //! the interface's `TextureSlot::access`, as do the comparisons the shader makes of such texels. A //! size query reads no texel, and a color texture's read is not a depth texel. @@ -16,6 +18,10 @@ use std::sync::atomic::{AtomicU64, Ordering}; use crate::device::profile::DeviceProfile; use crate::device::requirements::{VkExtension, VkProperty}; + +/// The property a depth comparison the device makes requires on a device without the extension +/// whose depth images keep values outside `[0, 1]`. +const KEPT: VkProperty = VkProperty::DepthImageKeepsValuesOutsideUnitRange; use crate::pipeline::artifact::PrecisionNote; use crate::pipeline::interface::SlotInterface; use crate::pipeline::testing::EXACT_SAMPLING; @@ -165,6 +171,10 @@ fn unrestricted(p: &DeviceProfile) -> bool { .contains(&VkExtension::ExtDepthRangeUnrestricted) } +fn kept(p: &DeviceProfile) -> bool { + p.fields().enabled.properties.contains(&KEPT) +} + /// The committed profiles the product reads the extension from: the RADV and lavapipe /// profiles list it, MoltenVK's and the 1.2 floor's do not. #[test] @@ -183,7 +193,8 @@ fn the_extension_is_read_from_the_device_description() { } /// A comparison of a depth texel the device makes records `RestrictedDepthRange` exactly where the -/// profile lacks the extension; a read, a sample and a gather never do, their use stated by the +/// profile lacks the extension and its driver is not measured to keep depth values outside +/// `[0, 1]` (MoltenVK's is, and the module requires that property there instead); a read, a sample and a gather never do, their use stated by the /// texture slot's access (read or sample) on every profile, as a color read's is; a size query /// reads no texel. The nearest comparison through a constexpr sampler is the device's only on a /// device with `VkProperty::MetalSampler` (MoltenVK's); elsewhere the shader compares the texels a @@ -210,6 +221,7 @@ fn depth_comparisons_record_the_restricted_range_without_the_extension() { }; let [(_, radv), (_, anv), (_, m3)] = &profiles; assert!(unrestricted(radv) && !unrestricted(anv) && !unrestricted(m3)); + assert!(!kept(anv) && kept(m3)); assert!(!metal(radv) && !metal(anv) && metal(m3)); for (form, text, texels, compares) in depth_kernels() { let Some(bc) = assemble(form, &text) else { @@ -217,7 +229,8 @@ fn depth_comparisons_record_the_restricted_range_without_the_extension() { }; for (device, p) in &profiles { let device_compares = compares && metal(p); - let expected = device_compares && !unrestricted(p); + let expected = device_compares && !unrestricted(p) && !kept(p); + let requires = device_compares && !unrestricted(p) && kept(p); let a = compile(&bc, "k", p).unwrap_or_else(|e| panic!("{form}: compile: {e}")); link_and_validate(&a, p).unwrap_or_else(|e| panic!("{form}: L3: {e}")); assert_eq!( @@ -226,6 +239,11 @@ fn depth_comparisons_record_the_restricted_range_without_the_extension() { "{form} on {device}: {:?}", a.precision ); + assert_eq!( + a.requirements.properties.contains(&KEPT), + requires, + "{form} on {device}" + ); let slot = a .interface .slots @@ -249,7 +267,8 @@ fn depth_comparisons_record_the_restricted_range_without_the_extension() { /// shader the taps it fetched without comparison, which a twinned texture holds in colour, so it /// records no `RestrictedDepthRange` without the extension (ANV), nor with it (RADV); on MoltenVK, /// whose device comparison is Metal's own (`VkProperty::MetalSampler`), the device compares, -/// without the extension, and records it. +/// without the extension, over a depth image that keeps values outside `[0, 1]`, and requires +/// that property in place of the note. #[test] fn a_linear_comparison_the_shader_makes_records_no_restricted_range() { // Linear minification and magnification, compare function `less`. @@ -264,7 +283,7 @@ fn a_linear_comparison_the_shader_makes_records_no_restricted_range() { let Some(bc) = assemble("linear compare", &text) else { return; }; - for (stem, expected) in [ + for (stem, requires) in [ ("intel-irisxe-anv", false), ("amd-rdna3-radv", false), ("moltenvk-m3", true), @@ -272,11 +291,15 @@ fn a_linear_comparison_the_shader_makes_records_no_restricted_range() { let p = profile(stem, EXACT_SAMPLING).expect(stem); let a = compile(&bc, "k", &p).unwrap_or_else(|e| panic!("{stem}: compile: {e}")); link_and_validate(&a, &p).unwrap_or_else(|e| panic!("{stem}: L3: {e}")); - assert_eq!( - a.precision.contains(&PrecisionNote::RestrictedDepthRange), - expected, + assert!( + !a.precision.contains(&PrecisionNote::RestrictedDepthRange), "{stem}: {:?}", a.precision ); + assert_eq!( + a.requirements.properties.contains(&KEPT), + requires, + "{stem}" + ); } } diff --git a/crates/metal2vulkan/src/tests/engine_private_render_state.rs b/crates/metal2vulkan/src/tests/engine_private_render_state.rs index 1f481a758..4229cfa7d 100644 --- a/crates/metal2vulkan/src/tests/engine_private_render_state.rs +++ b/crates/metal2vulkan/src/tests/engine_private_render_state.rs @@ -11,6 +11,12 @@ //! is refused where the fragment function could tell Metal's mask, applied after it runs, from //! Vulkan's (the owned fixtures `engine/sample_rate`, reading `[[sample_mask]]`, and //! `engine/multisample`, writing memory). +//! - The alpha test is run by the fragment function, against the encoder's reference as a push +//! field; `Always` keeps the pipeline. +//! - The logic operation leaves the normalized, sRGB and integer attachments unblended (unwritten +//! under a no-op), so copy and no-op draw on every device; the others take Vulkan's `logicOp` +//! where the device has it (lavapipe), and are refused naming it where it does not +//! (MoltenVK), and where Vulkan's operation is not Metal's. //! - Each property not built refuses a value other than Metal's default `NotImplemented`, naming //! it. A compute pipeline's `needs_custom_border_color_samplers`, which changes nothing, keeps //! its key. @@ -46,12 +52,16 @@ fn fixture(stem: &str) -> Option { } fn device(stem: &str) -> Device { + device_with(stem, DevicePolicy::default()) +} + +fn device_with(stem: &str, policy: DevicePolicy) -> Device { let path = Path::new(env!("CARGO_MANIFEST_DIR")) .join("../metal2vulkan-validation/profiles") .join(format!("{stem}.json")); let text = std::fs::read_to_string(path).expect("profile"); let description = DeviceDescription::from_khronos_json(&text, None).expect("description"); - Device::new(description, DevicePolicy::default()).expect("device") + Device::new(description, policy).expect("device") } /// The fullscreen triangle drawn white into one `RGBA8Unorm` attachment at `samples`. @@ -116,6 +126,10 @@ fn defaults_and_properties_that_change_nothing_keep_the_pipeline() { s.needs_custom_border_color_samplers, ] .contains(&true)); + assert_eq!( + (s.vertex_amplification_mode, s.explicit_visibility_group_id), + (0, u32::MAX) + ); assert_eq!(PrivateRenderState::default(), s); let Some(lib) = fixture("rt6_render_state") else { return; @@ -137,6 +151,9 @@ fn defaults_and_properties_that_change_nothing_keep_the_pipeline() { p.vertex_depth_compare_clamp_mask = u32::MAX; p.depth_stencil_write_disabled = true; p.needs_custom_border_color_samplers = true; + p.vertex_amplification_mode = 1; + // A pipeline that does not amplify. + p.explicit_visibility_group_id = 3; // Every sample's bit set, and bits past the sample count cleared or set. p.sample_mask = ((1 << samples) - 1) | 0xf0_0000_0000; let kept = compile(&dev, &d, &what); @@ -313,16 +330,17 @@ fn each_property_not_built_refuses_a_value_other_than_metals_default() { let Some(lib) = fixture("rt6_render_state") else { return; }; - let cases: [(fn(&mut PrivateRenderState), PrivateRenderField); 6] = [ + let cases: [(fn(&mut PrivateRenderState), PrivateRenderField); 4] = [ (|p| p.sample_coverage = 0.5, F::SampleCoverage), (|p| p.sample_coverage = f32::NAN, F::SampleCoverage), - (|p| p.alpha_test_enabled = true, F::AlphaTest), - (|p| p.logic_operation_enabled = true, F::LogicOperation), - (|p| p.point_smooth_enabled = true, F::PointSmooth), ( - |p| p.fragment_depth_compare_clamp_mask = 1, - F::FragmentDepthCompareClamp, + |p| { + p.alpha_test_enabled = true; + p.alpha_test_function = 8; + }, + F::AlphaTest, ), + (|p| p.point_smooth_enabled = true, F::PointSmooth), ]; for stem in STEMS { let dev = device(stem); @@ -334,6 +352,347 @@ fn each_property_not_built_refuses_a_value_other_than_metals_default() { Ok(_) => panic!("{stem} {field:?}: compiled"), } } + // A visibility group where the pipeline amplifies. + let mut d = render(&lib, 1); + d.max_vertex_amplification_count = 2; + d.private.explicit_visibility_group_id = 0; + match dev.compile_render_pipeline(&d, &Budget::standard()) { + Err(e) => assert_eq!(e, refused(F::ExplicitVisibilityGroup), "{stem}"), + Ok(_) => panic!("{stem}: an amplified visibility group compiled"), + } + // A mode Metal's descriptor asserts at. + let mut d = render(&lib, 1); + d.private.vertex_amplification_mode = 2; + match dev.compile_render_pipeline(&d, &Budget::standard()) { + Err(Error::InvalidDescriptor(_)) => {} + other => panic!("{stem}: vertexAmplificationMode 2: {other:?}"), + } + } +} + +/// The private logic operation: every normalized, sRGB and integer attachment is unblended, and +/// under a no-op unwritten, which draws copy and no-op on both profiles with no Vulkan operation; +/// another operation (xor, raw 10, and raw 26, whose low four bits are xor's) is Vulkan's +/// `logicOp` on lavapipe, its requirements naming the feature, and refused naming the feature on +/// MoltenVK, which lacks it; a float attachment keeps its blend under copy and no-op and takes +/// Vulkan's operation unblended; an sRGB attachment under xor, a blended float attachment under xor +/// and a format whose operation Metal was not measured with are refused `NotImplemented`. +#[test] +fn the_logic_operation_draws_as_metal_s_or_is_refused() { + use crate::device::requirements::VkFeature; + use crate::error::{Attachment, Capability}; + use crate::metal::BlendFactor; + use crate::vk; + let Some(lib) = fixture("rt6_render_state") else { + return; + }; + let with = |pf: PixelFormat, blended: bool, op: Option| { + let mut d = render(&lib, 1); + let mut a = ColorAttachmentDescriptor::new(pf); + if blended { + a.blending_enabled = true; + a.source_rgb_blend_factor = BlendFactor::One; + a.destination_rgb_blend_factor = BlendFactor::One; + } + d.color_attachments[0] = Some(a); + if let Some(op) = op { + d.private.logic_operation_enabled = true; + d.private.logic_operation = op; + } + d + }; + let not_built = |index: u32| { + Error::Unsupported(Unsupported::not_implemented(Feature::PrivateRenderState( + PrivateRenderField::LogicOperation, + ))) + .at_attachment(Attachment::Color(index)) + }; + for stem in STEMS { + let dev = device(stem); + let has = stem == "lavapipe"; + let state = |d: &RenderPipelineDescriptor, what: &str| { + let p = compile(&dev, d, &format!("{stem} {what}")); + let a = p.graphics.color_attachments[0].expect("attachment 0"); + (p.graphics.logic_op, a.blend.is_some(), a.write_mask, p) + }; + // Copy and no-op on every device, the blend dropped, no-op writing nothing. + let (op, blends, mask, _) = state(&with(PixelFormat::RGBA8Unorm, true, Some(2)), "copy"); + assert_eq!((op, blends), (None, false), "{stem} copy"); + assert_eq!(mask, vk::ColorComponentFlags::known_bits(), "{stem} copy"); + let (op, blends, mask, _) = state(&with(PixelFormat::RGBA8Unorm, true, Some(4)), "no-op"); + assert_eq!( + (op, blends, mask), + (None, false, vk::ColorComponentFlags::empty()) + ); + let (op, blends, _, _) = state(&with(PixelFormat::RGBA8UnormSRGB, true, Some(2)), "srgb"); + assert_eq!((op, blends), (None, false), "{stem} sRGB copy"); + // A float attachment keeps its blend under copy. + let (op, blends, _, _) = state(&with(PixelFormat::RGBA16Float, true, Some(2)), "float"); + assert_eq!((op, blends), (None, true), "{stem} float copy"); + for raw in [10, 26] { + for pf in [ + PixelFormat::RGBA8Unorm, + PixelFormat::RGBA8Snorm, + PixelFormat::RGB10A2Unorm, + PixelFormat::R16Unorm, + PixelFormat::RGBA16Float, + ] { + let blended = pf != PixelFormat::RGBA16Float; + let d = with(pf, blended, Some(raw)); + match (has, dev.compile_render_pipeline(&d, &Budget::standard())) { + (true, Ok(p)) => { + assert_eq!(p.graphics.logic_op, Some(vk::LogicOp::XOR), "{pf:?}"); + let a = p.graphics.color_attachments[0].expect("attachment 0"); + assert!(a.blend.is_none(), "{stem} {pf:?} blends"); + assert!(p.requirements.features.contains(&VkFeature::LogicOp)); + } + (false, Err(e)) => assert_eq!( + e, + Error::Unsupported(Unsupported::needs( + Feature::PrivateRenderState(PrivateRenderField::LogicOperation), + Capability::Feature(VkFeature::LogicOp), + )), + "{stem} {pf:?}" + ), + (_, other) => panic!("{stem} {pf:?} xor: {other:?}"), + } + } + } + // Where Vulkan's operation is not Metal's, on either device. + for (pf, blended) in [ + (PixelFormat::RGBA8UnormSRGB, false), + (PixelFormat::RGBA16Float, true), + (PixelFormat::RG11B10Float, false), + ] { + match dev.compile_render_pipeline(&with(pf, blended, Some(10)), &Budget::standard()) { + Err(e) => assert_eq!(e, not_built(0), "{stem} {pf:?}"), + Ok(_) => panic!("{stem} {pf:?} xor compiled"), + } + } + // Each Vulkan operation keys a pipeline of its own, apart from copy's, whose attachments + // are the same unblended ones. + if has { + let key = |raw: u64| { + compile(&dev, &with(PixelFormat::RGBA8Unorm, true, Some(raw)), "key").key + }; + let keys = [key(0), key(10), key(15), key(2)]; + for (i, a) in keys.iter().enumerate() { + assert!(keys[i + 1..].iter().all(|b| a != b), "{stem} keys {keys:?}"); + } + } + // Off, the pipeline is the one without the property. + let off = compile(&dev, &with(PixelFormat::RGBA8Unorm, true, None), "off"); + let mut d = with(PixelFormat::RGBA8Unorm, true, None); + d.private.logic_operation = 10; + let unset = compile(&dev, &d, "off, an operation set"); + assert!(off.graphics.logic_op.is_none() && unset.graphics.logic_op.is_none()); + assert_eq!(off.graphics, unset.graphics, "{stem}"); + } +} + +/// The private alpha test: the fragment function runs it at its returns, reading the encoder's +/// reference as a push field for every function but `Never`, which kills every fragment; `Always` +/// keeps the pipeline as without the test. The keys a consumer looks the pipeline up by name the +/// tested compile, and a function compiled without the test is compiled for the pipeline again. A +/// pipeline without a fragment function, and a function past `Always`, are refused. +#[test] +fn the_alpha_test_runs_in_the_fragment_function() { + use crate::metal::CompareFunction; + use crate::pipeline::sym::{PushField, Stage}; + let Some(lib) = fixture("rt6_render_state") else { + return; + }; + let reads_reference = |p: &RenderPipeline| { + p.interface.push.iter().any(|pl| { + pl.stage == Stage::Fragment + && pl + .fields + .iter() + .any(|f| f.field == PushField::AlphaTestReference) + }) + }; + for stem in STEMS { + let dev = device(stem); + let plain = render(&lib, 1); + let base = compile(&dev, &plain, stem); + let untested = dev + .render_pipeline_key(&plain, &Budget::standard()) + .unwrap_or_else(|e| panic!("{stem}: {e}")) + .fragment_inputs + .expect("fragment inputs"); + assert_eq!(untested.alpha_test, None, "{stem}"); + for raw in 0..=7u64 { + let what = format!("{stem} function {raw}"); + let mut d = render(&lib, 1); + d.private.alpha_test_enabled = true; + d.private.alpha_test_function = raw; + let p = compile(&dev, &d, &what); + let function = CompareFunction::try_from(raw as u32).expect("function"); + if function == CompareFunction::Always { + assert_eq!(p.key, base.key, "{what}"); + assert!(same_modules(&p, &base), "{what}"); + continue; + } + assert_ne!(p.key, base.key, "{what}"); + assert!(!same_modules(&p, &base), "{what}"); + assert_eq!( + reads_reference(&p), + function != CompareFunction::Never, + "{what}" + ); + for m in &p.stages { + check_words_valid(&m.spirv, &p.requirements, dev.profile()) + .unwrap_or_else(|e| panic!("{what} {:?}: L3: {e}", m.stage)); + } + let keys = dev + .render_pipeline_key(&d, &Budget::standard()) + .unwrap_or_else(|e| panic!("{what}: {e}")); + assert_eq!(keys.pipeline, p.key, "{what}"); + let inputs = keys.fragment_inputs.expect("fragment inputs"); + assert_eq!(inputs.alpha_test, Some(function), "{what}"); + let Some(StageSource::Function(f)) = &d.fragment else { + unreachable!("a function fragment stage") + }; + let mut compiled = d.clone(); + compiled.fragment = Some(StageSource::Compiled( + dev.compile_function(f, &untested, &Budget::standard()) + .unwrap_or_else(|e| panic!("{what}: {e}")), + )); + match dev.compile_render_pipeline(&compiled, &Budget::standard()) { + Err(e) => assert_eq!(e, Error::NeedsInput(RuntimeInput::AlphaTest), "{what}"), + Ok(_) => panic!("{what}: compiled"), + } + } + let mut bare = render(&lib, 1); + bare.fragment = None; + bare.private.alpha_test_enabled = true; + bare.private.alpha_test_function = 1; + match dev.compile_render_pipeline(&bare, &Budget::standard()) { + Err(e) => assert_eq!(e, refused(PrivateRenderField::AlphaTest), "{stem}"), + Ok(_) => panic!("{stem}: compiled without a fragment function"), + } + } +} + +/// `fragmentDepthCompareClampMask` over the owned fixture `engine/pdc_compare_clamp`: a fragment +/// function clamps the reference of a comparison through `[[sampler(s)]]` where bit `s` is set and +/// through a constexpr sampler where bit 31 is, and records the samplers it compares through and +/// those it clamps; a mask over none of them keeps its module. A function compiled for another +/// mask over its samplers is compiled for the pipeline again, and one comparing through an +/// argument buffer's sampler is refused under a mask other than 0. +#[test] +fn the_depth_compare_clamp_mask_clamps_its_samplers_references() { + use crate::pipeline::stage_io::DepthCompares; + let Some(lib) = fixture("pdc_compare_clamp") else { + return; + }; + let pipeline = |fragment: &str, mask: u32| { + let stage = |name: &str| { + StageSource::Function(FunctionDescriptor::new( + lib.function(name).expect("function"), + )) + }; + let mut d = RenderPipelineDescriptor::new(stage("pdc_vertex")); + d.fragment = Some(stage(fragment)); + d.color_attachments[0] = Some(ColorAttachmentDescriptor::new(PixelFormat::RGBA8Unorm)); + d.private.fragment_depth_compare_clamp_mask = mask; + d + }; + // (fragment, its comparisons' samplers, (mask, clamped)). + let slot = 1u32 << 2; + let cases: [(&str, u32, [(u32, u32); 4]); 2] = [ + ( + "pdc_slot", + slot, + [(0, 0), (slot, slot), (!slot, 0), (u32::MAX, slot)], + ), + ( + "pdc_constexpr", + DepthCompares::CONSTEXPR, + [ + (0, 0), + (DepthCompares::CONSTEXPR, DepthCompares::CONSTEXPR), + (0x7fff_ffff, 0), + (u32::MAX, DepthCompares::CONSTEXPR), + ], + ), + ]; + // Under exact sampling lavapipe's shader makes the constexpr comparison and the slot's gather + // itself (`compared::select`), which clamp alike. + let devices = STEMS.map(|stem| (stem, device(stem))).into_iter().chain([( + "lavapipe exact sampling", + device_with("lavapipe", crate::pipeline::testing::EXACT_SAMPLING), + )]); + for (stem, dev) in devices { + for (fragment, samplers, masks) in cases { + let base = compile(&dev, &pipeline(fragment, 0), stem); + for (mask, clamped) in masks { + let what = format!("{stem} {fragment} mask {mask:#x}"); + let d = pipeline(fragment, mask); + let p = compile(&dev, &d, &what); + assert_eq!(same_modules(&p, &base), clamped == 0, "{what}"); + for m in &p.stages { + check_words_valid(&m.spirv, &p.requirements, dev.profile()) + .unwrap_or_else(|e| panic!("{what} {:?}: L3: {e}", m.stage)); + } + let inputs = dev + .render_pipeline_key(&d, &Budget::standard()) + .unwrap_or_else(|e| panic!("{what}: {e}")) + .fragment_inputs + .expect("fragment inputs"); + assert_eq!(inputs.depth_compare_clamp_mask, mask, "{what}"); + let Some(StageSource::Function(f)) = &d.fragment else { + unreachable!("a function fragment stage") + }; + let own = dev + .compile_function(f, &inputs, &Budget::standard()) + .unwrap_or_else(|e| panic!("{what}: {e}")); + let compares = own.artifact().interface.io.depth_compares; + assert_eq!(compares.samplers, samplers, "{what}"); + assert_eq!(compares.clamped, clamped, "{what}"); + // The function compiled without the mask clamps nothing. + let unclamped = dev + .compile_function( + f, + &crate::pipeline::LoweringInputs { + depth_compare_clamp_mask: 0, + ..inputs + }, + &Budget::standard(), + ) + .unwrap_or_else(|e| panic!("{what}: {e}")); + let mut compiled = d.clone(); + compiled.fragment = Some(StageSource::Compiled(unclamped)); + match ( + dev.compile_render_pipeline(&compiled, &Budget::standard()), + clamped, + ) { + (Ok(_), 0) => {} + (Err(e), 0) => panic!("{what}: {e}"), + (Err(e), _) => assert_eq!( + e, + Error::NeedsInput(RuntimeInput::DepthCompareClamp), + "{what}" + ), + (Ok(_), _) => panic!("{what}: compiled without the clamp"), + } + } + } + // An argument buffer's sampler: no mask bit names it. + compile(&dev, &pipeline("pdc_argument", 0), stem); + for mask in [1, slot, DepthCompares::CONSTEXPR] { + match dev.compile_render_pipeline(&pipeline("pdc_argument", mask), &Budget::standard()) + { + // Refused at the comparison, which the refusal locates. + Err(Error::Unsupported(u)) => assert_eq!( + u.feature, + Feature::PrivateRenderState(PrivateRenderField::FragmentDepthCompareClamp), + "{stem} {mask:#x}" + ), + Err(e) => panic!("{stem} {mask:#x}: {e}"), + Ok(_) => panic!("{stem} {mask:#x}: compiled"), + } + } } } diff --git a/docs/API.md b/docs/API.md index 1c20c17fa..db92fe22b 100644 --- a/docs/API.md +++ b/docs/API.md @@ -2490,7 +2490,7 @@ fast forms record, and each `PrecisionNote`'s rustdoc states its bound. may answer another sign or payload (llvmpipe: `0xffc00000`). - `metal2vulkan-degrade-restricted-depth-range` (precision). `PrecisionNote::RestrictedDepthRange`: The device compares a depth texture's texels on a device without `VK_EXT_depth_range_unrestricted` - enabled. + enabled whose driver is not measured to keep depth values outside `[0, 1]` without it. - `metal2vulkan-degrade-cube-gradient-footprint` (precision). `PrecisionNote::CubeGradientFootprint`: An explicit-gradient sample of a cube texture takes Metal's footprint in a form a Vulkan device reads alike, but for what is not reproduced. Cost: diff --git a/docs/FAST-PATHS.md b/docs/FAST-PATHS.md index 756d4380e..efd8845ac 100644 --- a/docs/FAST-PATHS.md +++ b/docs/FAST-PATHS.md @@ -542,3 +542,8 @@ driver's. Each is open work. write resolved. No note announces it. The exact form needs the GPU's write to carry its resolution: a word of the record the translated setter fills from a per-dispatch stamp of the device's IDs, which the host step, the getter and the GPU-alone preprocess resolve. +- **A private logic operation other than copy and no-op without Vulkan's form.** On a device + without `logicOp` (MoltenVK), and on any device where an attachment is sRGB, a float attachment + blends, a format's operation was not measured or the function writes an attachment itself, the + pipeline is refused (`PrivateRenderField::LogicOperation`), where the function could apply + Metal's operation to the codes it reads and writes in the pixel interlock. diff --git a/docs/REFUSALS.md b/docs/REFUSALS.md index d412cdf89..dc6b9c9f6 100644 --- a/docs/REFUSALS.md +++ b/docs/REFUSALS.md @@ -14,15 +14,15 @@ Columns: - `none`: no public API path: malformed or non-Metal input, Apple-private calls, or a cap no valid program of ordinary size meets; - `?`: not assessed yet. -Generated at `9f4fa7347`. +Generated at `871440aca`. ## Totals | Kind | Variants | With a site | Reach system | Reach app | Reach rare | Reach none | Unassessed | |---|---|---|---|---|---|---|---| | Translator and front-end refusals | 125 | 125 | 6 | 33 | 68 | 18 | 0 | -| Runtime gaps | 68 | 68 | 1 | 8 | 41 | 18 | 0 | -| Apple-only calls | 9 | 9 | 1 | 0 | 0 | 8 | 0 | +| Runtime gaps | 69 | 69 | 1 | 8 | 42 | 18 | 0 | +| Apple-only calls | 7 | 7 | 1 | 0 | 0 | 6 | 0 | | Binder refusals at a device limit | 9 | 9 | 0 | 1 | 7 | 1 | 0 | | Translation caps | 14 | 14 | 0 | 0 | 7 | 7 | 0 | | Rate maps the compile layer does not compile | 5 | 5 | 0 | 0 | 4 | 1 | 0 | @@ -65,7 +65,7 @@ Generated at `9f4fa7347`. | `Int64Atomics` | 64-bit atomics | devices short of a Vulkan feature the site names; devices without buffer device addresses (`addressed_needs`) | 2: `crates/metal2vulkan/src/lower/access/atomic.rs:624`, `crates/metal2vulkan/src/lower/access/atomic.rs:633` | `rare`: 64-bit atomics | | `ImageAtomics` | Image atomics beyond 32-bit integers | devices without a capability the site computes (`gaps`); every device (no Vulkan mechanism) | 3: `crates/metal2vulkan-runtime/src/families/formats.rs:464`, `crates/metal2vulkan-runtime/src/families/formats.rs:468` (+1) | `rare`: texture atomics beyond 32-bit integers | | `DescriptorCount` | Too many descriptors of one kind in a stage or pipeline | devices short of a device limit the site names; devices without VkLimit::MaxUniformBufferRange | 3: `crates/metal2vulkan/src/lower/access/mod.rs:1684`, `crates/metal2vulkan/src/lower/select.rs:1641` (+1) | `app`: many textures or buffers in one stage on a smaller device | -| `BufferRange` | A buffer window beyond the descriptor range limits | devices without a capability the site computes (`needs`); devices without buffer device addresses (`addressed_needs`); every device (no Vulkan mechanism) | 7: `crates/metal2vulkan-runtime/src/function_table.rs:569`, `crates/metal2vulkan/src/bind/graphics.rs:3556` (+5) | `app`: a buffer window past a device's descriptor range | +| `BufferRange` | A buffer window beyond the descriptor range limits | devices without a capability the site computes (`needs`); devices without buffer device addresses (`addressed_needs`); every device (no Vulkan mechanism) | 7: `crates/metal2vulkan-runtime/src/function_table.rs:569`, `crates/metal2vulkan/src/bind/graphics.rs:3571` (+5) | `app`: a buffer window past a device's descriptor range | | `Int64Arithmetic` | 64-bit integer arithmetic | devices without VkFeature::ShaderInt64 | 2: `crates/metal2vulkan/src/lower/arith/legal.rs:582`, `crates/metal2vulkan/src/lower/select.rs:1133` | `rare`: 64-bit integers on a device without shaderInt64 | | `Float64Arithmetic` | 64-bit float arithmetic | devices without VkFeature::ShaderFloat64 | 2: `crates/metal2vulkan/src/device/metal.rs:230`, `crates/metal2vulkan/src/lower/arith/legal.rs:587` | `rare`: doubles (MSL has none outside Apple's own code) | | `Format` | A pixel format not supported for the required use | devices without VkFeature::ShaderStorageImageExtendedFormats; devices without a capability the site computes; devices without a capability the site computes (`alternatives`); devices without a capability the site computes (`c`); devices without a capability the site computes (`missing`); devices without a capability the site computes (`routes`); devices without a format's usage; every device (no Vulkan mechanism); every device (not implemented) | 121: `crates/metal2vulkan-runtime/src/binding_view.rs:146`, `crates/metal2vulkan-runtime/src/blit_plan.rs:462` (+119) | `system`: pixel formats a device lacks for a use (CoreVideo's 4:2:x and 10-bit formats among them) | @@ -84,28 +84,28 @@ Generated at `9f4fa7347`. | `PixelSamplerCompare` | A constexpr sampler with pixel coordinates and a compare function, which Apple's compiler rejects ("invalid values combination in sampler... | every device (no Vulkan mechanism) | 1: `crates/metal2vulkan/src/lower/sampler/constexpr.rs:115` | `none`: Apple's compiler rejects it | | `TexelBuffer` | Texture buffers beyond the device's texel-buffer limits | devices without a format's usage; every device (no Vulkan mechanism) | 3: `crates/metal2vulkan/src/bind/instantiate.rs:879`, `crates/metal2vulkan/src/bind/instantiate.rs:885` (+1) | `app`: texture buffers past a device's texel-buffer limits | | `RasterOrderGroups` | Raster order groups without fragment shader interlock | devices without VkFeature::FragmentShaderPixelInterlock; devices without VkFeature::FragmentShaderSampleInterlock; devices without a capability the site computes (`alternatives`); every device (not implemented) | 4: `crates/metal2vulkan/src/device/metal.rs:242`, `crates/metal2vulkan/src/lower/fragment/rog.rs:151` (+2) | `rare`: raster order groups | -| `FramebufferFetch` | Framebuffer fetch without an ordered form on the device (rasterization-order attachment access, or the pixel interlock's storage form where the... | devices short of a Vulkan property the site names; devices without VkFeature::FragmentShaderPixelInterlock; devices without VkFeature::RasterizationOrderColorAttachmentAccess; devices without VkFeature::SampleRateShading; devices without a capability the site computes; devices without a capability the site computes (`alternatives`); devices without a capability the site computes (`c`); devices without a capability the site computes (`capability`); devices without a capability the site computes (`missing`); devices without a format's usage; drivers with a defect; every device (not implemented) | 26: `crates/metal2vulkan-runtime/src/families/features.rs:1007`, `crates/metal2vulkan-runtime/src/render.rs:5709` (+24) | `system`: programmable blending (framebuffer fetch); macOS 26.6.2's login reaches it (two WindowServer and RenderBox pipelines fetch RGB10A8_2P_XR10 attachments, the consumer's boots) | -| `PrimitiveId` | `[[primitive_id]]` in a fragment function | devices without a capability the site computes; every device (not implemented) | 3: `crates/metal2vulkan-runtime/src/families/features.rs:1115`, `crates/metal2vulkan/src/lower/stage_io/plan.rs:3112` (+1) | `rare`: primitive_id on a device without geometry or tessellation shaders, in an indexed draw or behind a mesh function | -| `VertexAmplification` | Vertex amplification | devices without VkFeature::Multiview; devices without VkFeature::MultiviewTessellationShader; devices without VkLimit::MaxMultiviewInstanceIndex; devices without a capability the site computes (`needs`); every device (not implemented) | 5: `crates/metal2vulkan/src/bind/graphics.rs:3897`, `crates/metal2vulkan/src/lower/stage_io/plan.rs:1281` (+3) | `rare`: vertex amplification | -| `LayeredRendering` | Layered rendering (`render_target_array_index`, `viewport_array_index`) | devices without VkFeature::ImageView2DOn3DImage; devices without VkFeature::MultiViewport; devices without VkFeature::ShaderOutputLayer; devices without VkFeature::ShaderOutputViewportIndex; devices without a capability the site computes (`needs`); every device (not implemented) | 7: `crates/metal2vulkan-runtime/src/render_pass.rs:1658`, `crates/metal2vulkan-runtime/src/render_state.rs:1078` (+5) | `rare`: layered rendering on a device without its features | +| `FramebufferFetch` | Framebuffer fetch without an ordered form on the device (rasterization-order attachment access, or the pixel interlock's storage form where the... | devices short of a Vulkan property the site names; devices without VkFeature::FragmentShaderPixelInterlock; devices without VkFeature::RasterizationOrderColorAttachmentAccess; devices without VkFeature::SampleRateShading; devices without a capability the site computes; devices without a capability the site computes (`alternatives`); devices without a capability the site computes (`c`); devices without a capability the site computes (`capability`); devices without a capability the site computes (`missing`); devices without a format's usage; drivers with a defect; every device (not implemented) | 26: `crates/metal2vulkan-runtime/src/families/features.rs:1007`, `crates/metal2vulkan-runtime/src/render.rs:5727` (+24) | `system`: programmable blending (framebuffer fetch); macOS 26.6.2's login reaches it (two WindowServer and RenderBox pipelines fetch RGB10A8_2P_XR10 attachments, the consumer's boots) | +| `PrimitiveId` | `[[primitive_id]]` in a fragment function | devices without a capability the site computes; every device (not implemented) | 3: `crates/metal2vulkan-runtime/src/families/features.rs:1115`, `crates/metal2vulkan/src/lower/stage_io/plan.rs:3131` (+1) | `rare`: primitive_id on a device without geometry or tessellation shaders, in an indexed draw or behind a mesh function | +| `VertexAmplification` | Vertex amplification | devices without VkFeature::Multiview; devices without VkFeature::MultiviewTessellationShader; devices without VkLimit::MaxMultiviewInstanceIndex; devices without a capability the site computes (`needs`); every device (not implemented) | 5: `crates/metal2vulkan/src/bind/graphics.rs:3912`, `crates/metal2vulkan/src/lower/stage_io/plan.rs:1281` (+3) | `rare`: vertex amplification | +| `LayeredRendering` | Layered rendering (`render_target_array_index`, `viewport_array_index`) | devices without VkFeature::ImageView2DOn3DImage; devices without VkFeature::MultiViewport; devices without VkFeature::ShaderOutputLayer; devices without VkFeature::ShaderOutputViewportIndex; devices without a capability the site computes (`needs`); every device (not implemented) | 7: `crates/metal2vulkan-runtime/src/render_pass.rs:1669`, `crates/metal2vulkan-runtime/src/render_state.rs:1092` (+5) | `rare`: layered rendering on a device without its features | | `ClipDistance` | Clip or cull distances | devices without VkFeature::ShaderClipDistance; devices without VkLimit::MaxClipDistances | 2: `crates/metal2vulkan/src/lower/mesh/mod.rs:934`, `crates/metal2vulkan/src/lower/mesh/mod.rs:942` | `rare`: clip distances on a device without them | | `DualSourceBlending` | Dual-source blending | devices without VkFeature::DualSrcBlend; devices without VkLimit::MaxFragmentDualSrcAttachments | 5: `crates/metal2vulkan-runtime/src/families/formats.rs:386`, `crates/metal2vulkan/src/metal/state.rs:37` (+3) | `rare`: dual-source blending on a device without it | | `Barycentrics` | Barycentric coordinates | devices without VkFeature::FragmentShaderBarycentric; devices without VkFeature::GeometryShader; devices without a capability the site computes (`needs`); drivers with a defect; every device (not implemented) | 5: `crates/metal2vulkan/src/device/metal.rs:263`, `crates/metal2vulkan/src/lower/stage_io/plan.rs:1876` (+3) | `rare`: barycentric coordinates | -| `StencilExport` | Stencil export | devices without VkExtension::ExtShaderStencilExport; every device (not implemented) | 6: `crates/metal2vulkan-runtime/src/families/features.rs:1102`, `crates/metal2vulkan/src/bind/graphics.rs:2606` (+4) | `rare`: stencil from the shader | -| `SampleRateShading` | Per-sample shading | devices without VkFeature::SampleRateShading; devices without a capability the site computes (`needs`); every device (not implemented) | 3: `crates/metal2vulkan/src/pipeline/link/graphics.rs:832`, `crates/metal2vulkan/src/pipeline/link/graphics.rs:834` (+1) | `rare`: per-sample shading | +| `StencilExport` | Stencil export | devices without VkExtension::ExtShaderStencilExport; every device (not implemented) | 6: `crates/metal2vulkan-runtime/src/families/features.rs:1102`, `crates/metal2vulkan/src/bind/graphics.rs:2608` (+4) | `rare`: stencil from the shader | +| `SampleRateShading` | Per-sample shading | devices without VkFeature::SampleRateShading; devices without a capability the site computes (`needs`); every device (not implemented) | 3: `crates/metal2vulkan/src/pipeline/link/graphics.rs:835`, `crates/metal2vulkan/src/pipeline/link/graphics.rs:837` (+1) | `rare`: per-sample shading | | `PixelCoverageAtSampleRate` | The pixel's coverage (`[[sample_mask]]` read) in a fragment function that runs once per sample | drivers with a defect; every device (no Vulkan mechanism); every device (not implemented) | 3: `crates/metal2vulkan/src/lower/fragment/coverage.rs:291`, `crates/metal2vulkan/src/lower/simd/mod.rs:754` (+1) | `rare`: coverage read at sample rate | | `InterfaceComponents` | Too many interface components or locations | devices short of a device limit the site names; devices without VkLimit::MaxColorAttachments; devices without VkLimit::MaxVertexInputAttributes | 4: `crates/metal2vulkan/src/pipeline/compile/color_group.rs:202`, `crates/metal2vulkan/src/pipeline/link/graphics.rs:301` (+2) | `rare`: too many varyings or attachments for a device | | `UnmatchedVarying` | A fragment input without a vertex producer (a Metal link error) | every device (no Vulkan mechanism) | 3: `crates/metal2vulkan/src/pipeline/link/varyings.rs:318`, `crates/metal2vulkan/src/pipeline/link/varyings.rs:537` (+1) | `none`: a Metal link error | | `KernelStageIn` | Kernel `[[stage_in]]` | every device (not implemented) | 3: `crates/metal2vulkan-runtime/src/indirect_execute.rs:350`, `crates/metal2vulkan/src/bind/dispatch.rs:877` (+1) | `rare`: kernel stage-in combinations Metal leaves unestablished | | `Tessellation` | Tessellation | devices without VkLimit::MaxPushConstantsSize; devices without VkLimit::MaxStorageBufferRange; devices without VkLimit::MaxTessellationGenerationLevel; every device (not implemented) | 13: `crates/metal2vulkan-air/src/canon/mod.rs:1256`, `crates/metal2vulkan-air/src/canon/mod.rs:1347` (+11) | `rare`: tessellation | -| `MeshShading` | | devices short of a device limit the site names; devices without VkLimit::MaxMeshOutputLayers; devices without VkLimit::MaxTaskPayloadSize; devices without a capability the site computes (`missing`); every device (not implemented) | 7: `crates/metal2vulkan/src/bind/graphics.rs:1536`, `crates/metal2vulkan/src/bind/graphics.rs:2966` (+5) | `rare`: mesh pipelines | +| `MeshShading` | | devices short of a device limit the site names; devices without VkLimit::MaxMeshOutputLayers; devices without VkLimit::MaxTaskPayloadSize; devices without a capability the site computes (`missing`); every device (not implemented) | 7: `crates/metal2vulkan/src/bind/graphics.rs:1536`, `crates/metal2vulkan/src/bind/graphics.rs:2981` (+5) | `rare`: mesh pipelines | | `TileShading` | | devices without VkLimit::MaxStorageBufferRange; devices without a format's usage; every device (not implemented) | 5: `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:521`, `crates/metal2vulkan/src/bind/plan/compute.rs:237` (+3) | `rare`: tile shaders (Apple GPU families) | | `Imageblocks` | An imageblock outside the single-sample forms implemented | devices without a capability the site computes (`missing`); every device (not implemented) | 7: `crates/metal2vulkan/src/lower/access/imageblock.rs:98`, `crates/metal2vulkan/src/lower/access/mod.rs:908` (+5) | `rare`: imageblocks (Apple GPU families) | | `RayTracing` | | devices without a capability the site computes (`missing`); every device (no Vulkan mechanism); every device (not implemented) | 12: `crates/metal2vulkan/src/bind/acceleration.rs:202`, `crates/metal2vulkan/src/bind/acceleration.rs:216` (+10) | `rare`: ray tracing (out of scope by ruling) | | `Tensors` | | every device (not implemented) | 2: `crates/metal2vulkan-air/src/canon/matmul2d/synth.rs:32`, `crates/metal2vulkan/src/lower/select.rs:903` | `rare`: shader tensors | | `RasterizationRateMap` | | every device (not implemented) | 1: `crates/metal2vulkan/src/lower/fragment/mod.rs:925` | `rare`: rasterization rate maps | | `GpuEncodedIndirectCommands` | | devices short of a Vulkan feature the site names; devices without buffer device addresses (`addressed_needs`); every device (no Vulkan mechanism); every device (not implemented) | 17: `crates/metal2vulkan/src/bind/replay.rs:556`, `crates/metal2vulkan/src/bind/replay.rs:796` (+15) | `rare`: indirect command buffers encoded by a kernel | -| `VulkanVersion` | The device's Vulkan version is below the 1.2 floor | devices without ApiVersion::V1_2 | 2: `crates/metal2vulkan/src/ash_interop/query.rs:915`, `crates/metal2vulkan/src/device/derive.rs:105` | `none`: a device below Vulkan 1.2 | +| `VulkanVersion` | The device's Vulkan version is below the 1.2 floor | devices without ApiVersion::V1_2 | 2: `crates/metal2vulkan/src/ash_interop/query.rs:916`, `crates/metal2vulkan/src/device/derive.rs:105` | `none`: a device below Vulkan 1.2 | | `Constant` | A bitcode constant record outside the typed model (block address, inline asm, `select` and other constant expressions the IR has no form for) | - | via a helper: 3: `crates/metal2vulkan-air/src/bitcode/constants.rs:210`, `crates/metal2vulkan-air/src/bitcode/constants.rs:268` (+1) | `none`: LLVM constant forms AIR does not emit | | `Attribute` | An LLVM attribute kind that changes the calling ABI and that AIR does not use (`inalloca`, `preallocated`, `byref`, `nest`, the `swift*` kinds) | - | via a helper: 2: `crates/metal2vulkan-air/src/bitcode/attrs.rs:493`, `crates/metal2vulkan/src/error/mod.rs:256` | `none`: LLVM ABI attributes AIR does not use | | `BitcodeRecord` | A bitcode record LLVM defines in `block` that the typed model does not cover and that has no more specific variant (legacy spellings predating... | - | via a helper: 7: `crates/metal2vulkan-air/src/bitcode/attrs.rs:337`, `crates/metal2vulkan-air/src/bitcode/function.rs:572` (+5) | `none`: bitcode records AIR does not emit | @@ -121,8 +121,8 @@ Generated at `9f4fa7347`. | `SamplerBicubicFilter` | A use of Metal's bicubic filter that no Metal reading establishes | every device (not implemented) | 5: `crates/metal2vulkan/src/bind/heap.rs:997`, `crates/metal2vulkan/src/bind/plan/resources.rs:1876` (+3) | `system`: bicubic filtering forms Metal does not establish; macOS 26.6.2 makes a runtime sampler with MTLSamplerMinMagFilterCubic (the consumer's boots), whose mip-filtered form is refused | | `GroupCount` | A dispatch whose threadgroup count on `axis` exceeds `maxComputeWorkGroupCount` by more than the binder splits into regions (`None` | every device (no Vulkan mechanism) | 5: `crates/metal2vulkan/src/bind/dispatch.rs:379`, `crates/metal2vulkan/src/bind/dispatch.rs:461` (+3) | `rare`: more threadgroups than a device dispatches, past the binder's split | | `IntersectionFunctionTable` | A ray intersection through intersection functions | every device (no Vulkan mechanism); every device (not implemented) | 9: `crates/metal2vulkan/src/bind/acceleration.rs:177`, `crates/metal2vulkan/src/bind/acceleration.rs:183` (+7) | `rare`: ray tracing (out of scope by ruling) | -| `IndependentBlending` | Color attachments whose write masks or blend states differ, as Metal sets them per attachment, on a device without `independentBlend`, where no... | devices without VkFeature::IndependentBlend | 2: `crates/metal2vulkan-runtime/src/render.rs:2036`, `crates/metal2vulkan/src/pipeline/link/graphics.rs:1005` | `rare`: per-attachment blending on a device without independentBlend | -| `RasterSampleCount` | A `rasterSampleCount` outside the device's framebuffer sample counts for the pipeline's attachments (`framebuffer*SampleCounts`), and, for a color... | devices short of a Vulkan property the site names; devices without a capability the site computes | 2: `crates/metal2vulkan-runtime/src/families/limits.rs:1059`, `crates/metal2vulkan/src/pipeline/graphics.rs:545` | `app`: a sample count a device lacks for the attachments | +| `IndependentBlending` | Color attachments whose write masks or blend states differ, as Metal sets them per attachment, on a device without `independentBlend`, where no... | devices without VkFeature::IndependentBlend | 2: `crates/metal2vulkan-runtime/src/render.rs:2036`, `crates/metal2vulkan/src/pipeline/link/graphics.rs:1008` | `rare`: per-attachment blending on a device without independentBlend | +| `RasterSampleCount` | A `rasterSampleCount` outside the device's framebuffer sample counts for the pipeline's attachments (`framebuffer*SampleCounts`), and, for a color... | devices short of a Vulkan property the site names; devices without a capability the site computes | 2: `crates/metal2vulkan-runtime/src/families/limits.rs:1059`, `crates/metal2vulkan/src/pipeline/graphics.rs:555` | `app`: a sample count a device lacks for the attachments | | `TriangleFillLines` | The render encoder's `MTLTriangleFillModeLines` (`polygonMode` `LINE`) on a device without `fillModeNonSolid` | - | via a helper: 1: `crates/metal2vulkan/src/metal/state.rs:347` | `app`: wireframe on a device without fillModeNonSolid | | `DepthClipClamp` | The render encoder's `MTLDepthClipModeClamp` (`depthClampEnable`) on a device without `depthClamp` | - | via a helper: 1: `crates/metal2vulkan/src/metal/state.rs:363` | `app`: depth clamp on a device without depthClamp | | `DepthBiasClamp` | The render encoder's depth bias clamp, nonzero with a nonzero bias, on a device without `depthBiasClamp` | - | via a helper: 1: `crates/metal2vulkan/src/metal/state.rs:463` | `app`: depth bias clamp on a device without depthBiasClamp | @@ -130,30 +130,30 @@ Generated at `9f4fa7347`. | `SparseTexture` | A sparse texture (`MTLTexture.isSparse`) bound at `slot`, where a function observes the residency of its accesses (`sparse_color::resident()`) and... | - | via a helper: 2: `crates/metal2vulkan/src/bind/plan/slots.rs:583`, `crates/metal2vulkan/src/bind/plan/slots.rs:607` | `rare`: sparse residency reads | | `TextureSize` | A texture whose extent, array layers, or level count is past what the device takes for its format, type, and usage (`Capability::Limit` names the... | devices short of a device limit the site names | 1: `crates/metal2vulkan-runtime/src/image_plan.rs:1196` | `app`: a texture past a device's image limits | | `TextureSampleCount` | A texture sample count the device does not take for its format, type, and usage | devices short of a Vulkan property the site names; devices without VkFeature::MultisampleArrayImage; every device (no Vulkan mechanism) | 3: `crates/metal2vulkan-runtime/src/image_plan.rs:1244`, `crates/metal2vulkan-runtime/src/image_plan.rs:598` (+1) | `app`: a sample count a device lacks for the texture | -| `TextureView` | A texture view Vulkan cannot make exactly on this image | every device (no Vulkan mechanism); every device (not implemented) | 7: `crates/metal2vulkan-runtime/src/binding_view.rs:156`, `crates/metal2vulkan-runtime/src/texture.rs:5030` (+5) | `app`: a texture view Vulkan cannot make exactly | +| `TextureView` | A texture view Vulkan cannot make exactly on this image | every device (no Vulkan mechanism); every device (not implemented) | 7: `crates/metal2vulkan-runtime/src/binding_view.rs:156`, `crates/metal2vulkan-runtime/src/texture.rs:5032` (+5) | `app`: a texture view Vulkan cannot make exactly | | `TextureSwizzle` | A texture swizzle whose Metal behavior is not measured | devices short of a Vulkan feature the site names; every device (not implemented) | 7: `crates/metal2vulkan-runtime/src/binding_view.rs:167`, `crates/metal2vulkan-runtime/src/texture.rs:980` (+5) | `app`: texture swizzles whose Metal behaviour is unmeasured | | `MipmapGeneration` | `generateMipmapsForTexture:` where the device's filter is not shown to give Metal's answer | devices without VkFeature::ShaderInt64; devices without a format's usage; every device (not implemented) | 7: `crates/metal2vulkan-runtime/src/blit_texture.rs:1787`, `crates/metal2vulkan-runtime/src/mipmap_pick.rs:37` (+5) | `app`: generateMipmapsForTexture: where the device's filter is not Metal's | | `HostMemory` | A buffer over the caller's host memory without a copy (`newBufferWithBytesNoCopy:`) | devices without VkExtension::ExtExternalMemoryHost; every device (no Vulkan mechanism); every device (not implemented) | 5: `crates/metal2vulkan-runtime/src/host_memory.rs:393`, `crates/metal2vulkan-runtime/src/host_memory.rs:433` (+3) | `system`: newBufferWithBytesNoCopy: where the device cannot import the memory | -| `GpuTimes` | A command buffer's GPU times (`GPUStartTime`, `GPUEndTime`) on a device whose queue family writes no timestamps (`timestampValidBits` 0) | every device (no Vulkan mechanism) | 1: `crates/metal2vulkan-runtime/src/command_buffer/mod.rs:2605` | `rare`: GPU times on a queue without timestamps | +| `GpuTimes` | A command buffer's GPU times (`GPUStartTime`, `GPUEndTime`) on a device whose queue family writes no timestamps (`timestampValidBits` 0) | every device (no Vulkan mechanism) | 1: `crates/metal2vulkan-runtime/src/command_buffer/mod.rs:2542` | `rare`: GPU times on a queue without timestamps | | `CountingVisibility` | A `Counting` visibility result (`MTLVisibilityResultModeCounting`) on a device without `occlusionQueryPrecise` | devices without VkFeature::OcclusionQueryPrecise | 1: `crates/metal2vulkan-runtime/src/visibility.rs:452` | `rare`: counting occlusion queries on a device without precise queries | | `ViewFormatReinterpretation` | A texture view whose format has other components, or components of other widths, than its texture's (`RGBA8Unorm` as `R32Uint`), on a device whose... | every device (no Vulkan mechanism) | 1: `crates/metal2vulkan-runtime/src/view_plan.rs:568` | `app`: a view of another component layout on a portability subset (MoltenVK) | | `SeparateMultisampledDepthStencil` | A render pass whose depth and stencil attachments are separate multisampled textures that it loads or may store, on a device without maintenance8,... | - | via a helper: 7: `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:188`, `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:294` (+5) | `rare`: separate multisampled depth and stencil textures | -| `PixelCoverage` | The fragment's coverage (`[[sample_mask]]` read) in a fragment function of a pipeline of more than one sample that runs once per pixel | drivers with a defect | 1: `crates/metal2vulkan/src/pipeline/link/graphics.rs:771` | `rare`: coverage reads at pixel rate in a multisampled pipeline | -| `CentroidVarying` | A centroid varying (`[[centroid_perspective]]`, `[[centroid_no_perspective]]`) in a fragment function of a pipeline of more than one sample | drivers with a defect | 1: `crates/metal2vulkan/src/pipeline/link/graphics.rs:789` | `rare`: centroid varyings in a multisampled pipeline | +| `PixelCoverage` | The fragment's coverage (`[[sample_mask]]` read) in a fragment function of a pipeline of more than one sample that runs once per pixel | drivers with a defect | 1: `crates/metal2vulkan/src/pipeline/link/graphics.rs:774` | `rare`: coverage reads at pixel rate in a multisampled pipeline | +| `CentroidVarying` | A centroid varying (`[[centroid_perspective]]`, `[[centroid_no_perspective]]`) in a fragment function of a pipeline of more than one sample | drivers with a defect | 1: `crates/metal2vulkan/src/pipeline/link/graphics.rs:792` | `rare`: centroid varyings in a multisampled pipeline | | `PrivateMemory` | A stage whose private memory (its `thread` variables and arrays, and the constants it holds per thread) takes more Function storage a thread than... | - | via a helper: 1: `crates/metal2vulkan/src/lower/select.rs:1171` | `rare`: very large per-thread arrays | | `SparseTextures` | A sparse heap (`MTLHeapTypeSparse`), or a texture made from one, on a device without what a sparse resident image of it needs, which `missing` names | every device (no Vulkan mechanism) | 1: `crates/metal2vulkan-runtime/src/sparse/texture.rs:32` | `rare`: sparse heaps on a device without sparse images | | `SparseMapping` | A sparse texture's mapping update (`updateTextureMapping:` and its array form, or a move of mappings) that covers part of one of the device's... | every device (no Vulkan mechanism) | 1: `crates/metal2vulkan-runtime/src/sparse/encoder.rs:466` | `rare`: sparse mappings off the device's blocks | | `TimelineSemaphores` | Command buffers and events, which the runtime completes and signals through timeline semaphores (core in Vulkan 1.2), on a device whose... | every device (no Vulkan mechanism) | 1: `crates/metal2vulkan-runtime/src/device/create.rs:1053` | `none`: a device below the runtime's floor | | `Reflection` | Reflection of an argument whose answer Metal's has not been measured for (`reflection`) | every device (not implemented) | 9: `crates/metal2vulkan/src/bind/argument_buffer.rs:626`, `crates/metal2vulkan/src/reflection/derive.rs:178` (+7) | `rare`: reflection of argument kinds Metal's answer is unmeasured for | | `HeapTextureTiling` | A texture of a heap whose memory the device's optimal images do not take (a `Shared` heap on a device whose optimal images take no host-visible... | every device (no Vulkan mechanism) | 1: `crates/metal2vulkan-runtime/src/texture/heap.rs:565` | `app`: textures in Shared heaps on a device whose optimal images take no host memory | -| `ViewportDepthRange` | A viewport depth range past `[0, 1]` (`setViewport:`), which Metal takes and the runtime draws natively (`VK_EXT_depth_range_unrestricted`) or... | drivers with a defect | 1: `crates/metal2vulkan-runtime/src/render_state.rs:1186` | `rare`: viewport depth outside [0, 1] | +| `ViewportDepthRange` | A viewport depth range past `[0, 1]` (`setViewport:`), which Metal takes and the runtime draws natively (`VK_EXT_depth_range_unrestricted`) or... | drivers with a defect | 1: `crates/metal2vulkan-runtime/src/render_state.rs:1200` | `rare`: viewport depth outside [0, 1] | | `UndeclaredTextureUsage` | A shader write to a texture made without `ShaderWrite` (or `ShaderAtomic`), or a read of one made without `ShaderRead`, which plain Metal runs,... | every device (not implemented) | 2: `crates/metal2vulkan-runtime/src/binding_view.rs:141`, `crates/metal2vulkan-runtime/src/texture/usage_shadow.rs:72` | `app`: a shader write to a texture made without ShaderWrite, which plain Metal runs | -| `RenderTargetSize` | A render pass whose render area or layers are past the device's framebuffer limits (`Capability::Limit` names `MaxFramebufferWidth`,... | devices short of a device limit the site names | 1: `crates/metal2vulkan-runtime/src/render_pass.rs:1264` | `rare`: a render area past a device's framebuffer limits | +| `RenderTargetSize` | A render pass whose render area or layers are past the device's framebuffer limits (`Capability::Limit` names `MaxFramebufferWidth`,... | devices short of a device limit the site names | 1: `crates/metal2vulkan-runtime/src/render_pass.rs:1271` | `rare`: a render area past a device's framebuffer limits | | `IndirectRenderState` | A render state a function sets on an indirect render command (`render_command::set_cull_mode`, `set_front_facing_winding`,... | every device (not implemented) | 1: `crates/metal2vulkan/src/lower/access/encode.rs:567` | `rare`: render state set by a kernel on an indirect command | | `GlobalBuiltinInFragment` | A fragment function's read of a Metal 3.1 program-scope built-in variable that Metal does not lower there | every device (not implemented) | 1: `crates/metal2vulkan/src/lower/select.rs:912` | `rare`: Metal 3.1 global built-ins in fragment functions | -| `PrivateRenderState` | A private fixed-function property of Metal's pipeline descriptor (Apple SPI, OpenGL on Metal's) set to a value whose effect the translation has... | every device (not implemented) | 4: `crates/metal2vulkan/src/bind/heap.rs:1300`, `crates/metal2vulkan/src/bind/plan/resources.rs:887` (+2) | `none`: Apple-private pipeline fields of OpenGL on Metal (no public header) | +| `PrivateRenderState` | A private fixed-function property of Metal's pipeline descriptor (Apple SPI, OpenGL on Metal's) set to a value whose effect the translation has... | devices without VkFeature::LogicOp; every device (not implemented) | 7: `crates/metal2vulkan/src/bind/heap.rs:1300`, `crates/metal2vulkan/src/bind/plan/resources.rs:887` (+5) | `none`: Apple-private pipeline fields of OpenGL on Metal (no public header) | | `ExtendedRangeBlend` | Metal's blend into an extended-range attachment (`BGRA10_XR`, `BGR10_XR`, `RGB10A8_2P_XR10` and their `_sRGB` twins), which the function computes... | every device (not implemented) | 4: `crates/metal2vulkan/src/lower/arith/extended_range/blend.rs:305`, `crates/metal2vulkan/src/lower/fragment/fetch.rs:1553` (+2) | `system`: the parts of a blend into an extended-range (XR10) attachment the measured model does not hold (second-source factors, the color blend color difference, a one-color-channel mask, float4 and sRGB outside the measured forms); the consumer's guests blend RGB10A8_2P_XR10 attachments | -| `TileReach` | The tiles a render pass's primitives reach, binned on the device ([`tile_reach_module`](crate::bind::tile_reach_module)), on a device without what... | devices short of a Vulkan feature the site names; devices without a capability the site computes (`vec![int64]`); every device (not implemented) | 3: `crates/metal2vulkan/src/bind/tile_reach.rs:270`, `crates/metal2vulkan/src/lower/stage_io/plan.rs:2450` (+1) | `app`: the tiles a pass's draws reach, binned on a device without shaderInt64 | +| `TileReach` | The tiles a render pass's primitives reach, binned on the device ([`tile_reach_module`](crate::bind::tile_reach_module)), on a device without what... | devices short of a Vulkan feature the site names; devices without a capability the site computes (`vec![int64]`); every device (not implemented) | 3: `crates/metal2vulkan/src/bind/tile_reach.rs:270`, `crates/metal2vulkan/src/lower/stage_io/plan.rs:2469` (+1) | `app`: the tiles a pass's draws reach, binned on a device without shaderInt64 | | `CommandPredication` | Metal's private command predication (`encodeStartIf:offset:comparison:referenceValue:` and the rest), whose step module... | devices without buffer device addresses (`addressed_needs`) | 1: `crates/metal2vulkan/src/bind/replay/predication.rs:414` | `none`: Apple-private command predication on a device without buffer device addresses | | `ProgramScopeBinding` | A program-scope buffer binding of MSL 3.2 (macOS 15 and later), `constant T* constant p [[buffer(n)]];` in Apple's `!air.global_bindings` list,... | - | via a helper: 2: `crates/metal2vulkan-air/src/abi/module.rs:77`, `crates/metal2vulkan/src/error/mod.rs:267` | `app`: MSL 3.2 program-scope buffer bindings (macOS 15 and later) | | `SeqCstFence` | A sequentially consistent fence (`seq_cst` `atomic_thread_fence`, an LLVM `fence seq_cst`, or a `seq_cst` barrier ordering device memory), whose... | devices short of a Vulkan feature the site names | 1: `crates/metal2vulkan/src/lower/sync/barrier.rs:443` | `rare`: a seq_cst fence in a vertex or fragment stage without its stores and atomics | @@ -166,7 +166,7 @@ Generated at `9f4fa7347`. | `ResourceHeap` | The resource-ID heap, descriptor set 1 | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/binding.rs:2016` | `rare`: the resource-ID heap's remaining forms | | `SparseHeaps` | Sparse heaps and their textures | every device (runtime piece not built) | 3: `crates/metal2vulkan-runtime/src/sparse/encoder.rs:458`, `crates/metal2vulkan-runtime/src/texture.rs:1629` (+1) | `rare`: sparse heaps | | `SparseTileMaps` | What the runtime's emulation of sparse textures does not build yet | every device (runtime piece not built) | 3: `crates/metal2vulkan-runtime/src/binding.rs:553`, `crates/metal2vulkan-runtime/src/sparse/texture.rs:30` (+1) | `rare`: sparse texture emulation's unbuilt pieces | -| `HeapPastMaxBufferSize` | A heap larger than the device's `maxBufferSize`, which the device can allocate | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/heap.rs:697` | `rare`: a heap past maxBufferSize | +| `HeapPastMaxBufferSize` | A heap larger than the device's `maxBufferSize`, which the device can allocate | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/heap.rs:694` | `rare`: a heap past maxBufferSize | | `HeapTextureAlignment` | A heap texture whose image needs an alignment past the heap memory's base alignment (256 KiB) | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/texture/heap.rs:980` | `rare`: a heap texture needing more than 256 KiB alignment | | `HeapTextureMemory` | A heap texture whose image the heap's memory type does not take | every device (runtime piece not built) | 5: `crates/metal2vulkan-runtime/src/texture/heap.rs:1418`, `crates/metal2vulkan-runtime/src/texture/heap.rs:1425` (+3) | `app`: a heap texture the heap's memory type does not take | | `FunctionTablePastMaxBufferLength` | A visible-function table of more entries than one buffer of the device's `max_buffer_length` holds words for, or than its size word holds | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/function_table.rs:622` | `none`: a function table past one buffer | @@ -176,22 +176,22 @@ Generated at `9f4fa7347`. | `CommandReplay` | The device replay of indirect command buffers | every device (runtime piece not built) | 2: `crates/metal2vulkan-runtime/src/binding.rs:694`, `crates/metal2vulkan-runtime/src/binding.rs:697` | `rare`: the device replay of indirect command buffers | | `RenderAttachments` | Render attachments and their binding forms | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/binding.rs:1839` | `rare`: render attachment forms not built | | `AccelerationStructures` | Acceleration structures | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/binding.rs:1842` | `rare`: ray tracing (out of scope by ruling) | -| `FeatureEnable` | A feature a created device would enable that the runtime's feature chain has no member for, or whose structure no enabled extension exposes | devices without the feature or extension it names | 1: `crates/metal2vulkan-runtime/src/enables.rs:1155` | `none`: device creation with a feature the runtime's chain lacks | -| `ExtensionEnable` | An extension a created device would enable that the device lists under none of the names the runtime knows for it | devices without the feature or extension it names | 1: `crates/metal2vulkan-runtime/src/enables.rs:1146` | `none`: device creation with an extension under an unknown name | +| `FeatureEnable` | A feature a created device would enable that the runtime's feature chain has no member for, or whose structure no enabled extension exposes | devices without the feature or extension it names | 1: `crates/metal2vulkan-runtime/src/enables.rs:1156` | `none`: device creation with a feature the runtime's chain lacks | +| `ExtensionEnable` | An extension a created device would enable that the device lists under none of the names the runtime knows for it | devices without the feature or extension it names | 1: `crates/metal2vulkan-runtime/src/enables.rs:1147` | `none`: device creation with an extension under an unknown name | | `Render` | Render pipelines, passes and draws | every device (runtime piece not built) | 23: `crates/metal2vulkan-runtime/src/attachment_stand_in.rs:404`, `crates/metal2vulkan-runtime/src/attachment_stand_in.rs:460` (+21) | `system`: render pass, resolve and attachment forms not built (20 sites: see the appendix) | | `TexelsPastBufferLength` | A 2D array over a buffer whose texels run past the buffer's length, which Metal makes over bytes its buffer's allocation has past the length | every device (runtime piece not built) | 2: `crates/metal2vulkan-runtime/src/buffer_texture.rs:261`, `crates/metal2vulkan-runtime/src/texture/surface_depth.rs:105` | `rare`: a 2D array over a buffer past its length | | `OverlappingSurfaceRows` | A texture of an IOSurface plane (`Buffer::new_texture_with_iosurface_plane`, the stand-in for `newTextureWithDescriptor:iosurface:plane:`) whose... | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/buffer_texture.rs:263` | `rare`: an IOSurface plane whose rows overlap | -| `SamplePositionsAtBegin` | A render pass whose custom sample positions Vulkan takes only through what the runtime does not build | every device (runtime piece not built) | 3: `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:145`, `crates/metal2vulkan-runtime/src/render_pass.rs:1850` (+1) | `rare`: custom sample positions Vulkan takes only at begin | +| `SamplePositionsAtBegin` | A render pass whose custom sample positions Vulkan takes only through what the runtime does not build | every device (runtime piece not built) | 3: `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:145`, `crates/metal2vulkan-runtime/src/render_pass.rs:1861` (+1) | `rare`: custom sample positions Vulkan takes only at begin | | `SharedEventAcrossDevices` | A shared event handle opened on a device other than its event's | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/event.rs:376` | `rare`: a shared event opened on another device | -| `ViewportDepthRange` | A viewport depth range past `[0, 1]`, which Metal takes, on a device without the features to take it natively or by the vertex stage's... | every device (runtime piece not built) | 7: `crates/metal2vulkan-runtime/src/render/draw_shape.rs:330`, `crates/metal2vulkan-runtime/src/render_state.rs:1010` (+5) | `rare`: viewport depth outside [0, 1] without the device features | -| `NonFiniteDepthBias` | NaN or infinite depth bias factors whose effect differs between flat and sloped triangles, or a draw whose bias adds a clamp that moves a... | every device (runtime piece not built) | 5: `crates/metal2vulkan-runtime/src/render_state.rs:1573`, `crates/metal2vulkan-runtime/src/render_state.rs:1576` (+3) | `rare`: NaN or infinite depth bias | +| `ViewportDepthRange` | A viewport depth range past `[0, 1]`, which Metal takes, on a device without the features to take it natively or by the vertex stage's... | every device (runtime piece not built) | 7: `crates/metal2vulkan-runtime/src/render/draw_shape.rs:330`, `crates/metal2vulkan-runtime/src/render_state.rs:1024` (+5) | `rare`: viewport depth outside [0, 1] without the device features | +| `NonFiniteDepthBias` | NaN or infinite depth bias factors whose effect differs between flat and sloped triangles, or a draw whose bias adds a clamp that moves a... | every device (runtime piece not built) | 5: `crates/metal2vulkan-runtime/src/render_state.rs:1587`, `crates/metal2vulkan-runtime/src/render_state.rs:1590` (+3) | `rare`: NaN or infinite depth bias | | `DepthNeverWithoutAttachment` | A draw under a depth compare of `Never` in a pass without a depth attachment, which fails every fragment, whose fragment function writes color... | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/depth_stencil.rs:147` | `rare`: depth compare Never with no depth attachment | -| `HiddenDepthStencil` | A draw whose depth/stencil state uses depth or the stencil that the pass lacks, which plain Metal tests against a hidden `float` depth of 1.0 and... | every device (runtime piece not built) | 2: `crates/metal2vulkan-runtime/src/attachment_stand_in.rs:563`, `crates/metal2vulkan-runtime/src/render.rs:6432` | `app`: a depth-stencil state using depth or stencil the pass lacks | -| `IndirectDrawArguments` | An indirect draw whose arguments the binding plan asks to read on the CPU (`DrawCommands::indirect_needs_arguments`) | every device (runtime piece not built) | 5: `crates/metal2vulkan-runtime/src/index_bounds.rs:91`, `crates/metal2vulkan-runtime/src/render.rs:3138` (+3) | `rare`: indirect draws whose arguments the CPU must read | -| `DepthStencilResolve` | A depth/stencil resolve no Vulkan resolve mode of the device states | every device (runtime piece not built) | 7: `crates/metal2vulkan-runtime/src/depth_stencil_resolve.rs:441`, `crates/metal2vulkan-runtime/src/resolve.rs:1247` (+5) | `rare`: depth/stencil resolve modes a device lacks | -| `TileAtSampleCount` | The tile memory of a render pass of a sample count Apple's GPUs lack (theirs are 1, 2 and 4), which a Vulkan device may have | every device (runtime piece not built) | 2: `crates/metal2vulkan-runtime/src/render_pass.rs:1600`, `crates/metal2vulkan-runtime/src/render_pass.rs:930` | `none`: tile memory at a sample count Apple's GPUs lack | -| `ImageblockMasters` | A draw or tile dispatch whose imageblock is of another size than the pass's, or a draw whose fragment function's layouts are of another alignment... | every device (runtime piece not built) | 2: `crates/metal2vulkan-runtime/src/render.rs:7115`, `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:930` | `rare`: imageblocks of mixed sizes in one pass | -| `TileAndFragmentImageblocks` | A render pass that reaches its imageblock storage, from a draw whose fragment function declares an explicit imageblock or a tile dispatch whose... | every device (runtime piece not built) | 3: `crates/metal2vulkan-runtime/src/render.rs:7107`, `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:797` (+1) | `rare`: explicit imageblocks shared by tile and fragment functions | +| `HiddenDepthStencil` | A draw whose depth/stencil state uses depth or the stencil that the pass lacks, which plain Metal tests against a hidden `float` depth of 1.0 and... | every device (runtime piece not built) | 2: `crates/metal2vulkan-runtime/src/attachment_stand_in.rs:563`, `crates/metal2vulkan-runtime/src/render.rs:6450` | `app`: a depth-stencil state using depth or stencil the pass lacks | +| `IndirectDrawArguments` | An indirect draw whose arguments the binding plan asks to read on the CPU (`DrawCommands::indirect_needs_arguments`) | every device (runtime piece not built) | 5: `crates/metal2vulkan-runtime/src/index_bounds.rs:91`, `crates/metal2vulkan-runtime/src/render.rs:3153` (+3) | `rare`: indirect draws whose arguments the CPU must read | +| `DepthStencilResolve` | A depth/stencil resolve no Vulkan resolve mode of the device states | every device (runtime piece not built) | 7: `crates/metal2vulkan-runtime/src/depth_stencil_resolve.rs:441`, `crates/metal2vulkan-runtime/src/resolve.rs:1388` (+5) | `rare`: depth/stencil resolve modes a device lacks | +| `TileAtSampleCount` | The tile memory of a render pass of a sample count Apple's GPUs lack (theirs are 1, 2 and 4), which a Vulkan device may have | every device (runtime piece not built) | 2: `crates/metal2vulkan-runtime/src/render_pass.rs:1611`, `crates/metal2vulkan-runtime/src/render_pass.rs:937` | `none`: tile memory at a sample count Apple's GPUs lack | +| `ImageblockMasters` | A draw or tile dispatch whose imageblock is of another size than the pass's, or a draw whose fragment function's layouts are of another alignment... | every device (runtime piece not built) | 2: `crates/metal2vulkan-runtime/src/render.rs:7133`, `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:930` | `rare`: imageblocks of mixed sizes in one pass | +| `TileAndFragmentImageblocks` | A render pass that reaches its imageblock storage, from a draw whose fragment function declares an explicit imageblock or a tile dispatch whose... | every device (runtime piece not built) | 3: `crates/metal2vulkan-runtime/src/render.rs:7125`, `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:797` (+1) | `rare`: explicit imageblocks shared by tile and fragment functions | | `Metal4Api` | Metal 4's API (`MTL4CommandQueue`, `MTL4CommandBuffer`, `MTL4ArgumentTable`, `MTL4Compiler` and the rest), with the features only its programming... (not scheduled) | every device (runtime piece not built) | family audit only: 3: `crates/metal2vulkan-runtime/src/families/features.rs:1460`, `crates/metal2vulkan-runtime/src/families/limits.rs:1022` (+1) | `app`: Metal 4 (the API is missing: METAL-COVERAGE.md) | | `CounterSampleBuffers` | Counter sample buffers (`MTLCounterSampleBuffer`) and the commands that sample into them (not scheduled) | every device (runtime piece not built) | family audit only: 1: `crates/metal2vulkan-runtime/src/families/limits.rs:1013` | `app`: GPU counters and timestamps by sample buffer (missing API) | | `ResidencySets` | Residency sets (`MTLResidencySet`) (not scheduled) | every device (runtime piece not built) | family audit only: 2: `crates/metal2vulkan-runtime/src/families/features.rs:1442`, `crates/metal2vulkan-runtime/src/families/limits.rs:1015` | `app`: residency sets (missing API) | @@ -207,21 +207,22 @@ Generated at `9f4fa7347`. | `LayeredPass` | A layered render pass (`renderTargetArrayLength` 2 or more) that needs a step of one layer | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/color_resolve.rs:890` | `rare`: layered passes needing a per-layer color resolve | | `FunctionOptions` | A function descriptor's options beyond `CompileToBinary` and `StoreFunctionInMetalPipelinesScript` (`Library::new_function_with_descriptor`) | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/library.rs:215` | `rare`: function descriptor options beyond CompileToBinary | | `OverlappingTextureCopies` | A blit copy between overlapping regions of one texture's texels (`copyFromTexture:...` with the source's region meeting the destination's, through... (not scheduled) | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/blit_texture.rs:1242` | `rare`: overlapping texture copies (Metal races) | -| `RebindTextures` | `Buffer::rebind_bytes_no_copy` of a no-copy buffer with a live texture over its bytes, given memory at another offset in its page than the old | every device (runtime piece not built) | 5: `crates/metal2vulkan-runtime/src/buffer_descriptor.rs:615`, `crates/metal2vulkan-runtime/src/texture/heap.rs:2431` (+3) | `none`: a runtime extension's rebind with a live texture | -| `PvrtcBlockOrder` | A PVRTC texture's blocks in a Metal block order the runtime does not lay out | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/texture.rs:5573` | `rare`: PVRTC regions off whole levels | +| `RebindTextures` | `Buffer::rebind_bytes_no_copy` of a no-copy buffer with a live texture over its bytes, given memory at another offset in its page than the old | every device (runtime piece not built) | 5: `crates/metal2vulkan-runtime/src/buffer_descriptor.rs:600`, `crates/metal2vulkan-runtime/src/texture/heap.rs:2431` (+3) | `none`: a runtime extension's rebind with a live texture | +| `PvrtcBlockOrder` | A PVRTC texture's blocks in a Metal block order the runtime does not lay out | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/texture.rs:5575` | `rare`: PVRTC regions off whole levels | | `DecodedHeapTexture` | A heap's or a sparse heap's texture of an ASTC format on a device without that ASTC format (`astc.rs`), or a sparse heap's texture of an ETC2 or... | every device (runtime piece not built) | 2: `crates/metal2vulkan-runtime/src/texture.rs:1637`, `crates/metal2vulkan-runtime/src/texture/heap.rs:1281` | `app`: an ASTC texture in a heap on a device without ASTC | | `VertexFetchPast4GiB` | A draw (`drawPrimitives:` and its forms, or an indirect command buffer's command) that may read a vertex attribute the pipeline fetches in its... | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/render/vertex_reach.rs:72` | `rare`: vertex fetch past 4 GiB of a bind offset | | `StageInFetchPast4GiB` | A dispatch (`dispatchThreads:threadsPerThreadgroup:` and its forms, or an indirect command buffer's command) whose kernel may read a... | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/fetch_reach.rs:126` | `rare`: stage-in fetch past 4 GiB of a bind offset | | `MappedTextureSampling` | A command that would sample a texture of an address-mode map (`TextureDescriptor::address_mode_map`) where the runtime cannot map it at bind... | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/address_map.rs:158` | `none`: a runtime extension's texture (address_mode_map) sampled where the runtime cannot map it; no Metal API path | | `LibrarySource` | A library compiled from Metal Shading Language source | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/library.rs:107` | `app`: a library compiled from Metal source (newLibraryWithSource:); the runtime takes metallibs and AIR | -| `RestartedStrip` | An indexed strip after `set_primitive_restart_enabled` with an index Vulkan does not restart at, which the runtime draws as a list an index... | every device (runtime piece not built) | 2: `crates/metal2vulkan-runtime/src/index_rewrite.rs:110`, `crates/metal2vulkan-runtime/src/render.rs:7219` | `none`: a strip after the Apple-private setPrimitiveRestartEnabled:index: whose rewrite pass cannot run as Metal draws | -| `PrimitiveIdIndices` | An indexed draw (`drawIndexedPrimitives:`) of a pipeline whose fragment function reads `[[primitive_id]]` on a device whose fragment stage cannot... | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/render.rs:7596` | `rare`: an indexed draw of a primitive_id pipeline, on a device without geometry or tessellation shaders, whose indices the encoder wrote since its last barrier | +| `RestartedStrip` | An indexed strip after `set_primitive_restart_enabled` with an index Vulkan does not restart at, which the runtime draws as a list an index... | every device (runtime piece not built) | 2: `crates/metal2vulkan-runtime/src/index_rewrite.rs:110`, `crates/metal2vulkan-runtime/src/render.rs:7237` | `none`: a strip after the Apple-private setPrimitiveRestartEnabled:index: whose rewrite pass cannot run as Metal draws | +| `PrimitiveIdIndices` | An indexed draw (`drawIndexedPrimitives:`) of a pipeline whose fragment function reads `[[primitive_id]]` on a device whose fragment stage cannot... | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/render.rs:7614` | `rare`: an indexed draw of a primitive_id pipeline, on a device without geometry or tessellation shaders, whose indices the encoder wrote since its last barrier | | `RotatedTexture` | A rotated texture (`TextureDescriptor::rotation`) where the runtime does not build what Metal does | every device (runtime piece not built) | 9: `crates/metal2vulkan-runtime/src/blit_texture.rs:1571`, `crates/metal2vulkan-runtime/src/buffer_texture.rs:715` (+7) | `rare`: a rotated drawable's views, blits with images over overlapping rows, rows past its buffer | -| `DetachTextures` | A texture over a no-copy buffer's or heap's bytes (a heap's texture, or a texture over the buffer or over one of the heap's buffers) that no... | every device (runtime piece not built) | 8: `crates/metal2vulkan-runtime/src/buffer_descriptor.rs:619`, `crates/metal2vulkan-runtime/src/buffer_texture.rs:622` (+6) | `none`: a runtime extension's detach with a texture no stand-in presents exactly | +| `DetachTextures` | A texture over a no-copy buffer's or heap's bytes (a heap's texture, or a texture over the buffer or over one of the heap's buffers) that no... | every device (runtime piece not built) | 8: `crates/metal2vulkan-runtime/src/buffer_descriptor.rs:604`, `crates/metal2vulkan-runtime/src/buffer_texture.rs:622` (+6) | `none`: a runtime extension's detach with a texture no stand-in presents exactly | | `TextureBufferLevels` | A texture buffer of more than one level (`TextureDescriptor::mipmap_level_count`, up to its width's full chain) from the device's, a heap's or the... | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/texture_descriptor.rs:540` | `rare`: a texture buffer of more than one level (public, unusual) | | `WriteSwizzle` | A texture of `TextureDescriptor::write_swizzle_enabled` whose swizzle is not the default, with `ShaderWrite` or `RenderTarget` usage, from the... | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/texture_descriptor.rs:547` | `none`: Apple-private writeSwizzleEnabled with a swizzle that writes | -| `DetachedTexelAccess` | `Texture::replace_region` or `get_bytes` of a texture whose bytes (a no-copy buffer's or heap's) are detached (`detach_backing`) | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/texture.rs:4818` | `none`: CPU texel access while a runtime extension detached the bytes | +| `DetachedTexelAccess` | `Texture::replace_region` or `get_bytes` of a texture whose bytes (a no-copy buffer's or heap's) are detached (`detach_backing`) | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/texture.rs:4820` | `none`: CPU texel access while a runtime extension detached the bytes | | `SurfaceDepthStencil` | A use of a texture of a depth or stencil format (`Depth16Unorm`, `Depth32Float`, `Depth32Float_Stencil8`, `Stencil8`, `X32_Stencil8`) over a plane... | every device (runtime piece not built) | 2: `crates/metal2vulkan-runtime/src/blit_texture.rs:236`, `crates/metal2vulkan-runtime/src/texture/surface_depth.rs:57` | `rare`: a blit of the stencil of a Depth32Float_Stencil8 texture over a plane of an IOSurface with planes, or a pass on an X32_Stencil8 one's view as Depth32Float_Stencil8 | +| `ExtendedRangeResolve` | The multisample resolve (`MultisampleResolve`, `StoreAndMultisampleResolve`) of a color attachment of an extended-range format (`BGRA10_XR`,... | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/resolve.rs:604` | `rare`: a multisample resolve of a BGRA10_XR, BGR10_XR or sRGB twin attachment (EDR content drawn multisampled) | | `HostHeapUncompressedMultisample` | A multisample texture in a heap over host pages (`Device::new_heap_with_bytes_no_copy`) that Metal keeps uncompressed | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/texture/heap.rs:1924` | `none`: a multisample texture Metal keeps uncompressed in a runtime extension's heap over host pages | | `PredicationUnbalanced` | An unbalanced command-predication record (`ComputeCommandEncoder::encode_end_if` and the other ends, or `encode_start_else`, with no block open;... | every device (runtime piece not built) | 4: `crates/metal2vulkan-runtime/src/predication.rs:371`, `crates/metal2vulkan-runtime/src/predication.rs:403` (+2) | `none`: an unbalanced Apple-private command-predication record, whose dropped work Metal decides by no rule measured | | `PredicationOpenAtUnitEnd` | A command buffer one of whose units of predication ended with an If still open that no misused record killed, refused at `CommandBuffer::commit` | every device (runtime piece not built) | 2: `crates/metal2vulkan-runtime/src/predication.rs:280`, `crates/metal2vulkan-runtime/src/predication.rs:296` | `none`: an Apple-private predication If left open, live, where its unit ends | @@ -235,13 +236,11 @@ Generated at `9f4fa7347`. | Variant | What it blocks | Where | Sites | Reach | |---|---|---|---|---| -| `ProtectedContent` | Protected content | every device (Apple-private, Metal's answer not measured) | 1: `crates/metal2vulkan-runtime/src/apple_only.rs:200` | `none`: Apple-private (no public header) | -| `LineWidth` | A line width other than 1 (`setLineWidth:`) | every device (Apple-private, Metal's answer not measured) | 1: `crates/metal2vulkan-runtime/src/apple_only.rs:202` | `none`: Apple-private (no public header) | -| `ProvokingVertexMode` | `setProvokingVertexMode:` other than 0 | every device (Apple-private, not built) | 1: `crates/metal2vulkan-runtime/src/apple_only.rs:207` | `none`: Apple-private (no public header) | -| `ViewportTransformDisabled` | The viewport transform turned off (`setViewportTransformEnabled:NO`) | every device (Apple-private, Metal's answer not measured) | 1: `crates/metal2vulkan-runtime/src/apple_only.rs:204` | `none`: Apple-private (no public header) | -| `VertexAmplificationMode` | `setVertexAmplificationMode:value:` | every device (Apple-private, Metal's answer not measured) | 1: `crates/metal2vulkan-runtime/src/apple_only.rs:210` | `none`: Apple-private (no public header) | -| `DepthCleared` | `setDepthCleared` | every device (Apple-private, Metal's answer not measured) | 1: `crates/metal2vulkan-runtime/src/apple_only.rs:212` | `none`: Apple-private (no public header) | -| `StencilCleared` | `setStencilCleared` | every device (Apple-private, Metal's answer not measured) | 1: `crates/metal2vulkan-runtime/src/apple_only.rs:213` | `none`: Apple-private (no public header) | +| `ProtectedContent` | Protected content | every device (Apple-private, Metal's answer not measured) | 1: `crates/metal2vulkan-runtime/src/apple_only.rs:208` | `none`: Apple-private (no public header) | +| `LineWidth` | A line width other than 1 (`setLineWidth:`) | every device (Apple-private, Metal's answer not measured) | 1: `crates/metal2vulkan-runtime/src/apple_only.rs:210` | `none`: Apple-private (no public header) | +| `ProvokingVertexMode` | `setProvokingVertexMode:` other than 0 | every device (Apple-private, not built) | 1: `crates/metal2vulkan-runtime/src/apple_only.rs:215` | `none`: Apple-private (no public header) | +| `ViewportTransformDisabled` | The viewport transform turned off (`setViewportTransformEnabled:NO`) | every device (Apple-private, Metal's answer not measured) | 1: `crates/metal2vulkan-runtime/src/apple_only.rs:212` | `none`: Apple-private (no public header) | +| `VertexAmplificationMode` | `setVertexAmplificationMode:value:` of a count (the value's set bits in mode 1, else the value) of 0, whose copies change from run to run on... | every device (Apple-private, Metal's answer not measured) | 2: `crates/metal2vulkan-runtime/src/apple_only.rs:219`, `crates/metal2vulkan-runtime/src/apple_only.rs:344` | `none`: Apple-private (no public header) | | `SurfaceClientDirection` | A texture over an IOSurface made with `kIOSurfaceClientDirection` (`newTextureWithDescriptor:iosurface:plane:` of such a surface) | every device (Apple-private, Metal's answer not measured) | 1: `crates/metal2vulkan-runtime/src/buffer_texture.rs:417` | `none`: an IOSurface key in no public header | | `FillUnmeasured` | A texture fill (`fillTexture:level:slice:region:bytes:length:` or a color form) whose answer on Apple's GPU is unmeasured | every device (Apple-private, Metal's answer not measured) | 1: `crates/metal2vulkan-runtime/src/blit_fill.rs:149` | `system`: Apple-private texture fills, which macOS system software encodes | @@ -252,9 +251,9 @@ Generated at `9f4fa7347`. | `DescriptorRangeExceeded` | A descriptor-form slot's window exceeds the descriptor range limit (Profile F) | at the device's limit | 1: `crates/metal2vulkan/src/bind/instantiate.rs:652` | `app`: a buffer window past a device's descriptor range | | `TexelBufferTooLarge` | A texel buffer exceeds `maxTexelBufferElements` | at the device's limit | 1: `crates/metal2vulkan/src/bind/instantiate.rs:891` | `rare`: a texture buffer past maxTexelBufferElements | | `HeapTooLarge` | The set-1 heap's elements (one per resident texture a handle can name, plus the null element) exceed the pipeline's heap capacity | at the device's limit | 7: `crates/metal2vulkan/src/bind/heap.rs:1014`, `crates/metal2vulkan/src/bind/heap.rs:1748` (+5) | `rare`: more resident textures than the pipeline's heap holds (bindless at scale) | -| `TessellationFactorRange` | The tessellation factors a draw reads span more bytes (`needed`) than one storage-buffer descriptor can bind (`limit`, `maxStorageBufferRange`),... | at the device's limit | 1: `crates/metal2vulkan/src/bind/graphics.rs:3551` | `rare`: tessellation factors past one storage descriptor | -| `PatchIndexRange` | The patch indices a draw reads span more bytes (`needed`) than one storage-buffer descriptor can bind (`limit`, `maxStorageBufferRange`) | at the device's limit | 1: `crates/metal2vulkan/src/bind/graphics.rs:3595` | `rare`: patch indices past one storage descriptor | -| `ControlPointIndexRange` | The control-point indices a draw reads span more bytes (`needed`) than one storage-buffer descriptor can bind (`limit`, `maxStorageBufferRange`) | at the device's limit | 1: `crates/metal2vulkan/src/bind/graphics.rs:3633` | `rare`: control-point indices past one storage descriptor | +| `TessellationFactorRange` | The tessellation factors a draw reads span more bytes (`needed`) than one storage-buffer descriptor can bind (`limit`, `maxStorageBufferRange`),... | at the device's limit | 1: `crates/metal2vulkan/src/bind/graphics.rs:3566` | `rare`: tessellation factors past one storage descriptor | +| `PatchIndexRange` | The patch indices a draw reads span more bytes (`needed`) than one storage-buffer descriptor can bind (`limit`, `maxStorageBufferRange`) | at the device's limit | 1: `crates/metal2vulkan/src/bind/graphics.rs:3610` | `rare`: patch indices past one storage descriptor | +| `ControlPointIndexRange` | The control-point indices a draw reads span more bytes (`needed`) than one storage-buffer descriptor can bind (`limit`, `maxStorageBufferRange`) | at the device's limit | 1: `crates/metal2vulkan/src/bind/graphics.rs:3648` | `rare`: control-point indices past one storage descriptor | | `MissingStageInRegion` | The kernel reads the compute encoder's stage-in region (a `[[stage_in]]` attribute stepping by thread position, or `[[grid_origin]]` or... | at the device's limit | 1: `crates/metal2vulkan/src/bind/dispatch.rs:802` | `none`: a stage-in region never set, which Metal leaves undefined | | `UniformViewAliased` | A `device` buffer slot the pipeline reads through a uniform view (Profile F's per-stage storage-buffer fallback,... | at the device's limit | 1: `crates/metal2vulkan/src/bind/instantiate.rs:606` | `rare`: Profile F's uniform-view fallback aliased by a write | | `MissingDeviceAddress` | A device-address slot received a buffer without a device address | at the device's limit | 1: `crates/metal2vulkan/src/bind/plan/slots.rs:133` | `rare`: a slot reached through a pointer loaded from memory, bound with inline bytes or on a device without device addresses | @@ -331,10 +330,10 @@ Each refusal's sites, with the function that builds it. - `feature::Int64Atomics`: `crates/metal2vulkan/src/lower/access/atomic.rs:624 (select)`; `crates/metal2vulkan/src/lower/access/atomic.rs:633 (select)` - `feature::ImageAtomics`: `crates/metal2vulkan-runtime/src/families/formats.rs:464 (atomic_gap)`; `crates/metal2vulkan-runtime/src/families/formats.rs:468 (atomic_gap)`; `crates/metal2vulkan/src/lower/texture/slot.rs:900 (atomic_format)` - `feature::DescriptorCount`: `crates/metal2vulkan/src/lower/access/mod.rs:1684 (accept_placement)`; `crates/metal2vulkan/src/lower/select.rs:1641 (finish)`; `crates/metal2vulkan/src/pipeline/link.rs:1135 (limit_error)` -- `feature::BufferRange`: `crates/metal2vulkan-runtime/src/function_table.rs:569 (past_storage_buffer_range)`; `crates/metal2vulkan/src/bind/graphics.rs:3556 (patch_binding)`; `crates/metal2vulkan/src/bind/graphics.rs:3600 (patch_binding)`; `crates/metal2vulkan/src/bind/graphics.rs:3638 (patch_binding)`; `crates/metal2vulkan/src/bind/instantiate.rs:658 (bind_buffers)`; `crates/metal2vulkan/src/lower/access/function_table.rs:226 (select)`; `crates/metal2vulkan/src/lower/access/mod.rs:1184 (place_slots)` +- `feature::BufferRange`: `crates/metal2vulkan-runtime/src/function_table.rs:569 (past_storage_buffer_range)`; `crates/metal2vulkan/src/bind/graphics.rs:3571 (patch_binding)`; `crates/metal2vulkan/src/bind/graphics.rs:3615 (patch_binding)`; `crates/metal2vulkan/src/bind/graphics.rs:3653 (patch_binding)`; `crates/metal2vulkan/src/bind/instantiate.rs:658 (bind_buffers)`; `crates/metal2vulkan/src/lower/access/function_table.rs:226 (select)`; `crates/metal2vulkan/src/lower/access/mod.rs:1184 (place_slots)` - `feature::Int64Arithmetic`: `crates/metal2vulkan/src/lower/arith/legal.rs:582 (check_scalar)`; `crates/metal2vulkan/src/lower/select.rs:1133 (selector_form)` - `feature::Float64Arithmetic`: `crates/metal2vulkan/src/device/metal.rs:230 (unsupported_features)`; `crates/metal2vulkan/src/lower/arith/legal.rs:587 (check_scalar)` -- `feature::Format`: `crates/metal2vulkan-runtime/src/binding_view.rs:146 (binding_view)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:462 (check_formats)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:469 (check_formats)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:484 (check_formats)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:541 (pair_unit)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:633 (plan_levels_copy)`; `crates/metal2vulkan-runtime/src/blit_texture.rs:2087 (through_buffer)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:519 (make_texture_over)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:582 (make_texture_over)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:614 (make_texture_over)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:851 (texture_buffer_texel)`; `crates/metal2vulkan-runtime/src/copy_plan.rs:269 (colour_unit)`; `crates/metal2vulkan-runtime/src/copy_plan.rs:297 (copy_unit)`; `crates/metal2vulkan-runtime/src/copy_plan.rs:343 (copy_unit)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:346 (scratch)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:526 (usable_twin)`; `crates/metal2vulkan-runtime/src/families/features.rs:1598 (read_write_tier)`; `crates/metal2vulkan-runtime/src/families/formats.rs:1628 (sparse_missing)`; `crates/metal2vulkan-runtime/src/families/formats.rs:227 (none)`; `crates/metal2vulkan-runtime/src/families/formats.rs:271 (answers)`; `crates/metal2vulkan-runtime/src/families/formats.rs:291 (answers)`; `crates/metal2vulkan-runtime/src/families/formats.rs:306 (answers)`; `crates/metal2vulkan-runtime/src/families/formats.rs:353 (answers)`; `crates/metal2vulkan-runtime/src/families/formats.rs:392 (answers)`; `crates/metal2vulkan-runtime/src/families/formats.rs:474 (atomic_gap)`; `crates/metal2vulkan-runtime/src/families/formats.rs:508 (lacking)`; `crates/metal2vulkan-runtime/src/families/formats.rs:522 (unsupported)`; `crates/metal2vulkan-runtime/src/image_plan.rs:544 (check_own_memory)`; `crates/metal2vulkan-runtime/src/image_plan.rs:670 (plan_held)`; `crates/metal2vulkan-runtime/src/image_plan.rs:787 (plan_held)`; `crates/metal2vulkan-runtime/src/image_plan.rs:907 (plan_held)`; `crates/metal2vulkan-runtime/src/render.rs:2155 (viewing)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1024 (check_target)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1362 (layout)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1698 (target)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1791 (attachment_format)`; `crates/metal2vulkan-runtime/src/resolve.rs:392 (unmodelled_resolve)`; `crates/metal2vulkan-runtime/src/resolve.rs:482 (color)`; `crates/metal2vulkan-runtime/src/sample_copy.rs:177 (checked_twin)`; `crates/metal2vulkan-runtime/src/sample_copy.rs:205 (plan)`; `crates/metal2vulkan-runtime/src/sample_interleave.rs:296 (interleave_merge)`; `crates/metal2vulkan-runtime/src/shadow.rs:644 (unmerged)`; `crates/metal2vulkan-runtime/src/shadow.rs:651 (unmerged)`; `crates/metal2vulkan-runtime/src/texture.rs:2000 (texture_as)`; `crates/metal2vulkan-runtime/src/texture.rs:3538 (two_planes_refused)`; `crates/metal2vulkan-runtime/src/texture/decoded_twin.rs:498 (astc_texels)`; `crates/metal2vulkan-runtime/src/texture/decoded_twin.rs:534 (etc_texels)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:1810 (planned_heap_texture)`; `crates/metal2vulkan-runtime/src/texture/surface_two_planes.rs:80 (refused)`; `crates/metal2vulkan-runtime/src/texture/ycbcr_image.rs:115 (converted_storage)`; `crates/metal2vulkan-runtime/src/texture/ycbcr_image.rs:278 (ycbcr_write_shadow)`; `crates/metal2vulkan-runtime/src/texture/ycbcr_image.rs:384 (new_render_shadow)`; `crates/metal2vulkan-runtime/src/two_planes.rs:114 (unmeasured)`; `crates/metal2vulkan-runtime/src/view_plan.rs:380 (check_format)`; `crates/metal2vulkan-runtime/src/view_plan.rs:393 (check_format)`; `crates/metal2vulkan-runtime/src/view_plan.rs:400 (check_format)`; `crates/metal2vulkan-runtime/src/view_plan.rs:410 (check_format)`; `crates/metal2vulkan-runtime/src/view_plan.rs:420 (check_format)`; `crates/metal2vulkan-runtime/src/ycbcr.rs:285 (refused)`; `crates/metal2vulkan/src/bind/extended_shadow.rs:184 (extended_shadow_module)`; `crates/metal2vulkan/src/bind/plan/resources.rs:1134 (plain_texture)`; `crates/metal2vulkan/src/bind/plan/resources.rs:1814 (extended_sampler)`; `crates/metal2vulkan/src/bind/plan/resources.rs:193 (require_filter_features)`; `crates/metal2vulkan/src/bind/plan/resources.rs:959 (plain_texture)`; `crates/metal2vulkan/src/bind/sample_interleave.rs:304 (finish)`; `crates/metal2vulkan/src/bind/sample_interleave.rs:328 (interleave_split_module)`; `crates/metal2vulkan/src/bind/shadow_copy_in.rs:259 (shadow_copy_in_module)`; `crates/metal2vulkan/src/bind/unused_bits.rs:657 (unused_bits_module)`; `crates/metal2vulkan/src/lower/access/tile.rs:1029 (storage_format)`; `crates/metal2vulkan/src/lower/fragment/color.rs:160 (select_param)`; `crates/metal2vulkan/src/lower/fragment/color.rs:166 (select_param)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1138 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1159 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1165 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1171 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1196 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1371 (plan)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1762 (select_read)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1870 (select_output)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1897 (select_output)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1916 (select_output)`; `crates/metal2vulkan/src/lower/sampler/select.rs:1093 (select_extended)`; `crates/metal2vulkan/src/lower/sampler/select.rs:691 (texel_in)`; `crates/metal2vulkan/src/lower/stage_io/extended_color.rs:77 (plan)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:2288 (entry)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:865 (zeroed_output)`; `crates/metal2vulkan/src/lower/stage_io/word_color.rs:83 (plan)`; `crates/metal2vulkan/src/lower/texture/mod.rs:2342 (select)`; `crates/metal2vulkan/src/lower/texture/mod.rs:2984 (cross_class)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3156 (select_image)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3326 (select_read_as)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3363 (select_read_as)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3696 (select_write)`; `crates/metal2vulkan/src/lower/texture/slot.rs:1035 (declare_slot)`; `crates/metal2vulkan/src/lower/texture/slot.rs:1048 (declare_slot)`; `crates/metal2vulkan/src/lower/texture/slot.rs:1054 (declare_slot)`; `crates/metal2vulkan/src/lower/texture/slot.rs:739 (storage_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:742 (storage_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:753 (storage_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:771 (storage_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:791 (storage_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:815 (ulong_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:826 (ulong_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:873 (ulong_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:908 (atomic_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:917 (atomic_format)`; `crates/metal2vulkan/src/metal/format/mod.rs:1657 (vk_format)`; `crates/metal2vulkan/src/metal/format/mod.rs:1659 (vk_format)`; `crates/metal2vulkan/src/metal/format/mod.rs:1789 (candidates)`; `crates/metal2vulkan/src/metal/format/mod.rs:2745 (storage_choice_viewed)`; `crates/metal2vulkan/src/metal/format/mod.rs:2763 (held_storage_choice)`; `crates/metal2vulkan/src/metal/format/mod.rs:2771 (held_storage_choice)`; `crates/metal2vulkan/src/metal/format/mod.rs:2868 (held_storage_choice)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:1087 (extended_write_mask)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:428 (graphics_state)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:474 (graphics_state)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:546 (graphics_state)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:957 (reads_alpha_to_coverage)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:978 (reads_alpha_to_coverage)`; `crates/metal2vulkan/src/pipeline/rotated_blend.rs:449 (rotated_blend)`; `crates/metal2vulkan/src/pipeline/rotated_blend.rs:593 (alpha_in_red_blend)` +- `feature::Format`: `crates/metal2vulkan-runtime/src/binding_view.rs:146 (binding_view)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:462 (check_formats)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:469 (check_formats)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:484 (check_formats)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:541 (pair_unit)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:633 (plan_levels_copy)`; `crates/metal2vulkan-runtime/src/blit_texture.rs:2087 (through_buffer)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:519 (make_texture_over)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:582 (make_texture_over)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:614 (make_texture_over)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:851 (texture_buffer_texel)`; `crates/metal2vulkan-runtime/src/copy_plan.rs:269 (colour_unit)`; `crates/metal2vulkan-runtime/src/copy_plan.rs:297 (copy_unit)`; `crates/metal2vulkan-runtime/src/copy_plan.rs:343 (copy_unit)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:346 (scratch)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:526 (usable_twin)`; `crates/metal2vulkan-runtime/src/families/features.rs:1598 (read_write_tier)`; `crates/metal2vulkan-runtime/src/families/formats.rs:1628 (sparse_missing)`; `crates/metal2vulkan-runtime/src/families/formats.rs:227 (none)`; `crates/metal2vulkan-runtime/src/families/formats.rs:271 (answers)`; `crates/metal2vulkan-runtime/src/families/formats.rs:291 (answers)`; `crates/metal2vulkan-runtime/src/families/formats.rs:306 (answers)`; `crates/metal2vulkan-runtime/src/families/formats.rs:353 (answers)`; `crates/metal2vulkan-runtime/src/families/formats.rs:392 (answers)`; `crates/metal2vulkan-runtime/src/families/formats.rs:474 (atomic_gap)`; `crates/metal2vulkan-runtime/src/families/formats.rs:508 (lacking)`; `crates/metal2vulkan-runtime/src/families/formats.rs:522 (unsupported)`; `crates/metal2vulkan-runtime/src/image_plan.rs:544 (check_own_memory)`; `crates/metal2vulkan-runtime/src/image_plan.rs:670 (plan_held)`; `crates/metal2vulkan-runtime/src/image_plan.rs:787 (plan_held)`; `crates/metal2vulkan-runtime/src/image_plan.rs:907 (plan_held)`; `crates/metal2vulkan-runtime/src/render.rs:2155 (viewing)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1031 (check_target)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1369 (layout)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1709 (target)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1802 (attachment_format)`; `crates/metal2vulkan-runtime/src/resolve.rs:409 (unmodelled_resolve)`; `crates/metal2vulkan-runtime/src/resolve.rs:616 (color)`; `crates/metal2vulkan-runtime/src/sample_copy.rs:177 (checked_twin)`; `crates/metal2vulkan-runtime/src/sample_copy.rs:205 (plan)`; `crates/metal2vulkan-runtime/src/sample_interleave.rs:296 (interleave_merge)`; `crates/metal2vulkan-runtime/src/shadow.rs:644 (unmerged)`; `crates/metal2vulkan-runtime/src/shadow.rs:651 (unmerged)`; `crates/metal2vulkan-runtime/src/texture.rs:2000 (texture_as)`; `crates/metal2vulkan-runtime/src/texture.rs:3540 (two_planes_refused)`; `crates/metal2vulkan-runtime/src/texture/decoded_twin.rs:498 (astc_texels)`; `crates/metal2vulkan-runtime/src/texture/decoded_twin.rs:534 (etc_texels)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:1810 (planned_heap_texture)`; `crates/metal2vulkan-runtime/src/texture/surface_two_planes.rs:80 (refused)`; `crates/metal2vulkan-runtime/src/texture/ycbcr_image.rs:115 (converted_storage)`; `crates/metal2vulkan-runtime/src/texture/ycbcr_image.rs:278 (ycbcr_write_shadow)`; `crates/metal2vulkan-runtime/src/texture/ycbcr_image.rs:384 (new_render_shadow)`; `crates/metal2vulkan-runtime/src/two_planes.rs:114 (unmeasured)`; `crates/metal2vulkan-runtime/src/view_plan.rs:380 (check_format)`; `crates/metal2vulkan-runtime/src/view_plan.rs:393 (check_format)`; `crates/metal2vulkan-runtime/src/view_plan.rs:400 (check_format)`; `crates/metal2vulkan-runtime/src/view_plan.rs:410 (check_format)`; `crates/metal2vulkan-runtime/src/view_plan.rs:420 (check_format)`; `crates/metal2vulkan-runtime/src/ycbcr.rs:285 (refused)`; `crates/metal2vulkan/src/bind/extended_shadow.rs:184 (extended_shadow_module)`; `crates/metal2vulkan/src/bind/plan/resources.rs:1134 (plain_texture)`; `crates/metal2vulkan/src/bind/plan/resources.rs:1814 (extended_sampler)`; `crates/metal2vulkan/src/bind/plan/resources.rs:193 (require_filter_features)`; `crates/metal2vulkan/src/bind/plan/resources.rs:959 (plain_texture)`; `crates/metal2vulkan/src/bind/sample_interleave.rs:304 (finish)`; `crates/metal2vulkan/src/bind/sample_interleave.rs:328 (interleave_split_module)`; `crates/metal2vulkan/src/bind/shadow_copy_in.rs:259 (shadow_copy_in_module)`; `crates/metal2vulkan/src/bind/unused_bits.rs:657 (unused_bits_module)`; `crates/metal2vulkan/src/lower/access/tile.rs:1029 (storage_format)`; `crates/metal2vulkan/src/lower/fragment/color.rs:160 (select_param)`; `crates/metal2vulkan/src/lower/fragment/color.rs:166 (select_param)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1138 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1159 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1165 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1171 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1196 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1371 (plan)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1762 (select_read)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1870 (select_output)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1897 (select_output)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1916 (select_output)`; `crates/metal2vulkan/src/lower/sampler/select.rs:1093 (select_extended)`; `crates/metal2vulkan/src/lower/sampler/select.rs:691 (texel_in)`; `crates/metal2vulkan/src/lower/stage_io/extended_color.rs:77 (plan)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:2307 (entry)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:865 (zeroed_output)`; `crates/metal2vulkan/src/lower/stage_io/word_color.rs:83 (plan)`; `crates/metal2vulkan/src/lower/texture/mod.rs:2347 (select)`; `crates/metal2vulkan/src/lower/texture/mod.rs:2989 (cross_class)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3161 (select_image)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3331 (select_read_as)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3368 (select_read_as)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3701 (select_write)`; `crates/metal2vulkan/src/lower/texture/slot.rs:1035 (declare_slot)`; `crates/metal2vulkan/src/lower/texture/slot.rs:1048 (declare_slot)`; `crates/metal2vulkan/src/lower/texture/slot.rs:1054 (declare_slot)`; `crates/metal2vulkan/src/lower/texture/slot.rs:739 (storage_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:742 (storage_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:753 (storage_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:771 (storage_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:791 (storage_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:815 (ulong_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:826 (ulong_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:873 (ulong_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:908 (atomic_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:917 (atomic_format)`; `crates/metal2vulkan/src/metal/format/mod.rs:1657 (vk_format)`; `crates/metal2vulkan/src/metal/format/mod.rs:1659 (vk_format)`; `crates/metal2vulkan/src/metal/format/mod.rs:1789 (candidates)`; `crates/metal2vulkan/src/metal/format/mod.rs:2745 (storage_choice_viewed)`; `crates/metal2vulkan/src/metal/format/mod.rs:2763 (held_storage_choice)`; `crates/metal2vulkan/src/metal/format/mod.rs:2771 (held_storage_choice)`; `crates/metal2vulkan/src/metal/format/mod.rs:2868 (held_storage_choice)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:1090 (extended_write_mask)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:428 (graphics_state)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:474 (graphics_state)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:546 (graphics_state)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:960 (reads_alpha_to_coverage)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:981 (reads_alpha_to_coverage)`; `crates/metal2vulkan/src/pipeline/rotated_blend.rs:449 (rotated_blend)`; `crates/metal2vulkan/src/pipeline/rotated_blend.rs:593 (alpha_in_red_blend)` - `feature::DivergentImplicitLod`: `crates/metal2vulkan/src/lower/sampler/select.rs:352 (select_sampling)` - `feature::ImplicitLodOutsideFragment`: `crates/metal2vulkan/src/lower/sampler/constexpr.rs:136 (query_min_level)`; `crates/metal2vulkan/src/lower/sampler/select.rs:229 (query_level_measured)`; `crates/metal2vulkan/src/lower/sampler/select.rs:255 (query_min_level)` - `feature::MinLodClamp`: `crates/metal2vulkan/src/lower/sampler/select.rs:1572 (select_one)`; `crates/metal2vulkan/src/lower/sampler/select.rs:973 (min_lod)` @@ -350,28 +349,28 @@ Each refusal's sites, with the function that builds it. - `feature::PixelSamplerCompare`: `crates/metal2vulkan/src/lower/sampler/constexpr.rs:115 (lowered)` - `feature::TexelBuffer`: `crates/metal2vulkan/src/bind/instantiate.rs:879 (texel_ranges)`; `crates/metal2vulkan/src/bind/instantiate.rs:885 (texel_ranges)`; `crates/metal2vulkan/src/bind/plan/resources.rs:1147 (plain_texture)` - `feature::RasterOrderGroups`: `crates/metal2vulkan/src/device/metal.rs:242 (unsupported_features)`; `crates/metal2vulkan/src/lower/fragment/rog.rs:151 (mode)`; `crates/metal2vulkan/src/lower/fragment/rog.rs:172 (mode)`; `crates/metal2vulkan/src/lower/fragment/snapshot.rs:158 (finish)` -- `feature::FramebufferFetch`: `crates/metal2vulkan-runtime/src/families/features.rs:1007 (state)`; `crates/metal2vulkan-runtime/src/render.rs:5709 (next_instance)`; `crates/metal2vulkan-runtime/src/sample_planes.rs:116 (lacks)`; `crates/metal2vulkan-runtime/src/sample_planes.rs:143 (new)`; `crates/metal2vulkan-runtime/src/sample_planes.rs:514 (planes_merge)`; `crates/metal2vulkan/src/bind/extended_shadow.rs:190 (extended_shadow_module)`; `crates/metal2vulkan/src/bind/graphics.rs:1453 (plan)`; `crates/metal2vulkan/src/bind/graphics.rs:1490 (plan)`; `crates/metal2vulkan/src/bind/graphics.rs:1509 (plan)`; `crates/metal2vulkan/src/bind/sample_planes.rs:477 (finish)`; `crates/metal2vulkan/src/device/metal.rs:252 (unsupported_features)`; `crates/metal2vulkan/src/lower/arith/extended_range/blend.rs:1198 (unorm8)`; `crates/metal2vulkan/src/lower/arith/extended_range/blend.rs:1216 (unorm8)`; `crates/metal2vulkan/src/lower/arith/extended_range/blend.rs:1230 (unorm8)`; `crates/metal2vulkan/src/lower/arith/extended_range/blend.rs:1273 (packed16)`; `crates/metal2vulkan/src/lower/fragment/color.rs:215 (select_param)`; `crates/metal2vulkan/src/lower/fragment/color.rs:279 (unordered)`; `crates/metal2vulkan/src/lower/fragment/depth_test.rs:195 (not_implemented)`; `crates/metal2vulkan/src/lower/fragment/depth_test.rs:272 (depth_test_form)`; `crates/metal2vulkan/src/lower/fragment/depth_test.rs:318 (stencil_test_form)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1024 (storage_form)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1114 (storage_form)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1151 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1716 (plan_sample)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:749 (not_implemented)`; `crates/metal2vulkan/src/pipeline/link/fetch.rs:164 (storage_attachments)` -- `feature::PrimitiveId`: `crates/metal2vulkan-runtime/src/families/features.rs:1115 (state)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:3112 (finish)`; `crates/metal2vulkan/src/pipeline/link/varyings.rs:240 (check_primitive_id)` -- `feature::VertexAmplification`: `crates/metal2vulkan/src/bind/graphics.rs:3897 (multiview_instances)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:1281 (own_index_store)`; `crates/metal2vulkan/src/lower/tessellation/mod.rs:718 (select_param)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:258 (vertex_amplification)`; `crates/metal2vulkan/src/pipeline/link/tessellation/mod.rs:228 (control_plan)` -- `feature::LayeredRendering`: `crates/metal2vulkan-runtime/src/render_pass.rs:1658 (target)`; `crates/metal2vulkan-runtime/src/render_state.rs:1078 (needs_viewports)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:778 (target_index)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:797 (target_index)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:1282 (own_index_store)`; `crates/metal2vulkan/src/pipeline/link/geometry.rs:150 (not_implemented)`; `crates/metal2vulkan/src/pipeline/link/geometry.rs:172 (refused)` +- `feature::FramebufferFetch`: `crates/metal2vulkan-runtime/src/families/features.rs:1007 (state)`; `crates/metal2vulkan-runtime/src/render.rs:5727 (next_instance)`; `crates/metal2vulkan-runtime/src/sample_planes.rs:116 (lacks)`; `crates/metal2vulkan-runtime/src/sample_planes.rs:143 (new)`; `crates/metal2vulkan-runtime/src/sample_planes.rs:514 (planes_merge)`; `crates/metal2vulkan/src/bind/extended_shadow.rs:190 (extended_shadow_module)`; `crates/metal2vulkan/src/bind/graphics.rs:1453 (plan)`; `crates/metal2vulkan/src/bind/graphics.rs:1490 (plan)`; `crates/metal2vulkan/src/bind/graphics.rs:1509 (plan)`; `crates/metal2vulkan/src/bind/sample_planes.rs:477 (finish)`; `crates/metal2vulkan/src/device/metal.rs:252 (unsupported_features)`; `crates/metal2vulkan/src/lower/arith/extended_range/blend.rs:1198 (unorm8)`; `crates/metal2vulkan/src/lower/arith/extended_range/blend.rs:1216 (unorm8)`; `crates/metal2vulkan/src/lower/arith/extended_range/blend.rs:1230 (unorm8)`; `crates/metal2vulkan/src/lower/arith/extended_range/blend.rs:1273 (packed16)`; `crates/metal2vulkan/src/lower/fragment/color.rs:215 (select_param)`; `crates/metal2vulkan/src/lower/fragment/color.rs:279 (unordered)`; `crates/metal2vulkan/src/lower/fragment/depth_test.rs:195 (not_implemented)`; `crates/metal2vulkan/src/lower/fragment/depth_test.rs:272 (depth_test_form)`; `crates/metal2vulkan/src/lower/fragment/depth_test.rs:318 (stencil_test_form)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1024 (storage_form)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1114 (storage_form)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1151 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1716 (plan_sample)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:749 (not_implemented)`; `crates/metal2vulkan/src/pipeline/link/fetch.rs:164 (storage_attachments)` +- `feature::PrimitiveId`: `crates/metal2vulkan-runtime/src/families/features.rs:1115 (state)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:3131 (finish)`; `crates/metal2vulkan/src/pipeline/link/varyings.rs:240 (check_primitive_id)` +- `feature::VertexAmplification`: `crates/metal2vulkan/src/bind/graphics.rs:3912 (multiview_instances)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:1281 (own_index_store)`; `crates/metal2vulkan/src/lower/tessellation/mod.rs:718 (select_param)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:258 (vertex_amplification)`; `crates/metal2vulkan/src/pipeline/link/tessellation/mod.rs:228 (control_plan)` +- `feature::LayeredRendering`: `crates/metal2vulkan-runtime/src/render_pass.rs:1669 (target)`; `crates/metal2vulkan-runtime/src/render_state.rs:1092 (needs_viewports)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:778 (target_index)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:797 (target_index)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:1282 (own_index_store)`; `crates/metal2vulkan/src/pipeline/link/geometry.rs:150 (not_implemented)`; `crates/metal2vulkan/src/pipeline/link/geometry.rs:172 (refused)` - `feature::ClipDistance`: `crates/metal2vulkan/src/lower/mesh/mod.rs:934 (select)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:942 (select)` -- `feature::DualSourceBlending`: `crates/metal2vulkan-runtime/src/families/formats.rs:386 (answers)`; `crates/metal2vulkan/src/metal/state.rs:37 (blend_factor)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:1144 (check_outputs)`; `crates/metal2vulkan/src/pipeline/rotated_blend.rs:463 (rotated_blend)`; `crates/metal2vulkan/src/pipeline/rotated_blend.rs:538 (rotated_blend)` +- `feature::DualSourceBlending`: `crates/metal2vulkan-runtime/src/families/formats.rs:386 (answers)`; `crates/metal2vulkan/src/metal/state.rs:37 (blend_factor)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:1147 (check_outputs)`; `crates/metal2vulkan/src/pipeline/rotated_blend.rs:463 (rotated_blend)`; `crates/metal2vulkan/src/pipeline/rotated_blend.rs:538 (rotated_blend)` - `feature::Barycentrics`: `crates/metal2vulkan/src/device/metal.rs:263 (unsupported_features)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:1876 (input_builtin)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:742 (param)`; `crates/metal2vulkan/src/pipeline/link/geometry.rs:148 (not_implemented)`; `crates/metal2vulkan/src/pipeline/link/geometry.rs:170 (refused)` -- `feature::StencilExport`: `crates/metal2vulkan-runtime/src/families/features.rs:1102 (state)`; `crates/metal2vulkan/src/bind/graphics.rs:2606 (shadow_stencil_words)`; `crates/metal2vulkan/src/lower/fragment/stencil.rs:157 (device_form)`; `crates/metal2vulkan/src/lower/fragment/stencil.rs:168 (not_implemented)`; `crates/metal2vulkan/src/pipeline/link/stencil.rs:55 (shadow_stencil)`; `crates/metal2vulkan/src/pipeline/link/stencil.rs:73 (shadow_stencil)` -- `feature::SampleRateShading`: `crates/metal2vulkan/src/pipeline/link/graphics.rs:832 (sample_invocations)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:834 (sample_invocations)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:916 (sample_invocations)` -- `feature::PixelCoverageAtSampleRate`: `crates/metal2vulkan/src/lower/fragment/coverage.rs:291 (finish)`; `crates/metal2vulkan/src/lower/simd/mod.rs:754 (select_param)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:867 (sample_invocations)` +- `feature::StencilExport`: `crates/metal2vulkan-runtime/src/families/features.rs:1102 (state)`; `crates/metal2vulkan/src/bind/graphics.rs:2608 (shadow_stencil_words)`; `crates/metal2vulkan/src/lower/fragment/stencil.rs:157 (device_form)`; `crates/metal2vulkan/src/lower/fragment/stencil.rs:168 (not_implemented)`; `crates/metal2vulkan/src/pipeline/link/stencil.rs:55 (shadow_stencil)`; `crates/metal2vulkan/src/pipeline/link/stencil.rs:73 (shadow_stencil)` +- `feature::SampleRateShading`: `crates/metal2vulkan/src/pipeline/link/graphics.rs:835 (sample_invocations)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:837 (sample_invocations)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:919 (sample_invocations)` +- `feature::PixelCoverageAtSampleRate`: `crates/metal2vulkan/src/lower/fragment/coverage.rs:291 (finish)`; `crates/metal2vulkan/src/lower/simd/mod.rs:754 (select_param)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:870 (sample_invocations)` - `feature::InterfaceComponents`: `crates/metal2vulkan/src/pipeline/compile/color_group.rs:202 (refusal)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:301 (graphics_state)`; `crates/metal2vulkan/src/pipeline/link/varyings.rs:409 (assign)`; `crates/metal2vulkan/src/pipeline/link/varyings.rs:90 (limit_error)` - `feature::UnmatchedVarying`: `crates/metal2vulkan/src/pipeline/link/varyings.rs:318 (mesh_fragment)`; `crates/metal2vulkan/src/pipeline/link/varyings.rs:537 (varyings)`; `crates/metal2vulkan/src/pipeline/link/varyings.rs:548 (varyings)` - `feature::KernelStageIn`: `crates/metal2vulkan-runtime/src/indirect_execute.rs:350 (record)`; `crates/metal2vulkan/src/bind/dispatch.rs:877 (instantiate)`; `crates/metal2vulkan/src/lower/stage_io/stage_in.rs:133 (select)` -- `feature::Tessellation`: `crates/metal2vulkan-air/src/canon/mod.rs:1256 (post_check)`; `crates/metal2vulkan-air/src/canon/mod.rs:1347 (post_check)`; `crates/metal2vulkan/src/bind/graphics.rs:3754 (tessellation_dispatch)`; `crates/metal2vulkan/src/lower/stage_io/fetch.rs:519 (select)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:1457 (primitive_id_output)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:1750 (input_builtin)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:799 (param)`; `crates/metal2vulkan/src/lower/tessellation/mod.rs:150 (not_implemented)`; `crates/metal2vulkan/src/lower/tessellation/mod.rs:489 (plan_entry)`; `crates/metal2vulkan/src/metal/vertex.rs:219 (fetch_as)`; `crates/metal2vulkan/src/pipeline/link/tessellation/mod.rs:212 (control_plan)`; `crates/metal2vulkan/src/pipeline/link/tessellation/mod.rs:292 (check_fragment)`; `crates/metal2vulkan/src/pipeline/link/tessellation/mod.rs:316 (push_offset)` -- `feature::MeshShading`: `crates/metal2vulkan/src/bind/graphics.rs:1536 (plan)`; `crates/metal2vulkan/src/bind/graphics.rs:2966 (mesh_limit)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:499 (check_payload)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:538 (plan_entry)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:572 (plan_entry)`; `crates/metal2vulkan/src/memory/plan.rs:2056 (reprs)`; `crates/metal2vulkan/src/pipeline/link/mesh.rs:95 (records)` -- `feature::TileShading`: `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:521 (scratch)`; `crates/metal2vulkan/src/bind/plan/compute.rs:237 (tile_memory)`; `crates/metal2vulkan/src/lower/access/tile.rs:151 (not_implemented)`; `crates/metal2vulkan/src/lower/sync/barrier.rs:275 (tile_shading)`; `crates/metal2vulkan/src/pipeline/compile/api.rs:687 (tile_pipeline)` -- `feature::Imageblocks`: `crates/metal2vulkan/src/lower/access/imageblock.rs:98 (imageblocks)`; `crates/metal2vulkan/src/lower/access/mod.rs:908 (select_param)`; `crates/metal2vulkan/src/lower/fragment/imageblock.rs:103 (require)`; `crates/metal2vulkan/src/lower/fragment/imageblock.rs:85 (not_implemented)`; `crates/metal2vulkan/src/lower/texture/mod.rs:2352 (select)`; `crates/metal2vulkan/src/lower/texture/slice.rs:139 (imageblocks)`; `crates/metal2vulkan/src/pipeline/link/imageblock.rs:46 (fragment_imageblock)` +- `feature::Tessellation`: `crates/metal2vulkan-air/src/canon/mod.rs:1256 (post_check)`; `crates/metal2vulkan-air/src/canon/mod.rs:1347 (post_check)`; `crates/metal2vulkan/src/bind/graphics.rs:3769 (tessellation_dispatch)`; `crates/metal2vulkan/src/lower/stage_io/fetch.rs:519 (select)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:1457 (primitive_id_output)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:1750 (input_builtin)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:799 (param)`; `crates/metal2vulkan/src/lower/tessellation/mod.rs:150 (not_implemented)`; `crates/metal2vulkan/src/lower/tessellation/mod.rs:489 (plan_entry)`; `crates/metal2vulkan/src/metal/vertex.rs:219 (fetch_as)`; `crates/metal2vulkan/src/pipeline/link/tessellation/mod.rs:212 (control_plan)`; `crates/metal2vulkan/src/pipeline/link/tessellation/mod.rs:292 (check_fragment)`; `crates/metal2vulkan/src/pipeline/link/tessellation/mod.rs:316 (push_offset)` +- `feature::MeshShading`: `crates/metal2vulkan/src/bind/graphics.rs:1536 (plan)`; `crates/metal2vulkan/src/bind/graphics.rs:2981 (mesh_limit)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:499 (check_payload)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:538 (plan_entry)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:572 (plan_entry)`; `crates/metal2vulkan/src/memory/plan.rs:2056 (reprs)`; `crates/metal2vulkan/src/pipeline/link/mesh.rs:95 (records)` +- `feature::TileShading`: `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:521 (scratch)`; `crates/metal2vulkan/src/bind/plan/compute.rs:237 (tile_memory)`; `crates/metal2vulkan/src/lower/access/tile.rs:151 (not_implemented)`; `crates/metal2vulkan/src/lower/sync/barrier.rs:275 (tile_shading)`; `crates/metal2vulkan/src/pipeline/compile/api.rs:690 (tile_pipeline)` +- `feature::Imageblocks`: `crates/metal2vulkan/src/lower/access/imageblock.rs:98 (imageblocks)`; `crates/metal2vulkan/src/lower/access/mod.rs:908 (select_param)`; `crates/metal2vulkan/src/lower/fragment/imageblock.rs:103 (require)`; `crates/metal2vulkan/src/lower/fragment/imageblock.rs:85 (not_implemented)`; `crates/metal2vulkan/src/lower/texture/mod.rs:2357 (select)`; `crates/metal2vulkan/src/lower/texture/slice.rs:139 (imageblocks)`; `crates/metal2vulkan/src/pipeline/link/imageblock.rs:46 (fragment_imageblock)` - `feature::RayTracing`: `crates/metal2vulkan/src/bind/acceleration.rs:202 (instance_record)`; `crates/metal2vulkan/src/bind/acceleration.rs:216 (instance_record)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:1087 (primitive_data_read)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:1202 (instance_count)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:1245 (intersect)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:1257 (intersect)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:1282 (intersect)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:1297 (intersect)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:1312 (intersect)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:344 (slot_of)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:385 (select_param)`; `crates/metal2vulkan/src/lower/select.rs:899 (route_air)` - `feature::Tensors`: `crates/metal2vulkan-air/src/canon/matmul2d/synth.rs:32 (refuse)`; `crates/metal2vulkan/src/lower/select.rs:903 (route_air)` - `feature::RasterizationRateMap`: `crates/metal2vulkan/src/lower/fragment/mod.rs:925 (select)` -- `feature::GpuEncodedIndirectCommands`: `crates/metal2vulkan/src/bind/replay.rs:556 (preprocess)`; `crates/metal2vulkan/src/bind/replay.rs:796 (replay_preprocess_module)`; `crates/metal2vulkan/src/bind/replay/draws.rs:280 (draw_replay_preprocess)`; `crates/metal2vulkan/src/bind/replay/draws.rs:482 (draw_replay_module)`; `crates/metal2vulkan/src/bind/replay/flat.rs:247 (flat_dispatch_module)`; `crates/metal2vulkan/src/bind/replay/merged.rs:242 (draw_merge_module)`; `crates/metal2vulkan/src/lower/access/encode.rs:393 (needs)`; `crates/metal2vulkan/src/lower/access/encode.rs:409 (needs)`; `crates/metal2vulkan/src/lower/access/encode.rs:526 (select_command)`; `crates/metal2vulkan/src/lower/access/mod.rs:1539 (plan_replay)`; `crates/metal2vulkan/src/lower/access/mod.rs:1562 (plan_replay)`; `crates/metal2vulkan/src/lower/access/mod.rs:1565 (plan_replay)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:2613 (merged)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:2669 (finish_merged)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:455 (param)`; `crates/metal2vulkan/src/pipeline/compile.rs:2110 (plan_one)`; `crates/metal2vulkan/src/pipeline/compile.rs:2115 (plan_one)` -- `feature::VulkanVersion`: `crates/metal2vulkan/src/ash_interop/query.rs:915 (query)`; `crates/metal2vulkan/src/device/derive.rs:105 (with_deviations)` +- `feature::GpuEncodedIndirectCommands`: `crates/metal2vulkan/src/bind/replay.rs:556 (preprocess)`; `crates/metal2vulkan/src/bind/replay.rs:796 (replay_preprocess_module)`; `crates/metal2vulkan/src/bind/replay/draws.rs:280 (draw_replay_preprocess)`; `crates/metal2vulkan/src/bind/replay/draws.rs:482 (draw_replay_module)`; `crates/metal2vulkan/src/bind/replay/flat.rs:247 (flat_dispatch_module)`; `crates/metal2vulkan/src/bind/replay/merged.rs:242 (draw_merge_module)`; `crates/metal2vulkan/src/lower/access/encode.rs:393 (needs)`; `crates/metal2vulkan/src/lower/access/encode.rs:409 (needs)`; `crates/metal2vulkan/src/lower/access/encode.rs:526 (select_command)`; `crates/metal2vulkan/src/lower/access/mod.rs:1539 (plan_replay)`; `crates/metal2vulkan/src/lower/access/mod.rs:1562 (plan_replay)`; `crates/metal2vulkan/src/lower/access/mod.rs:1565 (plan_replay)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:2632 (merged)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:2688 (finish_merged)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:455 (param)`; `crates/metal2vulkan/src/pipeline/compile.rs:2124 (plan_one)`; `crates/metal2vulkan/src/pipeline/compile.rs:2129 (plan_one)` +- `feature::VulkanVersion`: `crates/metal2vulkan/src/ash_interop/query.rs:916 (query)`; `crates/metal2vulkan/src/device/derive.rs:105 (with_deviations)` - `feature::Constant`: `crates/metal2vulkan-air/src/bitcode/constants.rs:210 (record)`; `crates/metal2vulkan-air/src/bitcode/constants.rs:268 (record)`; `crates/metal2vulkan/src/error/mod.rs:255 (from)` - `feature::Attribute`: `crates/metal2vulkan-air/src/bitcode/attrs.rs:493 (known)`; `crates/metal2vulkan/src/error/mod.rs:256 (from)` - `feature::BitcodeRecord`: `crates/metal2vulkan-air/src/bitcode/attrs.rs:337 (decode_lists)`; `crates/metal2vulkan-air/src/bitcode/function.rs:572 (symtab)`; `crates/metal2vulkan-air/src/bitcode/metadata.rs:130 (decode)`; `crates/metal2vulkan-air/src/bitcode/metadata.rs:157 (decode)`; `crates/metal2vulkan-air/src/bitcode/module.rs:727 (check_bodies)`; `crates/metal2vulkan-air/src/bitcode/module.rs:872 (symtab)`; `crates/metal2vulkan/src/error/mod.rs:257 (from)` @@ -379,16 +378,16 @@ Each refusal's sites, with the function that builds it. - `feature::SubgroupOperations`: `crates/metal2vulkan-runtime/src/families/features.rs:1686 (simd)`; `crates/metal2vulkan/src/lower/simd/mod.rs:407 (finish)`; `crates/metal2vulkan/src/lower/simd/mod.rs:466 (full_quads)`; `crates/metal2vulkan/src/lower/simd/mod.rs:990 (select_group)` - `feature::DirectCall`: `crates/metal2vulkan-air/src/canon/mod.rs:1319 (post_check)` - `feature::WideSwitchLiteral`: `crates/metal2vulkan/src/structurize/emit.rs:207 (check_tree)` -- `feature::Lowering`: `crates/metal2vulkan/src/bind/plan/resources.rs:762 (level_views)`; `crates/metal2vulkan/src/lower/access/handle.rs:1062 (texture_target)`; `crates/metal2vulkan/src/lower/access/handle.rs:1073 (sampler_target)`; `crates/metal2vulkan/src/lower/access/handle.rs:318 (domain_kind)`; `crates/metal2vulkan/src/lower/access/imageblock.rs:175 (operand)`; `crates/metal2vulkan/src/lower/access/mod.rs:571 (not_lowered)`; `crates/metal2vulkan/src/lower/access/pulled.rs:76 (share)`; `crates/metal2vulkan/src/lower/arith/legal.rs:53 (not_lowered)`; `crates/metal2vulkan/src/lower/dispatch.rs:113 (not_lowered)`; `crates/metal2vulkan/src/lower/fragment/discard.rs:144 (not_lowered)`; `crates/metal2vulkan/src/lower/fragment/discard.rs:653 (plan)`; `crates/metal2vulkan/src/lower/fragment/mod.rs:123 (not_lowered)`; `crates/metal2vulkan/src/lower/fragment/snapshot.rs:168 (finish)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:147 (not_lowered)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:126 (not_lowered)`; `crates/metal2vulkan/src/lower/sampler/mod.rs:212 (refuse)`; `crates/metal2vulkan/src/lower/sampler/select.rs:30 (refuse)`; `crates/metal2vulkan/src/lower/select.rs:829 (not_lowered)`; `crates/metal2vulkan/src/lower/select.rs:918 (route_air)`; `crates/metal2vulkan/src/lower/simd/mod.rs:136 (not_lowered)`; `crates/metal2vulkan/src/lower/simd/mod.rs:747 (select_param)`; `crates/metal2vulkan/src/lower/simd/workgroup.rs:353 (check)`; `crates/metal2vulkan/src/lower/stage_io/fetch.rs:96 (not_lowered)`; `crates/metal2vulkan/src/lower/stage_io/mod.rs:177 (not_lowered)`; `crates/metal2vulkan/src/lower/sync/barrier.rs:72 (not_lowered)`; `crates/metal2vulkan/src/lower/sync/memory_model.rs:269 (not_implemented)`; `crates/metal2vulkan/src/lower/sync/memory_model.rs:310 (select)`; `crates/metal2vulkan/src/lower/tessellation/mod.rs:146 (not_lowered)`; `crates/metal2vulkan/src/lower/texture/mod.rs:180 (refuse)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3665 (select_write)`; `crates/metal2vulkan/src/memory/alloca.rs:54 (not_lowered)`; `crates/metal2vulkan/src/memory/leaf.rs:183 (not_lowered)`; `crates/metal2vulkan/src/memory/plan.rs:490 (not_lowered)`; `crates/metal2vulkan/src/memory/provenance.rs:665 (not_lowered)`; `crates/metal2vulkan/src/pipeline/link/tessellation/mod.rs:96 (patch_fetch_projection)` +- `feature::Lowering`: `crates/metal2vulkan/src/bind/plan/resources.rs:762 (level_views)`; `crates/metal2vulkan/src/lower/access/handle.rs:1062 (texture_target)`; `crates/metal2vulkan/src/lower/access/handle.rs:1073 (sampler_target)`; `crates/metal2vulkan/src/lower/access/handle.rs:318 (domain_kind)`; `crates/metal2vulkan/src/lower/access/imageblock.rs:175 (operand)`; `crates/metal2vulkan/src/lower/access/mod.rs:571 (not_lowered)`; `crates/metal2vulkan/src/lower/access/pulled.rs:76 (share)`; `crates/metal2vulkan/src/lower/arith/legal.rs:53 (not_lowered)`; `crates/metal2vulkan/src/lower/dispatch.rs:113 (not_lowered)`; `crates/metal2vulkan/src/lower/fragment/discard.rs:144 (not_lowered)`; `crates/metal2vulkan/src/lower/fragment/discard.rs:653 (plan)`; `crates/metal2vulkan/src/lower/fragment/mod.rs:123 (not_lowered)`; `crates/metal2vulkan/src/lower/fragment/snapshot.rs:168 (finish)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:147 (not_lowered)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:126 (not_lowered)`; `crates/metal2vulkan/src/lower/sampler/mod.rs:212 (refuse)`; `crates/metal2vulkan/src/lower/sampler/select.rs:30 (refuse)`; `crates/metal2vulkan/src/lower/select.rs:829 (not_lowered)`; `crates/metal2vulkan/src/lower/select.rs:918 (route_air)`; `crates/metal2vulkan/src/lower/simd/mod.rs:136 (not_lowered)`; `crates/metal2vulkan/src/lower/simd/mod.rs:747 (select_param)`; `crates/metal2vulkan/src/lower/simd/workgroup.rs:353 (check)`; `crates/metal2vulkan/src/lower/stage_io/fetch.rs:96 (not_lowered)`; `crates/metal2vulkan/src/lower/stage_io/mod.rs:177 (not_lowered)`; `crates/metal2vulkan/src/lower/sync/barrier.rs:72 (not_lowered)`; `crates/metal2vulkan/src/lower/sync/memory_model.rs:269 (not_implemented)`; `crates/metal2vulkan/src/lower/sync/memory_model.rs:310 (select)`; `crates/metal2vulkan/src/lower/tessellation/mod.rs:146 (not_lowered)`; `crates/metal2vulkan/src/lower/texture/mod.rs:180 (refuse)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3670 (select_write)`; `crates/metal2vulkan/src/memory/alloca.rs:54 (not_lowered)`; `crates/metal2vulkan/src/memory/leaf.rs:183 (not_lowered)`; `crates/metal2vulkan/src/memory/plan.rs:490 (not_lowered)`; `crates/metal2vulkan/src/memory/provenance.rs:665 (not_lowered)`; `crates/metal2vulkan/src/pipeline/link/tessellation/mod.rs:96 (patch_fetch_projection)` - `feature::SamplerAddressMode`: `crates/metal2vulkan/src/lower/sampler/constexpr.rs:176`; `crates/metal2vulkan/src/metal/sampler.rs:251 (check_sampler)` - `feature::AlphaToOne`: `crates/metal2vulkan/src/pipeline/link/graphics.rs:282 (graphics_state)` - `feature::StageStoresAndAtomics`: `crates/metal2vulkan/src/lower/access/tile_memory.rs:72 (written)` - `feature::FunctionConstantArgument`: `crates/metal2vulkan-air/src/canon/interface.rs:899 (absent_values)`; `crates/metal2vulkan/src/lower/access/absent.rs:100 (require)` - `feature::SamplerBicubicFilter`: `crates/metal2vulkan/src/bind/heap.rs:997 (new)`; `crates/metal2vulkan/src/bind/plan/resources.rs:1876 (bicubic_texels)`; `crates/metal2vulkan/src/bind/plan/slots.rs:503 (cubic_variant)`; `crates/metal2vulkan/src/lower/sampler/bicubic.rs:120 (refuse)`; `crates/metal2vulkan/src/lower/sampler/select.rs:35 (bicubic_refused)` -- `feature::GroupCount`: `crates/metal2vulkan/src/bind/dispatch.rs:379 (product)`; `crates/metal2vulkan/src/bind/dispatch.rs:461`; `crates/metal2vulkan/src/bind/dispatch.rs:959 (instantiate)`; `crates/metal2vulkan/src/bind/graphics.rs:3170 (mesh_draw)`; `crates/metal2vulkan/src/bind/graphics.rs:3221 (emulated_draw)` +- `feature::GroupCount`: `crates/metal2vulkan/src/bind/dispatch.rs:379 (product)`; `crates/metal2vulkan/src/bind/dispatch.rs:461`; `crates/metal2vulkan/src/bind/dispatch.rs:959 (instantiate)`; `crates/metal2vulkan/src/bind/graphics.rs:3185 (mesh_draw)`; `crates/metal2vulkan/src/bind/graphics.rs:3236 (emulated_draw)` - `feature::IntersectionFunctionTable`: `crates/metal2vulkan/src/bind/acceleration.rs:177 (geometry_table_offset)`; `crates/metal2vulkan/src/bind/acceleration.rs:183 (geometry_table_offset)`; `crates/metal2vulkan/src/bind/acceleration.rs:188 (geometry_table_offset)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:1222 (null_table)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:1251 (intersect)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:1272 (intersect)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:406 (table_of)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:422 (select_table)`; `crates/metal2vulkan/src/lower/select.rs:885 (route_air)` -- `feature::IndependentBlending`: `crates/metal2vulkan-runtime/src/render.rs:2036 (check_pipeline)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:1005 (uniform_blend)` -- `feature::RasterSampleCount`: `crates/metal2vulkan-runtime/src/families/limits.rs:1059 (sample_count)`; `crates/metal2vulkan/src/pipeline/graphics.rs:545 (sample_count_properties)` +- `feature::IndependentBlending`: `crates/metal2vulkan-runtime/src/render.rs:2036 (check_pipeline)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:1008 (uniform_blend)` +- `feature::RasterSampleCount`: `crates/metal2vulkan-runtime/src/families/limits.rs:1059 (sample_count)`; `crates/metal2vulkan/src/pipeline/graphics.rs:555 (sample_count_properties)` - `feature::TriangleFillLines`: `crates/metal2vulkan/src/metal/state.rs:347 (polygon_mode)` - `feature::DepthClipClamp`: `crates/metal2vulkan/src/metal/state.rs:363 (depth_clamp_enable)` - `feature::DepthBiasClamp`: `crates/metal2vulkan/src/metal/state.rs:463 (depth_bias)` @@ -396,63 +395,63 @@ Each refusal's sites, with the function that builds it. - `feature::SparseTexture`: `crates/metal2vulkan/src/bind/plan/slots.rs:583 (check_sparse_textures)`; `crates/metal2vulkan/src/bind/plan/slots.rs:607 (check_sparse_textures)` - `feature::TextureSize`: `crates/metal2vulkan-runtime/src/image_plan.rs:1196 (check_image_limits)` - `feature::TextureSampleCount`: `crates/metal2vulkan-runtime/src/image_plan.rs:1244 (check_image_limits)`; `crates/metal2vulkan-runtime/src/image_plan.rs:598 (plan_held)`; `crates/metal2vulkan-runtime/src/image_plan.rs:608 (plan_held)` -- `feature::TextureView`: `crates/metal2vulkan-runtime/src/binding_view.rs:156 (binding_view)`; `crates/metal2vulkan-runtime/src/texture.rs:5030 (view)`; `crates/metal2vulkan-runtime/src/texture/decoded_twin.rs:1420 (make_second_twin)`; `crates/metal2vulkan-runtime/src/texture/view_shadow.rs:298 (apart_refusal)`; `crates/metal2vulkan-runtime/src/view_plan.rs:431 (check_format)`; `crates/metal2vulkan-runtime/src/view_plan.rs:481 (check_view)`; `crates/metal2vulkan-runtime/src/view_plan.rs:503 (check_view)` -- `feature::TextureSwizzle`: `crates/metal2vulkan-runtime/src/binding_view.rs:167 (binding_view)`; `crates/metal2vulkan-runtime/src/texture.rs:980 (may_view)`; `crates/metal2vulkan/src/bind/plan/resources.rs:1102 (plain_texture)`; `crates/metal2vulkan/src/lower/sampler/select.rs:2587 (select_one)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3391 (select_read_as)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3738 (select_write)`; `crates/metal2vulkan/src/lower/texture/slice.rs:307 (select)` +- `feature::TextureView`: `crates/metal2vulkan-runtime/src/binding_view.rs:156 (binding_view)`; `crates/metal2vulkan-runtime/src/texture.rs:5032 (view)`; `crates/metal2vulkan-runtime/src/texture/decoded_twin.rs:1420 (make_second_twin)`; `crates/metal2vulkan-runtime/src/texture/view_shadow.rs:298 (apart_refusal)`; `crates/metal2vulkan-runtime/src/view_plan.rs:431 (check_format)`; `crates/metal2vulkan-runtime/src/view_plan.rs:481 (check_view)`; `crates/metal2vulkan-runtime/src/view_plan.rs:503 (check_view)` +- `feature::TextureSwizzle`: `crates/metal2vulkan-runtime/src/binding_view.rs:167 (binding_view)`; `crates/metal2vulkan-runtime/src/texture.rs:980 (may_view)`; `crates/metal2vulkan/src/bind/plan/resources.rs:1102 (plain_texture)`; `crates/metal2vulkan/src/lower/sampler/select.rs:2587 (select_one)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3396 (select_read_as)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3743 (select_write)`; `crates/metal2vulkan/src/lower/texture/slice.rs:307 (select)` - `feature::MipmapGeneration`: `crates/metal2vulkan-runtime/src/blit_texture.rs:1787 (mipmaps)`; `crates/metal2vulkan-runtime/src/mipmap_pick.rs:37 (pick_mipmaps)`; `crates/metal2vulkan-runtime/src/mipmap_plan.rs:262 (plan_mipmaps)`; `crates/metal2vulkan-runtime/src/mipmap_plan.rs:270 (plan_mipmaps)`; `crates/metal2vulkan-runtime/src/mipmap_plan.rs:275 (plan_mipmaps)`; `crates/metal2vulkan-runtime/src/mipmap_plan.rs:304 (plan_mipmaps)`; `crates/metal2vulkan/src/bind/mipmap_filter.rs:973 (mipmap_filter_module)` - `feature::HostMemory`: `crates/metal2vulkan-runtime/src/host_memory.rs:393 (not_importable)`; `crates/metal2vulkan-runtime/src/host_memory.rs:433 (refuse_unwritable)`; `crates/metal2vulkan-runtime/src/host_memory.rs:652 (new)`; `crates/metal2vulkan-runtime/src/host_memory.rs:657 (new)`; `crates/metal2vulkan-runtime/src/host_memory.rs:675 (new)` -- `feature::GpuTimes`: `crates/metal2vulkan-runtime/src/command_buffer/mod.rs:2605 (gpu_times)` +- `feature::GpuTimes`: `crates/metal2vulkan-runtime/src/command_buffer/mod.rs:2542 (gpu_times)` - `feature::CountingVisibility`: `crates/metal2vulkan-runtime/src/visibility.rs:452 (check_mode)` - `feature::ViewFormatReinterpretation`: `crates/metal2vulkan-runtime/src/view_plan.rs:568 (reinterpretation_refused)` -- `feature::SeparateMultisampledDepthStencil`: `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:188 (sampled_candidate)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:294 (by_draws)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:336 (scratch)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:376 (scratch)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:777 (plan)`; `crates/metal2vulkan-runtime/src/nan_clear.rs:651 (nan_write)`; `crates/metal2vulkan-runtime/src/texture/signed_depth.rs:191 (sample_strip)` -- `feature::PixelCoverage`: `crates/metal2vulkan/src/pipeline/link/graphics.rs:771 (split_pixel_fragments)` -- `feature::CentroidVarying`: `crates/metal2vulkan/src/pipeline/link/graphics.rs:789 (split_pixel_fragments)` +- `feature::SeparateMultisampledDepthStencil`: `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:188 (sampled_candidate)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:294 (by_draws)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:336 (scratch)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:376 (scratch)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:777 (plan)`; `crates/metal2vulkan-runtime/src/nan_clear.rs:658 (nan_write)`; `crates/metal2vulkan-runtime/src/texture/signed_depth.rs:191 (sample_strip)` +- `feature::PixelCoverage`: `crates/metal2vulkan/src/pipeline/link/graphics.rs:774 (split_pixel_fragments)` +- `feature::CentroidVarying`: `crates/metal2vulkan/src/pipeline/link/graphics.rs:792 (split_pixel_fragments)` - `feature::PrivateMemory`: `crates/metal2vulkan/src/lower/select.rs:1171 (function_storage)` - `feature::SparseTextures`: `crates/metal2vulkan-runtime/src/sparse/texture.rs:32 (sparse_refusal)` - `feature::SparseMapping`: `crates/metal2vulkan-runtime/src/sparse/encoder.rs:466 (splits_a_unit)` - `feature::TimelineSemaphores`: `crates/metal2vulkan-runtime/src/device/create.rs:1053 (timeline_difference)` - `feature::Reflection`: `crates/metal2vulkan/src/bind/argument_buffer.rs:626 (unmeasured)`; `crates/metal2vulkan/src/reflection/derive.rs:178 (specialized_reads)`; `crates/metal2vulkan/src/reflection/derive.rs:212 (read_attributes)`; `crates/metal2vulkan/src/reflection/derive.rs:239 (gap_at)`; `crates/metal2vulkan/src/reflection/function.rs:172 (unmeasured)`; `crates/metal2vulkan/src/reflection/function.rs:366 (attribute)`; `crates/metal2vulkan/src/reflection/function.rs:437 (module_constants)`; `crates/metal2vulkan/src/reflection/linked.rs:125 (function)`; `crates/metal2vulkan/src/reflection/mod.rs:249 (stage)` - `feature::HeapTextureTiling`: `crates/metal2vulkan-runtime/src/texture/heap.rs:565 (tiling_refusal)` -- `feature::ViewportDepthRange`: `crates/metal2vulkan-runtime/src/render_state.rs:1186 (depth_ranges_refused)` +- `feature::ViewportDepthRange`: `crates/metal2vulkan-runtime/src/render_state.rs:1200 (depth_ranges_refused)` - `feature::UndeclaredTextureUsage`: `crates/metal2vulkan-runtime/src/binding_view.rs:141 (binding_view)`; `crates/metal2vulkan-runtime/src/texture/usage_shadow.rs:72 (refused)` -- `feature::RenderTargetSize`: `crates/metal2vulkan-runtime/src/render_pass.rs:1264 (framebuffer_fits)` +- `feature::RenderTargetSize`: `crates/metal2vulkan-runtime/src/render_pass.rs:1271 (framebuffer_fits)` - `feature::IndirectRenderState`: `crates/metal2vulkan/src/lower/access/encode.rs:567 (select_command)` - `feature::GlobalBuiltinInFragment`: `crates/metal2vulkan/src/lower/select.rs:912 (route_air)` -- `feature::PrivateRenderState`: `crates/metal2vulkan/src/bind/heap.rs:1300 (array)`; `crates/metal2vulkan/src/bind/plan/resources.rs:887 (write_rounding)`; `crates/metal2vulkan/src/lower/texture/mod.rs:2902 (mode_rounded_write)`; `crates/metal2vulkan/src/pipeline/private_state.rs:46 (refused)` +- `feature::PrivateRenderState`: `crates/metal2vulkan/src/bind/heap.rs:1300 (array)`; `crates/metal2vulkan/src/bind/plan/resources.rs:887 (write_rounding)`; `crates/metal2vulkan/src/lower/sampler/select.rs:2710 (clamps_reference)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:3358 (alpha_test_refused)`; `crates/metal2vulkan/src/lower/texture/mod.rs:2907 (mode_rounded_write)`; `crates/metal2vulkan/src/pipeline/private_state.rs:378 (logic_operation)`; `crates/metal2vulkan/src/pipeline/private_state.rs:97 (refused)` - `feature::ExtendedRangeBlend`: `crates/metal2vulkan/src/lower/arith/extended_range/blend.rs:305 (refused)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1553 (plan)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1556 (plan)`; `crates/metal2vulkan/src/lower/fragment/input_blend.rs:153 (plan)` -- `feature::TileReach`: `crates/metal2vulkan/src/bind/tile_reach.rs:270 (tile_reach_module)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:2450 (capture)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:2476 (capture)` +- `feature::TileReach`: `crates/metal2vulkan/src/bind/tile_reach.rs:270 (tile_reach_module)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:2469 (capture)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:2495 (capture)` - `feature::CommandPredication`: `crates/metal2vulkan/src/bind/replay/predication.rs:414 (predication_step_module)` - `feature::ProgramScopeBinding`: `crates/metal2vulkan-air/src/abi/module.rs:77 (decode)`; `crates/metal2vulkan/src/error/mod.rs:267 (from)` - `feature::SeqCstFence`: `crates/metal2vulkan/src/lower/sync/barrier.rs:443 (require_seq_cst)` -- `gap::Textures`: `crates/metal2vulkan-runtime/src/blit_texture.rs:163 (check_depth_view)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:1554 (view_usage)`; `crates/metal2vulkan-runtime/src/pipeline/mod.rs:1499 (compile_error)`; `crates/metal2vulkan-runtime/src/texture.rs:1445 (image_error)`; `crates/metal2vulkan-runtime/src/texture.rs:2174 (storage_over_buffer)`; `crates/metal2vulkan-runtime/src/texture.rs:2986 (new_image_starting)`; `crates/metal2vulkan-runtime/src/texture.rs:4028 (image)`; `crates/metal2vulkan-runtime/src/texture.rs:5501 (host_copy)`; `crates/metal2vulkan-runtime/src/texture/surface_two_planes.rs:207 (new_surface_planes_texture)` +- `gap::Textures`: `crates/metal2vulkan-runtime/src/blit_texture.rs:163 (check_depth_view)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:1554 (view_usage)`; `crates/metal2vulkan-runtime/src/pipeline/mod.rs:1499 (compile_error)`; `crates/metal2vulkan-runtime/src/texture.rs:1445 (image_error)`; `crates/metal2vulkan-runtime/src/texture.rs:2174 (storage_over_buffer)`; `crates/metal2vulkan-runtime/src/texture.rs:2986 (new_image_starting)`; `crates/metal2vulkan-runtime/src/texture.rs:4030 (image)`; `crates/metal2vulkan-runtime/src/texture.rs:5503 (host_copy)`; `crates/metal2vulkan-runtime/src/texture/surface_two_planes.rs:207 (new_surface_planes_texture)` - `gap::ResourceHeap`: `crates/metal2vulkan-runtime/src/binding.rs:2016 (descriptor)` -- `gap::SparseHeaps`: `crates/metal2vulkan-runtime/src/sparse/encoder.rs:458 (first_slice)`; `crates/metal2vulkan-runtime/src/texture.rs:1629 (plan_sparse_texture)`; `crates/metal2vulkan-runtime/src/texture.rs:4720 (make_aliasable)` +- `gap::SparseHeaps`: `crates/metal2vulkan-runtime/src/sparse/encoder.rs:458 (first_slice)`; `crates/metal2vulkan-runtime/src/texture.rs:1629 (plan_sparse_texture)`; `crates/metal2vulkan-runtime/src/texture.rs:4722 (make_aliasable)` - `gap::SparseTileMaps`: `crates/metal2vulkan-runtime/src/binding.rs:553 (slot_tile_map)`; `crates/metal2vulkan-runtime/src/sparse/texture.rs:30 (sparse_refusal)`; `crates/metal2vulkan-runtime/src/texture.rs:1662 (plan_sparse_texture)` -- `gap::HeapPastMaxBufferSize`: `crates/metal2vulkan-runtime/src/heap.rs:697 (heap_size)` +- `gap::HeapPastMaxBufferSize`: `crates/metal2vulkan-runtime/src/heap.rs:694 (heap_size)` - `gap::HeapTextureAlignment`: `crates/metal2vulkan-runtime/src/texture/heap.rs:980 (check_heap_base)` - `gap::HeapTextureMemory`: `crates/metal2vulkan-runtime/src/texture/heap.rs:1418 (heap_plan)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:1425 (heap_plan)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:1919 (host_heap_plan)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2132 (memory_shadow)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:489 (memory_refusal)` - `gap::FunctionTablePastMaxBufferLength`: `crates/metal2vulkan-runtime/src/function_table.rs:622 (past_limit)` - `gap::IndirectCommandBufferPastMaxBufferLength`: `crates/metal2vulkan-runtime/src/indirect_command_buffer.rs:516 (new_indirect_command_buffer)` -- `gap::IndirectRenderCommands`: `crates/metal2vulkan-runtime/src/compute.rs:1084 (execute_range)`; `crates/metal2vulkan-runtime/src/compute.rs:1163 (execute_indirect_range)`; `crates/metal2vulkan-runtime/src/depth_stencil.rs:85 (gpu_resource_id)`; `crates/metal2vulkan-runtime/src/indirect_command_buffer.rs:3638 (render_state)`; `crates/metal2vulkan-runtime/src/indirect_command_buffer.rs:511 (new_indirect_command_buffer)`; `crates/metal2vulkan-runtime/src/pipeline/mod.rs:1506 (compile_error)`; `crates/metal2vulkan-runtime/src/render.rs:6979 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:7342 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:7747 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:8196 (draw_resident)`; `crates/metal2vulkan-runtime/src/render/executions.rs:1086 (back_memoryless)`; `crates/metal2vulkan-runtime/src/render/executions.rs:1989 (record)`; `crates/metal2vulkan-runtime/src/render/executions.rs:2032 (record)`; `crates/metal2vulkan-runtime/src/render/executions.rs:2827 (record_forms)`; `crates/metal2vulkan-runtime/src/render/executions.rs:375 (execute_range)`; `crates/metal2vulkan-runtime/src/render/executions.rs:434 (execute_indirect_range)`; `crates/metal2vulkan-runtime/src/render/executions.rs:449 (execute_indirect_range)` +- `gap::IndirectRenderCommands`: `crates/metal2vulkan-runtime/src/compute.rs:1084 (execute_range)`; `crates/metal2vulkan-runtime/src/compute.rs:1163 (execute_indirect_range)`; `crates/metal2vulkan-runtime/src/depth_stencil.rs:85 (gpu_resource_id)`; `crates/metal2vulkan-runtime/src/indirect_command_buffer.rs:3638 (render_state)`; `crates/metal2vulkan-runtime/src/indirect_command_buffer.rs:511 (new_indirect_command_buffer)`; `crates/metal2vulkan-runtime/src/pipeline/mod.rs:1506 (compile_error)`; `crates/metal2vulkan-runtime/src/render.rs:6997 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:7360 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:7765 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:8214 (draw_resident)`; `crates/metal2vulkan-runtime/src/render/executions.rs:1086 (back_memoryless)`; `crates/metal2vulkan-runtime/src/render/executions.rs:1989 (record)`; `crates/metal2vulkan-runtime/src/render/executions.rs:2032 (record)`; `crates/metal2vulkan-runtime/src/render/executions.rs:2827 (record_forms)`; `crates/metal2vulkan-runtime/src/render/executions.rs:375 (execute_range)`; `crates/metal2vulkan-runtime/src/render/executions.rs:434 (execute_indirect_range)`; `crates/metal2vulkan-runtime/src/render/executions.rs:449 (execute_indirect_range)` - `gap::IndirectImageblockSize`: `crates/metal2vulkan-runtime/src/indirect_command_buffer.rs:2757 (set_imageblock_size)` - `gap::CommandReplay`: `crates/metal2vulkan-runtime/src/binding.rs:694 (bind)`; `crates/metal2vulkan-runtime/src/binding.rs:697 (bind)` - `gap::RenderAttachments`: `crates/metal2vulkan-runtime/src/binding.rs:1839 (unexpected)` - `gap::AccelerationStructures`: `crates/metal2vulkan-runtime/src/binding.rs:1842 (unexpected)` -- `gap::FeatureEnable`: `crates/metal2vulkan-runtime/src/enables.rs:1155 (of)` -- `gap::ExtensionEnable`: `crates/metal2vulkan-runtime/src/enables.rs:1146 (of)` -- `gap::Render`: `crates/metal2vulkan-runtime/src/attachment_stand_in.rs:404 (stand_in_as)`; `crates/metal2vulkan-runtime/src/attachment_stand_in.rs:460 (stand_in_as)`; `crates/metal2vulkan-runtime/src/attachment_stand_in.rs:684 (check_copies)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:796 (attachment_twin)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:283 (check_sizes)`; `crates/metal2vulkan-runtime/src/kept_bytes.rs:138 (settle)`; `crates/metal2vulkan-runtime/src/linear_attachment.rs:293 (settle)`; `crates/metal2vulkan-runtime/src/nan_clear.rs:197 (plan)`; `crates/metal2vulkan-runtime/src/pipeline/render.rs:1131 (imageblock_sample_length)`; `crates/metal2vulkan-runtime/src/render.rs:2086 (check_pipeline)`; `crates/metal2vulkan-runtime/src/render.rs:5755 (next_instance)`; `crates/metal2vulkan-runtime/src/render.rs:7436 (draw_resident)`; `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:517 (scratch)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1306 (layout)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1665 (target)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1719 (target)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1780 (attachment_format)`; `crates/metal2vulkan-runtime/src/render_pass.rs:2013 (depth_stencil)`; `crates/metal2vulkan-runtime/src/resolve.rs:1010 (destination)`; `crates/metal2vulkan-runtime/src/resolve.rs:1027 (destination)`; `crates/metal2vulkan-runtime/src/resolve.rs:1091 (destination)`; `crates/metal2vulkan-runtime/src/resolve.rs:901 (attach)`; `crates/metal2vulkan-runtime/src/resolve.rs:969 (color_copy)` +- `gap::FeatureEnable`: `crates/metal2vulkan-runtime/src/enables.rs:1156 (of)` +- `gap::ExtensionEnable`: `crates/metal2vulkan-runtime/src/enables.rs:1147 (of)` +- `gap::Render`: `crates/metal2vulkan-runtime/src/attachment_stand_in.rs:404 (stand_in_as)`; `crates/metal2vulkan-runtime/src/attachment_stand_in.rs:460 (stand_in_as)`; `crates/metal2vulkan-runtime/src/attachment_stand_in.rs:684 (check_copies)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:796 (attachment_twin)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:283 (check_sizes)`; `crates/metal2vulkan-runtime/src/kept_bytes.rs:138 (settle)`; `crates/metal2vulkan-runtime/src/linear_attachment.rs:293 (settle)`; `crates/metal2vulkan-runtime/src/nan_clear.rs:204 (plan)`; `crates/metal2vulkan-runtime/src/pipeline/render.rs:1131 (imageblock_sample_length)`; `crates/metal2vulkan-runtime/src/render.rs:2086 (check_pipeline)`; `crates/metal2vulkan-runtime/src/render.rs:5773 (next_instance)`; `crates/metal2vulkan-runtime/src/render.rs:7454 (draw_resident)`; `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:517 (scratch)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1313 (layout)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1676 (target)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1730 (target)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1791 (attachment_format)`; `crates/metal2vulkan-runtime/src/render_pass.rs:2024 (depth_stencil)`; `crates/metal2vulkan-runtime/src/resolve.rs:1035 (attach)`; `crates/metal2vulkan-runtime/src/resolve.rs:1103 (color_copy)`; `crates/metal2vulkan-runtime/src/resolve.rs:1150 (destination)`; `crates/metal2vulkan-runtime/src/resolve.rs:1167 (destination)`; `crates/metal2vulkan-runtime/src/resolve.rs:1232 (destination)` - `gap::TexelsPastBufferLength`: `crates/metal2vulkan-runtime/src/buffer_texture.rs:261 (refusal_error)`; `crates/metal2vulkan-runtime/src/texture/surface_depth.rs:105 (surface_depth_twin)` - `gap::OverlappingSurfaceRows`: `crates/metal2vulkan-runtime/src/buffer_texture.rs:263 (refusal_error)` -- `gap::SamplePositionsAtBegin`: `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:145 (stencil_scratch)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1850 (positioned_stand_in)`; `crates/metal2vulkan-runtime/src/sample_positions.rs:185 (grid)` +- `gap::SamplePositionsAtBegin`: `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:145 (stencil_scratch)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1861 (positioned_stand_in)`; `crates/metal2vulkan-runtime/src/sample_positions.rs:185 (grid)` - `gap::SharedEventAcrossDevices`: `crates/metal2vulkan-runtime/src/event.rs:376 (new_shared_event_with_handle)` -- `gap::ViewportDepthRange`: `crates/metal2vulkan-runtime/src/render/draw_shape.rs:330 (settings)`; `crates/metal2vulkan-runtime/src/render_state.rs:1010`; `crates/metal2vulkan-runtime/src/render_state.rs:1178 (depth_ranges_refused)`; `crates/metal2vulkan-runtime/src/render_state.rs:1545 (bias_holds)`; `crates/metal2vulkan-runtime/src/render_state.rs:1564 (collapses)`; `crates/metal2vulkan-runtime/src/render_state.rs:503 (depth_range)`; `crates/metal2vulkan-runtime/src/render_state.rs:731 (compensation)` -- `gap::NonFiniteDepthBias`: `crates/metal2vulkan-runtime/src/render_state.rs:1573 (collapses)`; `crates/metal2vulkan-runtime/src/render_state.rs:1576 (collapses)`; `crates/metal2vulkan-runtime/src/render_state.rs:347 (set_depth_bias)`; `crates/metal2vulkan-runtime/src/render_state.rs:439 (draw_viewports)`; `crates/metal2vulkan-runtime/src/render_state.rs:581 (compensation)` +- `gap::ViewportDepthRange`: `crates/metal2vulkan-runtime/src/render/draw_shape.rs:330 (settings)`; `crates/metal2vulkan-runtime/src/render_state.rs:1024`; `crates/metal2vulkan-runtime/src/render_state.rs:1192 (depth_ranges_refused)`; `crates/metal2vulkan-runtime/src/render_state.rs:1559 (bias_holds)`; `crates/metal2vulkan-runtime/src/render_state.rs:1578 (collapses)`; `crates/metal2vulkan-runtime/src/render_state.rs:512 (depth_range)`; `crates/metal2vulkan-runtime/src/render_state.rs:740 (compensation)` +- `gap::NonFiniteDepthBias`: `crates/metal2vulkan-runtime/src/render_state.rs:1587 (collapses)`; `crates/metal2vulkan-runtime/src/render_state.rs:1590 (collapses)`; `crates/metal2vulkan-runtime/src/render_state.rs:350 (set_depth_bias)`; `crates/metal2vulkan-runtime/src/render_state.rs:448 (draw_viewports)`; `crates/metal2vulkan-runtime/src/render_state.rs:590 (compensation)` - `gap::DepthNeverWithoutAttachment`: `crates/metal2vulkan-runtime/src/depth_stencil.rs:147 (failing_draw)` -- `gap::HiddenDepthStencil`: `crates/metal2vulkan-runtime/src/attachment_stand_in.rs:563 (hidden)`; `crates/metal2vulkan-runtime/src/render.rs:6432 (hidden_depth_stencil)` -- `gap::IndirectDrawArguments`: `crates/metal2vulkan-runtime/src/index_bounds.rs:91 (new)`; `crates/metal2vulkan-runtime/src/render.rs:3138 (draw_indexed_primitives_indirect)`; `crates/metal2vulkan-runtime/src/render.rs:7192 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:7246 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:7277 (draw_resident)` -- `gap::DepthStencilResolve`: `crates/metal2vulkan-runtime/src/depth_stencil_resolve.rs:441 (draws_run)`; `crates/metal2vulkan-runtime/src/resolve.rs:1247 (plan)`; `crates/metal2vulkan-runtime/src/resolve.rs:653 (depth_stencil)`; `crates/metal2vulkan-runtime/src/resolve.rs:751 (steps)`; `crates/metal2vulkan-runtime/src/resolve.rs:771 (steps)`; `crates/metal2vulkan-runtime/src/resolve.rs:812 (split_steps)`; `crates/metal2vulkan-runtime/src/resolve.rs:824 (split_steps)` -- `gap::TileAtSampleCount`: `crates/metal2vulkan-runtime/src/render_pass.rs:1600 (layout)`; `crates/metal2vulkan-runtime/src/render_pass.rs:930` -- `gap::ImageblockMasters`: `crates/metal2vulkan-runtime/src/render.rs:7115 (draw_resident)`; `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:930 (dispatch_tiles_resident)` -- `gap::TileAndFragmentImageblocks`: `crates/metal2vulkan-runtime/src/render.rs:7107 (draw_resident)`; `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:797 (dispatch_tiles_resident)`; `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:922 (dispatch_tiles_resident)` +- `gap::HiddenDepthStencil`: `crates/metal2vulkan-runtime/src/attachment_stand_in.rs:563 (hidden)`; `crates/metal2vulkan-runtime/src/render.rs:6450 (hidden_depth_stencil)` +- `gap::IndirectDrawArguments`: `crates/metal2vulkan-runtime/src/index_bounds.rs:91 (new)`; `crates/metal2vulkan-runtime/src/render.rs:3153 (draw_indexed_primitives_indirect)`; `crates/metal2vulkan-runtime/src/render.rs:7210 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:7264 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:7295 (draw_resident)` +- `gap::DepthStencilResolve`: `crates/metal2vulkan-runtime/src/depth_stencil_resolve.rs:441 (draws_run)`; `crates/metal2vulkan-runtime/src/resolve.rs:1388 (plan)`; `crates/metal2vulkan-runtime/src/resolve.rs:787 (depth_stencil)`; `crates/metal2vulkan-runtime/src/resolve.rs:885 (steps)`; `crates/metal2vulkan-runtime/src/resolve.rs:905 (steps)`; `crates/metal2vulkan-runtime/src/resolve.rs:946 (split_steps)`; `crates/metal2vulkan-runtime/src/resolve.rs:958 (split_steps)` +- `gap::TileAtSampleCount`: `crates/metal2vulkan-runtime/src/render_pass.rs:1611 (layout)`; `crates/metal2vulkan-runtime/src/render_pass.rs:937` +- `gap::ImageblockMasters`: `crates/metal2vulkan-runtime/src/render.rs:7133 (draw_resident)`; `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:930 (dispatch_tiles_resident)` +- `gap::TileAndFragmentImageblocks`: `crates/metal2vulkan-runtime/src/render.rs:7125 (draw_resident)`; `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:797 (dispatch_tiles_resident)`; `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:922 (dispatch_tiles_resident)` - `gap::Metal4Api`: `crates/metal2vulkan-runtime/src/families/features.rs:1460 (state)`; `crates/metal2vulkan-runtime/src/families/limits.rs:1022 (state)`; `crates/metal2vulkan-runtime/src/families/mod.rs:362 (audit)` - `gap::CounterSampleBuffers`: `crates/metal2vulkan-runtime/src/families/limits.rs:1013 (state)` - `gap::ResidencySets`: `crates/metal2vulkan-runtime/src/families/features.rs:1442 (state)`; `crates/metal2vulkan-runtime/src/families/limits.rs:1015 (state)` @@ -468,21 +467,22 @@ Each refusal's sites, with the function that builds it. - `gap::LayeredPass`: `crates/metal2vulkan-runtime/src/color_resolve.rs:890 (plan)` - `gap::FunctionOptions`: `crates/metal2vulkan-runtime/src/library.rs:215 (new_function_with_descriptor)` - `gap::OverlappingTextureCopies`: `crates/metal2vulkan-runtime/src/blit_texture.rs:1242 (texture_copies_of_bytes)` -- `gap::RebindTextures`: `crates/metal2vulkan-runtime/src/buffer_descriptor.rs:615 (rebind_host_pages)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2431 (rebound_heap_images)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2446 (rebound_heap_images)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2457 (rebound_heap_images)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2500 (dma_buf_heap_images_again)` -- `gap::PvrtcBlockOrder`: `crates/metal2vulkan-runtime/src/texture.rs:5573 (host_copy)` +- `gap::RebindTextures`: `crates/metal2vulkan-runtime/src/buffer_descriptor.rs:600 (rebind_host_pages)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2431 (rebound_heap_images)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2446 (rebound_heap_images)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2457 (rebound_heap_images)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2500 (dma_buf_heap_images_again)` +- `gap::PvrtcBlockOrder`: `crates/metal2vulkan-runtime/src/texture.rs:5575 (host_copy)` - `gap::DecodedHeapTexture`: `crates/metal2vulkan-runtime/src/texture.rs:1637 (plan_sparse_texture)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:1281 (heap_plan)` - `gap::VertexFetchPast4GiB`: `crates/metal2vulkan-runtime/src/render/vertex_reach.rs:72 (check_vertex_reach)` - `gap::StageInFetchPast4GiB`: `crates/metal2vulkan-runtime/src/fetch_reach.rs:126 (check_stage_in_reach)` - `gap::MappedTextureSampling`: `crates/metal2vulkan-runtime/src/address_map.rs:158 (resolve)` - `gap::LibrarySource`: `crates/metal2vulkan-runtime/src/library.rs:107 (new_library_with_source)` -- `gap::RestartedStrip`: `crates/metal2vulkan-runtime/src/index_rewrite.rs:110 (new)`; `crates/metal2vulkan-runtime/src/render.rs:7219 (draw_resident)` -- `gap::PrimitiveIdIndices`: `crates/metal2vulkan-runtime/src/render.rs:7596 (draw_resident)` -- `gap::RotatedTexture`: `crates/metal2vulkan-runtime/src/blit_texture.rs:1571 (texel_copies)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:715 (turned_plane)`; `crates/metal2vulkan-runtime/src/rotated.rs:185 (new)`; `crates/metal2vulkan-runtime/src/rotated.rs:201 (new)`; `crates/metal2vulkan-runtime/src/shadow.rs:638 (unmerged)`; `crates/metal2vulkan-runtime/src/texture.rs:4988 (view)`; `crates/metal2vulkan-runtime/src/texture/rotation.rs:100 (check_rotated_reach)`; `crates/metal2vulkan-runtime/src/texture/rotation.rs:322 (copied_image)`; `crates/metal2vulkan-runtime/src/texture/usage_shadow.rs:238 (new_usage_shadow)` -- `gap::DetachTextures`: `crates/metal2vulkan-runtime/src/buffer_descriptor.rs:619 (rebind_host_pages)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:622 (make_texture_over)`; `crates/metal2vulkan-runtime/src/detach.rs:152 (detach_host_pages)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2639 (heap_texture_at)`; `crates/metal2vulkan-runtime/src/texture/stand_in.rs:143 (new_stand_in)`; `crates/metal2vulkan-runtime/src/texture/stand_in.rs:248 (stand_in_while_detached)`; `crates/metal2vulkan-runtime/src/texture/stand_in.rs:298 (stand_ins)`; `crates/metal2vulkan-runtime/src/texture/stand_in.rs:304 (stand_ins)` +- `gap::RestartedStrip`: `crates/metal2vulkan-runtime/src/index_rewrite.rs:110 (new)`; `crates/metal2vulkan-runtime/src/render.rs:7237 (draw_resident)` +- `gap::PrimitiveIdIndices`: `crates/metal2vulkan-runtime/src/render.rs:7614 (draw_resident)` +- `gap::RotatedTexture`: `crates/metal2vulkan-runtime/src/blit_texture.rs:1571 (texel_copies)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:715 (turned_plane)`; `crates/metal2vulkan-runtime/src/rotated.rs:185 (new)`; `crates/metal2vulkan-runtime/src/rotated.rs:201 (new)`; `crates/metal2vulkan-runtime/src/shadow.rs:638 (unmerged)`; `crates/metal2vulkan-runtime/src/texture.rs:4990 (view)`; `crates/metal2vulkan-runtime/src/texture/rotation.rs:100 (check_rotated_reach)`; `crates/metal2vulkan-runtime/src/texture/rotation.rs:322 (copied_image)`; `crates/metal2vulkan-runtime/src/texture/usage_shadow.rs:238 (new_usage_shadow)` +- `gap::DetachTextures`: `crates/metal2vulkan-runtime/src/buffer_descriptor.rs:604 (rebind_host_pages)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:622 (make_texture_over)`; `crates/metal2vulkan-runtime/src/detach.rs:152 (detach_host_pages)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2639 (heap_texture_at)`; `crates/metal2vulkan-runtime/src/texture/stand_in.rs:143 (new_stand_in)`; `crates/metal2vulkan-runtime/src/texture/stand_in.rs:248 (stand_in_while_detached)`; `crates/metal2vulkan-runtime/src/texture/stand_in.rs:298 (stand_ins)`; `crates/metal2vulkan-runtime/src/texture/stand_in.rs:304 (stand_ins)` - `gap::TextureBufferLevels`: `crates/metal2vulkan-runtime/src/texture_descriptor.rs:540 (check_made)` - `gap::WriteSwizzle`: `crates/metal2vulkan-runtime/src/texture_descriptor.rs:547 (check_made)` -- `gap::DetachedTexelAccess`: `crates/metal2vulkan-runtime/src/texture.rs:4818 (refuse_detached_texels)` +- `gap::DetachedTexelAccess`: `crates/metal2vulkan-runtime/src/texture.rs:4820 (refuse_detached_texels)` - `gap::SurfaceDepthStencil`: `crates/metal2vulkan-runtime/src/blit_texture.rs:236 (unit)`; `crates/metal2vulkan-runtime/src/texture/surface_depth.rs:57 (surface_depth_twin)` +- `gap::ExtendedRangeResolve`: `crates/metal2vulkan-runtime/src/resolve.rs:604 (color)` - `gap::HostHeapUncompressedMultisample`: `crates/metal2vulkan-runtime/src/texture/heap.rs:1924 (host_heap_plan)` - `gap::PredicationUnbalanced`: `crates/metal2vulkan-runtime/src/predication.rs:371 (nil)`; `crates/metal2vulkan-runtime/src/predication.rs:403 (start_else)`; `crates/metal2vulkan-runtime/src/predication.rs:455 (end_if)`; `crates/metal2vulkan-runtime/src/predication.rs:575 (end_loop)` - `gap::PredicationOpenAtUnitEnd`: `crates/metal2vulkan-runtime/src/predication.rs:280 (commit_refusal)`; `crates/metal2vulkan-runtime/src/predication.rs:296 (commit)` @@ -491,21 +491,19 @@ Each refusal's sites, with the function that builds it. - `gap::PredicatedLoopAcrossEncoders`: `crates/metal2vulkan-runtime/src/predication.rs:284 (commit_refusal)`; `crates/metal2vulkan-runtime/src/predication.rs:300 (commit)` - `gap::MultisampledBufferCopy`: `crates/metal2vulkan-runtime/src/blit_texture.rs:485 (copy_from_buffer_to_texture)`; `crates/metal2vulkan-runtime/src/blit_texture.rs:641 (copy_from_texture_to_buffer)` - `gap::ColorAttachmentGroups`: `crates/metal2vulkan-runtime/src/render/color_groups.rs:106 (gap)` -- `apple::ProtectedContent`: `crates/metal2vulkan-runtime/src/apple_only.rs:200 (check)` -- `apple::LineWidth`: `crates/metal2vulkan-runtime/src/apple_only.rs:202 (check)` -- `apple::ProvokingVertexMode`: `crates/metal2vulkan-runtime/src/apple_only.rs:207 (check)` -- `apple::ViewportTransformDisabled`: `crates/metal2vulkan-runtime/src/apple_only.rs:204 (check)` -- `apple::VertexAmplificationMode`: `crates/metal2vulkan-runtime/src/apple_only.rs:210 (check)` -- `apple::DepthCleared`: `crates/metal2vulkan-runtime/src/apple_only.rs:212 (check)` -- `apple::StencilCleared`: `crates/metal2vulkan-runtime/src/apple_only.rs:213 (check)` +- `apple::ProtectedContent`: `crates/metal2vulkan-runtime/src/apple_only.rs:208 (check)` +- `apple::LineWidth`: `crates/metal2vulkan-runtime/src/apple_only.rs:210 (check)` +- `apple::ProvokingVertexMode`: `crates/metal2vulkan-runtime/src/apple_only.rs:215 (check)` +- `apple::ViewportTransformDisabled`: `crates/metal2vulkan-runtime/src/apple_only.rs:212 (check)` +- `apple::VertexAmplificationMode`: `crates/metal2vulkan-runtime/src/apple_only.rs:219 (check)`; `crates/metal2vulkan-runtime/src/apple_only.rs:344 (set_vertex_amplification_mode)` - `apple::SurfaceClientDirection`: `crates/metal2vulkan-runtime/src/buffer_texture.rs:417 (new_texture_with_iosurface_plane)` - `apple::FillUnmeasured`: `crates/metal2vulkan-runtime/src/blit_fill.rs:149 (unmeasured)` - `bind::DescriptorRangeExceeded`: `crates/metal2vulkan/src/bind/instantiate.rs:652 (bind_buffers)` - `bind::TexelBufferTooLarge`: `crates/metal2vulkan/src/bind/instantiate.rs:891 (texel_ranges)` - `bind::HeapTooLarge`: `crates/metal2vulkan/src/bind/heap.rs:1014 (new)`; `crates/metal2vulkan/src/bind/heap.rs:1748 (directory_bytes)`; `crates/metal2vulkan/src/bind/heap.rs:1863 (listed_sampler_tables)`; `crates/metal2vulkan/src/bind/heap.rs:1913 (placed)`; `crates/metal2vulkan/src/bind/heap.rs:2069 (heap_elements)`; `crates/metal2vulkan/src/bind/heap.rs:949 (new)`; `crates/metal2vulkan/src/bind/heap.rs:965 (new)` -- `bind::TessellationFactorRange`: `crates/metal2vulkan/src/bind/graphics.rs:3551 (patch_binding)` -- `bind::PatchIndexRange`: `crates/metal2vulkan/src/bind/graphics.rs:3595 (patch_binding)` -- `bind::ControlPointIndexRange`: `crates/metal2vulkan/src/bind/graphics.rs:3633 (patch_binding)` +- `bind::TessellationFactorRange`: `crates/metal2vulkan/src/bind/graphics.rs:3566 (patch_binding)` +- `bind::PatchIndexRange`: `crates/metal2vulkan/src/bind/graphics.rs:3610 (patch_binding)` +- `bind::ControlPointIndexRange`: `crates/metal2vulkan/src/bind/graphics.rs:3648 (patch_binding)` - `bind::MissingStageInRegion`: `crates/metal2vulkan/src/bind/dispatch.rs:802 (instantiate)` - `bind::UniformViewAliased`: `crates/metal2vulkan/src/bind/instantiate.rs:606 (check_uniform_aliasing)` - `bind::MissingDeviceAddress`: `crates/metal2vulkan/src/bind/plan/slots.rs:133 (plan_buffer)` diff --git a/docs/RUNTIME-PORTING.md b/docs/RUNTIME-PORTING.md index 43f78da1b..d0270d462 100644 --- a/docs/RUNTIME-PORTING.md +++ b/docs/RUNTIME-PORTING.md @@ -390,14 +390,14 @@ narrow refusal that the call's rustdoc describes. | `ExecuteCommandsIndirect` | `executeCommandsInBuffer:indirectBuffer:indirectBufferOffset:` | `RenderCommandEncoder::execute_commands_in_buffer_indirect`: the pass is recorded at a host step (announced once); `_checked` adds an `IndirectCommandCheck` the step calls on each command first, and the `IndirectCommandCheckNeeds` it looks for *(partial)* | | `ExecuteCommandsInBuffer` | `executeCommandsInBuffer:withRange:` | `RenderCommandEncoder::execute_commands_in_buffer`: the records as they stand at commit, on the GPU alone where the commit can tell every command draws one primitive type under the inherited state (one merged draw for points, lines or triangles), or at a host step where the GPU writes them otherwise; `_checked` adds an `IndirectCommandCheck` that `commit` (for the CPU's records) or that step calls on each command first, and the `IndirectCommandCheckNeeds` it looks for, which may rule it out *(partial)* | | `MemoryBarrierWithScope` | `memoryBarrierWithScope:afterStages:beforeStages:` | `RenderCommandEncoder::memory_barrier_with_scope` | -| `SetAlphaTestReferenceValue` | `setAlphaTestReferenceValue:` (SPI) | `RenderCommandEncoder::set_alpha_test_reference_value`: a no-op (no runtime pipeline has an alpha test) | +| `SetAlphaTestReferenceValue` | `setAlphaTestReferenceValue:` (SPI) | `RenderCommandEncoder::set_alpha_test_reference_value`: the reference a pipeline with the private alpha test compares against | | `SetBlendColorRed` | `setBlendColorRed:green:blue:alpha:` | `RenderCommandEncoder::set_blend_color` | | `SetColorResolveTexture` | `setColorResolveTexture:slice:depthPlane:level:yInvert:atIndex:` (SPI) | `RenderCommandEncoder::set_color_resolve_target`: the last target set holds for every draw of the pass *(partial)* | | `SetColorStoreAction` | `setColorStoreAction:atIndex:` | `RenderCommandEncoder::set_color_store_action` | | `SetColorStoreActionOptions` | `setColorStoreActionOptions:atIndex:` | `RenderCommandEncoder::set_color_store_action_options`: custom sample positions refused where Metal refuses them | | `SetCullMode` | `setCullMode:` | `RenderCommandEncoder::set_cull_mode` | | `SetDepthBias` | `setDepthBias:slopeScale:clamp:` | `RenderCommandEncoder::set_depth_bias` *(partial)* | -| `SetDepthCleared` | `setDepthCleared` (SPI) | `RenderCommandEncoder::set_depth_cleared`: refused `AppleOnly::DepthCleared` *(partial)* | +| `SetDepthCleared` | `setDepthCleared` (SPI) | `RenderCommandEncoder::set_depth_cleared`: changes nothing, as on Metal | | `SetDepthResolveTexture` | `setDepthResolveTexture:slice:depthPlane:level:yInvert:` (SPI) | `RenderCommandEncoder::set_depth_resolve_target`, as the color one *(partial)* | | `SetDepthStencilState` | `setDepthStencilState:` | `RenderCommandEncoder::set_depth_stencil_state` (`None` for nil, Metal's default state) | | `SetDepthStoreAction` | `setDepthStoreAction:` | `RenderCommandEncoder::set_depth_store_action` | @@ -415,7 +415,7 @@ narrow refusal that the call's rustdoc describes. | `SetRenderPipelineState` | `setRenderPipelineState:` | `RenderCommandEncoder::set_render_pipeline_state` | | `SetScissorRect` | `setScissorRect:` | `RenderCommandEncoder::set_scissor_rect` | | `SetScissorRects` | `setScissorRects:count:` | `RenderCommandEncoder::set_scissor_rects` | -| `SetStencilCleared` | `setStencilCleared` (SPI) | `RenderCommandEncoder::set_stencil_cleared`: refused `AppleOnly::StencilCleared` *(partial)* | +| `SetStencilCleared` | `setStencilCleared` (SPI) | `RenderCommandEncoder::set_stencil_cleared`: changes nothing, as on Metal | | `SetStencilFrontReferenceValue` | `setStencilFrontReferenceValue:backReferenceValue:` | `RenderCommandEncoder::set_stencil_reference_values` | | `SetStencilResolveTexture` | `setStencilResolveTexture:slice:depthPlane:level:yInvert:` (SPI) | `RenderCommandEncoder::set_stencil_resolve_target`, as the color one *(partial)* | | `SetStencilStoreAction` | `setStencilStoreAction:` | `RenderCommandEncoder::set_stencil_store_action` | @@ -430,7 +430,7 @@ narrow refusal that the call's rustdoc describes. | `SetTileTextures` | `setTileTextures:withRange:` | `RenderCommandEncoder::set_tile_textures` | | `SetTriangleFillMode` | `setTriangleFillMode:` | `RenderCommandEncoder::set_triangle_fill_mode` | | `SetVertexAmplificationCount` | `setVertexAmplificationCount:viewMappings:` | `RenderCommandEncoder::set_vertex_amplification_count`: fewer view mappings than the count refused `Invalid` | -| `SetVertexAmplificationMode` | `setVertexAmplificationMode:value:` (SPI) | `RenderCommandEncoder::set_vertex_amplification_mode`: refused `AppleOnly::VertexAmplificationMode` *(partial)* | +| `SetVertexAmplificationMode` | `setVertexAmplificationMode:value:` (SPI) | `RenderCommandEncoder::set_vertex_amplification_mode`: sets the amplification count, the view mappings kept; a count of 0, past 8 or past the mappings refused `AppleOnly::VertexAmplificationMode` *(partial)* | | `SetVertexBuffer` | `setVertexBuffer:offset:atIndex:` | `RenderCommandEncoder::set_vertex_buffer` | | `SetVertexBufferOffset` | `setVertexBufferOffset:atIndex:` | `RenderCommandEncoder::set_vertex_buffer_offset` | | `SetVertexBufferOffsetAttributeStride` | `setVertexBufferOffset:attributeStride:atIndex:` | `RenderCommandEncoder::set_vertex_buffer_offset_with_stride` | diff --git a/scripts/refusal-surface/reach.tsv b/scripts/refusal-surface/reach.tsv index 77b87c948..9d1142862 100644 --- a/scripts/refusal-surface/reach.tsv +++ b/scripts/refusal-surface/reach.tsv @@ -221,6 +221,7 @@ gap PrivatePrimitives none a draw of an Apple-private primitive type (OpenGL on gap PrimitiveIdIndices rare an indexed draw of a primitive_id pipeline, on a device without geometry or tessellation shaders, whose indices the encoder wrote since its last barrier feature PrivateRenderState none Apple-private pipeline fields of OpenGL on Metal (no public header) gap SurfaceDepthStencil rare a blit of the stencil of a Depth32Float_Stencil8 texture over a plane of an IOSurface with planes, or a pass on an X32_Stencil8 one's view as Depth32Float_Stencil8 +gap ExtendedRangeResolve rare a multisample resolve of a BGRA10_XR, BGR10_XR or sRGB twin attachment (EDR content drawn multisampled) feature ExtendedRangeBlend system the parts of a blend into an extended-range (XR10) attachment the measured model does not hold (second-source factors, the color blend color difference, a one-color-channel mask, float4 and sRGB outside the measured forms); the consumer's guests blend RGB10A8_2P_XR10 attachments feature TileReach app the tiles a pass's draws reach, binned on a device without shaderInt64 feature CommandPredication none Apple-private command predication on a device without buffer device addresses