Files
metal2vulkan/docs
Anees Iqbal 6eb2a66d6e Gather a two-plane YCbCr texture's planes in place
A function that samples a YCBCR8_420_2P or YCBCR10_420_2P texture and also
gathers it (a probe asking each lane for a sample or a gather of red or
blue) lost the in-place form for the whole slot: `in_place_sample` built no
gather, so the gather set `in_place.blocked`, the slot bound the converted
image, and on MoltenVK its linear samples went through Metal's sampler of
RGBA16F-like texels: `ycbcr-filter-not-exact` (Half/FloatSampleFilter), and
through a pixel sampler `pixel-sampler-scaling`. Those notes killed three
of a consumer's strict Mac tests.

What: the in-place form now builds a 2D gather of a component without
comparison, constant offset or none, through a constexpr sampler (either
filter: a gather follows none) or a runtime one. The gather is the
extended-range emulation's `gathered` over `Decode::InPlace` taps: the four
taps of the linear footprint, each the texel Metal reads there (the border
texel past a border axis), in Vulkan's order, a runtime sampler's word
mapped as a 4:2:0 texture addresses. A gathered slot stays off the device's
own Y'CbCr conversion (`device: false`):
VUID-RuntimeSpirv-OpTypeSampledImage-12206 admits only samples through it.
No Quad routine for a gather. SEMANTICS_VERSION 1962 (facts and modules of
gathered slots change).

Tests (engine_ycbcr_in_place): every gather of each component of random
8- and 10-bit planes under three conversions, constexpr and runtime
samplers, float and half, on the lavapipe and moltenvk-m3 profiles, equals
Metal's model taps on the interpreter; a gather states the in-place fact
with `device: false`; a function that samples and gathers through one
runtime sampler notes FloatSampleFilter/HalfSampleFilter on its image
compile and states the fact, and its in-place compile builds both forms and
notes neither those nor PixelSamplerScaling. Device evidence against
Metal's rows follows with the fixture and conformance cases.

Docs: API.md and FAST-PATHS (in-place reads and the planes-image row),
RuntimeFact::YCbCrInPlace, InPlaceReads, the runtime README.
(cherry picked from commit b95b95a355f9a8ff4c1bfacbf329a728c4896db9)
2026-11-05 02:08:27 -08:00
..