Files
metal2vulkan/docs
Anees Iqbal 8f2f973478 Announce a runtime sampler slot's YCbCr filter note only where the bound sampler filters
What: a filtered sample's note of a two-plane YCbCr format through Metal's own sampler
(`PrecisionNote::HalfSampleFilter`, `FloatSampleFilter`, announced `ycbcr-filter-not-exact`)
through a runtime sampler slot now holds only where the word of the sampler bound there filters.
`lower::sampler::linear::filter_note` crosses the bound-format clauses with two tests of the bound
word (`NoteOn::BoundSampler`, `SpecKey::BoundSamplerWord`, which the plan already records for
noted keys): a linear min or mag filter, anisotropy or a cubic filter (any of those bits), or a
linear mip filter, the constexpr rule `linear::unfiltered` read from the word. A constexpr
sampler keeps its rule; an argument buffer's sampler, whose word no slot test reads, keeps the
format-only clauses.

Runtime: such a clause tests a bound value, so `Device::degrade_bound_values` reads it at each
draw or dispatch. It now also answers `SpecKey::BoundTexelFormat` from the command's formats (the
class `bound_texel_format` gives; a slot bound to nothing fails the clause, as
`degrade_bound_formats` reads it; unknown formats hold), checks a filter note's kind as
`ycbcr-filter-not-exact` (one atomic load once announced), and `degrade_clauses` announces a
filter note's slot of unknown format (an execution of GPU-written commands) as that kind, naming
"a format the GPU's commands bind", as `degrade_bound_formats` does. Which clauses hold stays a
function of the plan (the shape it is planned for holds each bound format and sampler word), so
render.rs's `QuietBoundValues` holds.

Why: a runtime sampler slot announced the note whatever its sampler state, so a nearest runtime
sampler on a texture that keeps its image (a 4:2:2 or 4:4:4 one on the M3) announced it though
a nearest sample reads the one texel the view holds, Metal's read; the consumer runs notes fatal
on Apple GPUs.

Validation: `run_kinds` (degrade_notices) evaluates the bound formats through the same closure,
and `bound_value_kinds` maps a filter note to `ycbcr-filter-not-exact`.

Tests: `tests::engine_ycbcr_in_place::a_runtime_sampler_s_filter_note_holds_only_where_the_bound_word_filters`
(clauses on moltenvk-m3 hold for linear min, mag, mip and anisotropic words over YCbCr formats,
not for nearest words or other formats; lavapipe records none) and the lane test
`runtime_lane::ycbcr_textures::a_runtime_sampler_announces_the_ycbcr_filter_only_where_it_filters`.

Docs: the notes' rustdoc, `YCbCrFilterNotExact`, docs/API.md's two entries.
SEMANTICS_VERSION 1973: the artifact's specialized notes change (no SPIR-V changes).

Verified: cargo fmt; builds and runs follow.
(cherry picked from commit d464b1d36f998cd8c69a9f2c9252288df64d13d9)
2026-11-05 21:13:11 -08:00
..