A half sample of a 32-bit float texel records no half-texel note where the device's half is Metal's

What: half_texels' clause for a sample of a 32-bit float texel (Bound & BicubicTexels::LINEAR,
'Metal rounds toward zero, saturating') is no longer added on a profile that takes
DriverDeviation::MetalHalfConversion; the module then requires VkProperty::MetalHalfConversion
(TexturePlan::storage_properties), as half_texel_nans' NaN clauses do since 782da3582b. Elsewhere
the clause stays. The unmeasured-class and 16-bit normalized clauses are unchanged.

Why: on MoltenVK over the M3 Max a half sample of RGBX32Float through a runtime sampler (the
consumer's rgbx_sample_half) announced half-texel-conversion ('where it binds texture 0 bound as
RGBX32Float') while every value was Metal's. The deviation's measurement covers the half result
of a read, sample and gather of every float word of RGBA32Float (half-texel-nans-rgba32f,
m3-max-13447: every value Metal's), and RGBX32Float is held in that twin.

Test: runtime_lane::rgbx_textures::rgbx_half_samples_are_metals (the previous commit): nearest and
linear runtime samplers, edge and border, shared and private, RGBX32Float and RGBA32Float; on a
profile of MetalSampler and MetalHalfConversion no half-texel-conversion may be announced.
Docs: the note's rustdoc and API.md's catalogue entry. SEMANTICS_VERSION 2019.

Verified: the M3 run of the control and of this commit follows.
(cherry picked from commit bb5662fd6d9bb512bc8d185c85a5d7098b1f2d9d)
This commit is contained in:
Anees Iqbal committed 2026-11-10 05:50:50 -08:00
1 parent 0ac33a5457
commit 199f9a99a2
4 files changed
+27 -6

No files matched your search

+1 -1
View File
@@ -60,7 +60,7 @@ mod tests;
/// unchanged version, and its bless records the version. Independent of the crate's version and of
/// [`ARTIFACT_FORMAT_VERSION`]. The commit that bumps it says what changed; this comment keeps no
/// history.
pub const SEMANTICS_VERSION: u32 = 2018;
pub const SEMANTICS_VERSION: u32 = 2019;
/// The byte-layout version of encoded artifacts (`CompiledFunction::to_bytes` and the
/// [`PipelineArtifact`] encodings). Every encoded artifact carries it, and a decode under another
+19 -2
View File
@@ -1630,7 +1630,10 @@ pub enum OneTexel {
/// none of the families (the slot's `UnmeasuredTexels` specialization), a 16-bit normalized grid
/// (`BicubicTexels::WIDE16`: three steps of each round twice), and a sample of a 32-bit float
/// texel (`BicubicTexels::LINEAR`: Metal rounds toward zero, saturating), tests of the bound
/// format the runtime announces at a draw or dispatch binding such a texture. A heap color
/// format the runtime announces at a draw or dispatch binding such a texture. Not a sample's of a
/// 32-bit float texel on a profile that takes `DriverDeviation::MetalHalfConversion` (the module
/// then requires its property): there the device's `half` of every `float` word a read, sample or
/// gather hands back is measured to be Metal's (`device::driver_facts`). A heap color
/// texture's and a depth texture's access records it outright.
pub(crate) fn half_texels(
cx: &mut SelectCx<'_>,
@@ -1657,8 +1660,22 @@ pub(crate) fn half_texels(
[NoteTest::equal(NoteOn::Unmeasured(index), 1, 1)].into(),
[NoteTest::differ(NoteOn::Bound(index), B::WIDE16, 0)].into(),
];
// A sample of a 32-bit float texel, but on a profile that takes
// `DriverDeviation::MetalHalfConversion`, whose `half` of every `float` word a read, sample or
// gather hands back is measured to be Metal's (the module then requires its property).
if sample {
when.push([NoteTest::differ(NoteOn::Bound(index), B::LINEAR, 0)].into());
match cx
.profile
.takes_driver_deviation(DriverDeviation::MetalHalfConversion)
{
true => {
cx.families
.texture
.storage_properties
.insert(crate::device::requirements::VkProperty::MetalHalfConversion);
}
false => when.push([NoteTest::differ(NoteOn::Bound(index), B::LINEAR, 0)].into()),
}
}
cx.note_when(PrecisionNote::HalfTexelConversion, when, m)?;
let slot = slot_of(cx, index)?.slot;
+4 -1
View File
@@ -1046,7 +1046,10 @@ pub enum PrecisionNote {
/// result, and its nearest even `half` is Metal's `half` but for the classes the note is
/// recorded under, by the slot's bound format (`SpecKey::TexelFormat`): a 32-bit float
/// texel's sample, which Metal rounds toward zero (within one `half` ulp, but past `±65504` the
/// infinity of its sign where Metal saturates to `±65504`); a 16-bit normalized texel, whose
/// infinity of its sign where Metal saturates to `±65504`), but on a profile that takes
/// [`DriverDeviation::MetalHalfConversion`](crate::error::DriverDeviation::MetalHalfConversion),
/// whose `half` of every `float` word a read, sample or gather hands back is measured to be
/// Metal's (the module then requires `VkProperty::MetalHalfConversion`); a 16-bit normalized texel, whose
/// `float` steps `65455 / 65535`, `65519 / 65535` and `32759 / 32767` round twice (one `half`
/// ulp); and a format whose conversion is not measured (unbounded). A heap element and a depth
/// texture record it wherever they are accessed. A two-plane YCbCr texture on the grid `8192`
+3 -2
View File
@@ -3733,8 +3733,9 @@ bound.
rounded to nearest even on every device: within one `half` ulp of Metal's, but a 32-bit float
texel's sample past `±65504`, the infinity where Metal saturates. On MoltenVK, whose `float`
texel is Metal's, announced at a draw or dispatch that binds a texture of a class whose Metal
`half` differs from it (a 32-bit float texel's sample, a 16-bit normalized texel, a format not
measured) and a two-plane YCbCr texture on the grid `8192` at a slot sampled through a runtime
`half` differs from it (a 32-bit float texel's sample, but where the profile takes
`DriverDeviation::MetalHalfConversion`, measured on the Apple M3 Max to answer Metal's `half` of
every `float` word; a 16-bit normalized texel; a format not measured) and a two-plane YCbCr texture on the grid `8192` at a slot sampled through a runtime
sampler (a sample of one texel is the device's rounding of its step: toward zero on MoltenVK
1.4.2 over the Apple M3 Max, within one `half` ulp of Metal's ties-away rounding, measured over
8,409 channels; unmeasured on other Apple GPUs); a heap element or a depth texture wherever it