diff --git a/crates/metal2vulkan-runtime/README.md b/crates/metal2vulkan-runtime/README.md index 32c245eae..dea3c3957 100644 --- a/crates/metal2vulkan-runtime/README.md +++ b/crates/metal2vulkan-runtime/README.md @@ -3395,6 +3395,12 @@ cache is answered compile-required on both. `Error::Translation` naming `RasterOrderGroups` and `fragmentShaderPixelInterlock`. Of the venues run, KosmicKrisp on the M3 Max and RADV on the RX 550 list neither the extension nor the feature (vulkaninfo, jobs m3-max-61291 and m3-max-61296). +- A fragment function that reads `[[sample_mask, post_depth_coverage]]`, the coverage after the + early depth and stencil tests, is refused at creation on every device, an `Error::Translation` + naming `PostDepthCoverage` (`NotImplemented`). Vulkan's one form for it is + `VK_EXT_post_depth_coverage`, which the floor does not enable, and the translator keeps no + lowering for it. The runtime has refused it on every device all along, worded before as the + extension the device lacked. If a guest meets it, it is built on that extension, with its tests. - The depth clip mode `Clamp` and the triangle fill mode `Lines`, which Vulkan 1.3 bakes into a `VkPipeline`, are each a `VkPipeline` of the draw's class that a content's first draw under them makes, which Metal does not: that draw waits for it (`Metrics::first_use_raster_waits`). diff --git a/crates/metal2vulkan/src/device/enables.rs b/crates/metal2vulkan/src/device/enables.rs index 0be4bd7a7..67787948b 100644 --- a/crates/metal2vulkan/src/device/enables.rs +++ b/crates/metal2vulkan/src/device/enables.rs @@ -355,7 +355,6 @@ fn facts(ext: VkExtension) -> ExtensionFacts { | E::ExtMultiDraw | E::ExtAttachmentFeedbackLoopLayout | E::ExtExtendedDynamicState3 - | E::ExtPostDepthCoverage | E::ImgFormatPvrtc | E::KhrPortabilitySubset | E::ExtShaderAtomicFloat => fact(true, None, &[]), @@ -400,6 +399,9 @@ fn facts(ext: VkExtension) -> ExtensionFacts { // Described, never enabled: a float fma is the device's `Fma` on every device // (`lower::arith::fma`), so the core reads none of its features. E::KhrShaderFma => fact(false, None, &[]), + // Described, never enabled: the coverage after the depth and stencil tests is refused on + // every device (`Feature::PostDepthCoverage`), so the core reads none of it. + E::ExtPostDepthCoverage => fact(false, None, &[]), E::KhrDynamicRendering => fact(false, Some(3), &[]), // Object and mesh functions. `VK_KHR_spirv_1_4` is core at the 1.2 floor. E::ExtMeshShader => fact(true, None, &[]), diff --git a/crates/metal2vulkan/src/device/requirements.rs b/crates/metal2vulkan/src/device/requirements.rs index 6b93a9f95..175875427 100644 --- a/crates/metal2vulkan/src/device/requirements.rs +++ b/crates/metal2vulkan/src/device/requirements.rs @@ -492,7 +492,8 @@ pub enum VkExtension { /// [`VkProperty::ProvokingVertexModePerPipeline`]. ExtProvokingVertex, /// `VK_EXT_post_depth_coverage` (never promoted, no feature member): a fragment shader's - /// `SampleMask` input read after the early depth and stencil tests (`PostDepthCoverage`). + /// `SampleMask` input read after the early depth and stencil tests. The translator reads it + /// nowhere: `Feature::PostDepthCoverage` is refused on every device. ExtPostDepthCoverage, // Appended. /// `VK_EXT_line_rasterization` (promoted to `VK_KHR_line_rasterization`, never core): diff --git a/crates/metal2vulkan/src/error/mod.rs b/crates/metal2vulkan/src/error/mod.rs index 3ab2b2eeb..791cc3ba9 100644 --- a/crates/metal2vulkan/src/error/mod.rs +++ b/crates/metal2vulkan/src/error/mod.rs @@ -898,8 +898,9 @@ pub enum Feature { /// buffer's other such fences the translation keeps through an atomic of the command buffer's /// `ExecutionStatus` word: in a vertex or fragment stage without its stores and atomics. SeqCstFence, - /// The coverage after the depth and stencil tests (`[[sample_mask, post_depth_coverage]]`), - /// read through `VK_EXT_post_depth_coverage`. + /// The coverage after the depth and stencil tests (`[[sample_mask, post_depth_coverage]]`). + /// Vulkan's one form reads `SampleMask` under `VK_EXT_post_depth_coverage`, which no runtime + /// enables; no form is built. PostDepthCoverage, /// Lines at a width other than 1 (Apple's `setLineWidth:`), drawn by the device's own wide /// lines (`wideLines`) or as bands of triangles through synthesized tessellation stages diff --git a/crates/metal2vulkan/src/lower/stage_io/plan.rs b/crates/metal2vulkan/src/lower/stage_io/plan.rs index e2b329228..8bdbeeb03 100644 --- a/crates/metal2vulkan/src/lower/stage_io/plan.rs +++ b/crates/metal2vulkan/src/lower/stage_io/plan.rs @@ -913,27 +913,16 @@ pub fn param(cx: &mut SelectCx<'_>, b: &ParamBinding) -> Result<(), Error> { ) .into()); } + // `[[sample_mask, post_depth_coverage]]`: Vulkan's one form, `SampleMask` read under + // `VK_EXT_post_depth_coverage`, is an extension no runtime enables, and no other form is + // built. + (ParamRole::Builtin(Builtin::PostDepthCoverage), _) => { + return Err(Unsupported::not_implemented(Feature::PostDepthCoverage).into()); + } (ParamRole::Builtin(bi), _) => { refuse_int64_interface(cx.entry, ty)?; let f = form_on(cx.entry, cx.profile, ty)?; let (spirv, shape, place, contract, enabler) = input_builtin(cx, *bi, f, frag)?; - // `[[sample_mask, post_depth_coverage]]`: `SampleMask` read after the early depth and - // stencil tests, which the entry declares (the AIR decode requires them), through - // `VK_EXT_post_depth_coverage`. - if *bi == Builtin::PostDepthCoverage { - let ext = VkExtension::ExtPostDepthCoverage; - if !cx.profile.fields().enabled.extensions.contains(&ext) { - return Err(Unsupported::needs( - Feature::PostDepthCoverage, - Capability::Extension(ext), - ) - .into()); - } - let modes = &mut cx.families.stage_io.modes; - if !modes.contains(&ExecMode::PostDepthCoverage) { - modes.push(ExecMode::PostDepthCoverage); - } - } if matches!( contract, StageBuiltin::BaseVertex | StageBuiltin::BaseInstance @@ -1862,9 +1851,7 @@ fn input_builtin( None, ) } - // The coverage after the early tests reads the same builtin under `PostDepthCoverage` - // (the entry's mode, `ParamRole::Builtin` in `plan`). - Bi::SampleMaskIn | Bi::PostDepthCoverage if !vertex => { + Bi::SampleMaskIn if !vertex => { int_scalar(f)?; ( B::SampleMask, diff --git a/crates/metal2vulkan/src/spirv/builder/module.rs b/crates/metal2vulkan/src/spirv/builder/module.rs index 259011ae1..ae07e0f8d 100644 --- a/crates/metal2vulkan/src/spirv/builder/module.rs +++ b/crates/metal2vulkan/src/spirv/builder/module.rs @@ -1445,7 +1445,6 @@ fn mode_contract(m: ExecMode) -> (u8, Option, &'static [ExecModel]) { (18, None, MESH) } ExecMode::RequireFullQuads => (19, None, FRAG), - ExecMode::PostDepthCoverage => (21, None, FRAG), } } diff --git a/crates/metal2vulkan/src/spirv/ir/module.rs b/crates/metal2vulkan/src/spirv/ir/module.rs index a1c05c6a4..615c0b6f4 100644 --- a/crates/metal2vulkan/src/spirv/ir/module.rs +++ b/crates/metal2vulkan/src/spirv/ir/module.rs @@ -1343,9 +1343,6 @@ pub enum ExecMode { /// `RequireFullQuadsKHR` (`SPV_KHR_quad_control`, fragment only): every quad starts with its /// four invocations, helpers included, and they take part in every group operation. RequireFullQuads, - /// `PostDepthCoverage` (`SPV_KHR_post_depth_coverage`, fragment only): `SampleMask` reads the - /// coverage after the early depth and stencil tests. - PostDepthCoverage, // ---- Tessellation ---- /// The triangle patch domain. Triangles, diff --git a/crates/metal2vulkan/src/spirv/requirements/mod.rs b/crates/metal2vulkan/src/spirv/requirements/mod.rs index 3a54941b8..7f116bb1c 100644 --- a/crates/metal2vulkan/src/spirv/requirements/mod.rs +++ b/crates/metal2vulkan/src/spirv/requirements/mod.rs @@ -876,11 +876,6 @@ impl Deriver<'_> { self.ext(SpirvExtension::KhrQuadControl); self.feat(VkFeature::ShaderQuadControl); } - ExecMode::PostDepthCoverage => { - self.cap(Cap::SampleMaskPostDepthCoverage); - self.ext(SpirvExtension::KhrPostDepthCoverage); - self.r.extensions.insert(VkExtension::ExtPostDepthCoverage); - } // A task or mesh entry's local size is bounded by the mesh shader limits, which no // profile records yet: the stage's feature, which none enables, refuses it first. ExecMode::LocalSize { x, y, z } if self.model == ExecModel::GLCompute => { diff --git a/crates/metal2vulkan/src/spirv/serialize/mod.rs b/crates/metal2vulkan/src/spirv/serialize/mod.rs index fd48132bb..2e2645173 100644 --- a/crates/metal2vulkan/src/spirv/serialize/mod.rs +++ b/crates/metal2vulkan/src/spirv/serialize/mod.rs @@ -999,7 +999,6 @@ impl Ser<'_> { ExecMode::SubgroupUniformControlFlow => plain(w, M::SubgroupUniformControlFlowKHR, &[]), ExecMode::MaximallyReconverges => plain(w, M::MaximallyReconvergesKHR, &[]), ExecMode::RequireFullQuads => plain(w, M::RequireFullQuadsKHR, &[]), - ExecMode::PostDepthCoverage => plain(w, M::PostDepthCoverage, &[]), ExecMode::Triangles => plain(w, M::Triangles, &[]), ExecMode::Quads => plain(w, M::Quads, &[]), ExecMode::SpacingEqual => plain(w, M::SpacingEqual, &[]), diff --git a/docs/REFUSALS.md b/docs/REFUSALS.md index 12d18d591..3533f0c98 100644 --- a/docs/REFUSALS.md +++ b/docs/REFUSALS.md @@ -40,7 +40,7 @@ Columns: | Kind | `metal-measured` | `metal-documented` | `metal-takes` | `device` | `ours` | `unknown` | `delegated` | `-` | |---|---|---|---|---|---|---|---|---| -| Translator and front-end refusals | 0 | 0 | 0 | 51 | 68 | 0 | 0 | 0 | +| Translator and front-end refusals | 0 | 0 | 0 | 50 | 69 | 0 | 0 | 0 | | Binder refusals at a device limit | 0 | 0 | 0 | 9 | 0 | 0 | 0 | 0 | | Translation caps | 0 | 0 | 0 | 0 | 14 | 0 | 0 | 0 | | Rate maps the compile layer does not compile | 0 | 0 | 0 | 0 | 5 | 0 | 0 | 0 | @@ -171,7 +171,7 @@ Columns: | `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,... | every device (not implemented) | `ours` | via a helper: 2: `crates/metal2vulkan-air/src/abi/module.rs (decode)`, `crates/metal2vulkan/src/error/mod.rs (from)` | `app`: MSL 3.2 program-scope buffer bindings (macOS 15 and later) | | `GenericPointer` | A generic pointer (MSL 4.1's `addrspace(8)`) that canonicalization cannot make a pointer of one address space, by how it comes to hold a space... | every device (not implemented) | `ours` | 2: `crates/metal2vulkan-air/src/canon/generic.rs (refuse)`, `crates/metal2vulkan-air/src/canon/generic.rs (refused)` | `system`: MSL 4.1 generic pointers held in memory or of two spaces (macOS 27 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 | `device` | 1: `crates/metal2vulkan/src/lower/sync/barrier.rs (require_seq_cst)` | `rare`: a seq_cst fence in a vertex or fragment stage without its stores and atomics | -| `PostDepthCoverage` | The coverage after the depth and stencil tests (`[[sample_mask, post_depth_coverage]]`), read through `VK_EXT_post_depth_coverage` | devices short of a Vulkan extension the site names | `device` | 1: `crates/metal2vulkan/src/lower/stage_io/plan.rs (param)` | `rare`: the coverage after early depth and stencil tests on a device without VK_EXT_post_depth_coverage | +| `PostDepthCoverage` | The coverage after the depth and stencil tests (`[[sample_mask, post_depth_coverage]]`) | every device (not implemented) | `ours` | 1: `crates/metal2vulkan/src/lower/stage_io/plan.rs (param)` | `rare`: the coverage after early depth and stencil tests, on every device | | `WideLines` | Lines at a width other than 1 (Apple's `setLineWidth:`), drawn by the device's own wide lines (`wideLines`) or as bands of triangles through... | devices without VkFeature::TessellationShader; devices without VkLimit::MaxTessellationEvaluationOutputComponents; every device (not implemented) | `ours` | 3: `crates/metal2vulkan/src/pipeline/link/band.rs (plan, 3 sites)` | `none`: a line under the Apple-private setLineWidth: at a width other than 1 drawn as the band, whose pipeline form the translator does not build (a selected slice or viewport, barycentric weights, multiview, synthesized geometry, too many stage outputs) | ## 2. Binder refusals at a device limit (`BindError`) diff --git a/scripts/refusal-surface/reach.tsv b/scripts/refusal-surface/reach.tsv index 3853de8db..8b5c6a761 100644 --- a/scripts/refusal-surface/reach.tsv +++ b/scripts/refusal-surface/reach.tsv @@ -110,7 +110,7 @@ feature DepthBiasClamp app depth bias clamp on a device without depthBiasClamp feature ConstantAlphaBlendFactor app blend-alpha factors on a portability-subset device without them feature SparseTexture rare sparse residency reads feature TextureSwizzle app texture swizzles whose Metal behaviour is unmeasured -feature PostDepthCoverage rare the coverage after early depth and stencil tests on a device without VK_EXT_post_depth_coverage +feature PostDepthCoverage rare the coverage after early depth and stencil tests, on every device feature PrivateMemory rare very large per-thread arrays feature Reflection rare reflection of argument kinds Metal's answer is unmeasured for feature ViewportDepthRange rare viewport depth outside [0, 1]