From 9a67d986e6ce168ce4933a2a48ec274ff5130944 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Wed, 11 Nov 2026 10:08:34 -0800 Subject: [PATCH] Separate depth and stencil textures: an unstored DontCare aspect follows UnstoredDontCarePolicy in the scratch image A pass whose depth and stencil attachments are two textures renders through a scratch image of the combined format (depth_stencil_scratch.rs), and clear_reach::dont_care_loads skipped it: an aspect loaded DontCare and not stored took the scratch's DONT_CARE load under every policy, with no notice. So under exact_answers() its draws read what the new scratch image held (on MoltenVK a stencil of 0 and a depth of 1.0, Metal's defaults for a load that names no clear value), where Metal's read the pass's clear value: measured on the M3 Max under macOS 27.0.1 by the lane's passes through Metal itself (job m3-max-16522), each aspect apart, whether the other aspect is so loaded or loaded and stored. Now such an aspect takes the answer of any attachment so loaded, each aspect apart: in a pass whose draws reach a tile, the scratch's Clear to the aspect's clear value under UnstoredDontCarePolicy::Cleared and on a driver with DriverFact::UnstoredClearNoSlower (the scratch image is a combined depth/stencil attachment, the shape the fact measured), else its DONT_CARE, announced dont-care-unstored-load naming the aspect. Nothing is copied into the aspect before the pass (only Load aspects are), so no earlier bytes reach it. An aspect the pass stores keeps the scratch's DONT_CARE load as before. Docs: clear_reach.rs records Metal's answer for separate textures and the rule; the scratch module, the notice's rustdoc and catalogue entry, UnstoredDontCarePolicy's rustdoc, API.md's section and the FAST-PATHS row name separate textures; the known gap is removed. --- .../metal2vulkan-runtime/src/clear_reach.rs | 37 ++++++++++++------- .../metal2vulkan-runtime/src/degradation.rs | 15 ++++---- .../src/depth_stencil_scratch.rs | 7 +++- crates/metal2vulkan/src/device/policy.rs | 16 ++++---- docs/API.md | 15 ++++---- docs/FAST-PATHS.md | 10 +---- 6 files changed, 55 insertions(+), 45 deletions(-) diff --git a/crates/metal2vulkan-runtime/src/clear_reach.rs b/crates/metal2vulkan-runtime/src/clear_reach.rs index 224ee1221..219e33b58 100644 --- a/crates/metal2vulkan-runtime/src/clear_reach.rs +++ b/crates/metal2vulkan-runtime/src/clear_reach.rs @@ -29,7 +29,11 @@ //! earlier texels (an M3 Max, macOS 27.0.1, lane `dont_care_unstored`: an `RG16Float` second //! color a framebuffer fetch reads and a `Stencil8` a stencil test reads, over 224x128 and //! 128x128 targets, in a pass whose first draw reaches some tiles and a later one every tile, a -//! pass of the reading draw alone, and a pass of no fetch). +//! pass of the reading draw alone, and a pass of no fetch). Separate depth and stencil textures +//! read the same, each aspect apart (a `Depth32Float` and a `Stencil8` texture read by a depth +//! and a stencil test over the same targets, with and without API validation): an aspect loaded +//! `DontCare` and not stored reads the clear value whether the other aspect is so loaded or is +//! loaded and stored, which reads its texels. //! - A `Load` keeps the texels past the render area, and a `DontCare` store stores nothing. //! //! **The runtime** gives the `Clear` load's answer and the `DontCare` load's near-equivalent, as @@ -50,14 +54,16 @@ //! pass's `tileWidth` and `tileHeight`, which set Metal's grid, as measured), a clear before the //! pass, and loads: every other tile keeps its texels, Metal's answer (a draw writes no pixel //! outside them), and a pass whose draws reach no pixel loads, as one whose draws draw nothing. -//! - A `DontCare`-loaded attachment the pass does not store (but separate depth and stencil -//! textures, and memoryless ones), in a pass whose draws reach a tile, clears to zero (a color) -//! or its clear value (depth, stencil) over the render area under -//! `UnstoredDontCarePolicy::Cleared`, and under the default `Driver` on a driver measured to run -//! that clear no slower than its `DONT_CARE` load (`DriverFact::UnstoredClearNoSlower`) -//! ([`UnstoredLoads`]): by the load operation of the pass's first instance, or before the pass -//! where that instance leaves it out (as below). Metal's answer wherever a fragment reads it, so -//! no notice: no fragment reads a tile no draw touches. What the pass leaves in it is a +//! - A `DontCare`-loaded attachment the pass does not store (but memoryless ones), in a pass whose +//! draws reach a tile, clears to zero (a color) or its clear value (depth, stencil) over the +//! render area under `UnstoredDontCarePolicy::Cleared`, and under the default `Driver` on a +//! driver measured to run that clear no slower than its `DONT_CARE` load +//! (`DriverFact::UnstoredClearNoSlower`) ([`UnstoredLoads`]): by the load operation of the +//! pass's first instance, or before the pass where that instance leaves it out (as below); an +//! aspect of separate depth and stencil textures by the load operation of the scratch image the +//! pass renders them through (`depth_stencil_scratch.rs`), which copies nothing into that +//! aspect, each aspect apart. Metal's answer wherever a fragment reads it, so no notice: no +//! fragment reads a tile no draw touches. What the pass leaves in it is a //! `DontCare` store's (`kept_bytes.rs`, `dont-care-store`). On every other driver under the //! default it stays `DontCare`, the driver's faster form, announced //! (`Degradation::DontCareUnstoredLoad`). In a pass whose draws reach no tile it stays @@ -347,11 +353,11 @@ pub(super) fn dont_care_loads( .get_or_insert_with(|| format!("color attachment {index}")); } } - if let Some(ds) = layout - .depth_stencil - .as_mut() - .filter(|ds| ds.separate.is_none()) - { + if let Some(ds) = layout.depth_stencil.as_mut() { + // Separate depth and stencil textures render through the pass's own scratch image + // (`depth_stencil_scratch.rs`), whose load operation is each aspect's: one the pass does + // not store takes the same answer there, per aspect; one it stores stays `DontCare`. + let separate = ds.separate.is_some(); for (name, aspect, taken) in [ ("depth", ds.depth.as_mut(), &mut loads.depth), ("stencil", ds.stencil.as_mut(), &mut loads.stencil), @@ -373,6 +379,9 @@ pub(super) fn dont_care_loads( } continue; } + if separate { + continue; + } aspect.load = load; *taken = true; if drew { diff --git a/crates/metal2vulkan-runtime/src/degradation.rs b/crates/metal2vulkan-runtime/src/degradation.rs index 29f482f9d..32b490bff 100644 --- a/crates/metal2vulkan-runtime/src/degradation.rs +++ b/crates/metal2vulkan-runtime/src/degradation.rs @@ -845,13 +845,14 @@ degradations! { DontCareLoadTiles = "dont-care-load-tiles", Precision, "the tiles no draw touches hold zero or the clear value where Metal keeps their \ texels"; - /// An attachment loaded with `DontCare` and not stored (not memoryless, not one of - /// separate depth and stencil textures), in a pass whose draws reach a tile, is left to the - /// driver's `DONT_CARE` load under `UnstoredDontCarePolicy::Driver`, the default, on a - /// driver not measured to clear it no slower (`DriverFact::UnstoredClearNoSlower`), where - /// Metal's draws read zero (a color) or the clear value (depth, stencil) wherever they read - /// it (`clear_reach.rs`). Cleared, Metal's answer, and not announced on a driver with the - /// fact and under `UnstoredDontCarePolicy::Cleared`. + /// An attachment loaded with `DontCare` and not stored (not memoryless; an aspect of + /// separate depth and stencil textures in the scratch image the pass renders them + /// through), in a pass whose draws reach a tile, is left to the driver's `DONT_CARE` load + /// under `UnstoredDontCarePolicy::Driver`, the default, on a driver not measured to clear + /// it no slower (`DriverFact::UnstoredClearNoSlower`), where Metal's draws read zero (a + /// color) or the clear value (depth, stencil) wherever they read it (`clear_reach.rs`). + /// Cleared, Metal's answer, and not announced on a driver with the fact and under + /// `UnstoredDontCarePolicy::Cleared`. DontCareUnstoredLoad = "dont-care-unstored-load", Precision, "the pass's draws read what the driver's `DONT_CARE` load leaves in the attachment \ (on lavapipe its earlier texels) where Metal's read zero or the clear value"; diff --git a/crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs b/crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs index 68c96f320..9436322cf 100644 --- a/crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs +++ b/crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs @@ -8,7 +8,12 @@ //! `D24_UNORM_S8_UINT` for 24-bit. Stencil is 8 bits in every format. //! //! - **Before the pass**, each aspect loaded with `Load` is copied from its texture into the -//! scratch image; `Clear` and `DontCare` load as the scratch's own operations. +//! scratch image; `Clear` and `DontCare` load as the scratch's own operations. An aspect loaded +//! `DontCare` that the pass does not store, in a pass whose draws reach a tile, takes the answer +//! of any attachment so loaded (`clear_reach.rs`, `UnstoredDontCarePolicy`), each aspect apart: +//! the scratch's `Clear` to the aspect's clear value, Metal's answer (an M3 Max under macOS +//! 27.0.1, `runtime_lane::dont_care_unstored`), or its `DONT_CARE`, announced +//! `dont-care-unstored-load`. One the pass stores loads `DONT_CARE`. //! - **After it**, each aspect stored with `Store`, `StoreAndMultisampleResolve` or //! `CustomSampleDepthStore` is copied back (a resolve of the scratch image into the separate //! resolve textures is `resolve.rs`'s split resolve). An aspect stored `DontCare` is not: its diff --git a/crates/metal2vulkan/src/device/policy.rs b/crates/metal2vulkan/src/device/policy.rs index b65e8882a..d59354996 100644 --- a/crates/metal2vulkan/src/device/policy.rs +++ b/crates/metal2vulkan/src/device/policy.rs @@ -553,13 +553,15 @@ pub enum DontCareColorPolicy { Kept, } -/// What a render pass's draws read of an attachment (not memoryless, not one of separate depth and -/// stencil textures) the pass loads `MTLLoadActionDontCare` and does not store -/// (`MTLStoreActionDontCare`), in a pass whose draws reach a tile. Metal's documentation leaves it -/// open; what Apple's GPU reads is measured: zero for a colour and the pass's clear value for -/// depth and stencil, wherever a draw reads it (an Apple M3 Max under macOS 27.0.1: a framebuffer -/// fetch and a stencil test, in passes split and whole). Vulkan's `DONT_CARE` load leaves the -/// contents undefined. The runtime's choice alone: no emitted code changes. +/// What a render pass's draws read of an attachment (not memoryless) the pass loads +/// `MTLLoadActionDontCare` and does not store (`MTLStoreActionDontCare`), in a pass whose draws +/// reach a tile. Metal's documentation leaves it open; what Apple's GPU reads is measured: zero for +/// a colour and the pass's clear value for depth and stencil, wherever a draw reads it (an Apple +/// M3 Max under macOS 27.0.1: a framebuffer fetch and a stencil test, in passes split and whole; +/// a depth and a stencil test of separate depth and stencil textures, each aspect apart). Vulkan's +/// `DONT_CARE` load leaves the contents undefined. Separate depth and stencil textures render +/// through a scratch image of the pass's own, whose load of each such aspect this decides. The +/// runtime's choice alone: no emitted code changes. #[non_exhaustive] #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] diff --git a/docs/API.md b/docs/API.md index 4dde0d164..28dbf499b 100644 --- a/docs/API.md +++ b/docs/API.md @@ -263,8 +263,9 @@ compile does. `DevicePolicy::default()` is `DevicePolicy::UNTRUSTED`: (`DriverFact::UnstoredClearNoSlower`: MoltenVK on the M3 Max, RADV on the Radeon 780M), and leaves it to the driver's `DONT_CARE` elsewhere, announced `dont-care-unstored-load`: lavapipe's draws then read its earlier texels. `unstored_dont_care_loads = UnstoredDontCarePolicy::Cleared`, - which `exact_answers()` selects, clears it on every device. A memoryless one, and one of separate - depth and stencil textures, are not covered. + which `exact_answers()` selects, clears it on every device. Separate depth and stencil textures + take the same answer, each aspect apart, in the scratch image the pass renders them through. A + memoryless one is not covered. Loops run as written: no execution bound is translated in. @@ -2362,11 +2363,11 @@ bound. the tiles no draw touches hold zero or the clear value where Metal keeps their texels. Not an attachment the pass does not store (`dont-care-unstored-load`). - `metal2vulkan-degrade-dont-care-unstored-load` (precision). `DontCareUnstoredLoad`: An attachment - loaded with `DontCare` and not stored (not memoryless, not one of separate depth and stencil - textures), in a pass whose draws reach a tile, is left to the driver's `DONT_CARE` load under - `UnstoredDontCarePolicy::Driver`, the default, on a driver not measured to clear it no slower - (`DriverFact::UnstoredClearNoSlower`), where Metal's draws read zero (a color) or the clear value - (depth, stencil) wherever they read it. Cleared, and not announced, on a driver with the fact and + loaded with `DontCare` and not stored (not memoryless; an aspect of separate depth and stencil + textures in the scratch image the pass renders them through), in a pass whose draws reach a + tile, is left to the driver's `DONT_CARE` load under `UnstoredDontCarePolicy::Driver`, the + default, on a driver not measured to clear it no slower (`DriverFact::UnstoredClearNoSlower`), + where Metal's draws read zero (a color) or the clear value (depth, stencil) wherever they read it. Cleared, and not announced, on a driver with the fact and under `UnstoredDontCarePolicy::Cleared` (`exact_answers()`). Cost: the pass's draws read what the driver's `DONT_CARE` load leaves in the attachment (on lavapipe its earlier texels) where Metal's read zero or the clear value. diff --git a/docs/FAST-PATHS.md b/docs/FAST-PATHS.md index d433e66cf..1216b5e7b 100644 --- a/docs/FAST-PATHS.md +++ b/docs/FAST-PATHS.md @@ -43,7 +43,7 @@ three consumer pipelines: A2X (`a2x-s4`, `a2x-s96`), Xgc14 (`xgc14-bgra8`) and X | A line Apple's `setLineWidth:` widens (`w' = floor(16 w) / 16`, other than 1), and a triangle's edge in fill mode `Lines`, is drawn by the device's own lines at `w'` wherever it draws that width (`wideLines`, `w'` in `lineWidthRange` and above 0), where Metal draws the parallelogram Vulkan's non-strict wide lines may be (`render/line_width.rs`). No device's are taken as it, announced on every device: a strict device's rectangle with square ends (lavapipe, NVIDIA), lines Vulkan does not state as parallelograms (ANV, and every width below 1), a width rounded to the granularity, and a driver's parallelograms (`strictLines` unset, `nonStrictWideLinesUseParallelogram` set), whose ends the driver places (RADV on the Radeon RX 7900 XTX draws 21 of `runtime_lane::line_widths`'s 48 scattered lines at width 2.5 a row or a column off Metal's at an end). A mesh draw's lines and edges and a tessellated patch draw's edges take the device's lines under either value, the band not drawing them (at the nearest width they draw where they do not draw `w'`, announced `lines-at-nearest-width`: a known gap below). The runtime's: no pipeline's code differs. | `wide_lines = WideLinePolicy::Device` | `wide_lines = WideLinePolicy::Exact`: a draw of lines or edges the device's lines draw is the pipeline's band variant (`VariantKey::line_band`, `pipeline::link::band`) on a device with `tessellationShader` (the device's lines where it has none, or where the translator refuses the state's band or the draw's): two triangles over each line's parallelogram, and each triangle's three edges' parallelograms facing as the triangle, through a tessellation control and evaluation stage; every other width other than 1 is the band under either value | The lines can cover pixels the parallelogram does not, and miss others, at each end and along each edge: up to half the width past each end (square ends), a rounded width, and a row or a column at an end (a driver's parallelograms). `DeviceWideLines` (`device-wide-lines`), at each such draw where `DeviceOptions::announce_each` asks, else once per device; `WorkCounts::device_wide_line_draws`, `line_band_draws`, `nearest_width_line_draws`; `runtime_lane::line_widths` (the band matches Metal's maps of lines and of triangles' edges, their facing, culling, flat inputs, primitive IDs and depth on MoltenVK under both values, which has no `wideLines`; a band of edges under a depth bias is announced `wide-edge-depth-bias`) | Not measured. Expected from the band's form: a second pipeline variant made for each render state that draws such lines or edges (its two synthesized stages), each line tessellated as a patch of two control points into four corners and each triangle as a patch of three into 21 triangles (12 degenerate), and a strip, loop or fan drawn as the list of its primitives | | A blit or fill through a `BGRA10_XR` or `BGRA10_XR_sRGB` texture Metal keeps losslessly compressed (`allowGPUOptimizedContents`, 16 texels or more a side, neither `ShaderWrite` nor `PixelFormatView` usage, one sample, not over a buffer) is the device's copy, which keeps the bytes it moves, on every device: Metal's GPU blit into, out of or between such textures moves the texels through its compression, which writes each 16-bit field's low six bits cleared and the alpha code clamped to `[384, 894]`, and its fill clears the low six bits alone (an Apple M3 Max under macOS 27.0.1, every direction, storage mode, usage and size that decides the compression; CPU copies keep the bytes on Metal too). A pass's draws through such an attachment are the device-gap row below. The runtime's choice: no pipeline differs (`compressed_blit.rs`). | `extended_range_blits = ExtendedRangeBlitPolicy::Kept` | `extended_range_blits = ExtendedRangeBlitPolicy::Canonical`: after a blit writes such a texture's region, or a blit out of one writes a buffer's words, a texture over a buffer's or another texture's, a compute dispatch (`bind::extended_canonical_module`, `extended_canonical.rs`) rewrites the texels it wrote in Metal's encoding: in place in a buffer's bytes, an image's through a scratch buffer, a copy out and back around the dispatch; a fill's texel is encoded before it is written. A buffer whose words the device cannot bind (an offset or pitch off 4 bytes, a region past `maxStorageBufferRange`) and a texture over a buffer whose rows share bytes keep the bytes under either value, announced | Bytes no Metal write left (uploaded, CPU-copied or kernel-written texels: a field's low six bits, an alpha code outside `[384, 894]`) keep what Metal's blit would rewrite; a texel reads the same value either way, its low six bits unread and its alpha read clamped. `ExtendedRangeBitsKept` (`extended-range-bits-kept`), once per device; under `Canonical` not for the blits it makes exact; `runtime_lane::compressed_blits` (both values on MoltenVK), the conformance cases `compressed-blits-bgra10xr` and `compressed-blits-bgra10xr-srgb` | Measured, `Canonical` against `Kept`, on `Private` `BGRA10_XR` textures Metal keeps compressed (the sRGB twin and fills not measured), 256x256 and 2048x2048, one whole-texture blit a command buffer: p50 of 300 blits a run, the two values interleaved in one process, three runs a host. RTX 5080 Laptop (NVIDIA 615.71.09, the command buffer's GPU time): a buffer into the texture 23.5 against 11.5 us and 761 against 244 us from a `Private` buffer, 42 against 30 us and 1,945 against 1,176 us from a `Shared` one; the texture into a `Private` buffer 14.1 against 11.2 us and 287 against 246 us, into a `Shared` one, whose words the dispatch rewrites in system memory, 66 against 27 us and 3,386 against 1,182 us; texture into texture 22.5 against 9.7 us and 630 against 80 us. Apple M3 Max (MoltenVK 1.4.2, whose GPU times are the host's, so per blit of 16 in one command buffer), the same blits: into the texture +38 to +57 us and +536 to +548 us, out of it into a buffer +15 us and +84 to +94 us, texture into texture +46 to +48 us and +535 to +541 us. Every figure is above its `Kept` one in every run, by more than the runs' spread (under 1 us on the 5080): measurable at both sizes on both hosts. Into an image a blit adds a copy out into a scratch buffer of the region's size, the dispatch, a copy back and the barriers between them; into a buffer the dispatch and a barrier. The scratch is made without zeros, since the copy out writes every byte the dispatch and the copy back read; the figures above were taken while it was zeroed first, by a command buffer of its own (a fill on the 5080, a copy on MoltenVK). CPU from the command buffer's making through its commit, a blit alone: +1 to +3 us on the M3 Max, +1 to +127 us on the 5080, whose host other builds loaded; 16 blits into 2048x2048 images in one command buffer hold 16 scratch buffers of 32 MiB, and encoding each costs 141 to 165 us (5080) and 286 to 356 us (M3 Max), new memory blocks among it, against 2 to 6 us under `Kept`. Nothing for a texture Metal keeps uncompressed or of another format | | A colour attachment of a texture's own image (not over a buffer's bytes, not memoryless, resolving nothing) that a pass stores `DontCare` is stored as the driver stores it: `DONT_CARE` on a driver measured to keep one of Metal's two answers or to store as Metal's own (`DriverFact::DontCareStoreIsOneOfMetals`, `DontCareStoreIsMetals`), else `STORE`, the rendered texels (`render_target.rs`). Metal's documentation leaves the contents open (`MTLStoreAction.dontCare`: "You need to assume that GPU discarded the texture's contents"); Apple's GPU leaves the texels the attachment held before the pass, the pass's clear and draws both gone (the conformance case `pass-sequence-color-actions`, an M3 Max under macOS 27.0.1, eight runs alike), or the rendered ones where its tiler overflows. A pass MoltenVK runs as one instance is handed to Metal's own `DontCare` under either value. | `dont_care_colors = DontCareColorPolicy::Driver` | `dont_care_colors = DontCareColorPolicy::Kept`: the pass renders through a backing its command queue keeps, one image of the attachment's shape, into which a `Load` copies the texels first, and nothing is copied back, so the texture keeps its earlier texels exactly (`kept_bytes.rs`, `WorkCounts::kept_texels_passes`); where a format makes no such image, the pass stores as under `Driver`, announced | Under `Driver`, the attachment holds the rendered texels (`STORE`: NVIDIA, lavapipe) or what the driver's `DONT_CARE` leaves (RADV, ANV: measured to be one of Metal's two answers), where Metal's holds the earlier texels unless its tiler overflows; where the pass also loads it `DontCare` and the runtime clears it (`unstored_dont_care_loads`, below), a tile no draw touches holds zero or the clear value. `DontCareStore` (`dont-care-store`), once per device; under `Kept` not for the passes it keeps; `runtime_lane::dont_care_stores` (both values), the conformance case `pass-sequence-color-actions` | Measured, `Kept` against the same pass stored `Store`, one pass of one draw over an `RGBA8Unorm` texture a command buffer, commit to completion, the median of 300 interleaved (a scratch measurement, `rows3_cost`): RTX 5080 Laptop (NVIDIA 615.71.09), a `Load` pass 19 µs more at 1920x1080 and 10 µs at 256x256 (16 µs and 7 µs of GPU time), a `Clear` pass 3 µs; lavapipe (llvmpipe, LLVM 23.1.4), a `Load` pass 0.5 to 0.8 ms more at 1920x1080 and 30 µs at 256x256, a `Clear` pass within the runs' spread. Memory: one backing image of the attachment's shape per command queue | -| An attachment (not memoryless, not one of separate depth and stencil textures) that a pass loads `DontCare` and does not store, in a pass whose draws reach a tile, is cleared over the render area (`clear_reach.rs`) on a driver measured to run that clear no slower than its `DONT_CARE` load (`DriverFact::UnstoredClearNoSlower`: MoltenVK on the M3 Max, RADV on the Radeon 780M), and left `DONT_CARE` on every other driver. Metal's draws read zero (a colour) or the pass's clear value (depth, stencil) of such an attachment wherever they read it, never its earlier texels (an M3 Max under macOS 27.0.1: an `RG16Float` second colour a framebuffer fetch reads and a `Stencil8` a stencil test reads, in passes split and whole, `runtime_lane::dont_care_unstored`); Vulkan's `DONT_CARE` load leaves the contents undefined. | `unstored_dont_care_loads = UnstoredDontCarePolicy::Driver` | `unstored_dont_care_loads = UnstoredDontCarePolicy::Cleared`: cleared on every device, by the pass's first render pass instance's load operation, or before the pass where that instance leaves the attachment out; Metal's answer wherever a draw reads it | On a driver without the fact, the draws read what its `DONT_CARE` load leaves (lavapipe: the attachment's earlier texels). `DontCareUnstoredLoad` (`dont-care-unstored-load`), once per device; `runtime_lane::dont_care_unstored` (both values: Metal's answer under `Cleared` and on a driver with the fact, lavapipe's earlier texels under `Driver`) | Measured, `CLEAR` against `DONT_CARE`, the GPU's span per pass, medians of 15 frames in each of two rounds, eight 3648x2038 passes a frame (a `BGRA8Unorm` colour loaded and stored, an `RG16Float` colour and a `Depth32Float_Stencil8` loaded by the form and stored `DontCare`, one draw over the whole target writing all three; a probe whose runtime still left such a load `DONT_CARE`, without the validation layer): lavapipe (Mesa 26.2.6, llvmpipe on LLVM 23.1.4) 10480 and 10744 µs against 7280 and 7259, 3.2 to 3.5 ms more, its clear a write of every texel; ANV (Mesa 26.2.6) on the Iris Xe (RPL-P) 1936 and 1936 µs against 1907 and 1151, slower in both rounds; RADV (Mesa 26.2.6) on the Radeon 780M 861 and 865 µs against 1147 and 988, faster; MoltenVK 1.4.2 on the M3 Max 218 and 218 µs against 224 and 217, apart by less than one form's two rounds; NVIDIA's 615.71.09 on the RTX 5080 Laptop GPU 74.4 and 74.6 µs against 71.2 and 71.4, 3.2 µs more. Memory: none | +| An attachment (not memoryless) that a pass loads `DontCare` and does not store, in a pass whose draws reach a tile, is cleared over the render area (`clear_reach.rs`) on a driver measured to run that clear no slower than its `DONT_CARE` load (`DriverFact::UnstoredClearNoSlower`: MoltenVK on the M3 Max, RADV on the Radeon 780M), and left `DONT_CARE` on every other driver; an aspect of separate depth and stencil textures likewise, each aspect apart, in the scratch image of the combined format the pass renders them through (`depth_stencil_scratch.rs`). Metal's draws read zero (a colour) or the pass's clear value (depth, stencil) of such an attachment wherever they read it, never its earlier texels (an M3 Max under macOS 27.0.1: an `RG16Float` second colour a framebuffer fetch reads and a `Stencil8` a stencil test reads, in passes split and whole; a separate `Depth32Float` and `Stencil8` read by a depth and a stencil test, each aspect so loaded alone or both; `runtime_lane::dont_care_unstored`); Vulkan's `DONT_CARE` load leaves the contents undefined. | `unstored_dont_care_loads = UnstoredDontCarePolicy::Driver` | `unstored_dont_care_loads = UnstoredDontCarePolicy::Cleared`: cleared on every device, by the pass's first render pass instance's load operation, or before the pass where that instance leaves the attachment out (separate depth and stencil textures: by the scratch image's load operation of the aspect); Metal's answer wherever a draw reads it | On a driver without the fact, the draws read what its `DONT_CARE` load leaves (lavapipe: the attachment's earlier texels). `DontCareUnstoredLoad` (`dont-care-unstored-load`), once per device; `runtime_lane::dont_care_unstored` (both values: Metal's answer under `Cleared` and on a driver with the fact, lavapipe's earlier texels under `Driver`; separate depth and stencil textures alike, but what lavapipe's `DONT_CARE` leaves in the scratch image is printed, not checked) | Measured, `CLEAR` against `DONT_CARE`, the GPU's span per pass, medians of 15 frames in each of two rounds, eight 3648x2038 passes a frame (a `BGRA8Unorm` colour loaded and stored, an `RG16Float` colour and a `Depth32Float_Stencil8` loaded by the form and stored `DontCare`, one draw over the whole target writing all three; a probe whose runtime still left such a load `DONT_CARE`, without the validation layer): lavapipe (Mesa 26.2.6, llvmpipe on LLVM 23.1.4) 10480 and 10744 µs against 7280 and 7259, 3.2 to 3.5 ms more, its clear a write of every texel; ANV (Mesa 26.2.6) on the Iris Xe (RPL-P) 1936 and 1936 µs against 1907 and 1151, slower in both rounds; RADV (Mesa 26.2.6) on the Radeon 780M 861 and 865 µs against 1147 and 988, faster; MoltenVK 1.4.2 on the M3 Max 218 and 218 µs against 224 and 217, apart by less than one form's two rounds; NVIDIA's 615.71.09 on the RTX 5080 Laptop GPU 74.4 and 74.6 µs against 71.2 and 71.4, 3.2 µs more. Memory: none | | A linear sample of a two-plane YCbCr texture whose planes a function reads in place (`YCBCR8_420_2P`, `YCBCR10_420_2P` through a uniform texel buffer over their codes, on an integrated GPU or a CPU device; `lower::sampler::in_place`), through a sampler that addresses no border on either plane axis, with no texel offset placed by a parent's size, is Vulkan's Y′CbCr model of the codes, as the device's own conversion with a linear chroma filter computes it: the four luma codes around the point and the four chroma pairs around the same point of the chroma plane (Metal's midpoint siting) blended bilinearly, then the surface's range and matrix (Metal's coefficients) in `float`, each channel clamped into `[0, 1]`: eight fetches. A runtime sampler's word decides as the function runs. A nearest sample, a border mode, a parent-placed offset and a gather are Metal's under either value. | `ycbcr_in_place_reads = YCbCrInPlacePolicy::Model` | `ycbcr_in_place_reads = YCbCrInPlacePolicy::Exact`: every tap Metal's texel (its chroma weighted 9/3/3/1 and rounded to a code, the fixed-point conversion), and the sample Metal's sum of the four taps' steps on the grid `2048`: twenty fetches and four conversions | The model reconstructs each channel at the point where Metal converts four taps and sums them: within the `float` arithmetic's rounding of the model (checked against an `f64` model on the CPU interpreter, `engine_ycbcr_in_place`), it differs from Metal's by the chroma the taps reconstruct, by Metal's roundings to a code and to `1/2048`, and where a tap's channel leaves `[0, 1]`, which Metal clamps before it sums. `HalfSampleFilter` / `FloatSampleFilter` under the bound converted 4:2:0 format, announced `ycbcr-filter-not-exact` | Radeon 780M (RADV): a 3840 x 2160 `YCBCR10_420_2P` frame sampled linearly into a 3840 x 2160 `BGRA8Unorm` target, GPU time per frame (median of 60): 6.4-6.9 ms under the exact form (`runtime_lane::video_frames`) | All at once: `DevicePolicy::exact_answers()` sets every switch above; each row states its own cost. @@ -455,14 +455,6 @@ recorded here. Open differences from Metal that no note announces yet, and runtime costs still above the driver's. Each is open work. -- **A `DontCare` load of separate depth and stencil textures the pass does not store reads the - pass's scratch image as the driver's `DONT_CARE` leaves it** (`depth_stencil_scratch.rs`): where - a pass's depth and stencil attachments are two textures, it renders into a scratch image of the - combined format, and an aspect loaded `DontCare` is the scratch's own `DONT_CARE` load on every - device and under every policy, where Metal's draws read the clear value of an aspect it does not - store (measured on a `Stencil8` alone, an M3 Max under macOS 27.0.1; - `UnstoredDontCarePolicy` covers a single depth/stencil texture only). No notice says so. - - **A heap texture Metal keeps uncompressed lies in its driver's layout, not Metal's tiles, where its image fits Metal's answer in the heap's memory** (`texture/heap.rs`, `heap-texture-untiled-layout`): on every driver whose colour images are not measured to lie as