Docs: Metal chooses between a sampler's two filters before the clamp into the texture's levels
level.rs stated Metal's rule as "every sampler magnifies where L + q is 0", with L + q taken after the clamp into the texture's levels, and left a texture of one level unmeasured. A Metal probe of the Apple M3 Max on macOS 27.0.1 (job m3-max-87718) measured it: a 16 x 4 rgba8Unorm texture of one level, through runtime samplers without a mip filter whose filters differ (min nearest / mag linear and the reverse), at level() and a kernel's bias() of -2, -0.5, 0, 1/64, 1/4, 1/2, 1, 2 and 5, 60 positions each, takes the magnification filter at -2, -0.5 and 0 and the minification filter at every level from 1/64 up. The stated rule would have magnified at every level. So the choice reads the level after the half rounding and the sampler's clamp, before the clamp into the texture's levels. On a texture of more than one level the two readings agree, so the 2,230- level probes the module cites still hold. Comment-only. No code takes this choice where the module reads texels itself: an extended-range sample's constexpr sampler with differing filters is refused, and a runtime word with mixed filters reads nearest (extended's open gap). The device path follows Vulkan's rule (λ after the sampler's [minLod, maxLod], before the view's levels), which the device paragraph now says matches Metal's choice. No translation changes, so SEMANTICS_VERSION stays. level.rs is not a runtime-sources input: pin-compute.py on this tree prints the committed e8f7cd09...6798, so the pin does not move.
This commit is contained in:
1 parent
e7f9a98fbf
commit
e52085541e
1 file changed
+22
-6
@@ -11,8 +11,11 @@
|
||||
//! - a nearest mip filter reads level `L + 1` where `q > 1/2`, else level `L`;
|
||||
//! - a linear mip filter blends levels `L` and `L + 1` with weights `1 - q` and `q`;
|
||||
//! - a sampler without a mip filter reads level 0;
|
||||
//! - every sampler magnifies (its magnification filter) where `L + q` is 0, and minifies
|
||||
//! elsewhere.
|
||||
//! - every sampler minifies (its minification filter) where `L + q` of the level before the clamp
|
||||
//! into the texture's levels (rounded and clamped into the sampler's clamp) is above 0, and
|
||||
//! magnifies (its magnification filter) elsewhere. On a texture of more than one level that is
|
||||
//! where the clamped `L + q` is not 0; a texture of one level, whose levels clamp every level to
|
||||
//! 0, minifies at every level above 0 though it reads level 0.
|
||||
//!
|
||||
//! Every lane of the probes reads so: 2,230 levels each (every sixty-fourth from -1 to 5, the
|
||||
//! neighbourhoods of `L + 1/2` in steps of `1/4096`, every `1/1024` from 1 to 2, the `half` ties
|
||||
@@ -24,8 +27,19 @@
|
||||
//! alike; through samplers clamping the level into `[0.75, 2.5]` and `[0.3, 2.7]`; and where a
|
||||
//! sampler minifies and magnifies with different filters (a 16x16 texture of distinct texels).
|
||||
//! Metal's compiler builds no kernel that samples with `min_lod_clamp` (its device compiler
|
||||
//! stops), so a clamp beside a bias is not measured; nor is a texture of one level, where the
|
||||
//! clamp into its levels would decide the filter of a sampler whose filters differ.
|
||||
//! stops), so a clamp beside a bias is not measured.
|
||||
//!
|
||||
//! **A texture of one level** (an Apple M3 Max on macOS 27.0.1): a 16 x 4 `rgba8Unorm` texture of
|
||||
//! one level sampled through runtime samplers without a mip filter whose filters differ
|
||||
//! (minifying nearest and magnifying linearly, and the reverse), clamping the level into `[0,
|
||||
//! FLT_MAX]`, a quarter of a texel past each texel's centre toward its right neighbour (60
|
||||
//! positions), at `level(x)` and at a kernel's `bias(x)` for `x` of -2, -0.5, 0, 1/64, 1/4, 1/2, 1,
|
||||
//! 2 and 5: every sample at -2, -0.5 and 0 is the magnification filter's, and every sample at 1/64
|
||||
//! and above the minification filter's. So the choice is made before the clamp into the texture's
|
||||
//! levels, which would have magnified at every level. A level between 0 and 1/64 (`q` of 0) on a
|
||||
//! texture of one level is not measured. No sample this module's levels serve takes the choice: an
|
||||
//! extended-range sample's constexpr sampler has one filter for both (`select`), and a runtime
|
||||
//! sampler's word whose filters differ reads nearest (`extended`'s open gap).
|
||||
//!
|
||||
//! **A depth comparison** reads its level by the same rule through a runtime, an argument
|
||||
//! buffer's, and a constexpr sampler alike (2,048,400 comparisons at 1,707 levels through nearest
|
||||
@@ -39,8 +53,10 @@
|
||||
//! sampler's `[minLod, maxLod]` (the same level clamp), at its own precision: a nearest mip filter
|
||||
//! reads `ceil(λ + 1/2) - 1` (rounding `L + 1/2` either way is the implementation's), a linear one
|
||||
//! blends `floor(λ)` and the next level by `λ`'s fraction to `mipmapPrecisionBits` (at least 6 on
|
||||
//! the measured venues), and `λ <= 0` magnifies. A sample the device makes takes the device's
|
||||
//! level (`PrecisionNote::DeviceSampling` on a device whose sampler is not Metal's).
|
||||
//! the measured venues), and `λ <= 0` magnifies, `λ` before its clamp into the view's levels, as
|
||||
//! Metal's level before the clamp into the texture's levels chooses. A sample the device makes
|
||||
//! takes the device's level (`PrecisionNote::DeviceSampling` on a device whose sampler is not
|
||||
//! Metal's).
|
||||
//!
|
||||
//! **A runtime or argument buffer's sampler** holds its clamp as `f32`s, not `half`s (Apple M4 on
|
||||
//! macOS 27.0.1: all 37,080 lanes of `level(x)` and a kernel's `bias(x)` through eighteen clamps,
|
||||
|
||||
Reference in new issue
Block a user