Write a blit's rows out of a texture below their row in turn, the later row's bytes standing

A copy out of a texture at a bytesPerRow below the region's row was refused
Invalid(Copy(BytesPerRow)), as Metal writes such overlapping rows in no
one order. Metal runs the copy, though, so under rule 2 it may not fail:
on the Apple M3 Max under macOS 27.0.1 (probes/short_row_blits.m, jobs
m3-max-5158 and 5170) every such copy returned, rows lay y x bytesPerRow
apart with nothing past their span written, and of 300 shapes of 12
formats at half the row about a fifth left the later rows' bytes
standing. The later row's bytes are one of Metal's own answers.

placed_rows no longer refuses the copy out at a pitch below a row; the
rows are placed as a copy out at any other pitch off Metal's rules is,
and plan_placed_copy's later_rows_win writes them in turn: the texture
goes to a packed staging buffer in one region, and the staging rows go
to the buffer in one vkCmdCopyBuffer whose destination regions are each
row's bytes no later row writes, disjoint as VUID-vkCmdCopyBuffer-
pRegions-12482 asks, one region a row. No buffer-image region states a
row length below the width (VUID-VkBufferImageCopy-bufferRowLength-09101).

Still refused: a multisampled texture's copy out at such a pitch (where
Metal places its rows there is not measured), a texture over a buffer,
and depth and stencil formats but Depth32Float, as before.

docs/API.md's accepted differences say so; CopyProblem::BytesPerRow's
doc and basis lose the case and REFUSALS.md is regenerated.

Tests: blit_plan's layouts test takes the copies out at a pitch below the
row (rows at y x bytesPerRow); a_copy_out_at_a_pitch_below_the_row_leaves
_the_later_rows (blit_plan, no device) checks the unstaged bytes for a
one-plane YCbCr texture at its described row, RGBA8 at half, RGBA32Float
at three quarters and R8 at a pitch of 0, nothing past the span written
and at most one region a row; described_row_copies' new device test
copies 501, 504 and RGBA8Unorm out at a pitch below the row into a
buffer of 0xcc and reads the later rows' bytes standing.

(cherry picked from commit 73554a28ae7c83ccdcb01d5ebb95787b74928c21)
This commit is contained in:
Anees Iqbal committed 2026-11-07 14:39:30 -08:00
1 parent 3f9cc68ed0
commit 8f652b31f1
7 files changed
+176 -58

No files matched your search

+9
View File
@@ -4201,6 +4201,15 @@ each item named states the rule in full.
(`drawn-depth-copy`).
- **A blit copy of 24-bit depth between textures of different formats is refused**: Apple's
reference GPUs make no `Depth24Unorm_Stencil8` texture, so there is no Metal answer to match.
- **A blit copy out of a texture whose rows overlap in the buffer writes them in turn, the later
row's bytes standing**: a `bytesPerRow` below the row, as `MTLPixelFormatGetInfoForDevice`
describes a one-plane YCbCr format's row, places each row at `y x bytesPerRow`, as Metal's blit
does. Metal writes such rows in no one order: on the Apple M3 Max under macOS 27.0.1, of 300
shapes of 12 formats copied out at half the row, about a fifth left the later rows' bytes
standing, a fifth every even row's and the rest neither order's, and 15 answered otherwise in
another process (`probes/short_row_blits.m`). The runtime's answer is one of those, the same
every time. A multisampled texture's copy out at such a pitch stays refused
(`Copy(BytesPerRow)`): where Metal places its rows there is not measured.
**Render passes**