Files
metal2vulkan/docs
Anees Iqbal 669d756fd7 Make a texture buffer over a surface's plane at an offset or pitch off 16
What. Buffer::new_texture_with_iosurface_plane makes a TextureBuffer
over a plane of a surface with planes whose offset or bytesPerRow is
off 16 bytes, where it answered NotImplemented(SurfacePlaneShape). Its
texels are placed from the plane's CPU layout (placed.cpu) and go
through into_texture_buffer as a buffer's texture buffer does: its CPU
calls at the plane's offset, its functions from the offset rounded down
to 16. A BC texture off 16 stays refused. SurfacePlaneShape's doc, the
module's Beyond the plane's rows, BufferRefusal::PlaneShape and
FAST-PATHS.md's known gap say so.

Why. Metal makes it, in one place a path. On the M3 Max under macOS
27.0.1 (probes/surface_texture_envelope.m's bgraat8.texbuf.64,
bgraat8.texbuf.128 and bgrarow264.texbuf.128, job m3-max-4776) its
kernels read texel i from the offset rounded down to 16 plus i texels,
and getBytes and replaceRegion from the offset, at a 264-byte pitch as
at 256: the layout a texture buffer over a buffer already has in the
runtime. What Metal lays out in one place stays in place.

Tests: tests::surface_shapes::textures_over_surfaces_take_the_bytes_metal_does
gains the three probe shapes over a plane at offset 8 and at 264 bytes a
row; a kernel's reads are checked against the rows from the offset
rounded down to 16 (gpu_rows_of), the CPU's from the offset. linear_plan's
a_surface_plane_s_other_shapes_follow_the_probe places offsets 36, 8 and
pitch 264 (CPU offset kept, GPU offset rounded down); its refused row
for an off-16 texture buffer goes.

Verified (same tree content on the previous base, replay-27 9a1a8abf1d):
lavapipe on homelab-gem10-1 (m3-max-4868): runtime lane 174/174 with
surface_shapes passing; negative control, the runtime's sources at the
base with these tests: surface_shapes fails.
Re-checked on this base by the
branch's check job.

(cherry picked from commit 5da259d2aa40580e62ec41a0aa98a06664521b43)
2026-11-07 12:44:46 -08:00
..