Files
metal2vulkan/docs
Anees Iqbal d946043cc5 Lay a heap's one-plane YCbCr rows off 16 bytes as Metal's blits do, sharing bytes
Item 2 laid a heap's one-plane YCbCr texture whose row is not a multiple
of 16 bytes in packed rows and announced heap-one-plane-layout. Metal's
blits lay such a row, where it is 16 bytes or more, the row rounded down
to 16 bytes apart, so consecutive rows share its last row % 16 bytes,
and its copies out read each row whole from there (an Apple M3 Max under
macOS 27.0.1, probes/one_plane_ycbcr_heap_rows.m, m3-max-5064: 10 x 3,
12 x 3, 13 x 7, 20 x 3, 33 x 3 and 100 x 30 at 4:2:2, 10 x 3, 13 x 7 and
33 x 3 at 4:4:4, and a 13 x 7 x 3 array, whose slices lie as its answer
counts them; each last byte written matches this layout's span). That
layout is one we can read, so the runtime now takes it.

heap_plane_layout gives a one-plane plane one_plane_pitch: row - row % 16
for a row of 16 bytes or more in more than one row, a packed row else;
an array's slices stay where the answer counts them. heap_planes returns
the copies into the shadow's image and back out of it apart
(PlaneCopies); a plane whose rows share bytes takes plane_copy_regions,
the copies an IOSurface plane whose GPU rows share bytes takes: into the
image each row whole from its own offset in two regions a slice, the
shared bytes read for both rows; back each byte once, a shared one from
the earlier row. Metal's blits leave the shared bytes from no one row
(the even rows' at 10 x 3, 12 x 3, 20 x 3 and 13 x 7, the later row's at
33 x 3, the earlier row's at 100 x 30); the earlier row's is one of
them, said in docs/API.md's accepted differences.

Still announced heap-one-plane-layout: rows under 16 bytes, which Metal
lays 16 apart past the answer and whose copies out read none of the rows
past the first back, and mipmapped and 3D textures. The notice's doc,
cost and catalogue entry say so.

Tests: tests::heap's a_heap_one_plane_texture_s_rows_lie_as_metal_s_blits
_lay_them (no device) holds the pitches, slice pitches and spans to the
probe's for eight shapes, every texel read into the image from its own
offset, and every byte written back once, a shared one from the earlier
row; the device test heap_one_plane_rows lays 13 x 7, 33 x 3 and a
13 x 7 x 3 array at 4:2:2 and 4:4:4 in the heap's bytes as Metal does
with no notice, and announces a 6 x 3; the lane test makes a 13 x 7 with
no notice and announces a 6 x 3 and a mipmapped one.

(cherry picked from commit ff300cc511502049e318d113015a5e2c14cb4645)
2026-11-07 15:23:32 -08:00
..