What. Buffer::new_texture_with_iosurface_plane over a plane of a surface
with planes makes three shapes it answered
NotImplemented(SurfacePlaneShape) for:
- a 2D texture of more than one level, a 3D texture and a 2D multisample
one, of a colour format (linear_plan::apart_from_plane: is_linear and
tail_held): a texture of the device's own memory
(Device::surface_texture_apart), zero when made in every storage mode,
a Private one's too (texture.rs's new Fresh::Zero start, which skips
Metal's fresh pattern and the uncounted held start), announced by the
new Degradation::SurfaceTexelsApart ("surface-texels-apart",
precision). A Memoryless one stays MemorylessSurfacePlane.
- a 2D array of more than one slice, of a colour format, over a plane
whose offset and bytesPerRow are multiples of 16
(linear_plan::slices_apart): its first slice over the plane as a 2D
texture's rows, its others in a tail of the texture's own. The planner
lays the slices one image apart and gives Placed::kept, the second
slice's first byte (or the buffer's length where that comes first);
Texels::kept cuts the tail there instead of at the buffer's length
(with_tail, past, staging), so the shadow's copies, blits and CPU
calls take slice 0 from the plane and the rest from the tail.
Announced by SurfaceTexelsTail, whose doc and cost now name both
cases.
Why. Metal makes these, and on the M3 Max under macOS 27.0.1
(probes/surface_texture_envelope.m, job m3-max-4776) it lays them out in
no one place: bgra1x2.mips2/mips7, 420v.p0.mips2, bgra1x2.3d.d2,
420v.p0.3d.d2 and bgra1x2.2dms4.private read level 0 or slice 0 by blit
and kernel from other bytes than its blits, replaceRegion and getBytes
put there; bgra1x2.2darray.a2 and .a2.64x64 keep slice 0 over the plane
on every path while slice 1 is read at the plane's offset by blits and
getBytes, one image on by kernels, and written at the plane's offset.
By the rule of 9ee7323e76 what lies in one place stays in place and the
rest goes in memory of the texture's own, announced (the orchestrator's
option A). The x86 Macs under macOS 26.7.1 keep level 0 and slice 0 of
the first shapes over the plane; API.md's accepted differences records
that the runtime does not.
Docs: API.md's catalogue (the new kind, SurfaceTexelsTail rewritten) and
two accepted differences (sliced arrays; mipmapped/3D/multisample);
FAST-PATHS.md's known gap; SurfacePlaneShape's, PlaneShape's and the
plane call's docs; REFUSALS.md regenerated; api_signatures.tsv blessed.
Tests: tests::buffer_tail_device::an_array_over_a_plane_keeps_its_second_slice_in_its_tail
(64x32x2 RGBA8 over a 32768-byte plane: slice 0 the plane's bytes and
slice 1 zero on get_bytes, blit and a kernel through 2D views; kernel,
CPU writes read back on every path; the plane past slice 0 and the
buffers around unchanged; one notice) and
a_plane_s_texture_metal_lays_in_no_one_place_lies_apart (2 levels, 3D of
depth 2, 4-sample Private; level 0 zero, levels and slices written and
read back, no byte of the surface changes, one notice);
validation lane a_mipmapped_plane_lies_apart_and_is_announced, listed in
degrade_notices; linear_plan table rows for apart and sliced shapes,
their kept cut, and the off-16 and depth arrays still refused.
Verified by potluck jobs at this commit (clippy plain and m2v_cpu_icd,
runtime unit tests, lavapipe runtime and validation lanes, a negative
control at the runtime sources before it); results in the tip's report.
(cherry picked from commit 463cd6b9ecccc9e0b4263d8ac2452190f0287241)