From 8f652b31f194deff6ba5046b8a1c5d7064321c28 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Sat, 7 Nov 2026 14:09:33 -0800 Subject: [PATCH] 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) --- crates/metal2vulkan-runtime/src/blit_plan.rs | 28 +++-- .../metal2vulkan-runtime/src/blit_texture.rs | 5 +- crates/metal2vulkan-runtime/src/copy_plan.rs | 20 ++-- .../src/tests/blit_plan.rs | 65 ++++++++++- .../src/tests/described_row_copies.rs | 103 +++++++++++++----- docs/API.md | 9 ++ docs/REFUSALS.md | 4 +- 7 files changed, 176 insertions(+), 58 deletions(-) diff --git a/crates/metal2vulkan-runtime/src/blit_plan.rs b/crates/metal2vulkan-runtime/src/blit_plan.rs index b9495d7f1..528993e81 100644 --- a/crates/metal2vulkan-runtime/src/blit_plan.rs +++ b/crates/metal2vulkan-runtime/src/blit_plan.rs @@ -12,8 +12,8 @@ //! stops it): each row at `offset + z * bytesPerImage + y * bytesPerRow` rounded down to the copy //! unit or to 4 bytes, whichever is smaller, and a copy into a texture of one image of more than //! one row, from offset 0, with `bytesPerRow` rounded down to the copy unit a multiple of 16, at -//! that rounded pitch (Metal's aligned path). Out of a texture, images that overlap are written in -//! turn, a later image's bytes over an earlier one's. A region of one image ignores +//! that rounded pitch (Metal's aligned path). Out of a texture, rows and images that overlap are +//! written in turn, a later one's bytes over an earlier one's. A region of one image ignores //! `bytesPerImage`. [`placed_rows`] states what stays refused. use super::chroma_pairs::is_four_two_two; @@ -163,9 +163,15 @@ fn off_rules(layout: &BufferLayout, s: &Shape, unit: &CopyUnit) -> bool { /// eight formats of 1 to 16 bytes a texel, `YCBCR8_422_1P` and `YCBCR10_444_1P` among them, /// `Private` and `Shared`). /// -/// Refused (`BytesPerRow`): a copy out of a texture whose rows overlap (its writes race on -/// Metal); on the aligned path, a pitch of 0 (Metal reads garbage) and an offset of 16 or more -/// (not measured). Refused (`BufferRange`): a row past `u64::MAX`, which lies past every buffer. +/// A copy out of a texture at a pitch below a row writes each row at its own offset, the rows +/// overlapping in the buffer: Metal writes them in no one order, and the runtime writes them in +/// turn, the later row's bytes over the earlier's (`plan_placed_copy`), one of Metal's own answers +/// (the same probe: copies out at half the row and below, rows `y x bytesPerRow` apart and nothing +/// past their span written, the later rows' bytes standing in about a fifth of its shapes). +/// +/// Refused (`BytesPerRow`): on the aligned path, a pitch of 0 (Metal reads garbage) and an offset +/// of 16 or more (not measured). Refused (`BufferRange`): a row past `u64::MAX`, which lies past +/// every buffer. fn placed_rows( layout: &BufferLayout, s: &Shape, @@ -175,9 +181,6 @@ fn placed_rows( let bytes = u64::from(unit.bytes); let word = bytes.min(4); let bpr = layout.bytes_per_row; - if s.rows > 1 && bpr < s.row_bytes && !into_texture { - return Err(CopyProblem::BytesPerRow); - } let pitch = bpr - bpr % bytes; let aligned = into_texture && s.images == 1 && s.rows > 1 && pitch.is_multiple_of(16); if aligned && layout.offset.is_multiple_of(16) { @@ -354,10 +357,11 @@ pub(super) fn plan_buffer_copy( /// A copy of a layout off Metal's rules (shape `s`, of the checked `image`) through a tightly /// packed staging layout, each row where plain Metal places it ([`placed_rows`]); the rows stay -/// in the buffer. Out of the texture, rows that overlap (images closer than the region's rows) -/// are written in turn, as plain Metal writes them (in order in every run of -/// 3D textures up to 256x64x4): each row's bytes that a later row writes are left out of it -/// ([`later_rows_win`]), so the copies' regions are disjoint. +/// in the buffer. Out of the texture, rows that overlap are written in turn: images closer than +/// the region's rows as plain Metal writes them (in order in every run of 3D textures up to +/// 256x64x4), and rows closer than a row, which Metal writes in no one order, as one of its +/// answers (the later row's bytes standing). Each row's bytes that a later row writes are left +/// out of it ([`later_rows_win`]), so the regions of the one copy into the buffer are disjoint. fn plan_placed_copy( layout: &BufferLayout, s: &Shape, diff --git a/crates/metal2vulkan-runtime/src/blit_texture.rs b/crates/metal2vulkan-runtime/src/blit_texture.rs index fd48b00a1..d1b3ef2a1 100644 --- a/crates/metal2vulkan-runtime/src/blit_texture.rs +++ b/crates/metal2vulkan-runtime/src/blit_texture.rs @@ -699,7 +699,10 @@ impl BlitCommandEncoder { /// texture's region into the buffer, laid out as /// [`copy_from_buffer_to_texture`](Self::copy_from_buffer_to_texture) reads it. The bytes /// between rows and images are left as they are; images closer than the region's rows are - /// written in turn, the later image's bytes staying, as plain Metal writes them. + /// written in turn, the later image's bytes staying, as plain Metal writes them. Rows closer + /// than a row (a `bytesPerRow` below it, as `MTLPixelFormatGetInfoForDevice` describes a + /// one-plane YCbCr format's) are written in turn too, the later row's bytes staying: plain + /// Metal writes them in no one order, and that is one of its answers. /// /// Refused as `copy_from_buffer_to_texture` is, except that depth is copied out on every /// device. diff --git a/crates/metal2vulkan-runtime/src/copy_plan.rs b/crates/metal2vulkan-runtime/src/copy_plan.rs index aa9da875b..4d5fda2d1 100644 --- a/crates/metal2vulkan-runtime/src/copy_plan.rs +++ b/crates/metal2vulkan-runtime/src/copy_plan.rs @@ -111,19 +111,15 @@ pub enum CopyProblem { /// not measured). Offset, /// A `bytesPerRow` that is not a multiple of the copy unit, or that does not cover a row, - /// where plain Metal's answer is undefined or not measured: a blit out of a texture whose - /// rows overlap (Metal's writes race), Metal's aligned path into a texture at a pitch of 0 - /// (it reads garbage) or from an offset of 16 or more, a depth or stencil format - /// other than `Depth32Float`, a texture over a buffer, and a CPU copy of a texture over a - /// buffer or of a pitch of 0 for more than one row and image (other layouts copy where plain - /// Metal places the rows). + /// where plain Metal's answer is undefined or not measured: Metal's aligned path into a + /// texture at a pitch of 0 (it reads garbage) or from an offset of 16 or more, a depth or + /// stencil format other than `Depth32Float`, a texture over a buffer, a multisampled + /// texture's copy out at a pitch below a row (where its rows lie is not measured), and a CPU + /// copy of a texture over a buffer or of a pitch of 0 for more than one row and image (other + /// layouts copy where plain Metal places the rows, a blit's rows out of a texture that + /// overlap in turn, the later row's bytes standing). /// - /// Basis: unknown (undefined or unmeasured by the shapes listed above; where a blit's rows - /// overlap out of a texture, Metal writes them in no one order: on an Apple M3 Max under macOS - /// 27.0.1, `probes/short_row_blits.m`, 900 copies out at half the row, 300 shapes of 12 - /// formats in 3 processes, left the later row's bytes standing at some widths, every even - /// row's at others and neither order's at most, 15 shapes answering otherwise in another - /// process). + /// Basis: unknown (undefined or unmeasured by the shapes listed above). BytesPerRow, /// Bytes past the end of the buffer: of a no-copy buffer read from, past the end of its /// host pages, which plain Metal reads up to. Past that, and past another buffer's length, diff --git a/crates/metal2vulkan-runtime/src/tests/blit_plan.rs b/crates/metal2vulkan-runtime/src/tests/blit_plan.rs index 92e35ef1d..da6464bae 100644 --- a/crates/metal2vulkan-runtime/src/tests/blit_plan.rs +++ b/crates/metal2vulkan-runtime/src/tests/blit_plan.rs @@ -9,7 +9,7 @@ use super::super::blit_plan::{ texel_rows, BufferCopyPlan, BufferLayout, BufferRange, CopyPair, ImageCopyRegion, RowsCopy, }; use super::super::copy_plan::{ - copy_unit, BlitOption, CopyProblem, CopyRefusal, CopyUnit, ImageRegion, TextureRegion, + copy_unit, shape, BlitOption, CopyProblem, CopyRefusal, CopyUnit, ImageRegion, TextureRegion, }; use super::super::error::RuntimeGap; use super::super::image_plan::{plan_image, ImagePlan}; @@ -291,11 +291,17 @@ fn layouts_off_metals_rules_copy_where_plain_metal_places_their_rows() { ); let half = at(P::YCBCR84221P, [32, 4, 1], 0, 32, true); assert_eq!(half, Ok(vec![0, 32, 64, 96])); - // Refused: overlapping writes out of a texture, the aligned path's pitch of 0 (it reads - // garbage) and offsets of 16 or more on it (not measured), and depth and stencil formats but - // `Depth32Float` (not measured). + // Out of a texture at a pitch below a row: each row at its own offset, the rows overlapping in + // the buffer (written in turn: `a_copy_out_at_a_pitch_below_the_row_leaves_the_later_rows`). + assert_eq!(at(rgba8.0, rgba8.1, 0, 8, false), Ok(vec![0, 8, 16, 24])); + assert_eq!(at(rgba8.0, rgba8.1, 0, 0, false), Ok(vec![0, 0, 0, 0])); + assert_eq!( + at(rgba8.0, [8, 4, 1], 0, 16, false), + Ok(vec![0, 16, 32, 48]) + ); + // Refused: the aligned path's pitch of 0 (it reads garbage) and offsets of 16 or more on it + // (not measured), and depth and stencil formats but `Depth32Float` (not measured). let refused = Err(CopyProblem::BytesPerRow); - assert_eq!(at(rgba8.0, rgba8.1, 0, 8, false), refused); assert_eq!(at(rgba8.0, rgba8.1, 0, 0, true), refused); assert_eq!(at(P::RGBA32Uint, [1, 4, 1], 0, 8, true), refused); assert_eq!(at(rgba8.0, rgba8.1, 16, 18, true), refused); @@ -338,6 +344,55 @@ fn unstage(plan: &BufferCopyPlan, texels: &[u8], len: usize) -> Vec { out } +/// A copy out of a texture at a pitch below its row writes each row at `y x bytesPerRow`, in turn, +/// the later row's bytes over the earlier's, one of the orders plain Metal's blit leaves (an Apple +/// M3 Max under macOS 27.0.1, `probes/short_row_blits.m`: no one order holds), nothing past the +/// last row written: a one-plane YCbCr texture at the row `MTLPixelFormatGetInfoForDevice` +/// describes (half the row), a 16-byte texel at a pitch off the row's half, and every row at the +/// first at a pitch of 0. Each row's buffer bytes are one region, apart from every other's. +#[test] +fn a_copy_out_at_a_pitch_below_the_row_leaves_the_later_rows() { + use PixelFormat as P; + for (pf, extent, bpr) in [ + (P::YCBCR84221P, [32u32, 4u32], 32u64), + (P::RGBA8Unorm, [8, 4], 16), + (P::RGBA32Float, [4, 3], 48), + (P::R8Unorm, [16, 4], 0), + ] { + let t = tex( + pf, + TextureType::Type2D, + [u64::from(extent[0]), u64::from(extent[1]), 1], + ); + let u = unit(&t, BlitOption::None).unwrap(); + let s = shape([extent[0], extent[1], 1], &u); + let r = region([0, 0, 0], [extent[0], extent[1], 1]); + let len = ((s.rows - 1) * bpr + s.row_bytes) as usize; + let plan = plan_buffer_copy(&t.record, &r, &u, &layout(0, bpr, 0), len as u64, 0, false); + let plan = plan.unwrap_or_else(|problem| panic!("{pf:?} at {bpr}: {problem:?}")); + assert_eq!(plan.span, 0..len as u64, "{pf:?} at {bpr}"); + let staging = plan.staging.as_ref().expect("a staged copy"); + assert!( + staging.rows.len() as u64 <= s.rows, + "{pf:?}: {:?}", + staging.rows + ); + let texels: Vec = (0..s.rows * s.row_bytes) + .map(|i| (i * 7 % 253) as u8) + .collect(); + let mut want = vec![0xabu8; len + 16]; + for y in 0..s.rows { + let (at, from, n) = ( + (y * bpr) as usize, + (y * s.row_bytes) as usize, + s.row_bytes as usize, + ); + want[at..at + n].copy_from_slice(&texels[from..from + n]); + } + assert_eq!(unstage(&plan, &texels, len + 16), want, "{pf:?} at {bpr}"); + } +} + /// A `bytesPerImage` off Metal's rules (an M4 under macOS 27.0.1; its validation /// stops it): a region of one image ignores it, and the images of a 3D texture are placed as rows /// are, at `z * bytesPerImage` rounded down to the copy unit or 4 bytes; out of the texture, images diff --git a/crates/metal2vulkan-runtime/src/tests/described_row_copies.rs b/crates/metal2vulkan-runtime/src/tests/described_row_copies.rs index 045b63d67..19ecf8728 100644 --- a/crates/metal2vulkan-runtime/src/tests/described_row_copies.rs +++ b/crates/metal2vulkan-runtime/src/tests/described_row_copies.rs @@ -3,19 +3,18 @@ //! `YCBCR8_422_1P` and two for `YCBCR10_444_1P`, half the bytes the texel's copies move) is made //! as plain Metal makes it: Metal's aligned path at a pitch below the row, each row read whole from //! its own row's offset, the rows overlapping in the source (an Apple M3 Max under macOS 27.0.1, -//! `metal2vulkan-conformance/probes/short_row_blits.m`). It was refused `Copy(BytesPerRow)`. A -//! copy out at that row stays refused so: Metal writes the overlapping rows in no one order (900 -//! copies out at half the row, 300 shapes of 12 formats in 3 processes: the later row's bytes -//! standing at some widths, every even row's at others, neither order at most, and 15 shapes -//! answering otherwise in another process). +//! `metal2vulkan-conformance/probes/short_row_blits.m`). A copy out at that row, or any other +//! below the row, writes each row at its own offset, in turn, the later row's bytes standing: +//! Metal writes the overlapping rows in no one order (900 copies out at half the row, 300 shapes +//! of 12 formats in 3 processes: the later row's bytes standing at some widths, every even row's +//! at others, neither order at most, and 15 shapes answering otherwise in another process), and +//! the later row's is one of its answers. Both were refused `Copy(BytesPerRow)`. //! //! A device test: compiled only under the validation crate's GPU safety cfgs (`m2v_gpu`, //! `m2v_cpu_icd`), on the kind of device the cfg selects. use super::blit_holds::{device, Scratch, WAIT}; -use crate::{ - BlitOption, CopyProblem, Error, Origin, Problem, ResourceOptions, Size, TextureDescriptor, -}; +use crate::{BlitOption, Origin, ResourceOptions, Size, TextureDescriptor}; use metal2vulkan::metal::PixelFormat; /// The texture's width and height. @@ -79,24 +78,6 @@ fn a_copy_into_a_one_plane_texture_at_its_described_row_reads_each_row_from_its_ BlitOption::None, )) .unwrap(); - // Out at the described row: Metal's overlapping writes stand in no one order. - let refused = blit.copy_from_texture_to_buffer( - &texture, - 0, - 0, - at, - size, - &out, - 0, - bpr, - bpr * height, - BlitOption::None, - ); - match refused { - Err(Error::Invalid(invalid)) - if invalid.problem == Problem::Copy(CopyProblem::BytesPerRow) => {} - other => panic!("{pf:?}: the copy out at the described row answered {other:?}"), - } blit.end_encoding().unwrap(); command_buffer.commit().unwrap(); command_buffer.wait_until_completed_for(WAIT).unwrap(); @@ -111,3 +92,73 @@ fn a_copy_into_a_one_plane_texture_at_its_described_row_reads_each_row_from_its_ } } } + +/// A copy out of a texture at a pitch below its row: a one-plane YCbCr texture at its described +/// row (half the row) and an `RGBA8Unorm` one at three quarters of it, each into a buffer of +/// `0xcc`: each row at `y x bytesPerRow`, written in turn so the later row's bytes stand over the +/// earlier's, and nothing past the last row written. +#[test] +fn a_copy_out_at_a_pitch_below_the_row_leaves_the_later_rows() { + let scratch = Scratch::new("described-row-copies-out"); + let device = device(&scratch.0); + let queue = device.new_command_queue().unwrap(); + let [width, height] = SIDE; + for (pf, unit, bpr) in [ + (PixelFormat::YCBCR84221P, 2, width), + (PixelFormat::YCBCR104441P, 4, width * 2), + (PixelFormat::RGBA8Unorm, 4, width * 3), + ] { + let row = width * unit; + let mut descriptor = TextureDescriptor::texture_2d(pf, width, height, false); + descriptor.resource_options = ResourceOptions::private(); + let texture = device.new_texture(&descriptor).unwrap(); + let texels: Vec = (0..row * height).map(pattern).collect(); + let source = (device.new_buffer_with_bytes(&texels, ResourceOptions::shared())).unwrap(); + let span = bpr * (height - 1) + row; + let blank = vec![0xccu8; (span + 64) as usize]; + let out = (device.new_buffer_with_bytes(&blank, ResourceOptions::shared())).unwrap(); + let size = Size::new(width, height, 1); + let command_buffer = queue.command_buffer().unwrap(); + let mut blit = command_buffer.blit_command_encoder().unwrap(); + let at = Origin::new(0, 0, 0); + (blit.copy_from_buffer_to_texture( + &source, + 0, + row, + row * height, + size, + &texture, + 0, + 0, + at, + BlitOption::None, + )) + .unwrap(); + (blit.copy_from_texture_to_buffer( + &texture, + 0, + 0, + at, + size, + &out, + 0, + bpr, + bpr * height, + BlitOption::None, + )) + .unwrap_or_else(|error| panic!("{pf:?}: the copy out at {bpr} answered {error:?}")); + blit.end_encoding().unwrap(); + command_buffer.commit().unwrap(); + command_buffer.wait_until_completed_for(WAIT).unwrap(); + assert_eq!(command_buffer.error(), None); + let mut expected = blank.clone(); + for y in 0..height { + let (at, from) = ((y * bpr) as usize, (y * row) as usize); + expected[at..at + row as usize].copy_from_slice(&texels[from..from + row as usize]); + } + let read = out.contents().unwrap(); + // SAFETY: a `Shared` buffer of `span + 64` bytes whose commands all completed. + let read = unsafe { std::slice::from_raw_parts(read.as_ptr(), (span + 64) as usize) }; + assert_eq!(read, &expected[..], "{pf:?} at {bpr}"); + } +} diff --git a/docs/API.md b/docs/API.md index 249f08984..1ba3aa720 100644 --- a/docs/API.md +++ b/docs/API.md @@ -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** diff --git a/docs/REFUSALS.md b/docs/REFUSALS.md index c1cf03b2a..246e6e2c6 100644 --- a/docs/REFUSALS.md +++ b/docs/REFUSALS.md @@ -443,7 +443,7 @@ Columns: | `CopyProblem::CpuAccessPrivate` | `replaceRegion` or `getBytes` of a private texture | every device (a public call's own check of its arguments) | `metal-takes`: an M4, macOS 27.0.1: plain Metal copies a private texture of up to 8 KiB as a shared one, so the refusal reaches past it; most of 16 KiB and more end the process | 6: `crates/metal2vulkan-runtime/src/buffer_texture.rs (bytes)`, `crates/metal2vulkan-runtime/src/buffer_texture.rs (past_runs)` (+4) | `-` | | `CopyProblem::Region` | A level or slice past the texture, or a region past its level (a compressed region past the level's last block) | every device (a public call's own check of its arguments) | `unknown`: plain Metal's answer for a blit level, slice or region past the texture is unmeasured | 10: `crates/metal2vulkan-runtime/src/blit_plan.rs (plan_levels_copy)`, `crates/metal2vulkan-runtime/src/blit_plan.rs (source_region, 2 sites)` (+6) | `-` | | `CopyProblem::Offset` | A buffer offset that is not a multiple of the copy unit, of a blit whose plain Metal answer is not measured | every device (a public call's own check of its arguments) | `unknown`: plain Metal's answer for a buffer offset off the copy unit of these blits is not measured | 2: `crates/metal2vulkan-runtime/src/blit_plan.rs (check_layout)`, `crates/metal2vulkan-runtime/src/blit_plan.rs (plan_block_order_copy)` | `-` | -| `CopyProblem::BytesPerRow` | A `bytesPerRow` that is not a multiple of the copy unit, or that does not cover a row, where plain Metal's answer is undefined or not measured | every device (a public call's own check of its arguments) | `unknown`: undefined or unmeasured by the shapes listed above; where a blit's rows overlap out of a texture, Metal writes them in no one order: on an Apple M3 Max under macOS 27.0.1, `probes/short_row_blits.m`, 900 copies out at half the row, 300 shapes of 12 formats in 3 processes, left the later row's bytes standing at some widths, every even row's at others and neither order's at most, 15 shapes answering otherwise in another process | 5: `crates/metal2vulkan-runtime/src/blit_plan.rs (check_layout)`, `crates/metal2vulkan-runtime/src/blit_plan.rs (placed_rows, 2 sites)` (+2) | `-` | +| `CopyProblem::BytesPerRow` | A `bytesPerRow` that is not a multiple of the copy unit, or that does not cover a row, where plain Metal's answer is undefined or not measured | every device (a public call's own check of its arguments) | `unknown`: undefined or unmeasured by the shapes listed above | 4: `crates/metal2vulkan-runtime/src/blit_plan.rs (check_layout)`, `crates/metal2vulkan-runtime/src/blit_plan.rs (placed_rows)` (+2) | `-` | | `CopyProblem::BufferRange` | Bytes past the end of the buffer | every device (a public call's own check of its arguments) | `metal-takes`: an M4, macOS 27.0.1: plain Metal reads past the buffer rather than refusing — zeros, bytes a write past the length left, or another resource's bytes | 9: `crates/metal2vulkan-runtime/src/blit_plan.rs (check_layout)`, `crates/metal2vulkan-runtime/src/blit_plan.rs (placed_rows, 2 sites)` (+6) | `-` | | `CopyProblem::Format` | Two textures whose formats a copy does not take | every device (a public call's own check of its arguments) | `metal-takes`: an M4, macOS 27.0.1: plain Metal copies the source's bytes in the GPU's own texel layout rather than refusing, which differs between formats of different units: no defined answer | 1: `crates/metal2vulkan-runtime/src/blit_plan.rs (check_formats)` | `-` | | `CopyProblem::SampleCount` | Two textures of different sample counts | every device (a public call's own check of its arguments) | `metal-takes`: an Apple M3 Max, macOS 27.0.1: plain Metal completes the copy with no error rather than refusing it, so the refusal reaches past Metal; what it stores is its own texel twiddling and sample compression, which neither Metal nor Vulkan defines, so the runtime has no exact answer to put in its place | 1: `crates/metal2vulkan-runtime/src/blit_plan.rs (check)` | `-` | @@ -903,7 +903,7 @@ Each refusal's sites, with the function that builds it. - `subproblem::CopyProblem::CpuAccessPrivate`: `crates/metal2vulkan-runtime/src/buffer_texture.rs (bytes)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs (past_runs)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs (write_past)`; `crates/metal2vulkan-runtime/src/copy_plan.rs (plan_host_copy)`; `crates/metal2vulkan-runtime/src/texture.rs (host_copy)`; `crates/metal2vulkan-runtime/src/texture/heap.rs (contents)` - `subproblem::CopyProblem::Region`: `crates/metal2vulkan-runtime/src/blit_plan.rs (plan_levels_copy)`; `crates/metal2vulkan-runtime/src/blit_plan.rs (source_region, 2 sites)`; `crates/metal2vulkan-runtime/src/blit_texture.rs (check_slice_level)`; `crates/metal2vulkan-runtime/src/blit_texture.rs (copy_texture_slices)`; `crates/metal2vulkan-runtime/src/blit_texture.rs (multisampled_region)`; `crates/metal2vulkan-runtime/src/blit_texture.rs (region)`; `crates/metal2vulkan-runtime/src/copy_plan.rs (check_region, 2 sites)`; `crates/metal2vulkan-runtime/src/texture.rs (host_copy)` - `subproblem::CopyProblem::Offset`: `crates/metal2vulkan-runtime/src/blit_plan.rs (check_layout)`; `crates/metal2vulkan-runtime/src/blit_plan.rs (plan_block_order_copy)` -- `subproblem::CopyProblem::BytesPerRow`: `crates/metal2vulkan-runtime/src/blit_plan.rs (check_layout)`; `crates/metal2vulkan-runtime/src/blit_plan.rs (placed_rows, 2 sites)`; `crates/metal2vulkan-runtime/src/copy_plan.rs (plan_host_copy)`; `crates/metal2vulkan-runtime/src/sample_interleave.rs (plan)` +- `subproblem::CopyProblem::BytesPerRow`: `crates/metal2vulkan-runtime/src/blit_plan.rs (check_layout)`; `crates/metal2vulkan-runtime/src/blit_plan.rs (placed_rows)`; `crates/metal2vulkan-runtime/src/copy_plan.rs (plan_host_copy)`; `crates/metal2vulkan-runtime/src/sample_interleave.rs (plan)` - `subproblem::CopyProblem::BufferRange`: `crates/metal2vulkan-runtime/src/blit_plan.rs (check_layout)`; `crates/metal2vulkan-runtime/src/blit_plan.rs (placed_rows, 2 sites)`; `crates/metal2vulkan-runtime/src/blit_plan.rs (plan_block_order_copy)`; `crates/metal2vulkan-runtime/src/blit_plan.rs (plan_placed_copy)`; `crates/metal2vulkan-runtime/src/blit_plan.rs (plan_rows_copy)`; `crates/metal2vulkan-runtime/src/sample_interleave.rs (plan)`; `crates/metal2vulkan-runtime/src/texture.rs (get_bytes)`; `crates/metal2vulkan-runtime/src/texture.rs (replace)` - `subproblem::CopyProblem::Format`: `crates/metal2vulkan-runtime/src/blit_plan.rs (check_formats)` - `subproblem::CopyProblem::SampleCount`: `crates/metal2vulkan-runtime/src/blit_plan.rs (check)`