4:2:2 twins hold the device's own conversion where it has Metal's reconstruction; planes read
in place are sampled through the device's Y'CbCr sampler where the driver lays them out as the
surface does; RADV's 10-bit conversion recorded as reading codes as words. With development's
golden re-bless after the native landings. SEMANTICS 1911, ARTIFACT 477, RUNTIME 1683.
One work packet, landed as 6 commit(s) (a1088b2c2e..67dc5650e1 on archive/development-linear-2026-10-28-evening), in order:
* Hold a 4:2:2 texture's twin as the device's own conversion where it converts the format
A GBGR422 or BGRG422 texture reads a decoded twin of 8-bit codes on every device: Vulkan views
G8B8G8R8_422_UNORM and B8G8R8G8_422_UNORM only through a sampler Y'CbCr conversion, which no
pipeline's layout bakes. Until now the twin always held Metal's decode, (3c + n + 2) >> 2, computed
by the runtime's own kernel or on the CPU, even where the device converts the format itself.
Now, where the device converts the pairs' format with Metal's reconstruction (its optimal tiling
reports SAMPLED_IMAGE, TRANSFER_DST, MIDPOINT_CHROMA_SAMPLES and a linear chroma filter, and the
width is even), the twin holds the device's conversion:
- each decode pass copies the written rows' pairs out of the carrier into the scratch, then into
a per-texture image of the 4:2:2 format, and samples it through the device's conversion (the
identity model at full range) into the band's texels, which go into the twin;
- the kernel is the new bind::chroma_sample_module (ChromaSampleModule), a sample at each luma
texel's centre at level 0, each channel stored as roundEven(clamp(c, 0, 1) * 255);
- such a carrier takes no host or staging copies, so every write's decode is a GPU pass and no
texel of the twin is the CPU's decode;
- counted in WorkCounts::chroma_device_twins and chroma_device_decodes, and announced
decoded-texel-precision (the catalogue's cost text says so).
Elsewhere the twin keeps Metal's decode, as capability. The FAST-PATHS device-gaps table has the
row.
Venues (from the formats' features): MoltenVK 1.4.2 converts both formats (its single-plane 4:2:2
reconstruction is Vulkan's); lavapipe filters their chroma nearest only; RADV (Mesa 26.2.4, 780M)
reports neither format.
Verified:
- clippy -D warnings, plain and --cfg m2v_gpu, for metal2vulkan and metal2vulkan-runtime;
- chroma_decode unit tests (the sample module is valid on every committed profile), fast_paths,
the degradation catalogue tests, api_surface and api_signatures (table blessed: the new module,
ChromaDecode::format and the two WorkCounts fields);
- M3 Max (MoltenVK 1.4.2): tests::ycbcr_device::a_four_two_two_twin_holds_the_devices_conversion...
took the device route for both formats (twins 1, passes >= 2, no CPU decode, announced once);
chroma within 0.5000 codes of Vulkan's (3c + n) / 4 on 40 x 24 random pairs (the test also
prints how many chroma codes differ from Metal's; that line is compiled and clippy-clean, not
yet run);
runtime_lane::chroma_pairs (5 tests) pass, the read lane checking green exactly and red and
blue within 1/255 of Metal's on the device route;
- lavapipe (arm64 linux-gate, m2v_cpu_icd): the same runtime test and the five chroma_pairs lane
tests pass; no 4:2:2 texture took the device route (twins hold Metal's decode, exactly);
- RADV 780M: not run (host away).
docs/REFUSALS.md regenerated: unchanged. runtime-sources.sha256 updated; the RUNTIME_VERSION
bump is in the versions commit.
* Record that RADV's 10-bit Y'CbCr conversion reads codes as words
RADV has the same defect lavapipe has (RuntimeDriverDefect::TenBitCodesReadAsWords): a sampler
Y'CbCr conversion of G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16 reads each code's 16-bit word as a
16-bit UNORM value, its six unused low bits included, where Vulkan converts the 10-bit code as
c / 1023.
Evidence: a bare Vulkan probe on the Radeon 780M (RADV, Mesa 26.2.4) read luma code 1023 (low bits
0) through the identity model of a LINEAR image of the format as 0.999039, which is 65472 / 65535
and not 1.0. The optimal tiling's conversion of the format was not measured; the row is per
driver, as the defect table's rows are.
What changes: the AFFECTED table gains a MESA_RADV row, with no clean GPU. Nothing is refused.
- A 10-bit two-plane texture on RADV now converts through Metal's arithmetic. Before, RADV's
optimal-tiling device conversion (ycbcr_device.rs) took it, and that path was never measured on
RADV.
- The planes image of the next commit is not taken for 10-bit codes there.
The driver_defects test expectations (every committed RADV profile, Hawk Point's 780M) and the
docs that name the defect's drivers (ycbcr.rs, ycbcr_device.rs, docs/API.md) say RADV too.
Verified: clippy -D warnings (plain and --cfg m2v_gpu) for metal2vulkan, metal2vulkan-runtime and
metal2vulkan-validation; tests::driver_defects on the host. The RADV device itself was not run: the
host is away.
* Sample YCbCr planes read in place through the device's own Y'CbCr sampler where it has Metal's reconstruction
On an integrated GPU or a CPU device, a function that only samples a YCBCR8_420_2P or
YCBCR10_420_2P texture reads the planes in place through a uniform texel buffer. It converts and
filters them with Metal's fixed-point arithmetic in the shader. Where the device converts the
planes' 4:2:0 format as a linear image with Metal's reconstruction (midpoint chroma through a
linear chroma filter), rule 1 makes the device's own conversion the only form. So such a slot now
samples the planes through the device's sampler Y'CbCr conversion. Elsewhere the texel buffer
read stays, as capability.
Translator (metal2vulkan):
- bind::YCbCrPlanesSampler (new, non-exhaustive) holds the conversion: the codes' bits and the
surface's range and matrix. It also gives the image's format: G8_B8R8_2PLANE_420_UNORM, or
G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16.
- YCbCrInPlace::with_planes_image, ::sampler and ::planes_sampler. TextureShape::Texture gains
ycbcr_planes_sampler.
- RuntimeFact::YCbCrInPlace gains `device`: the device's sampler takes every sample of the slot.
It does not where a constexpr sampler has a border address mode, or a texel offset is placed by a
parent's size.
- VariantKey and LoweringInputs gain ycbcr_planes_sampled. The binder fills it from slots with
`device`, bound to a texture that holds the image, whose runtime sampler words have no border
mode on s or t.
- Such a slot is declared as a combined image sampler: ResourceKind::YCbCrPlanes and
BindingSource::YCbCrPlanes, written from WriteSource::YCbCrPlanesImage. Its immutable sampler is
the new vk::SamplerDesc::ycbcr: linear, clamp to edge, lod 0, and a new `ycbcr` field.
- Each sample (lower/sampler/in_place.rs device_sample) is OpImageSampleExplicitLod at level 0:
- a linear sample takes Metal's coordinate, with its texel offset moved in texels;
- a nearest one takes the centre of the luma texel Metal reads, clamped to the edge;
- pixel coordinates and the filter are known when the module is made (constexpr) or read from
the runtime word;
- a half result is rounded to a half, as every sampled texel's is.
- The texel buffer stays the slot's resource otherwise. The planes read use is tracked as before.
Runtime (metal2vulkan-runtime):
- YCbCrFormats queries the two 4:2:0 formats' LINEAR tiling: SAMPLED_IMAGE,
MIDPOINT_CHROMA_SAMPLES, a linear chroma filter, and the limits and
combinedImageSamplerDescriptorCount.
- YCbCrSampler::planes gives the conversion. It is None under TwoPlaneChromaMisplaced, and for
10-bit codes under TenBitCodesReadAsWords. holds_planes checks for an even size within the
limits.
- texture/ycbcr_planes.rs (new) makes a PREINITIALIZED linear image of the format over the planes'
bytes, and only in memory the runtime allocated. It is made only where:
- the luma plane comes first;
- the driver's PLANE_0 and PLANE_1 subresource layouts are the surface's offsets and pitches;
- the alignment, the type and the room within the buffer fit.
Its view and every immutable sampler of it share one VkSamplerYcbcrConversion
(Device::made_ycbcr_conversion, kept in the owned kernels' map), so the two are identically
defined (VUID-VkWriteDescriptorSet-descriptorType-02738). Its first move rides the next
submission (Fresh, never rebindable), and it is announced ycbcr-filter-not-exact.
- Fresh pages, no-copy pages and the caller's VkBuffer keep the texel buffer. An image bound to
imported memory starts UNDEFINED, and the in-place check covers that first move for single-plane
images only.
- The texture's facts state the image (with_planes_image). binding.rs writes the view in GENERAL
under the layout's immutable sampler.
- sampler_set chains the conversion into each SamplerDesc::ycbcr sampler. A non-pushed set 0
reserves combinedImageSamplerDescriptorCount descriptors per such binding.
- WorkCounts gains ycbcr_planes_images, ycbcr_planes_images_kept_{conversion,memory,layout} and
ycbcr_planes_images_bound.
Venues (from the formats' linear features):
- Radeon 780M (RADV, Mesa 26.2.4): reports the 8-bit route for rows 256 bytes apart. Its 10-bit
codes carry TenBitCodesReadAsWords (previous commit).
- MoltenVK 1.4.2: TwoPlaneChromaMisplaced.
- lavapipe: its 4:2:0 conversion is cosited only.
Measured before building, through a bare Vulkan probe on the 780M with 8-bit codes:
- luma centres within 0.0003 codes of Vulkan's model, and points between texels within 0.66
codes;
- Metal's conversion-then-filter differs by up to 54/255 between texels of random planes;
- GPU time, 3840x2160 composited into 1680x1050: 248 us against the texel buffer's 340 (1 pass),
741 against 1027 (3 passes).
The runtime's path itself is not measured on a device that takes it: the 780M host is away.
Docs: a FAST-PATHS device-gaps row (the device's route, where the texel buffer stays, and why);
the in-place paragraph; docs/API.md (the pipeline interface paragraph, and the notice's catalogue
entry); module docs (ycbcr.rs, ycbcr_device.rs, ycbcr_image.rs); the api_surface table
(YCbCrPlanesSampler N); api_signatures blessed.
Tests:
- bind::ycbcr_in_place::the_planes_sampler_is_the_conversion_word.
- bind::plan::slots::the_planes_image_variant_takes_a_slot_the_device_s_sampler_reads.
- tests::engine_ycbcr_in_place::a_planes_image_slot_samples_through_the_device_s_conversion: the
lavapipe and M3 profiles; linear, nearest, pixel, offset and runtime samplers, each half and
float. Each case links and validates, with one OpImageSampleExplicitLod. Border and repeat-offset
slots state device false.
- Lane runtime_lane::ycbcr_in_place::a_ycbcr_texture_s_planes_image_samples_through_the_device_s_conversion
covers surfaces whose rows are 256 bytes apart. Each in-place texture is counted exactly once,
as an image or by why not. Through the image, nearest samples are Vulkan's conversion within the
device's bound, announced; without it, Metal's texels through the texel buffer, unannounced.
Verified:
- clippy -D warnings, plain and --cfg m2v_gpu, for metal2vulkan, metal2vulkan-runtime and
metal2vulkan-validation.
- Host, plain target, the touched selection (ycbcr, fast_paths, api_surface, api_signatures,
codec, slots, api_tests, the inputs encoding, sampler, ash_interop, driver_defects, degradation,
vk tests): 408 run, 407 passed. The engine test's half cases failed, because a half result was
an f16 where a sample holds it widened. They now take narrow::round_texel, and the in-place
engine tests pass, 4 of 4.
- M3 Max (MoltenVK 1.4.2), runtime and validation, ycbcr|chroma|driver_defects|runtime_sources:
66 run, 64 passed. The planes image test counted [0, 1, 0, 0] for both surfaces (kept for the
conversion: TwoPlaneChromaMisplaced), bound the texel buffer and read Metal's texels. The two
failures:
- the runtime-sources pin, re-pinned in the versions commit;
- runtime_lane::ycbcr_textures::a_ycbcr_sample_through_an_unmeasured_filter_is_announced
(anisotropic through a constexpr sampler), which fails the same way at the base, as
a1f1677174 recorded.
The 4:2:2 test's new line: GBGR422 and BGRG422 chroma within 0.5000 codes of Vulkan's, and
0 of 1920 chroma channels a code off Metal's.
- lavapipe (linux-gate arm64, --cfg m2v_cpu_icd), the same selection without the pin: 66 of 66.
The planes image test counted [0, 1, 0, 0] for both surfaces (cosited only).
- Radeon 780M, the only venue whose features take the route: not run, the host is away. The
device route's lane test, its notice and its GPU time against the texel buffer are unverified
through the runtime.
* Bump the cache versions for the 4:2:2 device twins and the YCbCr planes images
- SEMANTICS_VERSION 1908 -> 1909: the translator emits something new under keys that existed
before. A two-plane YCbCr in-place slot's RuntimeFact::YCbCrInPlace now states `device`, and
ycbcr_planes_sampled lowers such a slot as a combined image sampler sampled through the device's
Y'CbCr conversion.
- ARTIFACT_FORMAT_VERSION 475 -> 476: the encoding changed. RuntimeFact::YCbCrInPlace gains
`device`, SamplerDesc gains `ycbcr`, ResourceKind and BindingSource gain YCbCrPlanes, and the
YCbCrPlanesSampler struct is new.
- RUNTIME_VERSION 1681 -> 1682: a run of an unchanged artifact may now do something else.
- A 4:2:2 texture's twin holds the device's conversion where the device converts the format.
- RADV's 10-bit two-plane textures convert through Metal's arithmetic (TenBitCodesReadAsWords).
- The runtime makes planes images where the device converts the 4:2:0 format as a linear image
with Metal's reconstruction.
- Pools reserve combinedImageSamplerDescriptorCount for planes samplers.
runtime-sources.sha256 is re-pinned over this branch's runtime inputs:
d520b4179f55291b57dc7ffd5182ea5f37790889c768b9d49914f174f428ce7c. This is the fingerprint the
validation build script computed at the tip's tree.
These are lane numbers. The orchestrator renumbers them at landing.
* Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
* Re-bless the golden hashes on development after the native landings
Two rows of golden_hashes.tsv move: the RADV profile's cells, whose
16-bit-depth bias and tile-store answers the boundary-case commits made the
device's own (SEMANTICS_VERSION 1910, then 1911 with the YCbCr commits). The
engine inventory and the engine golden printouts blessed with no change.
The YCbCr versions commit (569d988e99) names SEMANTICS 1909, ARTIFACT 476
and RUNTIME 1682, the values it was written with on 8b7a8aa2d8. On
development they collided with the 16-bit half output's 1909/476 and the
boundary cases' 1682, so the landing set them to SEMANTICS 1911,
ARTIFACT_FORMAT_VERSION 477 and RUNTIME_VERSION 1683; the commit's text was
not rewritten.
Verified on macOS at 465e0eb538: bless_engine_inventory,
bless_golden_hashes and bless_engine_goldens pass; the conformance crate's
suite 1007/1007.