From 0558bb7979cc59e985ab29194b15903ffd1d2c4f Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Fri, 4 Dec 2026 20:35:24 -0800 Subject: [PATCH] Runtime: the test literals take handle_float_images; the 4:2:2 known gap and note docs say what is true now The Draws and Interface literals of tests/indirect.rs and tests/compute.rs missed the new field (job m3-max-87802, E0063). The README's 4:2:2 known gap now states the content lowered for the texture, its counters and costs, and the refusals and gaps; PrecisionNote::BicubicFilterArithmetic's doc and its docs/API.md entry name a 4:2:2 texture's linear sample. --- crates/metal2vulkan-runtime/README.md | 27 ++++++++++++++----- .../metal2vulkan-runtime/src/tests/compute.rs | 1 + .../src/tests/indirect.rs | 1 + crates/metal2vulkan/src/pipeline/artifact.rs | 6 +++-- docs/API.md | 4 ++- 5 files changed, 29 insertions(+), 10 deletions(-) diff --git a/crates/metal2vulkan-runtime/README.md b/crates/metal2vulkan-runtime/README.md index 1d26a7f0a..fa2ccf06a 100644 --- a/crates/metal2vulkan-runtime/README.md +++ b/crates/metal2vulkan-runtime/README.md @@ -2784,13 +2784,26 @@ once, as it is made, with no lock, and never rewritten for layouts. - A drawable's texture (see "Presenting") has no view of another pixel format (`Gap::TextureView`), and a draw that reads it as an attachment of its own pass is `Gap::Draw` of `AttachmentRead`: the swapchain's image lists no other format and has no feedback usage. -- A texture of Metal's 4:2:2 chroma-pair formats, `GBGR422` and `BGRG422`, is - `Gap::TextureFormat` at every make and at `heap_texture_size_and_align`. Vulkan's 4:2:2 formats - (`G8B8G8R8_422_UNORM`, `B8G8R8G8_422_UNORM`) are viewed only through a sampler Y′CbCr - conversion, whose chroma reconstruction is the implementation's, so the translator's format - table holds these two as a decoded `RGBA8Unorm` twin, which is not a form the runtime makes (a - format held otherwise than through its view, above). The conformance cases `chroma_pairs` and - `heap-sizes-422` record the refusal on every venue (`known-gaps-rt.tsv`). +- A texture of Metal's 4:2:2 chroma-pair formats, `GBGR422` and `BGRG422`, is held as its bytes, + an `R8G8_UNORM` image at its full width, since Vulkan's 4:2:2 formats (`G8B8G8R8_422_UNORM`, + `B8G8R8G8_422_UNORM`) are viewed only through a sampler Y′CbCr conversion, whose chroma + reconstruction is the implementation's. Only a function lowered for the texture reads its texels + as Metal's (`LoweringInputs::chroma_pairs`, `LoweringInputs::chroma_handles`): a draw or + dispatch that binds one at a texture slot its functions read, or that runs a function that may + reach a `float` colour texture through a handle while one lives on the device + (`Gauges::chroma_textures`), runs the state's content lowered for it. That content is made at + the first such draw or dispatch, a translation and its pipelines' compiles on the encoding thread + (`Metrics::chroma_contents`, within `Metrics::translations_at_encode`), kept in the device's map + of contents, and run by every such draw or dispatch (`Metrics::chroma_launches`); a state never + used with such a texture makes none, and its own module is the one it was. The content's read, + nearest sample and gather of the texture are Metal's values exactly; each decoded texel is four + fetches, so a linear sample or a gather reads sixteen texels where the device's own access reads + four, and a bicubic sample sixty-four. In a content lowered for handles, each read, sample and + gather through a handle tests whether its texture is such a texture. A linear or bicubic sample + carries `PrecisionNote::BicubicFilterArithmetic`. Shader-write and render-target usage, a + swizzle, and a function compiled outside the runtime that would read such a texture are + `Gap::ChromaPairsUse`; a type other than 2D, an odd width, more than one level and a view are + `Refusal::ChromaPairs`, as Metal refuses them. - A clear of a depth attachment converts the clear depth to a fixed-point code by the device's rounding, which Vulkan lets be either of the two codes nearest it ("Conversion From Floating-Point to Normalized Fixed-Point"): KosmicKrisp (Mesa 26.3.1, on an Apple M3 Max) clears a `Depth16Unorm` diff --git a/crates/metal2vulkan-runtime/src/tests/compute.rs b/crates/metal2vulkan-runtime/src/tests/compute.rs index e5be31735..7bd015141 100644 --- a/crates/metal2vulkan-runtime/src/tests/compute.rs +++ b/crates/metal2vulkan-runtime/src/tests/compute.rs @@ -50,6 +50,7 @@ pub(crate) mod on_device { numbered: Vec::new(), constexprs: Vec::new(), reads_unbound: false, + handle_float_images: false, writes_unbound: false, unbound_storage: false, has_effects: true, diff --git a/crates/metal2vulkan-runtime/src/tests/indirect.rs b/crates/metal2vulkan-runtime/src/tests/indirect.rs index 3cb4c77c5..b830c50e8 100644 --- a/crates/metal2vulkan-runtime/src/tests/indirect.rs +++ b/crates/metal2vulkan-runtime/src/tests/indirect.rs @@ -101,6 +101,7 @@ fn draws(fields: Vec<(DrawPlace, usize, FieldValue)>) -> Draws { levels: Vec::new(), bindings: Vec::new(), reads_unbound: false, + handle_float_images: false, writes_unbound: false, unbound_storage: false, writes_memory: false, diff --git a/crates/metal2vulkan/src/pipeline/artifact.rs b/crates/metal2vulkan/src/pipeline/artifact.rs index 8e1102dc3..75d0a6ec0 100644 --- a/crates/metal2vulkan/src/pipeline/artifact.rs +++ b/crates/metal2vulkan/src/pipeline/artifact.rs @@ -548,10 +548,12 @@ pub enum PrecisionNote { /// pixel, where they equal Metal's to the last bit or two. MultisamplePosition, /// A filter the module emulates by fetches sums its taps in the device's arithmetic, where - /// Metal's sampler has its own datapath: Metal's bicubic filter (every format), and an + /// Metal's sampler has its own datapath: Metal's bicubic filter (every format), an /// extended-range texture's linear, 3D and linear-mip-filter samples (`BGR10_XR_sRGB`, /// `BGRA10_XR_sRGB`, `RGB10A8_2P_XR10` and its `_sRGB` twin, the padded forms; read through - /// the slot's `extended_range` variant). The footprint, the + /// the slot's `extended_range` variant), and a 4:2:2 texture's linear sample of its decoded + /// texels (`GBGR422`, `BGRG422`, in a function lowered for it, + /// `LoweringInputs::chroma_pairs`), whose bicubic sample is the bicubic filter's. The footprint, the /// fraction (`1/256` of a texel), the addressing of each tap, the filter each format selects /// (a 32-bit float format's bicubic sample and a level under four texels bilinear), the level /// a mip filter reads, and each format's clamp are Metal's; the arithmetic is the device's: diff --git a/docs/API.md b/docs/API.md index 1b5ce0fd4..228861f91 100644 --- a/docs/API.md +++ b/docs/API.md @@ -2021,7 +2021,9 @@ category, and says what makes an operation carry the note and what may differ. E where Metal does. - `metal2vulkan-degrade-bicubic-filter-arithmetic` (precision). `PrecisionNote::BicubicFilterArithmetic`: a filter emulated by fetches (Metal's bicubic filter on - every format, and an extended-range texture's linear, 3D and linear-mip-filter samples) sums its + every format, an extended-range texture's linear, 3D and linear-mip-filter samples, and a 4:2:2 + texture's linear sample of its decoded texels, in a function lowered for it, + `LoweringInputs::chroma_pairs` or `chroma_handles`) sums its taps in the device's arithmetic: the Catmull-Rom weights computed in `f32` from the fraction, the taps summed by the device's multiply and add, a bilinear, trilinear or level blend by its `FMix` at the `f32` fractions, and a `half` result the device's narrowing. The footprint, addressing,