diff --git a/crates/metal2vulkan-runtime/README.md b/crates/metal2vulkan-runtime/README.md index a55f26d23..19e6ba3f5 100644 --- a/crates/metal2vulkan-runtime/README.md +++ b/crates/metal2vulkan-runtime/README.md @@ -241,7 +241,9 @@ Calls Metal does not have, for a consumer that emulates a Metal device: `[[primitive_id]]` a quad, as Metal does, where the list draws two triangles. Its `Nine`, value 9, draws nothing and fails the command buffer as Metal's GPU does: a hang (`CommandBufferError::GpuHang`), a page fault or a victim of the GPU's recovery - (`GpuRecoveryVictim`), by the draw's form (docs/API.md, "Accepted differences", for the timing). + (`GpuRecoveryVictim`), by the draw's form (docs/API.md, "Accepted differences", for the timing); + a queue's second hang or page fault revokes it, as Metal's does: its later command buffers fail + at their commit (`AccessRevoked`). - `TextureDescriptor::address_mode_map` presents a texture as sampling by other address modes than its sampler's. - Resource ID reservations, placements and counts (`Device::reserve_resource_ids`, diff --git a/crates/metal2vulkan-runtime/src/command_buffer/mod.rs b/crates/metal2vulkan-runtime/src/command_buffer/mod.rs index f459384d4..1d469316a 100644 --- a/crates/metal2vulkan-runtime/src/command_buffer/mod.rs +++ b/crates/metal2vulkan-runtime/src/command_buffer/mod.rs @@ -42,6 +42,7 @@ pub(super) mod own; pub(super) mod rebound_use; mod reencode; pub(super) mod rerun; +pub(super) mod revocation; mod storage_form; mod submit; @@ -342,6 +343,17 @@ pub(super) enum FailedSignals { } impl Failure { + /// The failure of a command buffer committed on a queue Metal revoked (`revocation.rs`): no + /// encoder runs, no event signal fires, and it completes with + /// `CommandBufferError::AccessRevoked`. + pub(super) fn revoked() -> Failure { + Failure { + encoders: FailedEncoders::From(0), + signals: FailedSignals::Dropped, + error: Some(CommandBufferError::AccessRevoked), + } + } + /// Whether ended encoder `encoder` runs under `failure`: every one does but those it fails. pub(super) fn runs(failure: Option<&Failure>, encoder: usize) -> bool { failure.is_none_or(|failure| !failure.encoders.fails(encoder)) @@ -2343,14 +2355,20 @@ impl CommandBuffer { // hang hangs where its encoder runs and its signals fire under what it was committed // as (`hang.rs`). // Either reads `Scheduled` early, from the hang's on, once its waits are met. + // One committed on a queue Metal revoked runs nothing and completes at once, its + // signals dropped (`revocation.rs`). + let revoked = run != CommitRun::Refused && self.0.queue.errors().revoked(); let event_waits = state.batches.events().0; let discarded = match failure { - None if run != CommitRun::Refused => hang::discarded(&self.0.queue, event_waits), + None if run != CommitRun::Refused && !revoked => { + hang::discarded(&self.0.queue, event_waits) + } _ => None, }; let joins = discarded.is_some(); let failure = failure.or(discarded); let behind = run != CommitRun::Refused + && !revoked && failure.is_none() && event_waits > 0 && hang::in_flight(&self.0.queue); @@ -2368,6 +2386,7 @@ impl CommandBuffer { hang::join(&self.0, &mut state, waits); } let hangs = run != CommitRun::Refused + && !revoked && matches!(state.fails_from, Some((at, CommandBufferError::GpuHang)) if failure.as_ref().is_none_or(|f| f.signals && !f.encoders.fails(at))); if let (true, Some(hang)) = (hangs, &state.hang) { @@ -2376,6 +2395,10 @@ impl CommandBuffer { } let failure = Failure::of(failure, state.fails_from, ended); let failure = Failure::with_faults(failure, &state.faulted, ended); + let failure = match revoked { + true => Some(Failure::revoked()), + false => failure, + }; // The encoders that run: all but those `failure` fails. let runs = |encoder: usize| Failure::runs(failure.as_ref(), encoder); state.committing = true; @@ -4032,6 +4055,10 @@ impl CommandBufferShared { state.error = Some(error); } } + // A GPU error the command buffer caused counts against its queue, which Metal revokes + // at the second, from before its status reads final (`revocation.rs`); a relayed one + // is the driver's queue's. + self.queue.errors().completed(state.failure); // The final status, with its error, once: a read sees no `Completed` that a decoded // failure turns to `Error`. self.answer(&state); diff --git a/crates/metal2vulkan-runtime/src/command_buffer/revocation.rs b/crates/metal2vulkan-runtime/src/command_buffer/revocation.rs new file mode 100644 index 000000000..2f1b7ac5f --- /dev/null +++ b/crates/metal2vulkan-runtime/src/command_buffer/revocation.rs @@ -0,0 +1,68 @@ +//! A queue Metal stops serving after GPU errors its command buffers caused. +//! +//! Measured on the M3 Max with macOS 27.0.1 (about sixty command buffers over five runs; each a +//! blit, a pass of one draw of primitive type 9, a blit, an event signal and a blit, then one +//! committed at once, one committed some milliseconds on, and one committed after the first +//! completed, on queues used in turn): +//! +//! - **Caused errors count, per queue.** A command buffer that fails with +//! `MTLCommandBufferErrorPageFault` (3) or `MTLCommandBufferErrorTimeout` (2, a GPU hang) +//! counts against its queue. One that fails as a victim of the GPU's recovery +//! (`MTLCommandBufferErrorInternal`, "Discarded (victim of GPU error/recovery)") does not: +//! three on one queue, and a victim then a fault, left the queue serving. +//! - **The second one revokes the queue.** Once the queue's second command buffer with a caused +//! error completes (two faults, two hangs, a hang then a fault), every command buffer committed +//! on the queue after that fails at its commit: `Scheduled` and completed 0.02 to 0.06 ms after +//! its commit, with status `Error` and `MTLCommandBufferErrorAccessRevoked` (4, "Ignored (for +//! causing prior/excessive GPU errors) +//! (00000004:kIOGPUCommandBufferCallbackErrorSubmissionsIgnored)"); none of its work runs, none +//! of its event signals fires, and its GPU and kernel times span nothing. Two seconds on it was +//! so still. One committed before that completion, 4.5 ms into the second fault, ran; one +//! committed 0.5 ms after it, and later ones, did not. +//! - **Other queues serve on.** A new queue of the same device ran normally after others were +//! revoked, its own first fault or hang leaving it serving. +//! - The second faulting command buffer itself answers as the first did (its other encoders ran +//! in 9 of 11 runs, nothing of it in 2), as does one committed at once after it. +//! +//! The runtime counts the command buffers of a queue that complete with a failure of its own +//! making that Metal's GPU causes: [`CommandBufferError::PageFault`] as the runtime fails an +//! encoder Metal's GPU faults (a draw of primitive type 9 over indices, a render encoder's +//! execution of an indirect command buffer under a state it cannot inherit), and +//! [`CommandBufferError::GpuHang`]. A failure the driver relays is the driver's own queue's, +//! which Metal counts itself under MoltenVK. From the completion of the second one, before its +//! status reads final, the queue is revoked: a command buffer committed on it then fails with +//! [`CommandBufferError::AccessRevoked`] as its commit's work, from its first encoder, its event +//! signals dropped (`commit_now`). One committed before runs as committed, whatever its event +//! waits (Metal's answer for one held by a wait across the revocation is not measured). + +use crate::error::CommandBufferError; +use std::sync::atomic::{AtomicU32, Ordering}; + +/// The command buffers whose GPU error Metal counts against their queue that revoke it. +const REVOKING: u32 = 2; + +/// A queue's count of its command buffers that completed with a GPU error they caused (the +/// module docs). +#[derive(Default)] +pub(crate) struct QueueErrors { + caused: AtomicU32, +} + +impl QueueErrors { + /// A command buffer of the queue completes with `error` (`None` for none), before its status + /// reads final: counted where the GPU caused it. + pub(super) fn completed(&self, error: Option) { + if matches!( + error, + Some(CommandBufferError::PageFault | CommandBufferError::GpuHang) + ) { + self.caused.fetch_add(1, Ordering::SeqCst); + } + } + + /// Whether Metal ignores the queue's command buffers committed now: its second command buffer + /// with a caused error completed. + pub(super) fn revoked(&self) -> bool { + self.caused.load(Ordering::SeqCst) >= REVOKING + } +} diff --git a/crates/metal2vulkan-runtime/src/error.rs b/crates/metal2vulkan-runtime/src/error.rs index 946b6ee02..5070ba4bd 100644 --- a/crates/metal2vulkan-runtime/src/error.rs +++ b/crates/metal2vulkan-runtime/src/error.rs @@ -1416,12 +1416,11 @@ pub enum RuntimeGap { RestartedStrip, /// A draw of one of Metal's private primitive types (`DrawPrimitiveType`: a line loop, a /// triangle fan, quads, a quad strip), which the runtime draws as the list Metal draws, where - /// that list cannot be drawn as Metal draws: a direct draw without indices from a vertex start - /// past `i32::MAX`, which the list's base vertex cannot carry, or whose list a `u32` cannot - /// count; a draw over indices or from indirect arguments the index rewrite pass cannot draw, - /// as for `RestartedStrip`; and a pipeline whose vertex function computes `[[primitive_id]]` - /// into a varying (a device whose fragment stage cannot declare it), from vertex indices the - /// list's are not. + /// that list cannot be drawn as Metal draws: a direct draw without indices whose list a `u32` + /// cannot count; a draw over indices or from indirect arguments the index rewrite pass cannot + /// draw, as for `RestartedStrip`; and a draw in the private list form (a vertex function that + /// writes memory or computes `[[primitive_id]]` into a varying, or a direct draw whose last + /// vertex ID passes `i32::MAX`) whose list has no device address. PrivatePrimitives, /// A draw under Apple's last provoking vertex (`setProvokingVertexMode:` 1) on a device /// without `VK_EXT_provoking_vertex`'s last vertex, which the runtime draws as the list of its @@ -1662,10 +1661,15 @@ pub enum CommandBufferError { /// passes: the runtime runs them. /// /// Also an indexed draw of primitive type 9 - /// ([`DrawPrimitiveType::Nine`](crate::DrawPrimitiveType::Nine)), of 1 to 3 indices on the M3 - /// Max (macOS 27.0.1): its render encoder runs nothing, the encoders after it run, every - /// event signal fires, and the queue runs on; Metal completed it 16.8 to 19.5 ms after its - /// commit, the runtime as its work completes. + /// ([`DrawPrimitiveType::Nine`](crate::DrawPrimitiveType::Nine)), of any index count, of no + /// index or instance too, on the M3 Max (macOS 27.0.1): its render encoder runs nothing, the + /// encoders after it run, every event signal fires, and the queue runs on; Metal completed it + /// 16.8 to 19.5 ms after its commit, the runtime as its work completes. + /// + /// Such a fault, as the runtime makes it, counts against the command buffer's queue, as a + /// [`GpuHang`](Self::GpuHang) does: from the completion of the queue's second, its later + /// command buffers fail with [`AccessRevoked`](Self::AccessRevoked). A relayed one is the + /// driver's queue's. /// /// Also a page fault Metal answers for the command buffer's work under MoltenVK, which the /// runtime relays (`CommandBufferError::Execution`). @@ -1686,7 +1690,8 @@ pub enum CommandBufferError { /// reads `Scheduled` 5.06 ms after its commit (later where the work before the draw is /// submitted later), completes no sooner than 32.7 ms after its commit and 27.5 ms after the /// work before the draw ran, and runs nothing of its queue's others: the outcome of Metal's - /// slower submission (`command_buffer/hang.rs`). + /// slower submission (`command_buffer/hang.rs`). It counts against its queue as a + /// [`PageFault`](Self::PageFault) does. GpuHang, /// Metal failed the command buffer as a victim of its GPU's recovery, at an indirect draw of /// primitive type 9, indexed or not, whatever its arguments @@ -1695,8 +1700,17 @@ pub enum CommandBufferError { /// (00000005:kIOGPUCommandBufferCallbackErrorInnocentVictim)", its `GPUStartTime` 0), 16.9 to /// 30.0 ms after its commit (the M3 Max, macOS 27.0.1, 5 draws): its render encoder ran /// nothing, the encoders after it ran, every event signal fired, and the queue ran on. The - /// runtime completes it as its work completes. + /// runtime completes it as its work completes. It does not count against its queue. GpuRecoveryVictim, + /// Metal ignored the command buffer, committed on a queue whose second command buffer with a + /// GPU error it caused ([`PageFault`](Self::PageFault), [`GpuHang`](Self::GpuHang); not a + /// [`GpuRecoveryVictim`](Self::GpuRecoveryVictim)) had completed: + /// `MTLCommandBufferErrorAccessRevoked` (4, "Ignored (for causing prior/excessive GPU errors) + /// (00000004:kIOGPUCommandBufferCallbackErrorSubmissionsIgnored)" on the M3 Max, macOS + /// 27.0.1). It reads `Scheduled` and completes at its commit, nothing of it runs and none of + /// its event signals fires; so does every later one of the queue, while the device's other + /// queues, new ones too, run on (`command_buffer/revocation.rs`). + AccessRevoked, /// Metal failed the command buffer's work with this `MTLCommandBufferError` code, which the /// driver relayed: MoltenVK, which runs each batch as a Metal command buffer, reports a /// failed one, and the runtime gives its code to the command buffer whose batch it was @@ -1953,7 +1967,8 @@ pub struct TessellationRecordsOverflow { impl CommandBufferError { /// Metal's `MTLCommandBufferError` code for this error: `MTLCommandBufferErrorDeviceRemoved` /// (11) for a lost device, `OutOfMemory` (8) for the device's memory, the index pool's and the - /// records pool's (mesh and tessellation), and a detached buffer's, `PageFault` (3), and + /// records pool's (mesh and tessellation), and a detached buffer's, `AccessRevoked` (4) for a + /// revoked queue's, `PageFault` (3), and /// `Internal` (1), also for the runtime's refusals (a cubic argument sampler's reach among /// them, a sampler state left out of an argument-sampler listing, a host step's object nothing /// made, a named use rebound before the submission, and a predicated loop past its copies); a @@ -1988,6 +2003,7 @@ impl CommandBufferError { CommandBufferError::PageFault => 3, CommandBufferError::GpuHang => 2, CommandBufferError::GpuRecoveryVictim => 1, + CommandBufferError::AccessRevoked => 4, CommandBufferError::PipelineCreation(cause) => match cause { PipelineCreationCause::OutOfMemory(_) => 8, PipelineCreationCause::DeviceLost => 11, @@ -2010,6 +2026,7 @@ impl CommandBufferError { | CommandBufferError::PageFault | CommandBufferError::GpuHang | CommandBufferError::GpuRecoveryVictim + | CommandBufferError::AccessRevoked | CommandBufferError::Execution(_) | CommandBufferError::RenderTargetSize | CommandBufferError::DetachedBacking diff --git a/crates/metal2vulkan-runtime/src/gpu_pools.rs b/crates/metal2vulkan-runtime/src/gpu_pools.rs index 8079fbc89..19a686f47 100644 --- a/crates/metal2vulkan-runtime/src/gpu_pools.rs +++ b/crates/metal2vulkan-runtime/src/gpu_pools.rs @@ -120,6 +120,14 @@ impl PoolKind { PoolKind::MeshRecords => vk::BufferUsageFlags::STORAGE_BUFFER, } } + + /// Whether the kind's blocks have a device address where the device has device addresses: + /// the index pool's, whose lists the private list form reads at their address + /// (`index_rewrite.rs`). It costs the block's memory a buffer of addresses, made once per + /// memory block (`memory::allocate_addressed`), and nothing per lease. + fn addressed(self) -> bool { + matches!(self, PoolKind::Index) + } } /// One queue's block of a kind and the leases holding it. @@ -280,6 +288,7 @@ pub(super) struct PoolLease { kind: PoolKind, queue: u64, raw: vk::Buffer, + address: Option, bytes: u64, } @@ -289,6 +298,12 @@ impl PoolLease { self.raw } + /// The device address of the leased block's byte 0, where its kind's blocks have one + /// ([`PoolKind::addressed`]) on a device with device addresses. + pub(super) fn address(&self) -> Option { + self.address + } + /// The block's bytes. pub(super) fn bytes(&self) -> u64 { self.bytes @@ -333,6 +348,9 @@ pub(super) struct IndexPool { pub(super) block: vk::Buffer, /// The block's bytes, its unused header's included. pub(super) bytes: u64, + /// The device address of the block's byte 0, where the device has device addresses: a list + /// in the private list form is read there (`index_rewrite.rs`). + pub(super) address: Option, } impl IndexPool { @@ -342,6 +360,7 @@ impl IndexPool { counter: counter.clone(), block: block.raw(), bytes: block.bytes(), + address: block.address(), } } @@ -358,20 +377,17 @@ impl Device { pub(super) fn lease_pool(&self, kind: PoolKind, queue: u64) -> Result { let shared = self.shared(); let bytes = shared.gpu_pools.block_bytes(kind); - let taken = lock(shared.gpu_pools.blocks(kind)).take(queue, Block::raw); - let (raw, leases) = match taken { + let read = |block: &Block| (block.raw(), block.address()); + let taken = lock(shared.gpu_pools.blocks(kind)).take(queue, read); + let ((raw, address), leases) = match taken { Some(taken) => taken, None => { // Made without the lock: a lease of another queue, or one ending, waits for no // making. - let block = self.make_block(bytes, kind.usage())?; + let block = self.make_block(bytes, kind.usage(), kind.addressed())?; shared.counts.gpu_pool_block_made(); - let (raw, leases, extra) = lock(shared.gpu_pools.blocks(kind)).made( - queue, - block, - Instant::now(), - Block::raw, - ); + let (raw, leases, extra) = + lock(shared.gpu_pools.blocks(kind)).made(queue, block, Instant::now(), read); if let Some(extra) = extra { // SAFETY: made just now, the block was never bound to a command. if unsafe { extra.release_in_section(shared) } { @@ -387,6 +403,7 @@ impl Device { kind, queue, raw, + address, bytes, }) } diff --git a/crates/metal2vulkan-runtime/src/index_rewrite.rs b/crates/metal2vulkan-runtime/src/index_rewrite.rs index 715367985..323614984 100644 --- a/crates/metal2vulkan-runtime/src/index_rewrite.rs +++ b/crates/metal2vulkan-runtime/src/index_rewrite.rs @@ -6,6 +6,13 @@ //! ([`WrittenList`]); and the lists of the index gather pass ([`GatherRuns`]). Each list is //! written in the draw's `RewriteOrder`. //! +//! A private type's list drawn in the private list form (`VariantKey::private_list`, chosen in +//! `render.rs`) is not drawn as indices: Metal's base vertex lies in the word before it, the +//! draw is a draw of its positions from its first index as first vertex, and the vertex function +//! reads its index and the base at the list's device address ([`RewritePass::address`], +//! [`WrittenList::address`]), which the index pool's block has where the device has device +//! addresses (`gpu_pools.rs`). +//! //! **The gather pass** (`bind::index_gather_module`) writes the list of a direct indexed draw of //! a program that never restarts (`RewriteProgram::gathers`: line and triangle lists, Apple's //! triangle fan and quads) that reads its indices in place and that no earlier draw's write @@ -112,12 +119,15 @@ pub(super) struct RewritePass { /// An indirect draw's Metal index offset and the buffer's length, where the offset lies at or /// past the length: every position draws index 0 there, where Metal reads memory. past_length: Option<(u64, u64)>, + /// The list is drawn in the private list form ([`IndexRewritePass::listed`]). + listed: bool, } impl RewritePass { /// The pass of `program` restarting at `restart` (`k'`) in `order` over the `index_size`-byte /// indices of `index` (`None` for a draw without indices), with `arguments`, in `core`'s - /// command buffer, whose reads of the Metal buffers are `uses` ([`reads`]). Refused + /// command buffer, whose reads of the Metal buffers are `uses` ([`reads`]), in the private + /// list form where `listed` (the module docs). Refused /// (`NotImplemented(gap)`: `RestartedStrip`, `PrivatePrimitives` for a private type's list, /// `ProvokingVertex` for a list of the last provoking vertex) where a direct draw's list is /// past what one storage range binds or a `u32` counts, or carries a base instance the @@ -126,7 +136,11 @@ impl RewritePass { /// refused. pub(super) fn new( core: &mut EncoderCore, - ((program, restart, order), refused): ((RewriteProgram, u32, RewriteOrder), RuntimeGap), + ((program, restart, order), refused, listed): ( + (RewriteProgram, u32, RewriteOrder), + RuntimeGap, + bool, + ), index: Option<&DrawSource<'_>>, arguments: &Arguments<'_>, index_size: u64, @@ -150,7 +164,8 @@ impl RewritePass { { return Err(gap()); } - let capacity = program.capacity(u64::from(count)); + // In the private list form, the base vertex's word before the list. + let capacity = program.capacity(u64::from(count)) + u64::from(listed); let bytes = capacity * 4; if bytes > u64::from(limits.max_storage_buffer_range) { return Err(gap()); @@ -200,6 +215,7 @@ impl RewritePass { ) .ok_or_else(gap)? .with_order(order); + let pass = if listed { pass.listed() } else { pass }; let kernel = |phase| device.owned_kernel(OwnedModule::IndexRewrite(program, phase)); let kernels = [ kernel(RewritePhase::Count)?, @@ -291,16 +307,30 @@ impl RewritePass { sets, uses, past_length, + listed, }) } + /// The device address of the list's region, where the device has device addresses: an owned + /// list's buffer's byte 0, a pooled one's first index's (past the pool's header), from which + /// the place dispatch's first index counts. The private list form reads its list there. + pub(super) fn address(&self) -> Option { + match &self.output { + Output::Owned(buffer) => buffer.device_address(), + Output::Pooled(pool) => pool + .address + .map(|address| address + IndexRewritePass::POOL_HEADER_BYTES), + } + } + /// The pass's reads of the Metal arguments and indices ([`reads`]). pub(super) fn uses(&self) -> &[Use] { &self.uses } /// The draw of the pass: its index binding, the `VkBuffer` of its arguments, and its command, - /// with `sized` the device's index range binding. + /// with `sized` the device's index range binding. In the private list form, the draw of the + /// list's positions without indices (`VkDrawIndirectCommand`). pub(super) fn draw( &self, sized: Option, @@ -309,7 +339,16 @@ impl RewritePass { Option, metal2vulkan::vk::DrawCommand, ) { - let (buffer, offset, bytes) = match &self.output { + let offset = self.words.offset() + IndexRewritePass::DRAW_OFFSET; + if self.listed { + let draw = metal2vulkan::vk::DrawCommand::DrawIndirect { + offset, + draw_count: 1, + stride: 16, + }; + return (None, Some(self.words.raw()), draw); + } + let (buffer, index_offset, bytes) = match &self.output { Output::Owned(buffer) => { let (raw, at) = buffer.at(0); (raw, at, buffer.length()) @@ -323,14 +362,14 @@ impl RewritePass { let index_type = metal2vulkan::vk::IndexType::UINT32; let draw = metal2vulkan::vk::DrawCommand::DrawIndexedIndirect { index_type, - index_buffer_offset: offset, - offset: self.words.offset() + IndexRewritePass::DRAW_OFFSET, + index_buffer_offset: index_offset, + offset, draw_count: 1, stride: 20, }; let bind = IndexBind { buffer, - offset, + offset: index_offset, index_type: index_type.into(), sized: sized.map(|bind| (bind, bytes)), }; @@ -390,9 +429,10 @@ impl RewritePass { /// the last provoking vertex on a device without it, which the CPU writes into the command /// buffer's upload arena while the draw is encoded: its positions are its vertices, so the list /// follows from its count alone ([`RewriteProgram::sequential_list`] in the draw's order, relative -/// to its first vertex), and the draw draws it from its vertex start as base vertex. The arena -/// holds it until the command buffer completes, and the host writes it before the draw's batch is -/// submitted (`upload.rs`). +/// to its first vertex), and the draw draws it from its vertex start as base vertex; in the private +/// list form, the vertex start lies in the word before it, and the draw is the binder's (the +/// module docs). The arena holds it until the command buffer completes, and the host writes it +/// before the draw's batch is submitted (`upload.rs`). pub(super) struct WrittenList { upload: Upload, indices: u32, @@ -400,21 +440,26 @@ pub(super) struct WrittenList { impl WrittenList { /// The list of `program` in `order` for a draw of `count` vertices from `vertex_start`, in - /// `core`'s command buffer. Refused (`NotImplemented(gap)`: `PrivatePrimitives`, or - /// `ProvokingVertex`) from a vertex start past `i32::MAX`, which a list's base vertex cannot - /// carry, and for a list of more indices than a `u32` counts; and as uploads are refused. + /// `core`'s command buffer, in the private list form where `listed`. Refused + /// (`NotImplemented(gap)`: `PrivatePrimitives`, or `ProvokingVertex`) outside that form from + /// a vertex start past `i32::MAX`, which a list's base vertex cannot carry, and for a list of + /// more indices than a `u32` counts; and as uploads are refused. pub(super) fn new( core: &mut EncoderCore, ((program, order), refused): ((RewriteProgram, RewriteOrder), RuntimeGap), (vertex_start, count): (u32, u32), + listed: bool, ) -> Result { let gap = || Error::NotImplemented(refused.clone()); - i32::try_from(vertex_start).map_err(|_| gap())?; + if !listed { + i32::try_from(vertex_start).map_err(|_| gap())?; + } let indices = u32::try_from(program.capacity(u64::from(count))).map_err(|_| gap())?; let device = core.device().clone(); - let bytes: Vec = program - .sequential_list(count, order) + let bytes: Vec = listed + .then_some(vertex_start) .into_iter() + .chain(program.sequential_list(count, order)) .flat_map(u32::to_le_bytes) .collect(); let len = (bytes.len() as u64).max(4); @@ -426,6 +471,12 @@ impl WrittenList { Ok(WrittenList { upload, indices }) } + /// The device address of the list's first word (the vertex start's in the private list + /// form), where the device has device addresses. + pub(super) fn address(&self) -> Option { + self.upload.device_address() + } + /// The draw of the list: its index binding, with `sized` the device's index range binding, /// and the binder's draw of the vertices `draw` (`vkCmdDraw`'s), drawn as the indexed draw of /// the list from its first vertex as base vertex, with its instances. `None` for another @@ -638,6 +689,15 @@ impl Listed { Listed::Gathered(list) => list.draw(draw, sized), } } + + /// The device address of a list the CPU wrote, where the device has device addresses: the + /// private list form's (a gather run's list takes no part in it, `render.rs`). + pub(super) fn address(&self) -> Option { + match self { + Listed::Written(list) => list.address(), + Listed::Gathered(_) => None, + } + } } /// The output words of a run's own buffer, where its first draw's list is shorter. diff --git a/crates/metal2vulkan-runtime/src/mipmap_scratch.rs b/crates/metal2vulkan-runtime/src/mipmap_scratch.rs index cf7d5fc4a..7ae834145 100644 --- a/crates/metal2vulkan-runtime/src/mipmap_scratch.rs +++ b/crates/metal2vulkan-runtime/src/mipmap_scratch.rs @@ -94,6 +94,12 @@ impl Block { self.raw } + /// The device address of the block's byte 0, where it was made addressed + /// ([`Device::make_block`]) on a device that enables `bufferDeviceAddress`. + pub(super) fn address(&self) -> Option { + self.placement.address + } + /// Release the buffer and its memory. /// /// # Safety @@ -181,7 +187,7 @@ impl Device { // SAFETY: the spare was leased to none, so no command uses it. unsafe { block.release_in_section(shared) }; } - match self.make_block(need, MIPMAP_USAGE) { + match self.make_block(need, MIPMAP_USAGE, false) { Ok(block) => (block, need), Err(Error::OutOfMemory(_)) => return Ok(None), Err(error) => return Err(error), @@ -196,11 +202,13 @@ impl Device { } /// A block of `size` bytes in private memory, of `usage` (a filter chain's - /// [`MIPMAP_USAGE`]; a command buffer's pool's, `gpu_pools.rs`). + /// [`MIPMAP_USAGE`]; a command buffer's pool's, `gpu_pools.rs`), with a device address where + /// `addressed` and the device has device addresses (`memory::allocate_addressed`). pub(super) fn make_block( &self, size: u64, usage: vk::BufferUsageFlags, + addressed: bool, ) -> Result { if self.is_lost() { return Err(Error::DeviceLost); @@ -214,12 +222,22 @@ impl Device { let raw = unsafe { raw_device.create_buffer(&info, None) }.map_err(vulkan)?; // SAFETY: `raw` is a live buffer of this device. let requirements = unsafe { raw_device.get_buffer_memory_requirements(raw) }; - let allocated = crate::memory::allocate( - &shared.memory, - raw_device, - &requirements, - MemoryClass::Private, - ); + let allocated = if addressed { + crate::memory::allocate_addressed( + &shared.memory, + raw_device, + &requirements, + MemoryClass::Private, + &shared.counts, + ) + } else { + crate::memory::allocate( + &shared.memory, + raw_device, + &requirements, + MemoryClass::Private, + ) + }; let placed = allocated.and_then(|placement| { // SAFETY: the placement meets the buffer's requirements and is bound nowhere // else. diff --git a/crates/metal2vulkan-runtime/src/queue.rs b/crates/metal2vulkan-runtime/src/queue.rs index 39f7ef92a..9211b138c 100644 --- a/crates/metal2vulkan-runtime/src/queue.rs +++ b/crates/metal2vulkan-runtime/src/queue.rs @@ -30,6 +30,7 @@ use super::attachment_stand_in::BackingPool; use super::command_buffer::hang::QueueHangs; use super::command_buffer::own::{running, slot_wait, Answer, Context}; +use super::command_buffer::revocation::QueueErrors; use super::command_buffer::CommandBuffer; use super::contexts; use super::degradation::Degradation; @@ -100,6 +101,9 @@ struct QueueShared { /// The program's handles of it ([`Handle`]): a predicated loop that would run on without /// bound stops once none is left (`command_buffer/rerun.rs`). handles: AtomicUsize, + /// Its command buffers that completed with a GPU error they caused, which revoke it at the + /// second (`command_buffer/revocation.rs`). + errors: QueueErrors, } /// A queue's slots: one per uncompleted command buffer, at most `max`. @@ -276,6 +280,7 @@ impl Device { kept_images: KeptImages::default(), hangs: Arc::default(), handles: AtomicUsize::new(1), + errors: QueueErrors::default(), }), Handle(true), ) @@ -406,6 +411,12 @@ impl CommandQueue { &self.0.hangs } + /// Its command buffers that completed with a GPU error they caused + /// (`command_buffer/revocation.rs`). + pub(super) fn errors(&self) -> &QueueErrors { + &self.0.errors + } + /// Place a command buffer of the queue that completed after every one placed before: `place` /// takes the latest GPU end of those and gives the command buffer's GPU end, which becomes /// the latest where later (`gpu_time.rs`). diff --git a/crates/metal2vulkan-runtime/src/render.rs b/crates/metal2vulkan-runtime/src/render.rs index 0e5c43413..18998a393 100644 --- a/crates/metal2vulkan-runtime/src/render.rs +++ b/crates/metal2vulkan-runtime/src/render.rs @@ -691,18 +691,67 @@ fn writes_primitive_ids(pipeline: &DrawingState) -> bool { }) } -/// Refuses (`NotImplemented(PrivatePrimitives)`) a draw of `pipeline` of a private type drawn as -/// its program's list where `[[primitive_id]]` would read other than Metal's: under a vertex -/// function that computes it into its varying, from a vertex index the list's indices are not. -/// Answers whether the draw is of quads or a quad strip whose fragment function reads it -/// (`BindState::quad_primitive_ids`), which runs the variant that reads the quad's, as Metal -/// counts one primitive a quad where the list draws two triangles. -fn private_primitive_ids(pipeline: &DrawingState, program: RewriteProgram) -> Result { - if writes_primitive_ids(pipeline) { - return Err(Error::NotImplemented(RuntimeGap::PrivatePrimitives)); +/// How a draw of one of Metal's private types, drawn as its program's list, binds +/// (`BindState::quad_primitive_ids`, `BindState::private_list`); the default for every other +/// draw. +#[derive(Clone, Copy, Default)] +pub(super) struct PrivateForm { + /// Quads or a quad strip whose fragment function reads `[[primitive_id]]`: the variant that + /// reads the quad's, as Metal counts one primitive a quad where the list draws two triangles. + quad_primitive_ids: bool, + /// The pulled list form (`VariantKey::private_list`): each list position run once without + /// indices, its index and Metal's base vertex read at the list's address. Metal runs the vertex + /// function once per vertex of its list for these types (its probes' counts on the M3 Max, + /// macOS 27.0.1), where Vulkan's indexed list draw may run a vertex once for every primitive + /// that shares it: the form for a vertex function that writes memory, and for one that writes + /// the primitive ID's varying, whose index the list's positions are. Also for a direct draw + /// without indices whose last vertex ID passes `i32::MAX`: an indexed list's base vertex + /// (`vertexOffset`, an `int32_t`) cannot carry a start past it, and Vulkan states no sum of an + /// index and the base past it, where the form adds them in the vertex function, wrapping as + /// Metal's vertex IDs do (its probes from vertex starts 2^31 - 3, 2^31 + 3 and 2^32 - 4). + private_list: bool, +} + +impl PrivateForm { + /// The form of `draw` of `pipeline` of a private type, listed by `program`. + fn of(pipeline: &DrawingState, program: RewriteProgram, draw: &DrawCall) -> PrivateForm { + let graphics = &pipeline.base().graphics; + let quads = matches!(program, RewriteProgram::Quads | RewriteProgram::QuadStrip); + let far = matches!(*draw, DrawCall::Primitives { vertex_start, vertex_count, .. } + if u64::from(vertex_start) + u64::from(vertex_count) > 1 << 31); + PrivateForm { + quad_primitive_ids: quads && graphics.reads_primitive_id, + private_list: writes_primitive_ids(pipeline) || graphics.vertex_writes_memory || far, + } + } +} + +/// The draw the binder instantiates for `draw` of a private type in the private list form, of +/// `program`'s list: a direct draw's list from its first index (the word after Metal's base vertex) +/// as first vertex, with its instances and base instance; an indirect draw as given, whose list +/// the GPU counts. +fn listed_call(program: RewriteProgram, draw: &DrawCall) -> DrawCall { + let listed = |count: u32, instance_count, base_instance| DrawCall::Primitives { + vertex_start: 1, + vertex_count: u32::try_from(program.capacity(u64::from(count))).unwrap_or(u32::MAX), + instance_count, + base_instance, + }; + match *draw { + DrawCall::Primitives { + vertex_count, + instance_count, + base_instance, + .. + } => listed(vertex_count, instance_count, base_instance), + DrawCall::Indexed { + index_count, + instance_count, + base_instance, + .. + } => listed(index_count, instance_count, base_instance), + other => other, } - let quads = matches!(program, RewriteProgram::Quads | RewriteProgram::QuadStrip); - Ok(quads && pipeline.base().graphics.reads_primitive_id) } /// What a draw settles from the encoder's state before its bind state @@ -3146,9 +3195,9 @@ impl RenderLowering { }; let empty = index_count == 0 || instance_count == 0; let Some(assembly) = Assembly::of(primitive_type) else { - // Metal's GPU faults at any indices. + // Metal's GPU faults at it, of any index count, of no index or instance too. let fault = NineFailure::Fault(CommandBufferError::PageFault); - return self.draw_nine(call, empty, (!empty).then_some(fault)); + return self.draw_nine(call, empty, Some(fault)); }; self.draw(call, assembly, draw, buffers, empty) } @@ -7081,9 +7130,9 @@ impl RenderLowering { let provoking = self.provoking(call, &pipeline, assembly, &draw); let rotated_weights = provoking.rotates_weights(assembly, &pipeline); let restarted = self.restarted(assembly, &draw, provoking); - let quad_primitive_ids = match assembly { - Assembly::Private(program) => private_primitive_ids(&pipeline, program)?, - _ => false, + let private = match assembly { + Assembly::Private(program) => PrivateForm::of(&pipeline, program, &draw), + _ => PrivateForm::default(), }; let assembly = restarted.map_or(assembly, |r| r.assembly()); // Its settings, and the memo entry its draw state and pipeline are found and kept in @@ -7160,7 +7209,7 @@ impl RenderLowering { &pipeline, &settings, primitive_id_indices, - quad_primitive_ids, + private, rotated_weights, ), (&pass_start, &sampler_maps), @@ -7294,7 +7343,12 @@ impl RenderLowering { } } // Over the last draw's commands, in their storage (`LiveBind::commands`). - plan.instantiate_draw_into(&live.state, &draw, &mut live.commands) + // A private type's list in the private list form is drawn without indices (`listed_call`). + let bound = match (private.private_list, restarted) { + (true, Some(restarted)) => listed_call(restarted.program, &draw), + _ => draw, + }; + plan.instantiate_draw_into(&live.state, &bound, &mut live.commands) .map_err(Error::Bind)?; // A mesh draw's own key, its residual form where the plan's is (`RenderVariant::plan`). if let Some(own) = live.commands.specialization.as_mut() { @@ -7384,6 +7438,7 @@ impl RenderLowering { &mut self.core, ((restarted.program, restarted.order), restarted.gap.gap()), (vertex_start, vertex_count), + private.private_list, )?; (None, Some(Listed::Written(list))) } @@ -7397,7 +7452,11 @@ impl RenderLowering { }, Some(index), None, - ) if restarted.program.gathers() && index.in_place() && !self.replaying => { + ) if restarted.program.gathers() + && index.in_place() + && !self.replaying + && !private.private_list => + { let size = restarted.index_size.unwrap_or(4); let arguments = index_rewrite::Arguments::Direct { count: index_count, @@ -7433,6 +7492,7 @@ impl RenderLowering { ( (restarted.program, restarted.restart, restarted.order), restarted.gap.gap(), + false, ), Some(index), &arguments, @@ -7488,6 +7548,7 @@ impl RenderLowering { ( (restarted.program, restarted.restart, restarted.order), restarted.gap.gap(), + private.private_list, ), index, &arguments, @@ -7857,6 +7918,17 @@ impl RenderLowering { if let Some(header) = self.replayed.as_ref().and_then(|r| r.merged_header()) { tables = tables.with_merged_header(header); } + // A private type's list in the private list form is read at its address, which the device + // gives the list's memory where it has device addresses, as the form needs. + if capture.is_none() && variant.key().private_list { + let address = match (&listed, &rewrite) { + (Some(list), _) => list.address(), + (_, Some(pass)) => pass.address(), + _ => None, + }; + let address = address.ok_or(Error::NotImplemented(RuntimeGap::PrivatePrimitives))?; + tables = tables.with_indices(address); + } // A de-indexed draw's vertex function reads its indices in place, at their address. if capture.is_none() && variant.key().primitive_id_indices.is_some() { let address = buffers @@ -8366,8 +8438,8 @@ impl RenderLowering { let sized = device.shared().sized_index_bind; let one = |draw| ([draw; 2], 1); // A list the CPU or a gather run wrote draws as the indexed draw of it the binder's draw - // becomes. - let listed_draw = match &listed { + // becomes; in the private list form, as the binder's draw. + let listed_draw = match listed.as_ref().filter(|_| !private.private_list) { Some(list) => Some( list.draw(commands.draw, sized) .ok_or_else(|| internal("a written list of another draw"))?, @@ -9346,8 +9418,8 @@ impl RenderLowering { /// Bring `live`, the encoder's kept bind state, to the bind state a draw of `pipeline` under /// `settings` binds in, reading its indices as `primitive_id_indices` says (`BindState:: - /// primitive_id_indices`, [`primitive_id_indices`]), its quads' primitive IDs as - /// `quad_primitive_ids` says (`BindState::quad_primitive_ids`, [`private_primitive_ids`]), + /// primitive_id_indices`, [`primitive_id_indices`]), a private type's list as `private` says + /// (`BindState::quad_primitive_ids` and `private_list`, [`PrivateForm`]), /// its triangles' barycentric weights as `rotated_weights` says (`BindState::rotated_weights`, /// `render/provoking.rs`), /// its vertex, object and mesh tables @@ -9362,11 +9434,11 @@ impl RenderLowering { fn settle_draw( &self, live: &mut LiveBind, - (pipeline, settings, primitive_id_indices, quad_primitive_ids, rotated_weights): ( + (pipeline, settings, primitive_id_indices, private, rotated_weights): ( &DrawingState, &DrawSettings, Option, - bool, + PrivateForm, bool, ), (pass_start, sampler_maps): (&PassStartTables, &SamplerMaps), @@ -9409,7 +9481,8 @@ impl RenderLowering { ); reshape.field(&mut state.depth16_bias_raises, settings.depth16_bias_raises); reshape.field(&mut state.primitive_id_indices, primitive_id_indices); - reshape.field(&mut state.quad_primitive_ids, quad_primitive_ids); + reshape.field(&mut state.quad_primitive_ids, private.quad_primitive_ids); + reshape.field(&mut state.private_list, private.private_list); reshape.field(&mut state.rotated_weights, rotated_weights); reshape.field_from(&mut state.dropped_colors, &colors.dropped); reshape.field_from(&mut state.extended_shadows, shadows); diff --git a/crates/metal2vulkan-runtime/src/render/executions.rs b/crates/metal2vulkan-runtime/src/render/executions.rs index e8a22ac94..99ebc8b93 100644 --- a/crates/metal2vulkan-runtime/src/render/executions.rs +++ b/crates/metal2vulkan-runtime/src/render/executions.rs @@ -266,8 +266,8 @@ use super::RenderCall; use super::RenderCommandEncoder; use super::{ index_size, Assembly, Before, DrawBuffers, DrawingState, IndexedDraw, Instance, - InterlockedStorage, Next, PatchDraw, PendingDraw, Piece, RenderLowering, RenderStateKind, - PASS_DRAW_STAGES, + InterlockedStorage, Next, PatchDraw, PendingDraw, Piece, PrivateForm, RenderLowering, + RenderStateKind, PASS_DRAW_STAGES, }; use crate::amplification::Amplification; use crate::argument_table::ArgumentTable; @@ -1805,7 +1805,7 @@ impl RenderLowering { let sampler_maps = self.sampler_maps(state, &pass_start)?; let settled = self.settle_draw( &mut lock(&live), - (state, &settings, None, false, false), + (state, &settings, None, PrivateForm::default(), false), (&pass_start, &sampler_maps), (&mut argument_samplers, &mut None), (&function_tables, &mut None), diff --git a/crates/metal2vulkan-runtime/src/render/executions/gpu.rs b/crates/metal2vulkan-runtime/src/render/executions/gpu.rs index aded65d03..4678c7080 100644 --- a/crates/metal2vulkan-runtime/src/render/executions/gpu.rs +++ b/crates/metal2vulkan-runtime/src/render/executions/gpu.rs @@ -74,7 +74,7 @@ use std::sync::Arc; use super::super::bound::{Bound, Recorded}; use super::super::pass_start_reads::PassStartTables; -use super::super::{Assembly, DrawBuffers, Recording, RenderLowering}; +use super::super::{Assembly, DrawBuffers, PrivateForm, Recording, RenderLowering}; use super::{HostStepCause, PassStorage, RenderExecution, Rendered, CALL}; use crate::binding::PushWrite; use crate::blit::{reads_by, writes_by}; @@ -715,7 +715,7 @@ impl RenderLowering { let mut live = lock(&live); let Settled { variant, plan, .. } = self.settle_draw( &mut live, - (state, &settings, None, false, false), + (state, &settings, None, PrivateForm::default(), false), (&pass_start, &sampler_maps), (&mut argument_samplers, &mut None), (&function_tables, &mut None), diff --git a/crates/metal2vulkan-runtime/src/render_values.rs b/crates/metal2vulkan-runtime/src/render_values.rs index e0b2b66c0..06bded244 100644 --- a/crates/metal2vulkan-runtime/src/render_values.rs +++ b/crates/metal2vulkan-runtime/src/render_values.rs @@ -346,7 +346,7 @@ pub enum DrawPrimitiveType { /// 9, which Metal's GPU draws nothing of, failing the command buffer (measured on the M3 /// Max, macOS 27.0.1, 18 draws): a direct draw of 3 vertices or more hangs it /// ([`CommandBufferError::GpuHang`](crate::CommandBufferError::GpuHang)), an indexed one of - /// any indices faults it + /// any indices, of none or of no instance too, faults it /// ([`CommandBufferError::PageFault`](crate::CommandBufferError::PageFault)), and an /// indirect one, whatever its arguments, fails it as a victim of the GPU's recovery /// ([`CommandBufferError::GpuRecoveryVictim`](crate::CommandBufferError::GpuRecoveryVictim)); @@ -358,6 +358,9 @@ pub enum DrawPrimitiveType { /// of its queue that reaches its submission meanwhile (committed during it, its event waits /// met) runs nothing and completes with no error, after it. A fault or a victim fails that /// encoder alone: the encoders after it run, and so do the queue's other command buffers. + /// A hang or a fault counts against its queue, a victim does not: from the completion of the + /// queue's second, its later command buffers fail at once + /// ([`CommandBufferError::AccessRevoked`](crate::CommandBufferError::AccessRevoked)). /// Metal's API validation stops the process at it. Nine, } diff --git a/crates/metal2vulkan-runtime/src/tests/command_buffer.rs b/crates/metal2vulkan-runtime/src/tests/command_buffer.rs index 3c41b140a..36c681428 100644 --- a/crates/metal2vulkan-runtime/src/tests/command_buffer.rs +++ b/crates/metal2vulkan-runtime/src/tests/command_buffer.rs @@ -254,6 +254,7 @@ fn a_command_buffer_error_names_whose_failure_it_is() { (E::PageFault, Metal, 3), (E::GpuHang, Metal, 2), (E::GpuRecoveryVictim, Metal, 1), + (E::AccessRevoked, Metal, 4), (E::Execution(1), Metal, 1), (E::Execution(12), Metal, 12), (E::RenderTargetSize, Metal, 1), diff --git a/crates/metal2vulkan-validation/fixtures/public/engine/TOOLCHAIN b/crates/metal2vulkan-validation/fixtures/public/engine/TOOLCHAIN index d14a9bc76..98df8dc78 100644 --- a/crates/metal2vulkan-validation/fixtures/public/engine/TOOLCHAIN +++ b/crates/metal2vulkan-validation/fixtures/public/engine/TOOLCHAIN @@ -237,6 +237,7 @@ fixture rt6_first_vertex: metal: Apple metal version 32023.921 (metalfe-32023.92 fixture rt6_layered: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425) fixture rt6_patch_index: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425) fixture rt6_private_types: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425) +fixture rt6_private_writes: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425) fixture rt6_provoking: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425) fixture rt6_render_state: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425) fixture rt6_resolves: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425) diff --git a/crates/metal2vulkan-validation/fixtures/public/engine/rt6_private_writes.air.ll b/crates/metal2vulkan-validation/fixtures/public/engine/rt6_private_writes.air.ll new file mode 100644 index 000000000..d5f99292c --- /dev/null +++ b/crates/metal2vulkan-validation/fixtures/public/engine/rt6_private_writes.air.ll @@ -0,0 +1,101 @@ +; Generated by scripts/regen-air-fixtures from rt6_private_writes.metal (typed pointers; xcrun metal-as reassembles it). Do not edit. +; ModuleID = '-' +source_filename = "-" +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-n8:16:32" +target triple = "air64_v28-apple-macosx26.0.0" + +%"struct.metal::_atomic" = type { i32 } + +; Function Attrs: mustprogress nounwind willreturn +define <{ <4 x float> }> @pw_vertex(i32 noundef %0, i32 noundef %1, i32 noundef %2, %"struct.metal::_atomic" addrspace(1)* nocapture noundef "air-buffer-no-alias" %3, <2 x i32> addrspace(1)* nocapture noundef writeonly "air-buffer-no-alias" %4) local_unnamed_addr #0 { + %6 = sub i32 %0, %1 + %7 = and i32 %6, 63 + %8 = tail call i32 @air.min.u.i32(i32 %2, i32 1) #4 + %9 = shl i32 %8, 6 + %10 = or i32 %9, %7 + %11 = zext i32 %10 to i64 + %12 = getelementptr inbounds %"struct.metal::_atomic", %"struct.metal::_atomic" addrspace(1)* %3, i64 %11, i32 0 + %13 = tail call i32 @air.atomic.global.add.u.i32(i32 addrspace(1)* nocapture %12, i32 1, i32 0, i32 2, i1 true) #5 + %14 = insertelement <2 x i32> undef, i32 %0, i64 0 + %15 = insertelement <2 x i32> %14, i32 %1, i64 1 + %16 = getelementptr inbounds <2 x i32>, <2 x i32> addrspace(1)* %4, i64 %11 + store <2 x i32> %15, <2 x i32> addrspace(1)* %16, align 8, !tbaa !29, !alias.scope !32, !noalias !35 + %17 = and i32 %0, 1 + %18 = tail call fast float @air.convert.f.f32.u.i32(i32 %17) #4 + %19 = fadd fast float %18, -5.000000e-01 + %20 = lshr i32 %0, 1 + %21 = and i32 %20, 1 + %22 = tail call fast float @air.convert.f.f32.u.i32(i32 %21) #4 + %23 = fadd fast float %22, -5.000000e-01 + %24 = insertelement <4 x float> , float %19, i64 0 + %25 = insertelement <4 x float> %24, float %23, i64 1 + %26 = insertvalue <{ <4 x float> }> undef, <4 x float> %25, 0 + ret <{ <4 x float> }> %26 +} + +; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn +declare float @air.convert.f.f32.u.i32(i32) local_unnamed_addr #1 + +; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn +define <4 x float> @pw_fragment() local_unnamed_addr #2 { + ret <4 x float> +} + +; Function Attrs: mustprogress nofree nosync nounwind readnone willreturn +declare i32 @air.min.u.i32(i32, i32) local_unnamed_addr #1 + +; Function Attrs: mustprogress nounwind willreturn +declare i32 @air.atomic.global.add.u.i32(i32 addrspace(1)* nocapture, i32, i32, i32, i1) local_unnamed_addr #3 + +attributes #0 = { mustprogress nounwind willreturn "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="0" "no-builtins" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" } +attributes #1 = { mustprogress nofree nosync nounwind readnone willreturn } +attributes #2 = { mustprogress nofree norecurse nosync nounwind readnone willreturn "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="128" "no-builtins" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" } +attributes #3 = { mustprogress nounwind willreturn } +attributes #4 = { nounwind readnone willreturn } +attributes #5 = { nounwind willreturn } + +!llvm.module.flags = !{!0, !1, !2, !3, !4, !5, !6, !7, !8} +!air.vertex = !{!9} +!air.fragment = !{!19} +!air.compile_options = !{!23, !24, !25} +!llvm.ident = !{!26} +!air.version = !{!27} +!air.language_version = !{!28} + +!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 27, i32 0]} +!1 = !{i32 1, !"wchar_size", i32 4} +!2 = !{i32 7, !"frame-pointer", i32 2} +!3 = !{i32 7, !"air.max_device_buffers", i32 31} +!4 = !{i32 7, !"air.max_constant_buffers", i32 31} +!5 = !{i32 7, !"air.max_threadgroup_buffers", i32 31} +!6 = !{i32 7, !"air.max_textures", i32 128} +!7 = !{i32 7, !"air.max_read_write_textures", i32 8} +!8 = !{i32 7, !"air.max_samplers", i32 16} +!9 = !{<{ <4 x float> }> (i32, i32, i32, %"struct.metal::_atomic" addrspace(1)*, <2 x i32> addrspace(1)*)* @pw_vertex, !10, !12} +!10 = !{!11} +!11 = !{!"air.position", !"air.arg_type_name", !"float4", !"air.arg_name", !"position"} +!12 = !{!13, !14, !15, !16, !18} +!13 = !{i32 0, !"air.vertex_id", !"air.arg_type_name", !"uint", !"air.arg_name", !"vid"} +!14 = !{i32 1, !"air.base_vertex", !"air.arg_type_name", !"uint", !"air.arg_name", !"base_vertex"} +!15 = !{i32 2, !"air.instance_id", !"air.arg_type_name", !"uint", !"air.arg_name", !"iid"} +!16 = !{i32 3, !"air.buffer", !"air.location_index", i32 0, i32 1, !"air.read_write", !"air.address_space", i32 1, !"air.struct_type_info", !17, !"air.arg_type_size", i32 4, !"air.arg_type_align_size", i32 4, !"air.arg_type_name", !"metal::_atomic", !"air.arg_name", !"counts"} +!17 = !{i32 0, i32 4, i32 0, !"uint", !"__s"} +!18 = !{i32 4, !"air.buffer", !"air.location_index", i32 1, i32 1, !"air.read_write", !"air.address_space", i32 1, !"air.arg_type_size", i32 8, !"air.arg_type_align_size", i32 8, !"air.arg_type_name", !"uint2", !"air.arg_name", !"seen"} +!19 = !{<4 x float> ()* @pw_fragment, !20, !22} +!20 = !{!21} +!21 = !{!"air.render_target", i32 0, i32 0, !"air.arg_type_name", !"float4"} +!22 = !{} +!23 = !{!"air.compile.denorms_disable"} +!24 = !{!"air.compile.fast_math_enable"} +!25 = !{!"air.compile.framebuffer_fetch_enable"} +!26 = !{!"Apple metal version 32023.921 (metalfe-32023.921.6)"} +!27 = !{i32 2, i32 8, i32 0} +!28 = !{!"Metal", i32 4, i32 0, i32 0} +!29 = !{!30, !30, i64 0} +!30 = !{!"omnipotent char", !31, i64 0} +!31 = !{!"Simple C++ TBAA"} +!32 = !{!33} +!33 = distinct !{!33, !34, !"air-alias-scope-arg(4)"} +!34 = distinct !{!34, !"air-alias-scopes(pw_vertex)"} +!35 = !{!36} +!36 = distinct !{!36, !34, !"air-alias-scope-arg(3)"} diff --git a/crates/metal2vulkan-validation/fixtures/public/engine/rt6_private_writes.ll b/crates/metal2vulkan-validation/fixtures/public/engine/rt6_private_writes.ll new file mode 100644 index 000000000..73343d9ce --- /dev/null +++ b/crates/metal2vulkan-validation/fixtures/public/engine/rt6_private_writes.ll @@ -0,0 +1,101 @@ +; Generated by scripts/regen-air-fixtures from rt6_private_writes.metal (llvm-dis of rt6_private_writes.air). Do not edit. +; ModuleID = '' +source_filename = "-" +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-n8:16:32" +target triple = "air64_v28-apple-macosx26.0.0" + +%"struct.metal::_atomic" = type { i32 } + +; Function Attrs: mustprogress nounwind willreturn +define <{ <4 x float> }> @pw_vertex(i32 noundef %0, i32 noundef %1, i32 noundef %2, ptr addrspace(1) noundef captures(none) "air-buffer-no-alias" %3, ptr addrspace(1) noundef writeonly captures(none) "air-buffer-no-alias" %4) local_unnamed_addr #0 { + %6 = sub i32 %0, %1 + %7 = and i32 %6, 63 + %8 = tail call i32 @air.min.u.i32(i32 %2, i32 1) #4 + %9 = shl i32 %8, 6 + %10 = or i32 %9, %7 + %11 = zext i32 %10 to i64 + %12 = getelementptr inbounds %"struct.metal::_atomic", ptr addrspace(1) %3, i64 %11, i32 0 + %13 = tail call i32 @air.atomic.global.add.u.i32(ptr addrspace(1) captures(none) %12, i32 1, i32 0, i32 2, i1 true) #5 + %14 = insertelement <2 x i32> undef, i32 %0, i64 0 + %15 = insertelement <2 x i32> %14, i32 %1, i64 1 + %16 = getelementptr inbounds <2 x i32>, ptr addrspace(1) %4, i64 %11 + store <2 x i32> %15, ptr addrspace(1) %16, align 8, !tbaa !29, !alias.scope !32, !noalias !35 + %17 = and i32 %0, 1 + %18 = tail call fast float @air.convert.f.f32.u.i32(i32 %17) #4 + %19 = fadd fast float %18, -5.000000e-01 + %20 = lshr i32 %0, 1 + %21 = and i32 %20, 1 + %22 = tail call fast float @air.convert.f.f32.u.i32(i32 %21) #4 + %23 = fadd fast float %22, -5.000000e-01 + %24 = insertelement <4 x float> , float %19, i64 0 + %25 = insertelement <4 x float> %24, float %23, i64 1 + %26 = insertvalue <{ <4 x float> }> undef, <4 x float> %25, 0 + ret <{ <4 x float> }> %26 +} + +; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) +declare float @air.convert.f.f32.u.i32(i32) local_unnamed_addr #1 + +; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) +define <4 x float> @pw_fragment() local_unnamed_addr #2 { + ret <4 x float> splat (float 1.000000e+00) +} + +; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) +declare i32 @air.min.u.i32(i32, i32) local_unnamed_addr #1 + +; Function Attrs: mustprogress nounwind willreturn +declare i32 @air.atomic.global.add.u.i32(ptr addrspace(1) captures(none), i32, i32, i32, i1) local_unnamed_addr #3 + +attributes #0 = { mustprogress nounwind willreturn "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="0" "no-builtins" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" } +attributes #1 = { mustprogress nofree nosync nounwind willreturn memory(none) } +attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="128" "no-builtins" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" } +attributes #3 = { mustprogress nounwind willreturn } +attributes #4 = { nounwind willreturn memory(none) } +attributes #5 = { nounwind willreturn } + +!llvm.module.flags = !{!0, !1, !2, !3, !4, !5, !6, !7, !8} +!air.vertex = !{!9} +!air.fragment = !{!19} +!air.compile_options = !{!23, !24, !25} +!llvm.ident = !{!26} +!air.version = !{!27} +!air.language_version = !{!28} + +!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 27, i32 0]} +!1 = !{i32 1, !"wchar_size", i32 4} +!2 = !{i32 7, !"frame-pointer", i32 2} +!3 = !{i32 7, !"air.max_device_buffers", i32 31} +!4 = !{i32 7, !"air.max_constant_buffers", i32 31} +!5 = !{i32 7, !"air.max_threadgroup_buffers", i32 31} +!6 = !{i32 7, !"air.max_textures", i32 128} +!7 = !{i32 7, !"air.max_read_write_textures", i32 8} +!8 = !{i32 7, !"air.max_samplers", i32 16} +!9 = !{ptr @pw_vertex, !10, !12} +!10 = !{!11} +!11 = !{!"air.position", !"air.arg_type_name", !"float4", !"air.arg_name", !"position"} +!12 = !{!13, !14, !15, !16, !18} +!13 = !{i32 0, !"air.vertex_id", !"air.arg_type_name", !"uint", !"air.arg_name", !"vid"} +!14 = !{i32 1, !"air.base_vertex", !"air.arg_type_name", !"uint", !"air.arg_name", !"base_vertex"} +!15 = !{i32 2, !"air.instance_id", !"air.arg_type_name", !"uint", !"air.arg_name", !"iid"} +!16 = !{i32 3, !"air.buffer", !"air.location_index", i32 0, i32 1, !"air.read_write", !"air.address_space", i32 1, !"air.struct_type_info", !17, !"air.arg_type_size", i32 4, !"air.arg_type_align_size", i32 4, !"air.arg_type_name", !"metal::_atomic", !"air.arg_name", !"counts"} +!17 = !{i32 0, i32 4, i32 0, !"uint", !"__s"} +!18 = !{i32 4, !"air.buffer", !"air.location_index", i32 1, i32 1, !"air.read_write", !"air.address_space", i32 1, !"air.arg_type_size", i32 8, !"air.arg_type_align_size", i32 8, !"air.arg_type_name", !"uint2", !"air.arg_name", !"seen"} +!19 = !{ptr @pw_fragment, !20, !22} +!20 = !{!21} +!21 = !{!"air.render_target", i32 0, i32 0, !"air.arg_type_name", !"float4"} +!22 = !{} +!23 = !{!"air.compile.denorms_disable"} +!24 = !{!"air.compile.fast_math_enable"} +!25 = !{!"air.compile.framebuffer_fetch_enable"} +!26 = !{!"Apple metal version 32023.921 (metalfe-32023.921.6)"} +!27 = !{i32 2, i32 8, i32 0} +!28 = !{!"Metal", i32 4, i32 0, i32 0} +!29 = !{!30, !30, i64 0} +!30 = !{!"omnipotent char", !31, i64 0} +!31 = !{!"Simple C++ TBAA"} +!32 = !{!33} +!33 = distinct !{!33, !34, !"air-alias-scope-arg(4)"} +!34 = distinct !{!34, !"air-alias-scopes(pw_vertex)"} +!35 = !{!36} +!36 = distinct !{!36, !34, !"air-alias-scope-arg(3)"} diff --git a/crates/metal2vulkan-validation/fixtures/public/engine/rt6_private_writes.metal b/crates/metal2vulkan-validation/fixtures/public/engine/rt6_private_writes.metal new file mode 100644 index 000000000..4ae46cf11 --- /dev/null +++ b/crates/metal2vulkan-validation/fixtures/public/engine/rt6_private_writes.metal @@ -0,0 +1,28 @@ +// Owned fixture: a vertex function that writes memory, for draws of Metal's private primitive +// types: each invocation counts itself at its position's slot of buffer 0 (its vertex ID less its +// base vertex, modulo 64, a second 64 slots for instances past the first) and stores the vertex ID +// and base vertex it read at the same slot of buffer 1, and places its vertex at a corner of the +// clip-space square from the vertex ID's low bits; and a fragment function that returns white. So +// a lane compares how many times each list vertex runs, and what it reads, with Metal's. +// Written for this repository; no third-party source. Loop-free. +#include +using namespace metal; + +struct PwVertex { + float4 position [[position]]; +}; + +vertex PwVertex pw_vertex(uint vid [[vertex_id]], uint base_vertex [[base_vertex]], + uint iid [[instance_id]], device atomic_uint *counts [[buffer(0)]], + device uint2 *seen [[buffer(1)]]) { + uint slot = ((vid - base_vertex) & 63u) + 64u * min(iid, 1u); + atomic_fetch_add_explicit(&counts[slot], 1u, memory_order_relaxed); + seen[slot] = uint2(vid, base_vertex); + PwVertex out; + out.position = float4(float(vid & 1u) - 0.5, float((vid >> 1) & 1u) - 0.5, 0.0, 1.0); + return out; +} + +fragment float4 pw_fragment() { + return float4(1.0); +} diff --git a/crates/metal2vulkan-validation/src/runtime_lane/private_primitives.rs b/crates/metal2vulkan-validation/src/runtime_lane/private_primitives.rs index 286dda2c0..639c10d7d 100644 --- a/crates/metal2vulkan-validation/src/runtime_lane/private_primitives.rs +++ b/crates/metal2vulkan-validation/src/runtime_lane/private_primitives.rs @@ -28,6 +28,11 @@ //! list's halved: the list draws two triangles a quad where Metal counts one, so the reference's //! primitive IDs are shifted right by one ([`Lane::reference`]). //! +//! A vertex function that writes the primitive ID's varying (a device without geometry and +//! tessellation shaders, whose fragment functions read `[[primitive_id]]` from it) draws each +//! private type in the private list form, as does one that writes memory ([`writes`]); the other +//! functions here draw the indexed list. +//! //! Type 9's draws, which fail their command buffers as Metal's GPU does: [`type_nine`]. use super::{buffer_with, validated_device, validated_device_with, Messages, ScratchCache, WAIT}; @@ -35,7 +40,9 @@ use crate::air_library::AirLibrary; use crate::gpu::TEST_DEVICE; use metal2vulkan::device::VkFeature; use metal2vulkan::metal::{IndexType, PixelFormat, PrimitiveType, TextureUsage}; -use metal2vulkan::pipeline::{ColorAttachmentDescriptor, RenderPipelineDescriptor, StageSource}; +use metal2vulkan::pipeline::{ + ColorAttachmentDescriptor, RenderPipelineDescriptor, RuntimeFact, StageSource, +}; use metal2vulkan::vk; use metal2vulkan_devtools::{engine_dir, llvm_assemble}; use metal2vulkan_runtime::{ @@ -46,6 +53,7 @@ use metal2vulkan_runtime::{ }; mod type_nine; +mod writes; /// The target's side, in pixels. const SIDE: u64 = 32; @@ -467,16 +475,15 @@ impl Lane { /// `case` drawn as its private type, in its form. fn private(&self, pipeline: &RenderPipelineState, case: &Case) -> Result { - Ok(self.private_executed(pipeline, case)?.0) + Ok(self.private_executed(pipeline, case)?.texels) } - /// [`private`](Self::private)'s texels, and how many geometry stages the pipeline its draw - /// executed carries (`None` for a draw that records nothing). + /// [`private`](Self::private)'s texels, with what its draw executed. fn private_executed( &self, pipeline: &RenderPipelineState, case: &Case, - ) -> Result<(Texels, Option), Error> { + ) -> Result { let index_type = case.form.index_type().unwrap_or(IndexType::UInt32); let index_bytes = bytes_of(index_type, &case.indices); // A buffer of 4 bytes at least, for a draw without indices that names none. @@ -566,23 +573,37 @@ impl Lane { None => {} } assert_eq!(command_buffer.status(), CommandBufferStatus::Completed); - let stages = command_buffer + let render = command_buffer .executions() .iter() .find_map(|e| match e.pipeline() { - ExecutedPipeline::Render(executed) => Some( - executed - .stages - .iter() - .filter(|s| s.stage == vk::ShaderStage::GEOMETRY) - .count(), - ), + ExecutedPipeline::Render(executed) => Some(executed.clone()), _ => None, }); - Ok((texels, stages)) + Ok(Drawn { + texels, + stages: render.as_ref().map(|executed| { + (executed.stages.iter()) + .filter(|s| s.stage == vk::ShaderStage::GEOMETRY) + .count() + }), + listed: render.is_some_and(|executed| { + (executed.dependencies.iter()).any(|d| d.fact == RuntimeFact::PrivateList) + }), + }) } } +/// A private draw's texels, and what it executed. +struct Drawn { + texels: Texels, + /// How many geometry stages the pipeline its draw executed carries (`None` for a draw that + /// records nothing). + stages: Option, + /// Its pipeline runs the private list form (`RuntimeFact::PrivateList`). + listed: bool, +} + /// Whether the case's texels cover a pixel. fn covers(texels: &[Vec<[u32; 4]>]) -> bool { texels[3].iter().any(|t| t[3] == 1) @@ -710,7 +731,7 @@ fn draws_metal_s_lists(cases: &[Case], weights: Weights) { let (mut drawn, mut covered) = (0, 0); for case in cases { let expected = lane.reference(&pipeline, case); - let (texels, stages) = lane + let Drawn { texels, stages, .. } = lane .private_executed(&pipeline, case) .unwrap_or_else(|e| panic!("{case:?} on {name}: {e}")); if weights == Weights::Withheld { @@ -784,8 +805,10 @@ fn through_a_geometry_stage_private_draws_are_metal_s_lists() { } /// Under fragment functions that read fewer of the inputs (the primitive ID without the weights, -/// the weights without the primitive ID, or neither), a draw of each form draws Metal's list too; and the same indices drawn as the -/// public strip of their class differ from Metal's list, so the comparison tells the forms apart. +/// the weights without the primitive ID, or neither), a draw of each form draws Metal's list too; +/// and the same indices drawn as the public strip of their class differ from Metal's list, so the +/// comparison tells the forms apart. Where the fragment function reads no primitive ID, the +/// vertex function, which writes no memory, draws the indexed list, not the private list form. #[test] fn other_fragments_draw_metal_s_lists_and_strips_differ() { let cache = ScratchCache::new().unwrap(); @@ -804,9 +827,13 @@ fn other_fragments_draw_metal_s_lists_and_strips_differ() { ]; for case in &cases { let expected = lane.reference(&pipeline, case); - let texels = lane - .private(&pipeline, case) + let Drawn { texels, listed, .. } = lane + .private_executed(&pipeline, case) .unwrap_or_else(|e| panic!("{fragment} {case:?} on {name}: {e}")); + assert!( + fragment == "pt_primitive" || !listed, + "{fragment} {case:?} on {name}: drawn in the private list form" + ); assert!( covers(&expected), "{fragment} {case:?}: Metal's list covers nothing" @@ -879,3 +906,70 @@ fn quads_count_one_primitive_id_a_quad() { "the validation layer reported: {reported:#?}" ); } + +/// With `geometryShader` and `tessellationShader` withheld, a fragment function reads +/// `[[primitive_id]]` from a flat varying its pipeline's vertex function writes +/// (`LoweringInputs::primitive_id_varying`): every direct, indexed and indirect private draw runs +/// the private list form, whose positions count Metal's primitives (one a quad), and draws Metal's +/// list at every texel. +#[test] +fn with_the_primitive_id_varying_private_draws_are_metal_s_lists() { + let cache = ScratchCache::new().unwrap(); + let messages = Messages::default(); + { + let device = validated_device_with(TEST_DEVICE, &messages, cache.path(), |options| { + options.withheld_features.extend([ + VkFeature::GeometryShader, + VkFeature::TessellationShader, + VkFeature::ShaderTessellationAndGeometryPointSize, + VkFeature::MultiviewGeometryShader, + VkFeature::MultiviewTessellationShader, + ]); + }) + .unwrap(); + let name = device.name().to_owned(); + let lane = Lane::new(device); + let walk: Vec = (0..14).map(|i| (i * 5 + 1) % SCATTERED).collect(); + let pipeline = lane.pipeline("pt_primitive"); + let mut drawn = 0; + for p in PRIVATE { + let mut indirect = + Case::indexed(p, Form::IndexedIndirect(IndexType::UInt32), walk.clone()); + indirect.instances = 2; + let mut vertices = Case::direct(p, 10); + vertices.form = Form::Indirect; + let cases = [ + Case::direct(p, 10), + Case::direct(p, 11), + Case::indexed(p, Form::Indexed(IndexType::UInt16), walk.clone()), + Case::indexed(p, Form::Indexed(IndexType::UInt32), walk.clone()), + indirect, + vertices, + ]; + for case in &cases { + let expected = lane.reference(&pipeline, case); + let Drawn { texels, listed, .. } = lane + .private_executed(&pipeline, case) + .unwrap_or_else(|e| panic!("{case:?} on {name}: {e}")); + assert!( + listed, + "{case:?} on {name}: not drawn in the private list form" + ); + assert!(covers(&expected), "{case:?}: Metal's list covers nothing"); + assert!( + texels == expected, + "{case:?} on {name}: differs from Metal's list" + ); + drawn += 1; + } + } + eprintln!( + "{name}: {drawn} private draws through the primitive ID's varying equal Metal's lists" + ); + } + let reported = messages.take(); + assert!( + reported.is_empty(), + "the validation layer reported: {reported:#?}" + ); +} diff --git a/crates/metal2vulkan-validation/src/runtime_lane/private_primitives/type_nine.rs b/crates/metal2vulkan-validation/src/runtime_lane/private_primitives/type_nine.rs index 0b4460c94..1ca2b919e 100644 --- a/crates/metal2vulkan-validation/src/runtime_lane/private_primitives/type_nine.rs +++ b/crates/metal2vulkan-validation/src/runtime_lane/private_primitives/type_nine.rs @@ -20,14 +20,19 @@ //! the hang) and one committed after the hang. //! - **A direct draw of 1 or 2 vertices, or of no vertex or instance** draws nothing: the pass //! clears, and every command buffer runs. -//! - **An indexed draw** (1, 2 or 3 indices) faults Metal's GPU: the command buffer fails with +//! - **An indexed draw** (any index count, none or of no instance too) faults Metal's GPU: the +//! command buffer fails with //! `MTLCommandBufferErrorPageFault` ([`CommandBufferError::PageFault`]); the pass runs nothing //! (no clear), its other encoders run and its signal fires, and the queue's others run. //! - **An indirect draw** (of 3 vertices or none) **or an indexed indirect one** fails the command //! buffer as a victim of the GPU's recovery, `MTLCommandBufferErrorInternal` //! ([`CommandBufferError::GpuRecoveryVictim`]), with the indexed draw's other answers. +//! - **A queue's second fault or hang revokes it**; victims do not count. Once the queue's second +//! command buffer that faulted or hung completed, every one committed on it fails at once with +//! `MTLCommandBufferErrorAccessRevoked` ([`CommandBufferError::AccessRevoked`]): nothing of it +//! runs and its event signals do not fire; a new queue runs on. //! -//! Each scenario commits on the lane's queue the command buffer of the draw (a blit's mark, the +//! Each scenario commits on a queue of its own the command buffer of the draw (a blit's mark, the //! pass of the draw over a target the host filled, a mark, an event signal of 1, a mark), at once //! one that marks and signals 2, and on another queue one that marks. 10 ms on, on the lane's //! queue, it commits one that marks and three that wait for an event first, then mark: the host @@ -87,9 +92,9 @@ const OTHERS: [usize; 7] = [3, 4, 5, 6, 7, 8, 9]; enum Draw { /// `drawPrimitives:vertexStart:vertexCount:instanceCount:`. Direct { vertices: u32, instances: u32 }, - /// `drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferOffset:` of 16-bit - /// indices 0, 1, 2. - Indexed(u32), + /// `drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferOffset:instanceCount:` + /// of 16-bit indices 0, 1, 2. + Indexed { indices: u32, instances: u32 }, /// `drawPrimitives:indirectBuffer:indirectBufferOffset:` of this vertex count, one instance. Indirect(u32), /// `drawIndexedPrimitives:indexType:...:indirectBuffer:` of 3 16-bit indices. @@ -236,7 +241,12 @@ fn targets(lane: &Lane) -> (Vec, RenderPassDescriptor) { } /// Run the scenario (the module docs) of `draw` under `pipeline`. -fn scenario(lane: &Lane, pipeline: &RenderPipelineState, draw: Draw) -> Outcome { +fn scenario( + lane: &Lane, + queue: &CommandQueue, + pipeline: &RenderPipelineState, + draw: Draw, +) -> Outcome { let device = &lane.device; let marks = buffer_with(device, &[0; 40]).unwrap(); let event = device.new_shared_event().unwrap(); @@ -253,7 +263,7 @@ fn scenario(lane: &Lane, pipeline: &RenderPipelineState, draw: Draw) -> Outcome let arguments = buffer_with(device, &arguments).unwrap(); let (targets, pass) = targets(lane); - let mut drawn = Tracked::new(&lane.queue); + let mut drawn = Tracked::new(queue); drawn.mark(&marks, 0); let mut encoder = drawn.command_buffer.render_command_encoder(&pass).unwrap(); encoder.set_render_pipeline_state(pipeline).unwrap(); @@ -269,9 +279,19 @@ fn scenario(lane: &Lane, pipeline: &RenderPipelineState, draw: Draw) -> Outcome vertices, instances, } => encoder.draw_primitives(nine, 0, vertices, instances, 0), - Draw::Indexed(count) => { - encoder.draw_indexed_primitives(nine, count, IndexType::UInt16, &indices, 0, 1, 0, 0) - } + Draw::Indexed { + indices: count, + instances, + } => encoder.draw_indexed_primitives( + nine, + count, + IndexType::UInt16, + &indices, + 0, + instances, + 0, + 0, + ), Draw::Indirect(_) => encoder.draw_primitives_indirect(nine, &arguments, 0), Draw::IndexedIndirect => encoder.draw_indexed_primitives_indirect( nine, @@ -291,16 +311,16 @@ fn scenario(lane: &Lane, pipeline: &RenderPipelineState, draw: Draw) -> Outcome .unwrap(); drawn.mark(&marks, 2); - let mut at_once = Tracked::new(&lane.queue); + let mut at_once = Tracked::new(queue); at_once.mark(&marks, 3); at_once .command_buffer .encode_signal_event(EventRef::from(&event), 2) .unwrap(); - let mut later = Tracked::new(&lane.queue); + let mut later = Tracked::new(queue); later.mark(&marks, 4); let waiting = |slot: usize, gate| { - let tracked = Tracked::new(&lane.queue); + let tracked = Tracked::new(queue); tracked .command_buffer .encode_wait_for_event(EventRef::from(gate), 1) @@ -340,7 +360,7 @@ fn scenario(lane: &Lane, pipeline: &RenderPipelineState, draw: Draw) -> Outcome held.wait(); other.wait(); signaller.wait_until_completed_for(WAIT).unwrap(); - let mut after = Tracked::new(&lane.queue); + let mut after = Tracked::new(queue); after.mark(&marks, 9); after.commit(); after.wait(); @@ -371,7 +391,9 @@ fn answers_as_metal_does(draws: &[Draw], expected: Expected) { let lane = Lane::new(device); let pipeline = lane.pipeline("pt_plain"); for &draw in draws { - let outcome = scenario(&lane, &pipeline, draw); + // A queue of its own: a queue's second fault or hang revokes it (`AccessRevoked`). + let queue = lane.device.new_command_queue().unwrap(); + let outcome = scenario(&lane, &queue, &pipeline, draw); check(&outcome, expected, &format!("{draw:?} on {name}")); let [drawn, rest @ ..] = &outcome.answers; let ms = |answer: &Answer| answer.took().as_secs_f64() * 1e3; @@ -543,8 +565,16 @@ fn a_direct_draw_of_type_nine_of_fewer_vertices_draws_nothing() { /// `GpuRecoveryVictim`: the pass runs nothing, everything else runs. #[test] fn indexed_draws_of_type_nine_fault_and_indirect_ones_are_victims() { + let indexed = |indices, instances| Draw::Indexed { indices, instances }; answers_as_metal_does( - &[Draw::Indexed(1), Draw::Indexed(2), Draw::Indexed(3)], + &[ + indexed(1, 1), + indexed(2, 1), + indexed(3, 1), + indexed(0, 1), + indexed(3, 0), + indexed(0, 0), + ], Expected::Fails(CommandBufferError::PageFault), ); answers_as_metal_does( @@ -552,3 +582,196 @@ fn indexed_draws_of_type_nine_fault_and_indirect_ones_are_victims() { Expected::Fails(CommandBufferError::GpuRecoveryVictim), ); } + +/// One command buffer on `queue` of a mark into `marks` at `slot`, the draw of type 9 `draw` under +/// `pipeline` where there is one, and an event signal of 1; committed, waited for: its answer, +/// whether it marked, and the event's value. +fn one( + lane: &Lane, + queue: &CommandQueue, + pipeline: &RenderPipelineState, + draw: Option, +) -> (Answer, bool, u64) { + let device = &lane.device; + let marks = buffer_with(device, &[0; 40]).unwrap(); + let event = device.new_shared_event().unwrap(); + let indices = buffer_with(device, &[0, 0, 1, 0, 2, 0, 0, 0]).unwrap(); + let arguments: Vec = [3u32, 1, 0, 0, 0] + .iter() + .flat_map(|w| w.to_le_bytes()) + .collect(); + let arguments = buffer_with(device, &arguments).unwrap(); + let mut tracked = Tracked::new(queue); + tracked.mark(&marks, 0); + if let Some(draw) = draw { + let (_targets, pass) = targets(lane); + let mut encoder = tracked + .command_buffer + .render_command_encoder(&pass) + .unwrap(); + encoder.set_render_pipeline_state(pipeline).unwrap(); + encoder + .set_vertex_buffer(Some(&lane.positions), 0, 0) + .unwrap(); + encoder + .set_vertex_buffer(Some(&lane.offsets), 0, 1) + .unwrap(); + let nine = DrawPrimitiveType::Nine; + match draw { + Draw::Direct { + vertices, + instances, + } => encoder.draw_primitives(nine, 0, vertices, instances, 0), + Draw::Indexed { + indices: count, + instances, + } => encoder.draw_indexed_primitives( + nine, + count, + IndexType::UInt16, + &indices, + 0, + instances, + 0, + 0, + ), + Draw::Indirect(_) => encoder.draw_primitives_indirect(nine, &arguments, 0), + Draw::IndexedIndirect => encoder.draw_indexed_primitives_indirect( + nine, + IndexType::UInt16, + &indices, + 0, + &arguments, + 0, + ), + } + .unwrap(); + encoder.end_encoding().unwrap(); + } + tracked + .command_buffer + .encode_signal_event(EventRef::from(&event), 1) + .unwrap(); + tracked.commit(); + tracked.wait(); + let marked = read_buffer(&marks, 0, 4).unwrap()[0] == MARKS[0].1; + (tracked.answer(), marked, event.signaled_value()) +} + +/// On one queue, each of `draws` of type 9 in turn (its command buffer failing with its error), +/// each followed by a command buffer of no draw: those run until the queue's second fault or hang +/// completed, and from then on every command buffer of the queue fails at its commit with +/// `AccessRevoked`, running nothing and signalling nothing, while a new queue runs. +fn revokes_after(draws: &[(Draw, CommandBufferError)], revoked_from: Option) { + let cache = ScratchCache::new().unwrap(); + let messages = Messages::default(); + { + let device = validated_device(TEST_DEVICE, &messages, cache.path()).unwrap(); + let name = device.name().to_owned(); + let lane = Lane::new(device); + let pipeline = lane.pipeline("pt_plain"); + let queue = lane.device.new_command_queue().unwrap(); + let revoked = |answer: &Answer, marked: bool, event: u64, label: &str| { + assert_eq!(answer.status, CommandBufferStatus::Error, "{label}"); + assert_eq!( + answer.error, + Some(CommandBufferError::AccessRevoked), + "{label}" + ); + assert!(!marked, "{label}: its mark ran"); + assert_eq!(event, 0, "{label}: its event signal fired"); + assert!(answer.scheduled <= answer.completed, "{label}"); + }; + for (at, &(draw, error)) in draws.iter().enumerate() { + let label = format!("{draw:?} (draw {at}) on {name}"); + let (answer, marked, event) = one(&lane, &queue, &pipeline, Some(draw)); + match revoked_from { + Some(from) if at > from => revoked(&answer, marked, event, &label), + _ => { + assert_eq!(answer.status, CommandBufferStatus::Error, "{label}"); + assert_eq!(answer.error, Some(error), "{label}"); + assert!(marked, "{label}: its mark before the pass ran"); + assert_eq!(event, 1, "{label}: its event signal"); + } + } + let (after, marked, event) = one(&lane, &queue, &pipeline, None); + let label = format!("the command buffer after {label}"); + match revoked_from { + Some(from) if at >= from => revoked(&after, marked, event, &label), + _ => { + assert!(after.completed_cleanly(), "{label}: {after:?}"); + assert!(marked && event == 1, "{label}: it ran"); + } + } + println!( + "{name}: {draw:?}: {:?} in {:.1} ms; after it {:?} {:?} in {:.2} ms", + answer.error, + answer.took().as_secs_f64() * 1e3, + after.status, + after.error, + after.took().as_secs_f64() * 1e3, + ); + } + let fresh = lane.device.new_command_queue().unwrap(); + let (answer, marked, event) = one(&lane, &fresh, &pipeline, None); + assert!( + answer.completed_cleanly(), + "a new queue on {name}: {answer:?}" + ); + assert!(marked && event == 1, "a new queue's command buffer ran"); + } + let reported = messages.take(); + assert!( + reported.is_empty(), + "the validation layer reported: {reported:#?}" + ); +} + +/// A queue's second command buffer that faulted revokes it, as Metal's does: every command buffer +/// committed on it after that one completed fails with `AccessRevoked` (a fault's draw too), and +/// a new queue runs. +#[test] +fn a_queue_s_second_fault_revokes_it() { + let fault = CommandBufferError::PageFault; + let indexed = Draw::Indexed { + indices: 3, + instances: 1, + }; + revokes_after( + &[(indexed, fault), (indexed, fault), (indexed, fault)], + Some(1), + ); +} + +/// Victims of the GPU's recovery do not count against their queue, a hang does: victims and a +/// fault leave the queue running, and a hang and a fault revoke it. +#[test] +fn victims_do_not_count_against_their_queue_and_a_hang_does() { + let victim = CommandBufferError::GpuRecoveryVictim; + let fault = CommandBufferError::PageFault; + let indexed = Draw::Indexed { + indices: 3, + instances: 1, + }; + revokes_after( + &[ + (Draw::Indirect(3), victim), + (Draw::IndexedIndirect, victim), + (indexed, fault), + (Draw::Indirect(0), victim), + ], + None, + ); + let hang = Draw::Direct { + vertices: 3, + instances: 1, + }; + revokes_after( + &[ + (hang, CommandBufferError::GpuHang), + (indexed, fault), + (hang, CommandBufferError::GpuHang), + ], + Some(1), + ); +} diff --git a/crates/metal2vulkan-validation/src/runtime_lane/private_primitives/writes.rs b/crates/metal2vulkan-validation/src/runtime_lane/private_primitives/writes.rs new file mode 100644 index 000000000..a4bd88ab0 --- /dev/null +++ b/crates/metal2vulkan-validation/src/runtime_lane/private_primitives/writes.rs @@ -0,0 +1,300 @@ +//! Device tests of a vertex function that writes memory under draws of Metal's private primitive +//! types 5 to 8, on the device the cfg selects, under the validation layer. The owned fixture +//! `rt6_private_writes`'s `pw_vertex` counts each of its invocations at its position's slot of +//! buffer 0 (its vertex ID less its base vertex, modulo 64; a second 64 slots for the instances +//! past the first) and stores the vertex ID and base vertex it read at that slot of buffer 1. +//! +//! Metal's answers (probes on the Apple M3 Max, macOS 27.0.1, 25 draws of types 5 to 8 and the +//! public triangle list, two instances each: direct from vertex starts 3, 2^31 - 3, 2^31 + 3 and +//! 2^32 - 4, and of 10 32-bit indices from base vertex 7): the vertex function runs once for each +//! vertex of the list [`metal_list`] states, in each instance, so a vertex the list names `k` times +//! runs `k` times (a fan's first `n - 2` times); `[[vertex_id]]` is the vertex start plus the +//! position, wrapping past `u32::MAX`, or the index plus the base vertex, and `[[base_vertex]]` +//! the vertex start or the base vertex. Vulkan's indexed draw of the list may run a vertex once for +//! all the primitives that share it, so the runtime draws such a function's private draws in the +//! private list form (`VariantKey::private_list`): each list position runs once, its index and +//! Metal's base vertex read at the list's address; a direct draw from a vertex start past +//! `i32::MAX`, which an indexed list's base vertex cannot carry, runs so whatever its functions. +//! +//! Each check draws a private type in one form and asks every slot's count, vertex ID and base +//! vertex to be Metal's, and the draw's pipeline to carry the form (`RuntimeFact::PrivateList`). + +use super::super::{buffer_with, read_buffer, validated_device, Messages, ScratchCache, WAIT}; +use super::{metal_list, Form, PRIVATE}; +use crate::air_library::AirLibrary; +use crate::gpu::TEST_DEVICE; +use metal2vulkan::device::VkFeature; +use metal2vulkan::metal::{IndexType, PixelFormat, TextureUsage}; +use metal2vulkan::pipeline::{ + ColorAttachmentDescriptor, RenderPipelineDescriptor, RuntimeFact, StageSource, +}; +use metal2vulkan_devtools::{engine_dir, llvm_assemble}; +use metal2vulkan_runtime::{ + Buffer, CommandBufferStatus, Device, DrawPrimitiveType, ExecutedPipeline, LoadAction, + PipelineOptions, RenderPassDescriptor, RenderPipelineState, ResourceOptions, StoreAction, + TextureDescriptor, +}; + +/// The slots of one instance (of the first, and of those past it). +const SLOTS: usize = 64; + +/// The value of a slot of buffer 1 no invocation wrote. +const UNSEEN: u32 = 0xeeee_eeee; + +/// A draw of a private type. +#[derive(Clone, Debug)] +struct WriteCase { + primitive: DrawPrimitiveType, + form: Form, + count: u32, + /// A draw without indices: its vertex start. + start: u32, + base_vertex: i32, + /// The index buffer's indices, all below [`SLOTS`] (empty for a draw without indices). + indices: Vec, +} + +/// Two instances, from base instance 0. +const INSTANCES: u32 = 2; + +impl WriteCase { + /// Each position's index as Metal reads it: a draw without indices its position. + fn values(&self) -> Vec { + match self.form.index_type() { + None => (0..self.count).collect(), + Some(_) => self.indices[..self.count as usize].to_vec(), + } + } + + /// The base the vertex ID adds to each value, which `[[base_vertex]]` reads. + fn base(&self) -> u32 { + match self.form.index_type() { + None => self.start, + Some(_) => self.base_vertex as u32, + } + } + + /// Metal's counts and seen values, slot by slot, of both instances. + fn expected(&self) -> (Vec, Vec<[u32; 2]>) { + let mut counts = vec![0; 2 * SLOTS]; + let mut seen = vec![[UNSEEN; 2]; 2 * SLOTS]; + let list = metal_list(self.primitive, &self.values(), u32::MAX); + for instance in 0..INSTANCES as usize { + for &value in &list { + let slot = (value as usize % SLOTS) + SLOTS * instance.min(1); + counts[slot] += 1; + seen[slot] = [value.wrapping_add(self.base()), self.base()]; + } + } + (counts, seen) + } +} + +/// The cases: each type direct from four vertex starts, two of them past `i32::MAX` (the last +/// wrapping), and indirect from one past it; indexed of both index types, direct and indirect. +fn cases() -> Vec { + let indices: Vec = (0..14).map(|i| (i * 5 + 1) % 13).collect(); + let mut cases = Vec::new(); + for primitive in PRIVATE { + let direct = |form, start| WriteCase { + primitive, + form, + count: 10, + start, + base_vertex: 0, + indices: Vec::new(), + }; + for start in [3, 0x7fff_fffd, 0x8000_0003, 0xffff_fffc] { + cases.push(direct(Form::Direct, start)); + } + cases.push(direct(Form::Indirect, 0x8000_0003)); + for form in [ + Form::Indexed(IndexType::UInt16), + Form::Indexed(IndexType::UInt32), + Form::IndexedIndirect(IndexType::UInt32), + ] { + cases.push(WriteCase { + primitive, + form, + count: 14, + start: 0, + base_vertex: 7, + indices: indices.clone(), + }); + } + } + cases +} + +/// The fixture's pipeline on `device`. +fn pipeline(device: &Device) -> RenderPipelineState { + let bitcode = llvm_assemble(&engine_dir().join("rt6_private_writes.ll")).unwrap(); + let library = device.new_library_with_air(&bitcode).unwrap(); + let function = |name| { + StageSource::Function( + library + .new_function_with_name(name) + .unwrap() + .function_descriptor(), + ) + }; + let mut descriptor = RenderPipelineDescriptor::new(function("pw_vertex")); + descriptor.fragment = Some(function("pw_fragment")); + descriptor.color_attachments[0] = Some(ColorAttachmentDescriptor::new(PixelFormat::RGBA8Unorm)); + device + .new_render_pipeline_state(&descriptor, &PipelineOptions::default()) + .unwrap() +} + +/// Draw `case` with `pipeline`: the counts and seen values of both instances, and whether the +/// draw's pipeline carries the private list form. +fn draw( + device: &Device, + pipeline: &RenderPipelineState, + case: &WriteCase, +) -> (Vec, Vec<[u32; 2]>, bool) { + let counts = buffer_with(device, &vec![0; 2 * SLOTS * 4]).unwrap(); + let seen = buffer_with(device, &vec![0xee; 2 * SLOTS * 8]).unwrap(); + let index_type = case.form.index_type().unwrap_or(IndexType::UInt32); + let index_bytes: Vec = match index_type { + IndexType::UInt16 => case + .indices + .iter() + .flat_map(|&i| (i as u16).to_le_bytes()) + .collect(), + _ => case.indices.iter().flat_map(|i| i.to_le_bytes()).collect(), + }; + let index_buffer = buffer_with(device, &[index_bytes, vec![0; 4]].concat()).unwrap(); + let words: Vec = match case.form { + Form::Indirect => vec![case.count, INSTANCES, case.start, 0], + _ => vec![case.count, INSTANCES, 0, case.base_vertex as u32, 0], + }; + let arguments: Vec = words.iter().flat_map(|w| w.to_le_bytes()).collect(); + let indirect = buffer_with(device, &arguments).unwrap(); + let mut target = TextureDescriptor::texture_2d(PixelFormat::RGBA8Unorm, 8, 8, false); + target.usage = TextureUsage::RENDER_TARGET; + target.resource_options = ResourceOptions::private(); + let target = device.new_texture(&target).unwrap(); + let mut pass = RenderPassDescriptor::new(); + let color = &mut pass.color_attachments[0]; + color.texture = Some(target); + color.load_action = LoadAction::Clear; + color.store_action = StoreAction::Store; + let queue = device.new_command_queue().unwrap(); + let command_buffer = queue.command_buffer().unwrap(); + let mut encoder = command_buffer.render_command_encoder(&pass).unwrap(); + encoder.set_render_pipeline_state(pipeline).unwrap(); + encoder.set_vertex_buffer(Some(&counts), 0, 0).unwrap(); + encoder.set_vertex_buffer(Some(&seen), 0, 1).unwrap(); + let drawn = match case.form { + Form::Direct => { + encoder.draw_primitives(case.primitive, case.start, case.count, INSTANCES, 0) + } + Form::Indirect => encoder.draw_primitives_indirect(case.primitive, &indirect, 0), + Form::Indexed(t) | Form::Written(t) => encoder.draw_indexed_primitives( + case.primitive, + case.count, + t, + &index_buffer, + 0, + INSTANCES, + case.base_vertex, + 0, + ), + Form::IndexedIndirect(t) => encoder.draw_indexed_primitives_indirect( + case.primitive, + t, + &index_buffer, + 0, + &indirect, + 0, + ), + }; + drawn.unwrap_or_else(|e| panic!("{case:?}: {e}")); + encoder.end_encoding().unwrap(); + command_buffer.commit().unwrap(); + command_buffer.wait_until_completed_for(WAIT).unwrap(); + assert_eq!( + command_buffer.status(), + CommandBufferStatus::Completed, + "{case:?}: {:?}", + command_buffer.error() + ); + let listed = command_buffer + .executions() + .iter() + .any(|execution| match execution.pipeline() { + ExecutedPipeline::Render(pipeline) => pipeline + .dependencies + .iter() + .any(|dependency| dependency.fact == RuntimeFact::PrivateList), + ExecutedPipeline::Compute(_) => false, + }); + (words_of(&counts), pairs_of(&seen), listed) +} + +/// `buffer`'s words. +fn words_of(buffer: &Buffer) -> Vec { + let bytes = read_buffer(buffer, 0, buffer.length()).unwrap(); + bytes + .as_chunks::<4>() + .0 + .iter() + .map(|w| u32::from_le_bytes(*w)) + .collect() +} + +/// `buffer`'s pairs of words. +fn pairs_of(buffer: &Buffer) -> Vec<[u32; 2]> { + words_of(buffer).as_chunks::<2>().0.to_vec() +} + +/// A vertex function that writes memory runs once for each vertex of Metal's list, in each +/// instance, and reads Metal's vertex ID and base vertex, in every form, from vertex starts past +/// `i32::MAX` too; each draw runs the private list form. +#[test] +fn vertex_functions_that_write_memory_run_once_a_list_vertex() { + let cache = ScratchCache::new().unwrap(); + let messages = Messages::default(); + { + let device = validated_device(TEST_DEVICE, &messages, cache.path()).unwrap(); + let name = device.name().to_owned(); + let stores = device + .compile_device() + .profile() + .enabled() + .features + .contains(&VkFeature::VertexPipelineStoresAndAtomics); + if !stores { + eprintln!("{name}: no vertexPipelineStoresAndAtomics, so no vertex writes: skipped"); + return; + } + let pipeline = pipeline(&device); + let cases = cases(); + for case in &cases { + let (counts, seen, listed) = draw(&device, &pipeline, case); + let (want_counts, want_seen) = case.expected(); + assert_eq!( + counts, want_counts, + "{case:?} on {name}: the invocation counts" + ); + assert_eq!( + seen, want_seen, + "{case:?} on {name}: the vertex IDs and base vertices" + ); + assert!( + listed, + "{case:?} on {name}: not drawn in the private list form" + ); + } + eprintln!( + "{name}: {} private draws of a memory-writing vertex function ran once a list vertex", + cases.len() + ); + } + let reported = messages.take(); + assert!( + reported.is_empty(), + "the validation layer reported: {reported:#?}" + ); +} diff --git a/crates/metal2vulkan/src/bind/graphics.rs b/crates/metal2vulkan/src/bind/graphics.rs index 353447605..5386f7b4d 100644 --- a/crates/metal2vulkan/src/bind/graphics.rs +++ b/crates/metal2vulkan/src/bind/graphics.rs @@ -196,7 +196,14 @@ //! vertices from 0, layout `[0, index count, base instance, base vertex]`, its indices read in //! the vertex stage at `PushHole::CaptureIndexAddress`; any other draw of that variant is //! `NeedsVariant` without it. A strip, an indirect indexed draw, indices past their buffer and -//! an indexed draw of a plan without the form are `NotImplemented(PrimitiveId)`. A direct +//! an indexed draw of a plan without the form are `NotImplemented(PrimitiveId)`. A draw of one +//! of Metal's private primitive types in the private list form (`BindShape::private_list`, +//! `VariantKey::private_list`) is the consumer's list, which it draws without indices from the +//! list's first index as first vertex whatever the call it gave: its vertices per primitive are +//! its list's, twice that where the list holds Metal's quads as two triangles a quad +//! (`BindState::quad_primitive_ids`), and it leaves `PushHole::CaptureIndexAddress` to the +//! consumer (its list's address, whose word before its first index holds Metal's base +//! vertex). A direct //! draw of a multiview plan whose last instance index exceeds `maxMultiviewInstanceIndex` is //! `Unsupported{VertexAmplification; Limit}`. `DrawCommands.uses` lists the draw's index buffer //! and indirect arguments. @@ -1079,6 +1086,13 @@ fn plan(p: &RenderPipeline, device: &Device, shape: &BindShape) -> Result Result Result Result, - from_zero: bool, + (from_zero, listed, quads): (bool, bool, bool), ) -> Result { let per_primitive = match primitive.ok_or(BindError::MissingPrimitiveType)? { metal::PrimitiveType::Triangle => 3, @@ -4076,6 +4095,8 @@ fn vertices_per_primitive( | metal::PrimitiveType::TriangleStrip => 1, }; match draw { + _ if listed && quads => Ok(2 * per_primitive), + _ if listed => Ok(per_primitive), DrawCall::Primitives { .. } | DrawCall::Indirect { indexed: None, .. } => Ok(per_primitive), DrawCall::Indexed { .. } if from_zero => Ok(per_primitive), _ => Err(not_implemented(Feature::PrimitiveId)), @@ -4363,9 +4384,9 @@ fn instantiate( } PushField::VerticesPerPrimitive => { let from_zero = capture.as_ref().is_some_and(|c| c.command.is_some()); + let form = (from_zero, t.private_list, state.quad_primitive_ids); FieldBytes::of( - &vertices_per_primitive(draw, state.primitive_type, from_zero)? - .to_le_bytes(), + &vertices_per_primitive(draw, state.primitive_type, form)?.to_le_bytes(), ) } // An emulated tessellation draw's first chunk (`TessellationDispatch::draw` diff --git a/crates/metal2vulkan/src/bind/graphics/tests.rs b/crates/metal2vulkan/src/bind/graphics/tests.rs index 5764721ba..a6ea60c1d 100644 --- a/crates/metal2vulkan/src/bind/graphics/tests.rs +++ b/crates/metal2vulkan/src/bind/graphics/tests.rs @@ -606,6 +606,7 @@ fn instantiation_bounds_a_draw_by_its_index_buffer() { shader_tests: None, capture: None, deindexed: None, + private_list: false, storage_kept: 0, color_write_rules: Vec::new(), }; @@ -655,6 +656,7 @@ fn a_draw_of_no_index_binds_inside_the_buffer() { shader_tests: None, capture: None, deindexed: None, + private_list: false, storage_kept: 0, color_write_rules: Vec::new(), }; @@ -739,6 +741,7 @@ fn an_unbounded_indexed_indirect_draw_reads_its_arguments() { shader_tests: None, capture: None, deindexed: None, + private_list: false, storage_kept: 0, color_write_rules: Vec::new(), }; @@ -797,6 +800,7 @@ fn draws_bind_vertex_buffers_at_aligned_offsets_with_their_windows() { shader_tests: None, capture: None, deindexed: None, + private_list: false, storage_kept: 0, color_write_rules: Vec::new(), }; @@ -888,6 +892,7 @@ fn inline_vertex_bytes_bind_the_strides_a_dynamic_layout_reads() { shader_tests: None, capture: None, deindexed: None, + private_list: false, storage_kept: 0, color_write_rules: Vec::new(), }; @@ -1522,6 +1527,7 @@ fn mesh_template(flat: bool, multiples: Vec) -> GraphicsTemplate { shader_tests: None, capture: None, deindexed: None, + private_list: false, storage_kept: 0, color_write_rules: Vec::new(), } diff --git a/crates/metal2vulkan/src/bind/index_rewrite.rs b/crates/metal2vulkan/src/bind/index_rewrite.rs index 85346ad84..d9eb996cf 100644 --- a/crates/metal2vulkan/src/bind/index_rewrite.rs +++ b/crates/metal2vulkan/src/bind/index_rewrite.rs @@ -82,7 +82,8 @@ //! | 8 to 12 | the consumer | a direct draw's Metal arguments (`MTLDrawIndexedPrimitivesIndirectArguments`: count, instances, first index 0, base vertex, base instance); 0 for an indirect draw, whose arguments are read from the Metal buffer | //! | 13 | the consumer | 1 for a draw without indices, whose arguments are `MTLDrawPrimitivesIndirectArguments` (count, instances, vertex start, base instance), else 0 | //! | 14 | the consumer | the order ([`RewriteOrder::word`]): 0 first, 1 last, 2 last first | -//! | 16 to 20 | the place dispatch | the draw's `VkDrawIndexedIndirectCommand` ([`IndexRewritePass::DRAW_OFFSET`]) | +//! | 15 | the consumer | 1 for a list drawn in the private list form ([`IndexRewritePass::listed`]): Metal's base vertex in the word before the list, the draw without indices, else 0 | +//! | 16 to 20 | the place dispatch | the draw's `VkDrawIndexedIndirectCommand` ([`IndexRewritePass::DRAW_OFFSET`]), or in the private list form its `VkDrawIndirectCommand` (the list's indices, instances, its first index's word as first vertex, base instance) and a 0 | //! | 21 | the place dispatch | the primitives written | //! | 22 to 25 | the place dispatch | the output's first word, 1 where the draw is written, the primitives before those past the walk, and those past it | //! | 32 on | the count and place dispatches | three words per group: its primitives (where its first piece's positions before it are even), then those before it; its primitives where they are odd, then the start of the piece it begins in (0 for none); the start of its last piece (0 for none) | @@ -603,6 +604,17 @@ impl IndexRewritePass { self } + /// The pass of a list drawn in the private list form (`VariantKey::private_list`): the + /// output holds Metal's base vertex (the draw's, its vertex start without indices) in the + /// word before the list's first index, which an owned output's capacity counts too, and the + /// draw at [`DRAW_OFFSET`](Self::DRAW_OFFSET) is a `VkDrawIndirectCommand` of the list's + /// positions, its first vertex the list's first index in the output (from the pool's index + /// region where pooled) and its first instance Metal's base instance. + pub fn listed(mut self) -> IndexRewritePass { + self.parameters[Parameter::Listed as usize] = 1; + self + } + /// The parameters as the bytes to upload at the rewrite words' start. pub fn parameter_bytes(&self) -> Vec { self.parameters @@ -628,6 +640,8 @@ enum Parameter { Sequential = 13, /// The order ([`RewriteOrder::word`]). Order = 14, + /// 1 for a list drawn in the private list form ([`IndexRewritePass::listed`]). + Listed = 15, } /// The pass's words in the rewrite words, by index. @@ -1096,6 +1110,8 @@ struct DrawWalk { groups: Value, /// The order's word ([`RewriteOrder::word`]). order: Value, + /// 1 where the list is drawn in the private list form, else 0. + listed: Value, program: RewriteProgram, } @@ -1113,6 +1129,8 @@ impl DrawWalk { let groups = load_at(f, g.words, Parameter::Groups as u32)?; let sequential = load_at(f, g.words, Parameter::Sequential as u32)?; let order = load_at(f, g.words, Parameter::Order as u32)?; + let listed = load_at(f, g.words, Parameter::Listed as u32)?; + let listed = f.glsl(GlslOp::UMin, &[listed, one])?; let most = k(f, IndexRewritePass::MAX_GROUPS)?; let groups = f.glsl(GlslOp::UMin, &[groups, most])?; let groups = f.glsl(GlslOp::UMax, &[groups, one])?; @@ -1174,6 +1192,7 @@ impl DrawWalk { pooled, groups, order, + listed, program, }) } @@ -1605,8 +1624,12 @@ fn place_phase(f: &mut FunctionBuilder<'_>, g: Globals, d: DrawWalk, lin: Value) _ => primitives, }; // The output's indices, where they fit a `u32`: where the product's high word is 0 - // (`replay::checked_mul`, whose docs say why). + // (`replay::checked_mul`, whose docs say why). In the private list form Metal's base + // vertex takes a word before them. let (written, past) = checked_mul(f, primitives, vk_, zero)?; + let words_needed = f.binary(BinOp::IAdd, written, d.listed)?; + let wrapped = f.binary(BinOp::ULessThan, words_needed, written)?; + let past = f.binary(BinOp::LogicalOr, past, wrapped)?; let countable = f.unary(UnOp::LogicalNot, past)?; // Placed in the pool's room, or in the draw's own region. let counter_ptr = word_ptr(f, g.output, zero)?; @@ -1616,20 +1639,22 @@ fn place_phase(f: &mut FunctionBuilder<'_>, g: Globals, d: DrawWalk, lin: Value) let four = k(f, 4)?; let room = f.binary(BinOp::UDiv, room, four)?; let room = f.select(d.pooled, room, d.capacity)?; - let fits = f.binary(BinOp::ULessThanEqual, written, room)?; + let fits = f.binary(BinOp::ULessThanEqual, words_needed, room)?; let ok = f.binary(BinOp::LogicalAnd, countable, fits)?; let reserve = f.binary(BinOp::LogicalAnd, ok, d.pooled)?; when(f, reserve, move |f| { let four = k(f, 4)?; - let bytes = f.binary(BinOp::IMul, written, four)?; + let bytes = f.binary(BinOp::IMul, words_needed, four)?; let next = f.binary(BinOp::IAdd, used, bytes)?; f.store(counter_ptr, next, MemAccess::default()) })?; + // The list's first index, past the base vertex's word in the private list form. let first_index = f.binary(BinOp::UDiv, used, four)?; let first_index = f.select(d.pooled, first_index, zero)?; + let first_index = f.binary(BinOp::IAdd, first_index, d.listed)?; let header = k(f, (IndexRewritePass::POOL_HEADER_BYTES / 4) as u32)?; let pool_base = f.binary(BinOp::IAdd, header, first_index)?; - let base_word = f.select(d.pooled, pool_base, zero)?; + let base_word = f.select(d.pooled, pool_base, first_index)?; let ok_word = f.select(ok, one, zero)?; for (word, value) in [ (Output::Base, base_word), @@ -1641,7 +1666,12 @@ fn place_phase(f: &mut FunctionBuilder<'_>, g: Globals, d: DrawWalk, lin: Value) } let drawn = f.select(ok, written, zero)?; let primitives_drawn = f.select(ok, primitives, zero)?; - for (i, value) in [drawn, d.instances, first_index, d.base, d.base_instance] + // An indexed draw's `VkDrawIndexedIndirectCommand`, or in the private list form a + // `VkDrawIndirectCommand` of the list's positions from its first index as first vertex. + let listed = f.binary(BinOp::INotEqual, d.listed, zero)?; + let fourth = f.select(listed, d.base_instance, d.base)?; + let fifth = f.select(listed, zero, d.base_instance)?; + for (i, value) in [drawn, d.instances, first_index, fourth, fifth] .into_iter() .enumerate() { @@ -1735,6 +1765,17 @@ fn write_phase( let written = load_at(f, g.words, Output::Written as u32)?; let ok = f.binary(BinOp::INotEqual, written, zero)?; let base_word = load_at(f, g.words, Output::Base as u32)?; + // In the private list form, Metal's base vertex in the word before the list, written once. + let listed = f.binary(BinOp::INotEqual, d.listed, zero)?; + let base_too = f.binary(BinOp::LogicalAnd, ok, listed)?; + let group0 = f.binary(BinOp::IEqual, at.group, zero)?; + let base_too = f.binary(BinOp::LogicalAnd, base_too, first)?; + let base_too = f.binary(BinOp::LogicalAnd, base_too, group0)?; + when(f, base_too, move |f| { + let one = k(f, 1)?; + let before = f.binary(BinOp::ISub, base_word, one)?; + contained_store(f, g.output, before, d.base) + })?; let v = program.vertices(); // A fan's first index, every triangle's first vertex. let hub = match program { diff --git a/crates/metal2vulkan/src/bind/index_rewrite/tests.rs b/crates/metal2vulkan/src/bind/index_rewrite/tests.rs index 2bdb21bb2..3b72e8761 100644 --- a/crates/metal2vulkan/src/bind/index_rewrite/tests.rs +++ b/crates/metal2vulkan/src/bind/index_rewrite/tests.rs @@ -86,6 +86,8 @@ struct Draw { vertices: bool, /// The order each primitive is written in. order: RewriteOrder, + /// The list in the private list form (`IndexRewritePass::listed`). + listed: bool, } /// What a pass left: the words, the output's indices (from the pool's index region where @@ -111,6 +113,7 @@ impl Draw { groups: None, vertices: false, order: RewriteOrder::First, + listed: false, } } @@ -160,7 +163,7 @@ impl Draw { arguments: IndirectRef::new(0, at), }, }; - let capacity = self.program.capacity(u64::from(count)) as u32; + let capacity = self.program.capacity(u64::from(count)) as u32 + u32::from(self.listed); let output = match self.counter { None => RewriteOutput::Owned { capacity }, Some(_) => RewriteOutput::Pooled { @@ -174,7 +177,10 @@ impl Draw { let pass = IndexRewritePass::new(source, self.restart, terms, output, ALIGNMENT, u32::MAX) .expect("pass") .with_order(self.order); - let mut pass = pass; + let mut pass = match self.listed { + true => pass.listed(), + false => pass, + }; if let Some(groups) = self.groups { pass.groups = groups; pass.parameters[Parameter::Groups as usize] = groups; @@ -928,3 +934,79 @@ fn the_pass_writes_each_order() { } } } + +/// In the private list form the pass writes the same list one word on, Metal's base vertex (a +/// direct or indexed indirect draw's base vertex, an indirect draw's vertex start) in the word +/// before it, and the draw as a `VkDrawIndirectCommand` of the list from its first index as +/// first vertex, with Metal's instances and base instance; the reservation takes the word too, +/// and a list the room holds but for the word draws nothing and says so. +#[test] +fn the_private_list_form_writes_the_base_vertex_before_its_list() { + let indices: Vec = vec![9, 9, 1, 2, 3, 0, 4, 5, 6, 7, 0, 8]; + for program in RewriteProgram::ALL { + let direct = Draw { + arguments: [9, 2, 0, 0x8000_0005, 3], + ..Draw::strip(program, true, &indices, 0) + }; + let indirect = Draw { + arguments: [8, 3, 2, 0xFFFF_FFFE, 4], + indirect: Some(36), + counter: Some(40), + ..Draw::strip(program, false, &indices, 0) + }; + let vertices = Draw { + groups: Some(1), + ..Draw::vertices(program, [7, 2, 0x8000_0010, 5]) + }; + for (draw, base, instances, base_instance) in [ + (direct, 0x8000_0005, 2, 3), + (indirect, 0xFFFF_FFFE, 3, 4), + (vertices, 0x8000_0010, 2, 5), + ] { + let (plain, _, _) = draw.drawn(); + let listed = Draw { + listed: true, + ..draw.clone() + }; + let (list, command, r) = listed.drawn(); + assert_eq!(list, plain, "{program:?}"); + let first = command[2] as usize; + let start = match draw.counter { + Some(counter) => (counter / 4) as usize + 1, + None => 1, + }; + assert_eq!(first, start, "{program:?}: the list's first index"); + assert_eq!(r.output[first - 1], base, "{program:?}: the base vertex"); + assert_eq!( + command, + [ + plain.len() as u32, + instances, + first as u32, + base_instance, + 0 + ], + "{program:?}" + ); + if let (Some(before), Some(after)) = (draw.counter, r.counter) { + assert_eq!(after, before + 4 * (plain.len() as u32 + 1), "{program:?}"); + } + assert!(!r.report.index_pool_overflow); + } + // Room for the list but not its base vertex's word: nothing drawn, the bit set. + let needed = metal(program, &fetched(&indices, 2, 8), 0).len() as u32; + let tight = Draw { + arguments: [8, 3, 2, 7, 4], + indirect: Some(36), + counter: Some(POOL_BYTES - 4 * needed), + listed: true, + ..Draw::strip(program, false, &indices, 0) + }; + let (list, command, r) = tight.drawn(); + if needed > 0 { + assert!(list.is_empty(), "{program:?}"); + assert_eq!(command[0], 0, "{program:?}"); + assert!(r.report.index_pool_overflow, "{program:?}"); + } + } +} diff --git a/crates/metal2vulkan/src/bind/plan.rs b/crates/metal2vulkan/src/bind/plan.rs index bb43da32a..f9e0836bb 100644 --- a/crates/metal2vulkan/src/bind/plan.rs +++ b/crates/metal2vulkan/src/bind/plan.rs @@ -225,6 +225,11 @@ pub struct GraphicsTemplate { /// and run without indices, as the indexed capture form's do. #[cfg_attr(feature = "serde", serde(default))] pub(crate) deindexed: Option, + /// A pipeline compiled in the private list form (`VariantKey::private_list`): its draws are + /// the consumer's lists of Metal's private primitive types, run without indices, of any + /// draw call. + #[cfg_attr(feature = "serde", serde(default))] + pub(crate) private_list: bool, /// `PushField::StorageKeptChannels`: each storage-form color attachment's kept channels /// (`StorageAttachmentUse::kept`), bits `4c` to `4c + 3` for color `c`, which its draws /// write. diff --git a/crates/metal2vulkan/src/bind/state.rs b/crates/metal2vulkan/src/bind/state.rs index 444406f37..8e4580fea 100644 --- a/crates/metal2vulkan/src/bind/state.rs +++ b/crates/metal2vulkan/src/bind/state.rs @@ -117,6 +117,13 @@ pub struct BindState { /// `false` for every other draw. #[cfg_attr(feature = "serde", serde(default))] pub quad_primitive_ids: bool, + /// The draw is of one of Metal's private primitive types, drawn in the pulled list form + /// (`VariantKey::private_list`): without indices, each position of the list the consumer + /// writes (Metal's base vertex in the word before its first index) run once, from the list's + /// first index as first vertex. Part of the shape (`BindShape::private_list`); `false` for + /// every other draw. + #[cfg_attr(feature = "serde", serde(default))] + pub private_list: bool, /// Where the heap arrays (set 1) hold the command's heap members and argument samplers /// ([`HeapPlacement`]). Only the instantiated tables and the elements the consumer writes /// ([`BindingPlan::heap_elements`]) depend on it, so it is not part of the shape. @@ -722,6 +729,7 @@ impl BindState { depth16_bias_raises: self.depth16_bias_raises, primitive_id_indices: self.primitive_id_indices, quad_primitive_ids: self.quad_primitive_ids, + private_list: self.private_list, } } @@ -777,6 +785,7 @@ impl BindState { depth16_bias_raises, primitive_id_indices, quad_primitive_ids, + private_list, } = shape; let tables = self.stages.iter().filter(|(_, t)| !t.has_empty_shape()); tables.clone().count() == stages.len() @@ -808,6 +817,7 @@ impl BindState { && self.depth16_bias_raises == *depth16_bias_raises && self.primitive_id_indices == *primitive_id_indices && self.quad_primitive_ids == *quad_primitive_ids + && self.private_list == *private_list // Last: the one field compared through a shape made of it. && match self.used_resources.is_empty() { true => used.is_empty(), @@ -1668,6 +1678,10 @@ pub struct BindShape { /// variant that reads the quad's (`VariantKey::quad_primitive_ids`). #[cfg_attr(feature = "serde", serde(default))] pub quad_primitive_ids: bool, + /// `BindState.private_list`: a draw of one of Metal's private primitive types in the pulled + /// list form runs the variant that draws it so (`VariantKey::private_list`). + #[cfg_attr(feature = "serde", serde(default))] + pub private_list: bool, } impl BindShape { diff --git a/crates/metal2vulkan/src/cache/codec.rs b/crates/metal2vulkan/src/cache/codec.rs index c32922ba8..f50200f4f 100644 --- a/crates/metal2vulkan/src/cache/codec.rs +++ b/crates/metal2vulkan/src/cache/codec.rs @@ -1236,6 +1236,7 @@ codec_enum! { }, MergedDraws, QuadPrimitiveIds, + PrivateList, } UniformViewChoice { Viewed, Spare, Kept } Mechanism { diff --git a/crates/metal2vulkan/src/cache/mod.rs b/crates/metal2vulkan/src/cache/mod.rs index 2315f3aad..46f343a70 100644 --- a/crates/metal2vulkan/src/cache/mod.rs +++ b/crates/metal2vulkan/src/cache/mod.rs @@ -424,6 +424,15 @@ pub struct VariantKey { /// (`RuntimeFact::QuadPrimitiveIds`). #[cfg_attr(feature = "serde", serde(default))] pub quad_primitive_ids: bool, + /// A draw of one of Metal's private primitive types drawn in the pulled list form + /// (`BindShape::private_list`): the variant's vertex function runs each position of the + /// consumer's list once, without indices, reading its index and Metal's base vertex at the + /// list's address (`LoweringInputs::private_list`). The runtime asks for it for such a draw + /// whose vertex function writes memory or the primitive ID's varying, or whose vertex start + /// a list's base vertex cannot carry, and the plan of a pipeline compiled under it states it + /// (`RuntimeFact::PrivateList`). + #[cfg_attr(feature = "serde", serde(default))] + pub private_list: bool, /// Extended-range color attachments whose `half` shadow the draw's render pass instance /// holds (`BindShape::extended_shadows`): the variant's fragment function reads and writes /// each through the interlocked storage form against the shadow as Metal's tile value @@ -565,6 +574,7 @@ impl VariantKey { && self.captured_positions.is_none() && self.primitive_id_indices.is_none() && !self.quad_primitive_ids + && !self.private_list && self.extended_shadows.is_empty() && self.cross_class.is_empty() && self.anisotropic_samplers.is_empty() @@ -713,6 +723,7 @@ impl VariantKey { .filter(|_| stage == crate::pipeline::sym::Stage::Vertex); out.quad_primitive_ids = self.quad_primitive_ids && stage == crate::pipeline::sym::Stage::Fragment; + out.private_list = self.private_list && stage == crate::pipeline::sym::Stage::Vertex; out.kept_imageblock_bytes = self .kept_imageblock_bytes .filter(|_| stage == crate::pipeline::sym::Stage::Kernel); diff --git a/crates/metal2vulkan/src/device/mechanism.rs b/crates/metal2vulkan/src/device/mechanism.rs index 9a52f92a6..c3757148b 100644 --- a/crates/metal2vulkan/src/device/mechanism.rs +++ b/crates/metal2vulkan/src/device/mechanism.rs @@ -184,6 +184,7 @@ pub fn mechanism(fact: &RuntimeFact, profile: &DeviceProfile) -> Mechanism { // A render pipeline compiled under the merged-draws variant; its plans state it. RuntimeFact::MergedDraws => Mechanism::Variant, RuntimeFact::QuadPrimitiveIds => Mechanism::Variant, + RuntimeFact::PrivateList => Mechanism::Variant, // The function marks the `ExecutionStatus` buffer its `ExecutionStatus` fact binds; the // consumer reads the bit after the command buffer. RuntimeFact::AbsentArgumentRead { .. } => Mechanism::None, diff --git a/crates/metal2vulkan/src/device/tests/mechanism.rs b/crates/metal2vulkan/src/device/tests/mechanism.rs index b2e4e79da..f13dbe9c2 100644 --- a/crates/metal2vulkan/src/device/tests/mechanism.rs +++ b/crates/metal2vulkan/src/device/tests/mechanism.rs @@ -155,6 +155,7 @@ fn every_fact() -> Vec { RuntimeFact::MergedDraws, RuntimeFact::QuadPrimitiveIds, RuntimeFact::RotatedWeights, + RuntimeFact::PrivateList, RuntimeFact::AbsentArgumentRead { stage: Stage::Fragment, }, @@ -380,6 +381,7 @@ fn variant(f: &RuntimeFact) -> usize { RuntimeFact::MergedDraws => 93, RuntimeFact::QuadPrimitiveIds => 94, RuntimeFact::RotatedWeights => 95, + RuntimeFact::PrivateList => 96, } } @@ -387,7 +389,7 @@ fn variant(f: &RuntimeFact) -> usize { fn mechanism_is_total_over_every_fact_and_profile() { let facts = every_fact(); let covered: std::collections::BTreeSet = facts.iter().map(variant).collect(); - assert_eq!(covered, (0..96).collect(), "every_fact misses a variant"); + assert_eq!(covered, (0..97).collect(), "every_fact misses a variant"); for (stem, _) in super::committed_profiles() { let dev = device(&stem); let p = dev.profile(); @@ -460,6 +462,7 @@ fn mechanism_is_total_over_every_fact_and_profile() { | RuntimeFact::ReplayBindings | RuntimeFact::MergedDraws | RuntimeFact::QuadPrimitiveIds + | RuntimeFact::PrivateList | RuntimeFact::ZeroedColor { .. } | RuntimeFact::DroppedColor { .. } | RuntimeFact::DepthClampRange diff --git a/crates/metal2vulkan/src/error/mod.rs b/crates/metal2vulkan/src/error/mod.rs index 1d0d5d430..446ae0102 100644 --- a/crates/metal2vulkan/src/error/mod.rs +++ b/crates/metal2vulkan/src/error/mod.rs @@ -1102,6 +1102,10 @@ pub enum Feature { /// strip, an indirect draw, indices past their buffer, and a vertex function that writes /// memory (`NotImplemented`). PrimitiveId, + /// One of Metal's private primitive types (a line loop, a triangle fan, quads, a quad strip) + /// drawn in the pulled list form (`VariantKey::private_list`), whose vertex function reads the + /// consumer's list at its device address: on a device without device addresses. + PrivatePrimitives, /// Vertex amplification. VertexAmplification, /// Layered rendering (`render_target_array_index`, `viewport_array_index`). diff --git a/crates/metal2vulkan/src/lower/emit.rs b/crates/metal2vulkan/src/lower/emit.rs index 0c0894115..ca150f287 100644 --- a/crates/metal2vulkan/src/lower/emit.rs +++ b/crates/metal2vulkan/src/lower/emit.rs @@ -228,6 +228,9 @@ enum Invariant { /// An indexed capture form's raw index (`stage_io::read_captured_index`), read at entry /// (`stage_io::emit_entry`): the index buffer is read-only to the draw. CapturedIndex, + /// The private list form's base vertex (`stage_io::read_listed_base`), read at entry + /// (`stage_io::emit_entry`): the list is read-only to the draw. + ListedBase, } impl<'a> EmitCx<'a> { @@ -370,6 +373,25 @@ impl<'a> EmitCx<'a> { Ok(v) } + /// The private list form's base vertex, read once where it dominates, as + /// [`EmitCx::captured_index`] reads the index. + pub(crate) fn listed_base(&mut self, fb: &mut FunctionBuilder<'_>) -> BResult { + let first = fb.entry_block(); + let read = self + .memo + .iter() + .find(|(k, _, at)| *k == Invariant::ListedBase && Some(*at) == first); + if let Some(&(_, v, _)) = read { + return Ok(v); + } + if let Some(v) = self.recall(fb, Invariant::ListedBase) { + return Ok(v); + } + let v = crate::lower::stage_io::read_listed_base(self, fb)?; + self.remember(fb, Invariant::ListedBase, v); + Ok(v) + } + /// The work before the body: load each push field the plan places once, in the function's first /// block, where it dominates every block. Where the body first reads a field never moves its /// load, so a read that canonicalization deletes cannot make the others load it again; a placed diff --git a/crates/metal2vulkan/src/lower/stage_io/mod.rs b/crates/metal2vulkan/src/lower/stage_io/mod.rs index e1b4613d5..2cc72d8ab 100644 --- a/crates/metal2vulkan/src/lower/stage_io/mod.rs +++ b/crates/metal2vulkan/src/lower/stage_io/mod.rs @@ -47,7 +47,10 @@ //! that read their indices at the draw's index address as the indexed capture form does //! ([`CapturedIndex`]), whose first vertex is 0. A vertex function that writes memory is //! refused there (it would run once per index), and so are the draws the binder cannot run -//! so (`NotImplemented(PrimitiveId)`). +//! so (`NotImplemented(PrimitiveId)`). A draw of one of Metal's private primitive types in the +//! private list form (`LoweringInputs::private_list`) runs its list's positions from its first +//! vertex without indices, each once, as Metal runs them: the same `(VertexIndex - first) / n` +//! is its list primitive's index. //! A post-tessellation vertex function emulated on a device without `tessellationShader` writes //! the same varying under that field, from another source: its patch's position in the draw //! (`lower::tessellation::emulated`), which a fragment function compiled under the field reads @@ -576,10 +579,18 @@ pub(crate) const CAPTURE_RECORD_BYTES: u64 = 32; /// `PushField::CaptureLayout` is not 0: a line or triangle strip) and the raw index is the type's /// all-ones value, the invocation stores its record's restart flag alone and returns before any /// fetch or instruction of the body, as Metal shades no vertex there. +/// +/// In the private list form (`LoweringInputs::private_list`, `first` is the draw's first vertex) +/// the draw runs its list from `first` without indices: the raw index, a `u32`, lies at +/// `PushField::CaptureIndexAddress + 4 · VertexIndex` all the same, Metal's base vertex at +/// `PushField::CaptureIndexAddress + 4 · (first - 1)`, the word before the list (read once at +/// entry), which the vertex adds in place of the layout's; nothing restarts, and no layout is +/// read. #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] pub struct CapturedIndex { pub vertex: usize, pub ty: crate::metal::IndexType, + pub first: Option, } /// The words a vertex function's index read adds: its input builtin's variable, decorations and @@ -1158,7 +1169,12 @@ pub fn emit_entry(cx: &mut EmitCx<'_>, fb: &mut FunctionBuilder<'_>) -> BResult< // every use, and a strip's restart index's return before the body. if let Some(c) = cx.plan.families.stage_io.captured_index { let raw = cx.captured_index(fb)?; - skip_restart(cx, fb, c, raw)?; + match c.first { + Some(_) => { + cx.listed_base(fb)?; + } + None => skip_restart(cx, fb, c, raw)?, + } } // A merged draw's vertex finds its corner's command before the body, which every read of the // command's values and slot table follows. @@ -1275,8 +1291,7 @@ pub fn param_value( return ops::mask(fb, form, x); } Some(Source::CapturedBaseVertex(form)) => { - let layout = cx.push_field(fb, PushField::CaptureLayout)?; - let x = fb.composite_extract(layout, &[0, 3])?; + let x = captured_base_vertex(cx, fb)?; return ops::mask(fb, form, x); } Some(Source::Merged { value, form }) => { @@ -2052,17 +2067,100 @@ pub(crate) fn read_captured_index( } /// The vertex an indexed capture form's function runs ([`CapturedIndex`]): its raw index plus -/// the layout's base vertex, wrapping as `u32`s. +/// the base vertex ([`captured_base_vertex`]), wrapping as `u32`s. pub(super) fn captured_vertex( cx: &mut EmitCx<'_>, fb: &mut FunctionBuilder<'_>, ) -> BResult { let raw = cx.captured_index(fb)?; - let layout = cx.push_field(fb, PushField::CaptureLayout)?; - let base = fb.composite_extract(layout, &[0, 3])?; + let base = captured_base_vertex(cx, fb)?; fb.binary(BinOp::IAdd, raw, base) } +/// The base vertex of a form that reads its draw's indices ([`CapturedIndex`]): the layout's +/// (lane 3 of `PushField::CaptureLayout`), or the private list form's word before its list. +fn captured_base_vertex(cx: &mut EmitCx<'_>, fb: &mut FunctionBuilder<'_>) -> BResult { + match cx + .plan + .families + .stage_io + .captured_index + .and_then(|c| c.first) + { + Some(_) => cx.listed_base(fb), + None => { + let layout = cx.push_field(fb, PushField::CaptureLayout)?; + fb.composite_extract(layout, &[0, 3]) + } + } +} + +/// The private list form's base vertex ([`CapturedIndex`]), loaded in the open block: the `u32` +/// at `PushField::CaptureIndexAddress + 4 · (first - 1)`, the word before the list's first +/// index, `first` the draw's first vertex, in 64 bits. [`EmitCx::listed_base`] reads it once +/// where it dominates. +pub(crate) fn read_listed_base( + cx: &mut EmitCx<'_>, + fb: &mut FunctionBuilder<'_>, +) -> BResult { + let Some(first) = cx + .plan + .families + .stage_io + .captured_index + .and_then(|c| c.first) + else { + return Err(cx.fail("a list's base vertex read without its plan")); + }; + let first = load_first_vertex(cx, fb, first)?; + let u64_ = fb.module().ty(SType::Int { + width: 64, + signed: false, + })?; + let u32_ = fb.module().ty(SType::Int { + width: 32, + signed: false, + })?; + let k64 = |fb: &mut FunctionBuilder<'_>, x: u64| -> BResult { + let k = fb.module().constant(Constant::Scalar { + ty: u64_, + bits: ConstBits(x), + })?; + fb.module().const_value(k) + }; + let first = fb.convert(ConvOp::UConvert, first, u64_)?; + let four = k64(fb, 4)?; + let offset = fb.binary(BinOp::IMul, first, four)?; + let offset = fb.binary(BinOp::ISub, offset, four)?; + let base = cx.push_field(fb, PushField::CaptureIndexAddress)?; + let at = fb.binary(BinOp::IAdd, base, offset)?; + let place = fb.device_place(at, u32_)?; + fb.load( + place, + MemAccess { + aligned: Some(4), + ..MemAccess::default() + }, + ) +} + +/// The draw's first vertex, read where `first` says ([`FirstVertex`]): `None` for +/// [`FirstVertex::Zero`]. +fn load_first_vertex( + cx: &mut EmitCx<'_>, + fb: &mut FunctionBuilder<'_>, + first: FirstVertex, +) -> BResult { + match first { + FirstVertex::Builtin { index } => fetch::load_builtin(cx, fb, index), + FirstVertex::Push => { + let bases = cx.push_field(fb, PushField::BaseVertexInstance)?; + fb.composite_extract(bases, &[0]) + } + FirstVertex::Zero => crate::memory::leaf::k32(fb, 0), + } +} + /// Output `o`'s part of the returned value `x`, as it is stored: its field, the amplification's /// offset added, held below its count, and a color's rounding. fn output_part( diff --git a/crates/metal2vulkan/src/lower/stage_io/plan.rs b/crates/metal2vulkan/src/lower/stage_io/plan.rs index 7379b402e..3d9f11911 100644 --- a/crates/metal2vulkan/src/lower/stage_io/plan.rs +++ b/crates/metal2vulkan/src/lower/stage_io/plan.rs @@ -1469,6 +1469,25 @@ pub(super) fn primitive_id(sp: &mut StageIoPlan, dir: IoDir) -> Result) -> super::FirstVertex { + cx.facts.insert(RuntimeFact::BaseVertexInstance); + if !cx.profile.fields().draw_parameters { + cx.push.insert(PushField::BaseVertexInstance); + return super::FirstVertex::Push; + } + let index = builtin( + &mut cx.families.stage_io, + B::BaseVertex, + IoDir::Input, + Shape::U32, + StageBuiltin::BaseVertex, + ); + super::FirstVertex::Builtin { index } +} + /// Plan a vertex function's primitive ID (`LoweringInputs::primitive_id_varying`, /// [`super::PrimitiveIdStore`]): its varying, the vertex index it divides, the draw's first /// vertex (the `BaseVertex` builtin with `shaderDrawParameters`, lane 0 of @@ -1480,7 +1499,8 @@ pub(super) fn primitive_id(sp: &mut StageIoPlan, dir: IoDir) -> Result) -> Result<(), Error> { if matches!(cx.entry.ep.stage, AirStage::Vertex { patch: Some(_) }) { return match crate::lower::tessellation::emulates(cx.profile) { @@ -1489,14 +1509,10 @@ fn primitive_id_output(cx: &mut SelectCx<'_>) -> Result<(), Error> { }; } cx.push.insert(PushField::VerticesPerPrimitive); - let deindexed = captured_index_type(cx).is_some(); - let draw_parameters = cx.profile.fields().draw_parameters; - if !deindexed { - cx.facts.insert(RuntimeFact::BaseVertexInstance); - if !draw_parameters { - cx.push.insert(PushField::BaseVertexInstance); - } - } + let first = match captured_index_type(cx).is_some() && !listed(cx) { + true => super::FirstVertex::Zero, + false => first_vertex(cx), + }; let sp = &mut cx.families.stage_io; let vertex = builtin( sp, @@ -1505,19 +1521,6 @@ fn primitive_id_output(cx: &mut SelectCx<'_>) -> Result<(), Error> { Shape::U32, StageBuiltin::VertexIndex, ); - let first = match (deindexed, draw_parameters) { - (true, _) => super::FirstVertex::Zero, - (false, true) => super::FirstVertex::Builtin { - index: builtin( - sp, - B::BaseVertex, - IoDir::Input, - Shape::U32, - StageBuiltin::BaseVertex, - ), - }, - (false, false) => super::FirstVertex::Push, - }; let object = primitive_id(sp, IoDir::Output)?; sp.primitive_id = Some(super::PrimitiveIdStore { vertex, @@ -2567,12 +2570,14 @@ fn capture(cx: &mut SelectCx<'_>, form: CaptureForm) -> Result<(), Error> { } /// The index type of the draw whose indices a vertex function reads at their address: the -/// indexed capture form's (`CaptureForm::Indexed`), else the primitive ID's de-indexed form's +/// indexed capture form's (`CaptureForm::Indexed`), else the private list form's `u32` +/// (`LoweringInputs::private_list`), else the primitive ID's de-indexed form's /// (`LoweringInputs::primitive_id_indices`, under `primitive_id_varying`); `None` for any other /// function. pub(super) fn captured_index_type(cx: &SelectCx<'_>) -> Option { match (cx.stage, cx.inputs.captured_positions) { (Stage::Vertex, Some(form)) => form.index_type(), + (Stage::Vertex, None) if cx.inputs.private_list => Some(crate::metal::IndexType::UInt32), (Stage::Vertex, None) => cx .inputs .primitive_id_indices @@ -2581,11 +2586,19 @@ pub(super) fn captured_index_type(cx: &SelectCx<'_>) -> Option) -> bool { + cx.stage == Stage::Vertex && cx.inputs.captured_positions.is_none() && cx.inputs.private_list +} + /// The feature a form that reads a draw's indices or records at their addresses serves: tile -/// reach for the capture form, the primitive ID for its de-indexed form. +/// reach for the capture form, Metal's private primitive types for the private list form, the +/// primitive ID for its de-indexed form. fn indices_feature(cx: &SelectCx<'_>) -> Feature { match cx.inputs.captured_positions { Some(_) => Feature::TileReach, + None if listed(cx) => Feature::PrivatePrimitives, None => Feature::PrimitiveId, } } @@ -2603,9 +2616,11 @@ fn refuse_unaddressed(cx: &SelectCx<'_>) -> Result<(), Error> { Ok(()) } -/// Plan the index read of type `ty` of the indexed capture form or the de-indexed form once -/// ([`super::CapturedIndex`]): its address and layout push fields and the vertex index builtin. -/// Refused ([`indices_feature`]) on a device without device addresses. +/// Plan the index read of type `ty` of the indexed capture form, the de-indexed form or the +/// private list form once ([`super::CapturedIndex`]): its address push field, the capture and +/// de-indexed forms' layout, the private list form's first vertex (as the primitive ID's, +/// [`first_vertex`]) and its fact, and the vertex index builtin. Refused ([`indices_feature`]) on +/// a device without device addresses. pub(super) fn captured_index( cx: &mut SelectCx<'_>, ty: crate::metal::IndexType, @@ -2615,7 +2630,16 @@ pub(super) fn captured_index( } refuse_unaddressed(cx)?; cx.push.insert(PushField::CaptureIndexAddress); - cx.push.insert(PushField::CaptureLayout); + let first = match listed(cx) { + true => { + cx.facts.insert(RuntimeFact::PrivateList); + Some(first_vertex(cx)) + } + false => { + cx.push.insert(PushField::CaptureLayout); + None + } + }; let sp = &mut cx.families.stage_io; let vertex = builtin( sp, @@ -2624,7 +2648,7 @@ pub(super) fn captured_index( Shape::U32, StageBuiltin::VertexIndex, ); - sp.captured_index = Some(super::CapturedIndex { vertex, ty }); + sp.captured_index = Some(super::CapturedIndex { vertex, ty, first }); sp.words = sp.words.saturating_add(super::CAPTURED_INDEX_WORDS); Ok(()) } @@ -2647,6 +2671,11 @@ fn captured_param( captured_index(cx, index)?; Source::CapturedVertex(f) } + // The private list form's base vertex lies before its list, found from its first vertex. + None if listed(cx) => { + captured_index(cx, crate::metal::IndexType::UInt32)?; + Source::CapturedBaseVertex(f) + } None => { cx.push.insert(PushField::CaptureLayout); Source::CapturedBaseVertex(f) @@ -2663,13 +2692,14 @@ fn captured_param( /// index builtins, the header's address, and its fact. Refused /// (`Unsupported{GpuEncodedIndirectCommands, NotImplemented}`): one compiled without /// `replay_bindings`, or under an input that reads the draw's own vertex or instance indices or -/// draws it more than once (the primitive ID's varying or de-indexed form, the capture form, -/// amplifications drawn apart, tessellation). +/// draws it more than once (the primitive ID's varying or de-indexed form, the private list form, +/// the capture form, amplifications drawn apart, tessellation). fn merged(cx: &mut SelectCx<'_>) -> Result<(), Error> { let i = cx.inputs; if !i.replay_bindings || i.primitive_id_varying || i.primitive_id_indices.is_some() + || i.private_list || i.captured_positions.is_some() || i.amplification_draws.is_some() || i.tessellation.is_some() @@ -3171,10 +3201,12 @@ pub fn finish(cx: &mut SelectCx<'_>) -> Result<(), Error> { } // The primitive ID's de-indexed form runs the vertex function once per index of the draw, // where Metal shades each vertex the indices name as its GPU shades it: a function that - // writes memory would write once per index. + // writes memory would write once per index. The private list form runs it once per list + // position, as Metal runs its private types. let deindexed = cx.stage == Stage::Vertex && cx.inputs.captured_positions.is_none() - && captured_index_type(cx).is_some(); + && captured_index_type(cx).is_some() + && !listed(cx); if deindexed && writes { return Err(Unsupported::not_implemented(Feature::PrimitiveId).into()); } diff --git a/crates/metal2vulkan/src/pipeline/api_tests.rs b/crates/metal2vulkan/src/pipeline/api_tests.rs index b87dc0f58..a710fed33 100644 --- a/crates/metal2vulkan/src/pipeline/api_tests.rs +++ b/crates/metal2vulkan/src/pipeline/api_tests.rs @@ -231,6 +231,7 @@ mod serde_round_trips { captured_positions: Some(crate::pipeline::CaptureForm::Vertices), primitive_id_indices: Some(metal::IndexType::UInt16), quad_primitive_ids: true, + private_list: true, extended_shadows: BTreeSet::from([0]), snapshot_textures: BTreeMap::from([( slot(Stage::Fragment, SlotClass::Texture, 2), @@ -345,6 +346,7 @@ mod serde_round_trips { primitive_id_varying: true, primitive_id_indices: Some(crate::metal::IndexType::UInt16), quad_primitive_ids: true, + private_list: true, color_writes: BTreeMap::from([ ( 0, @@ -1021,6 +1023,7 @@ mod bind_serde_round_trips { depth16_bias_raises: Some(true), primitive_id_indices: Some(metal::IndexType::UInt16), quad_primitive_ids: true, + private_list: true, }); let mut shape = StageShape::default(); shape.buffers.insert( @@ -1083,6 +1086,7 @@ mod bind_serde_round_trips { depth16_bias_raises: Some(true), primitive_id_indices: Some(metal::IndexType::UInt32), quad_primitive_ids: true, + private_list: true, }); } diff --git a/crates/metal2vulkan/src/pipeline/compile.rs b/crates/metal2vulkan/src/pipeline/compile.rs index ce961c447..f00793b0a 100644 --- a/crates/metal2vulkan/src/pipeline/compile.rs +++ b/crates/metal2vulkan/src/pipeline/compile.rs @@ -1934,12 +1934,14 @@ fn lower_inputs( } InputsFrom::Vertex(desc, variant, depth, primitive_id, _) => { let attributes = attributes_read(spec); - // The indexed capture form and the primitive ID's de-indexed form pull every - // attribute, whatever the caller's projection would fetch in fixed function. + // The indexed capture form, the primitive ID's de-indexed form and the private list + // form pull every attribute, whatever the caller's projection would fetch in fixed + // function. let pull_every = variant .captured_positions .is_some_and(|f| f.index_type().is_some()) - || variant.primitive_id_indices.is_some(); + || variant.primitive_id_indices.is_some() + || variant.private_list; let projection = crate::pipeline::link::vertex::vertex_fetch_projection_for( desc, &attributes, diff --git a/crates/metal2vulkan/src/pipeline/compile/key.rs b/crates/metal2vulkan/src/pipeline/compile/key.rs index 046c42236..80be3027d 100644 --- a/crates/metal2vulkan/src/pipeline/compile/key.rs +++ b/crates/metal2vulkan/src/pipeline/compile/key.rs @@ -301,6 +301,10 @@ pub fn function_key( h.bytes(b"quad-primitive-ids"); } // Appended only when set. + if inputs.private_list { + h.bytes(b"private-list"); + } + // Appended only when set. if let Some(d) = inputs.amplification_draws { h.bytes(b"amplification-draws") .u64(u64::from(d.layered)) diff --git a/crates/metal2vulkan/src/pipeline/compile/tests.rs b/crates/metal2vulkan/src/pipeline/compile/tests.rs index e528efcae..ac5978680 100644 --- a/crates/metal2vulkan/src/pipeline/compile/tests.rs +++ b/crates/metal2vulkan/src/pipeline/compile/tests.rs @@ -658,6 +658,7 @@ fn the_inputs_encoding_is_the_earlier_derived_debug() { .replace(", primitive_id_varying: false", "") .replace(", primitive_id_indices: None", "") .replace(", quad_primitive_ids: false", "") + .replace(", private_list: false", "") .replace(", amplification_draws: None", "") .replace(", color_writes: {}", "") .replace(", primitive_varyings: {}", "") diff --git a/crates/metal2vulkan/src/pipeline/facts.rs b/crates/metal2vulkan/src/pipeline/facts.rs index 2e05c6798..c3c70ba26 100644 --- a/crates/metal2vulkan/src/pipeline/facts.rs +++ b/crates/metal2vulkan/src/pipeline/facts.rs @@ -804,6 +804,12 @@ pub enum RuntimeFact { /// listed as two triangles a quad. Its plans state the variant the shape asks for /// (`BindShape::quad_primitive_ids`). QuadPrimitiveIds, + /// The render pipeline was compiled under `VariantKey::private_list`, and its vertex function + /// runs the consumer's list of one of Metal's private primitive types in the pulled list form + /// (`LoweringInputs::private_list`): its index and Metal's base vertex read at + /// `PushHole::CaptureIndexAddress`, each list position run once. Its plans state the variant + /// the shape asks for (`BindShape::private_list`). + PrivateList, } /// What one compile made of a slot of a `RuntimeFact::UniformViewRange`. diff --git a/crates/metal2vulkan/src/pipeline/lower_inputs.rs b/crates/metal2vulkan/src/pipeline/lower_inputs.rs index f8b1acd95..f44451fa5 100644 --- a/crates/metal2vulkan/src/pipeline/lower_inputs.rs +++ b/crates/metal2vulkan/src/pipeline/lower_inputs.rs @@ -289,6 +289,25 @@ pub struct LoweringInputs { /// ID's varying (`primitive_id_varying`), compiles as without it. #[cfg_attr(feature = "serde", serde(default))] pub quad_primitive_ids: bool, + /// The draw is the list a consumer writes for one of Metal's private primitive types (a line + /// loop, a triangle fan, quads, a quad strip), drawn without indices in the pulled list form + /// (`VariantKey::private_list`): `list length` vertices from vertex `first`, Vulkan's first + /// vertex (read as the primitive ID's `first` is: the `BaseVertex` builtin with + /// `shaderDrawParameters`, lane 0 of `PushField::BaseVertexInstance` without). The vertex at + /// `VertexIndex` reads its raw index, a `u32`, at `PushField::CaptureIndexAddress + + /// 4 · VertexIndex`, and Metal's base vertex at `PushField::CaptureIndexAddress + 4 · (first - + /// 1)`, the word before the list's first; it runs `raw + base vertex` (wrapping as `u32`s), + /// which `[[vertex_id]]` and every per-vertex attribute, all pulled, read, and + /// `[[base_vertex]]` reads that word. So each list position runs the vertex function once, + /// as Metal runs it for these types (once per vertex of its list: Metal probes on the M3 Max, + /// macOS 27.0.1), whatever vertex reuse the device does, and any `u32` vertex start or base + /// vertex is drawn: a vertex function that writes memory, or the primitive ID's varying + /// (`primitive_id_varying`, its `(VertexIndex - first) / n` the list primitive's), runs as + /// Metal's. Refused on a device without device addresses (`Feature::PrivatePrimitives`). The + /// function's pipeline states it (`RuntimeFact::PrivateList`). Any other function compiles + /// as without it. + #[cfg_attr(feature = "serde", serde(default))] + pub private_list: bool, /// The function's render pipeline draws each vertex amplification as a draw of its own /// (`VariantKey::amplification_draws`), where Vulkan multiview cannot draw the encoder's /// mappings as Metal renders them. Under it a vertex or fragment function reads its diff --git a/crates/metal2vulkan/src/tests/bind_shape_of.rs b/crates/metal2vulkan/src/tests/bind_shape_of.rs index 3e2ee1943..cb21aec1c 100644 --- a/crates/metal2vulkan/src/tests/bind_shape_of.rs +++ b/crates/metal2vulkan/src/tests/bind_shape_of.rs @@ -256,6 +256,7 @@ fn states() -> Vec { with(|s| s.depth16_bias_raises = Some(true)), with(|s| s.depth16_bias_raises = Some(false)), with(|s| s.quad_primitive_ids = true), + with(|s| s.private_list = true), ] } diff --git a/crates/metal2vulkan/src/tests/engine_primitive_ids.rs b/crates/metal2vulkan/src/tests/engine_primitive_ids.rs index bcfacfecf..7ee4659f5 100644 --- a/crates/metal2vulkan/src/tests/engine_primitive_ids.rs +++ b/crates/metal2vulkan/src/tests/engine_primitive_ids.rs @@ -523,3 +523,75 @@ fn a_memory_writing_vertex_function_is_refused_de_indexed() { other => panic!("{:?}", other.map(|_| ())), } } + +/// A private type's draw in the private list form (`BindState::private_list`) asks for the listed +/// variant through the shape. It reads its list's address (`PushField::CaptureIndexAddress`, a +/// push hole the consumer fills) and no capture layout, and draws the list's positions without +/// indices from the call's first vertex, the list's first index, with its instances; its vertices +/// per primitive are the list's, twice that for Metal's quads listed as two triangles a quad. A +/// vertex function that writes memory, which the de-indexed form refuses, runs in it, on a device +/// with both features too, where nothing reads the primitive ID's varying. Every module is valid. +#[test] +fn a_private_draw_in_the_list_form_runs_the_listed_variant() { + use crate::bind::{DrawCall, PushHole}; + use crate::metal::PrimitiveType; + use crate::pipeline::RuntimeFact; + let Some(bc) = fixture() else { return }; + let listed = |dev: &Device, vertex: &str| { + let d = pipeline(&bc, vertex, Some("pi_ids"), 1); + let base = compile(dev, &d).expect("base"); + let mut state = bound(); + state.primitive_type = Some(PrimitiveType::Triangle); + state.private_list = true; + let plan = base.plan(dev, &state.shape()).expect("base plan"); + assert!(plan.variant.private_list, "{vertex}: the plan's variant"); + let key = plan.variant.clone(); + let p = dev + .compile_render_variant(&d, &key, &Budget::standard()) + .unwrap_or_else(|e| panic!("{vertex}: the listed variant: {e}")); + validate(&p, dev); + assert!(p + .dependencies + .iter() + .any(|d| d.fact == RuntimeFact::PrivateList)); + assert!(reads_field(&p, PushField::CaptureIndexAddress), "{vertex}"); + assert!(!reads_field(&p, PushField::CaptureLayout), "{vertex}"); + let plan = p.plan(dev, &state.shape()).expect("plan"); + assert_eq!(plan.variant, key); + let draw = DrawCall::Primitives { + vertex_start: 1, + vertex_count: 12, + instance_count: 2, + base_instance: 1, + }; + let commands = plan.instantiate_draw(&state, &draw).expect("draw"); + assert_eq!( + commands.draw, + vk::DrawCommand::Draw { + vertex_count: 12, + instance_count: 2, + first_vertex: 1, + first_instance: 1, + } + ); + assert!(commands + .push_holes + .iter() + .any(|h| matches!(h, PushHole::CaptureIndexAddress { .. }))); + (plan, state, draw) + }; + let (plan, mut state, draw) = listed(&withheld(8), "pi_place"); + let commands = plan.instantiate_draw(&state, &draw).expect("draw"); + assert_eq!( + pushed(&plan, &commands, PushField::VerticesPerPrimitive, 1), + [3] + ); + state.quad_primitive_ids = true; + let commands = plan.instantiate_draw(&state, &draw).expect("quads"); + assert_eq!( + pushed(&plan, &commands, PushField::VerticesPerPrimitive, 1), + [6] + ); + listed(&withheld(8), "pi_counts"); + listed(&device("lavapipe"), "pi_counts"); +} diff --git a/docs/API.md b/docs/API.md index bc634aade..207244725 100644 --- a/docs/API.md +++ b/docs/API.md @@ -490,7 +490,14 @@ Where Metal's rules differ from Vulkan's, the pipeline gives Metal's answer: buffer, a vertex function that writes memory in that form, and a mesh pipeline. A draw of Metal's private quads or quad strip, which the consumer lists as two triangles a quad (`BindState::quad_primitive_ids`), runs the fragment variant that reads `PrimitiveId` shifted - right by one (`VariantKey::quad_primitive_ids`), as Metal counts one primitive a quad. + right by one (`VariantKey::quad_primitive_ids`), as Metal counts one primitive a quad. A + private type's draw whose vertex function writes the varying, or writes memory (Metal runs it + once for each vertex of its list, where an indexed draw may run a shared vertex once), runs the + private list form (`VariantKey::private_list`, `BindShape::private_list`; needs device + addresses): the consumer draws its list without indices from its first index as first vertex, + and the vertex function reads each position's index, and Metal's base vertex in the word before + the list, at the list's address (`PushHole::CaptureIndexAddress`), adding them as Metal's vertex + ID wraps, so each position runs once and the positions count Metal's primitives. Behind an emulated post-tessellation vertex function the varying carries the patch's position in its draw (tessellation, below). - A device draws to at most the lesser of its `maxColorAttachments` and @@ -3042,6 +3049,17 @@ each item named states the rule in full. the runtime's do (0.04 to 1.5 ms after it on MoltenVK, Metal's 0.01 to 0.03 ms). - **A page fault or a victim of the GPU's recovery completes as its work does** (about 1 ms on MoltenVK), where Metal completed it 16.8 to 30.0 ms after its commit. +- **A queue's second caused GPU error revokes it, as Metal's does**, and only an event wait held + across the revocation is answered unmeasured. Measured on the M3 Max (macOS 27.0.1, about sixty + command buffers): page faults and hangs (`CommandBufferError::PageFault`, `GpuHang`) count + against their queue, victims of the GPU's recovery (`GpuRecoveryVictim`) do not; from the + completion of the queue's second counted command buffer, every one committed on that queue fails + at its commit with `CommandBufferError::AccessRevoked` (`MTLCommandBufferErrorAccessRevoked`, 4), + running nothing and firing none of its event signals, for good (two seconds on too), while one + committed before it runs; the device's other queues, new ones too, run on. The runtime counts the + faults and hangs it makes Metal's answer for (primitive type 9, an execution of indirect + commands under a state it cannot inherit), not the ones the driver relays, and decides at the + commit: a command buffer committed before the revocation runs whatever its event waits. **Heaps and memory** diff --git a/docs/REFUSALS.md b/docs/REFUSALS.md index 07ae736fd..dafe5b1a2 100644 --- a/docs/REFUSALS.md +++ b/docs/REFUSALS.md @@ -14,13 +14,13 @@ Columns: - `none`: no public API path: malformed or non-Metal input, Apple-private calls, or a cap no valid program of ordinary size meets; - `?`: not assessed yet. -Generated at `e21cc1069`. +Generated at `56023d173`. ## Totals | Kind | Variants | With a site | Reach system | Reach app | Reach rare | Reach none | Unassessed | |---|---|---|---|---|---|---|---| -| Translator and front-end refusals | 125 | 125 | 6 | 33 | 69 | 17 | 0 | +| Translator and front-end refusals | 126 | 126 | 6 | 33 | 70 | 17 | 0 | | Runtime gaps | 67 | 67 | 1 | 8 | 43 | 15 | 0 | | Apple-only calls | 5 | 5 | 0 | 0 | 0 | 5 | 0 | | Binder refusals at a device limit | 9 | 9 | 0 | 1 | 7 | 1 | 0 | @@ -65,7 +65,7 @@ Generated at `e21cc1069`. | `Int64Atomics` | 64-bit atomics | devices short of a Vulkan feature the site names; devices without buffer device addresses (`addressed_needs`) | 2: `crates/metal2vulkan/src/lower/access/atomic.rs:624`, `crates/metal2vulkan/src/lower/access/atomic.rs:633` | `rare`: 64-bit atomics | | `ImageAtomics` | Image atomics beyond 32-bit integers | devices without a capability the site computes (`gaps`); every device (no Vulkan mechanism) | 3: `crates/metal2vulkan-runtime/src/families/formats.rs:464`, `crates/metal2vulkan-runtime/src/families/formats.rs:468` (+1) | `rare`: texture atomics beyond 32-bit integers | | `DescriptorCount` | Too many descriptors of one kind in a stage or pipeline | devices short of a device limit the site names; devices without VkLimit::MaxUniformBufferRange | 3: `crates/metal2vulkan/src/lower/access/mod.rs:1684`, `crates/metal2vulkan/src/lower/select.rs:1641` (+1) | `app`: many textures or buffers in one stage on a smaller device | -| `BufferRange` | A buffer window beyond the descriptor range limits | devices without a capability the site computes (`needs`); devices without buffer device addresses (`addressed_needs`); every device (no Vulkan mechanism) | 7: `crates/metal2vulkan-runtime/src/function_table.rs:569`, `crates/metal2vulkan/src/bind/graphics.rs:3601` (+5) | `app`: a buffer window past a device's descriptor range | +| `BufferRange` | A buffer window beyond the descriptor range limits | devices without a capability the site computes (`needs`); devices without buffer device addresses (`addressed_needs`); every device (no Vulkan mechanism) | 7: `crates/metal2vulkan-runtime/src/function_table.rs:569`, `crates/metal2vulkan/src/bind/graphics.rs:3618` (+5) | `app`: a buffer window past a device's descriptor range | | `Int64Arithmetic` | 64-bit integer arithmetic | devices without VkFeature::ShaderInt64 | 2: `crates/metal2vulkan/src/lower/arith/legal.rs:582`, `crates/metal2vulkan/src/lower/select.rs:1133` | `rare`: 64-bit integers on a device without shaderInt64 | | `Float64Arithmetic` | 64-bit float arithmetic | devices without VkFeature::ShaderFloat64 | 2: `crates/metal2vulkan/src/device/metal.rs:230`, `crates/metal2vulkan/src/lower/arith/legal.rs:587` | `rare`: doubles (MSL has none outside Apple's own code) | | `Format` | A pixel format not supported for the required use | devices without VkFeature::ShaderStorageImageExtendedFormats; devices without a capability the site computes; devices without a capability the site computes (`alternatives`); devices without a capability the site computes (`c`); devices without a capability the site computes (`missing`); devices without a capability the site computes (`routes`); devices without a format's usage; every device (no Vulkan mechanism); every device (not implemented) | 121: `crates/metal2vulkan-runtime/src/binding_view.rs:146`, `crates/metal2vulkan-runtime/src/blit_plan.rs:523` (+119) | `system`: pixel formats a device lacks for a use (CoreVideo's 4:2:x and 10-bit formats among them) | @@ -84,21 +84,22 @@ Generated at `e21cc1069`. | `PixelSamplerCompare` | A constexpr sampler with pixel coordinates and a compare function, which Apple's compiler rejects ("invalid values combination in sampler... | every device (no Vulkan mechanism) | 1: `crates/metal2vulkan/src/lower/sampler/constexpr.rs:115` | `none`: Apple's compiler rejects it | | `TexelBuffer` | Texture buffers beyond the device's texel-buffer limits | devices without a format's usage; every device (no Vulkan mechanism) | 3: `crates/metal2vulkan/src/bind/instantiate.rs:880`, `crates/metal2vulkan/src/bind/instantiate.rs:886` (+1) | `app`: texture buffers past a device's texel-buffer limits | | `RasterOrderGroups` | Raster order groups without fragment shader interlock | devices without VkFeature::FragmentShaderPixelInterlock; devices without VkFeature::FragmentShaderSampleInterlock; devices without a capability the site computes (`alternatives`); every device (not implemented) | 4: `crates/metal2vulkan/src/device/metal.rs:242`, `crates/metal2vulkan/src/lower/fragment/rog.rs:151` (+2) | `rare`: raster order groups | -| `FramebufferFetch` | Framebuffer fetch without an ordered form on the device (rasterization-order attachment access, or the pixel interlock's storage form where the... | devices short of a Vulkan property the site names; devices without VkFeature::FragmentShaderPixelInterlock; devices without VkFeature::RasterizationOrderColorAttachmentAccess; devices without VkFeature::SampleRateShading; devices without a capability the site computes; devices without a capability the site computes (`alternatives`); devices without a capability the site computes (`c`); devices without a capability the site computes (`capability`); devices without a capability the site computes (`missing`); devices without a format's usage; drivers with a defect; every device (not implemented) | 23: `crates/metal2vulkan-runtime/src/families/features.rs:1016`, `crates/metal2vulkan-runtime/src/render.rs:5838` (+21) | `system`: programmable blending (framebuffer fetch); macOS 26.6.2's login reaches it (two WindowServer and RenderBox pipelines fetch RGB10A8_2P_XR10 attachments, the consumer's boots) | -| `PrimitiveId` | `[[primitive_id]]` in a fragment function | devices without a capability the site computes; every device (not implemented) | 3: `crates/metal2vulkan-runtime/src/families/features.rs:1125`, `crates/metal2vulkan/src/lower/stage_io/plan.rs:3179` (+1) | `rare`: primitive_id on a device without geometry or tessellation shaders, in an indexed draw or behind a mesh function | -| `VertexAmplification` | Vertex amplification | devices without VkFeature::Multiview; devices without VkFeature::MultiviewTessellationShader; devices without VkLimit::MaxMultiviewInstanceIndex; devices without a capability the site computes (`needs`); every device (not implemented) | 5: `crates/metal2vulkan/src/bind/graphics.rs:3942`, `crates/metal2vulkan/src/lower/stage_io/plan.rs:1312` (+3) | `rare`: vertex amplification | +| `FramebufferFetch` | Framebuffer fetch without an ordered form on the device (rasterization-order attachment access, or the pixel interlock's storage form where the... | devices short of a Vulkan property the site names; devices without VkFeature::FragmentShaderPixelInterlock; devices without VkFeature::RasterizationOrderColorAttachmentAccess; devices without VkFeature::SampleRateShading; devices without a capability the site computes; devices without a capability the site computes (`alternatives`); devices without a capability the site computes (`c`); devices without a capability the site computes (`capability`); devices without a capability the site computes (`missing`); devices without a format's usage; drivers with a defect; every device (not implemented) | 23: `crates/metal2vulkan-runtime/src/families/features.rs:1016`, `crates/metal2vulkan-runtime/src/render.rs:5887` (+21) | `system`: programmable blending (framebuffer fetch); macOS 26.6.2's login reaches it (two WindowServer and RenderBox pipelines fetch RGB10A8_2P_XR10 attachments, the consumer's boots) | +| `PrimitiveId` | `[[primitive_id]]` in a fragment function | devices without a capability the site computes; every device (not implemented) | 3: `crates/metal2vulkan-runtime/src/families/features.rs:1125`, `crates/metal2vulkan/src/lower/stage_io/plan.rs:3211` (+1) | `rare`: primitive_id on a device without geometry or tessellation shaders, in an indexed draw or behind a mesh function | +| `PrivatePrimitives` | One of Metal's private primitive types (a line loop, a triangle fan, quads, a quad strip) drawn in the pulled list form... | - | via a helper: 1: `crates/metal2vulkan/src/lower/stage_io/plan.rs:2601` | `rare`: a private primitive type drawn in the pulled list form (a vertex function that writes memory or the primitive_id varying, a vertex start past 2^31) on a device without device addresses | +| `VertexAmplification` | Vertex amplification | devices without VkFeature::Multiview; devices without VkFeature::MultiviewTessellationShader; devices without VkLimit::MaxMultiviewInstanceIndex; devices without a capability the site computes (`needs`); every device (not implemented) | 5: `crates/metal2vulkan/src/bind/graphics.rs:3959`, `crates/metal2vulkan/src/lower/stage_io/plan.rs:1312` (+3) | `rare`: vertex amplification | | `LayeredRendering` | Layered rendering (`render_target_array_index`, `viewport_array_index`) | devices without VkFeature::ImageView2DOn3DImage; devices without VkFeature::MultiViewport; devices without VkFeature::ShaderOutputLayer; devices without VkFeature::ShaderOutputViewportIndex; devices without a capability the site computes (`needs`); every device (not implemented) | 7: `crates/metal2vulkan-runtime/src/render_pass.rs:1669`, `crates/metal2vulkan-runtime/src/render_state.rs:1107` (+5) | `rare`: layered rendering on a device without its features | | `ClipDistance` | Clip or cull distances | devices without VkFeature::ShaderClipDistance; devices without VkLimit::MaxClipDistances | 2: `crates/metal2vulkan/src/lower/mesh/mod.rs:934`, `crates/metal2vulkan/src/lower/mesh/mod.rs:942` | `rare`: clip distances on a device without them | | `DualSourceBlending` | Dual-source blending | devices without VkFeature::DualSrcBlend; devices without VkLimit::MaxFragmentDualSrcAttachments | 5: `crates/metal2vulkan-runtime/src/families/formats.rs:386`, `crates/metal2vulkan/src/metal/state.rs:37` (+3) | `rare`: dual-source blending on a device without it | -| `Barycentrics` | Barycentric coordinates | devices without VkFeature::FragmentShaderBarycentric; devices without VkFeature::GeometryShader; devices without a capability the site computes (`needs`); drivers with a defect; every device (not implemented) | 5: `crates/metal2vulkan/src/device/metal.rs:263`, `crates/metal2vulkan/src/lower/stage_io/plan.rs:1921` (+3) | `rare`: barycentric coordinates | -| `StencilExport` | Stencil export | devices without VkExtension::ExtShaderStencilExport; every device (not implemented) | 6: `crates/metal2vulkan-runtime/src/families/features.rs:1112`, `crates/metal2vulkan/src/bind/graphics.rs:2638` (+4) | `rare`: stencil from the shader | +| `Barycentrics` | Barycentric coordinates | devices without VkFeature::FragmentShaderBarycentric; devices without VkFeature::GeometryShader; devices without a capability the site computes (`needs`); drivers with a defect; every device (not implemented) | 5: `crates/metal2vulkan/src/device/metal.rs:263`, `crates/metal2vulkan/src/lower/stage_io/plan.rs:1924` (+3) | `rare`: barycentric coordinates | +| `StencilExport` | Stencil export | devices without VkExtension::ExtShaderStencilExport; every device (not implemented) | 6: `crates/metal2vulkan-runtime/src/families/features.rs:1112`, `crates/metal2vulkan/src/bind/graphics.rs:2655` (+4) | `rare`: stencil from the shader | | `SampleRateShading` | Per-sample shading | devices without VkFeature::SampleRateShading; devices without a capability the site computes (`needs`); every device (not implemented) | 3: `crates/metal2vulkan/src/pipeline/link/graphics.rs:844`, `crates/metal2vulkan/src/pipeline/link/graphics.rs:846` (+1) | `rare`: per-sample shading | | `PixelCoverageAtSampleRate` | The pixel's coverage (`[[sample_mask]]` read) in a fragment function that runs once per sample | drivers with a defect; every device (no Vulkan mechanism); every device (not implemented) | 3: `crates/metal2vulkan/src/lower/fragment/coverage.rs:296`, `crates/metal2vulkan/src/lower/simd/mod.rs:754` (+1) | `rare`: coverage read at sample rate | | `InterfaceComponents` | Too many interface components or locations | devices short of a device limit the site names; devices without VkLimit::MaxColorAttachments; devices without VkLimit::MaxVertexInputAttributes | 4: `crates/metal2vulkan/src/pipeline/compile/color_group.rs:202`, `crates/metal2vulkan/src/pipeline/link/graphics.rs:301` (+2) | `rare`: too many varyings or attachments for a device | | `UnmatchedVarying` | A fragment input without a vertex producer (a Metal link error) | every device (no Vulkan mechanism) | 3: `crates/metal2vulkan/src/pipeline/link/varyings.rs:318`, `crates/metal2vulkan/src/pipeline/link/varyings.rs:537` (+1) | `none`: a Metal link error | | `KernelStageIn` | Kernel `[[stage_in]]` | every device (not implemented) | 3: `crates/metal2vulkan-runtime/src/indirect_execute.rs:376`, `crates/metal2vulkan/src/bind/dispatch.rs:871` (+1) | `rare`: kernel stage-in combinations Metal leaves unestablished | | `Tessellation` | Tessellation | devices without VkLimit::MaxPushConstantsSize; devices without VkLimit::MaxStorageBufferRange; devices without VkLimit::MaxTessellationGenerationLevel; every device (not implemented) | 13: `crates/metal2vulkan-air/src/canon/mod.rs:1256`, `crates/metal2vulkan-air/src/canon/mod.rs:1347` (+11) | `rare`: tessellation | -| `MeshShading` | | devices short of a device limit the site names; devices without VkLimit::MaxMeshOutputLayers; devices without VkLimit::MaxTaskPayloadSize; devices without a capability the site computes (`missing`); every device (not implemented) | 7: `crates/metal2vulkan/src/bind/graphics.rs:1562`, `crates/metal2vulkan/src/bind/graphics.rs:3011` (+5) | `rare`: mesh pipelines | +| `MeshShading` | | devices short of a device limit the site names; devices without VkLimit::MaxMeshOutputLayers; devices without VkLimit::MaxTaskPayloadSize; devices without a capability the site computes (`missing`); every device (not implemented) | 7: `crates/metal2vulkan/src/bind/graphics.rs:1576`, `crates/metal2vulkan/src/bind/graphics.rs:3028` (+5) | `rare`: mesh pipelines | | `TileShading` | | devices without VkLimit::MaxStorageBufferRange; devices without a format's usage; every device (not implemented) | 5: `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:521`, `crates/metal2vulkan/src/bind/plan/compute.rs:237` (+3) | `rare`: tile shaders (Apple GPU families) | | `Imageblocks` | An imageblock outside the forms implemented | devices without VkFeature::SampleRateShading; devices without a capability the site computes (`missing`); drivers with a defect; every device (not implemented) | 10: `crates/metal2vulkan/src/lower/access/imageblock.rs:98`, `crates/metal2vulkan/src/lower/access/mod.rs:908` (+8) | `rare`: imageblocks (Apple GPU families) | | `RayTracing` | | devices without a capability the site computes (`missing`); every device (no Vulkan mechanism); every device (not implemented) | 12: `crates/metal2vulkan/src/bind/acceleration.rs:202`, `crates/metal2vulkan/src/bind/acceleration.rs:216` (+10) | `rare`: ray tracing (out of scope by ruling) | @@ -121,7 +122,7 @@ Generated at `e21cc1069`. | `SamplerBicubicFilter` | A use of Metal's bicubic filter that no Metal reading establishes | every device (not implemented) | 5: `crates/metal2vulkan/src/bind/heap.rs:997`, `crates/metal2vulkan/src/bind/plan/resources.rs:1876` (+3) | `system`: bicubic filtering forms Metal does not establish; macOS 26.6.2 makes a runtime sampler with MTLSamplerMinMagFilterCubic (the consumer's boots), whose mip-filtered form is refused | | `GroupCount` | A dispatch whose threadgroup count on `axis` exceeds `maxComputeWorkGroupCount` by more than the binder splits into regions (`None` | every device (no Vulkan mechanism) | 5: `crates/metal2vulkan/src/bind/dispatch.rs:379`, `crates/metal2vulkan/src/bind/dispatch.rs:455` (+3) | `rare`: more threadgroups than a device dispatches, past the binder's split | | `IntersectionFunctionTable` | A ray intersection through intersection functions | every device (no Vulkan mechanism); every device (not implemented) | 9: `crates/metal2vulkan/src/bind/acceleration.rs:177`, `crates/metal2vulkan/src/bind/acceleration.rs:183` (+7) | `rare`: ray tracing (out of scope by ruling) | -| `IndependentBlending` | Color attachments whose write masks or blend states differ, as Metal sets them per attachment, on a device without `independentBlend`, where no... | devices without VkFeature::IndependentBlend | 2: `crates/metal2vulkan-runtime/src/render.rs:2117`, `crates/metal2vulkan/src/pipeline/link/graphics.rs:1017` | `rare`: per-attachment blending on a device without independentBlend | +| `IndependentBlending` | Color attachments whose write masks or blend states differ, as Metal sets them per attachment, on a device without `independentBlend`, where no... | devices without VkFeature::IndependentBlend | 2: `crates/metal2vulkan-runtime/src/render.rs:2166`, `crates/metal2vulkan/src/pipeline/link/graphics.rs:1017` | `rare`: per-attachment blending on a device without independentBlend | | `RasterSampleCount` | A `rasterSampleCount` outside the device's framebuffer sample counts for the pipeline's attachments (`framebuffer*SampleCounts`), and, for a color... | devices short of a Vulkan property the site names; devices without a capability the site computes | 2: `crates/metal2vulkan-runtime/src/families/limits.rs:1059`, `crates/metal2vulkan/src/pipeline/graphics.rs:563` | `app`: a sample count a device lacks for the attachments | | `TriangleFillLines` | The render encoder's `MTLTriangleFillModeLines` (`polygonMode` `LINE`) on a device without `fillModeNonSolid` | - | via a helper: 1: `crates/metal2vulkan/src/metal/state.rs:347` | `app`: wireframe on a device without fillModeNonSolid | | `DepthClipClamp` | The render encoder's `MTLDepthClipModeClamp` (`depthClampEnable`) on a device without `depthClamp` | - | via a helper: 1: `crates/metal2vulkan/src/metal/state.rs:363` | `app`: depth clamp on a device without depthClamp | @@ -134,7 +135,7 @@ Generated at `e21cc1069`. | `TextureSwizzle` | A texture swizzle whose Metal behavior is not measured | devices short of a Vulkan feature the site names; every device (not implemented) | 7: `crates/metal2vulkan-runtime/src/binding_view.rs:167`, `crates/metal2vulkan-runtime/src/texture.rs:994` (+5) | `app`: texture swizzles whose Metal behaviour is unmeasured | | `MipmapGeneration` | `generateMipmapsForTexture:` where the device's filter is not shown to give Metal's answer | devices without VkFeature::ShaderInt64; devices without a format's usage; every device (not implemented) | 7: `crates/metal2vulkan-runtime/src/blit_texture.rs:1818`, `crates/metal2vulkan-runtime/src/mipmap_pick.rs:37` (+5) | `app`: generateMipmapsForTexture: where the device's filter is not Metal's | | `HostMemory` | A buffer over the caller's host memory without a copy (`newBufferWithBytesNoCopy:`) | devices without VkExtension::ExtExternalMemoryHost; every device (no Vulkan mechanism); every device (not implemented) | 5: `crates/metal2vulkan-runtime/src/host_memory.rs:430`, `crates/metal2vulkan-runtime/src/host_memory.rs:470` (+3) | `system`: newBufferWithBytesNoCopy: where the device cannot import the memory | -| `GpuTimes` | A command buffer's GPU times (`GPUStartTime`, `GPUEndTime`) on a device whose queue family writes no timestamps (`timestampValidBits` 0) | every device (no Vulkan mechanism) | 1: `crates/metal2vulkan-runtime/src/command_buffer/mod.rs:2841` | `rare`: GPU times on a queue without timestamps | +| `GpuTimes` | A command buffer's GPU times (`GPUStartTime`, `GPUEndTime`) on a device whose queue family writes no timestamps (`timestampValidBits` 0) | every device (no Vulkan mechanism) | 1: `crates/metal2vulkan-runtime/src/command_buffer/mod.rs:2855` | `rare`: GPU times on a queue without timestamps | | `CountingVisibility` | A `Counting` visibility result (`MTLVisibilityResultModeCounting`) on a device without `occlusionQueryPrecise` | devices without VkFeature::OcclusionQueryPrecise | 1: `crates/metal2vulkan-runtime/src/visibility.rs:452` | `rare`: counting occlusion queries on a device without precise queries | | `ViewFormatReinterpretation` | A texture view whose format has other components, or components of other widths, than its texture's (`RGBA8Unorm` as `R32Uint`), on a device whose... | every device (no Vulkan mechanism) | 1: `crates/metal2vulkan-runtime/src/view_plan.rs:570` | `app`: a view of another component layout on a portability subset (MoltenVK) | | `SeparateMultisampledDepthStencil` | A render pass whose depth and stencil attachments are separate multisampled textures that it loads or may store, on a device without maintenance8,... | - | via a helper: 7: `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:188`, `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:294` (+5) | `rare`: separate multisampled depth and stencil textures | @@ -153,7 +154,7 @@ Generated at `e21cc1069`. | `GlobalBuiltinInFragment` | A fragment function's read of a Metal 3.1 program-scope built-in variable that Metal does not lower there | every device (not implemented) | 1: `crates/metal2vulkan/src/lower/select.rs:912` | `rare`: Metal 3.1 global built-ins in fragment functions | | `PrivateRenderState` | A private fixed-function property of Metal's pipeline descriptor (Apple SPI, OpenGL on Metal's) set to a value whose effect the translation has... | devices without VkFeature::LogicOp; every device (not implemented) | 7: `crates/metal2vulkan/src/bind/heap.rs:1300`, `crates/metal2vulkan/src/bind/plan/resources.rs:887` (+5) | `none`: Apple-private pipeline fields of OpenGL on Metal (no public header) | | `ExtendedRangeBlend` | Metal's blend into an extended-range attachment (`BGRA10_XR`, `BGR10_XR`, `RGB10A8_2P_XR10` and their `_sRGB` twins), which the function computes... | every device (not implemented) | 4: `crates/metal2vulkan/src/lower/arith/extended_range/blend.rs:305`, `crates/metal2vulkan/src/lower/fragment/fetch.rs:1555` (+2) | `system`: the parts of a blend into an extended-range (XR10) attachment the measured model does not hold (second-source factors, the color blend color difference, a one-color-channel mask, float4 and sRGB outside the measured forms); the consumer's guests blend RGB10A8_2P_XR10 attachments | -| `TileReach` | The tiles a render pass's primitives reach, binned on the device ([`tile_reach_module`](crate::bind::tile_reach_module)), on a device without what... | devices short of a Vulkan feature the site names; devices without a capability the site computes (`vec![int64]`); every device (not implemented) | 3: `crates/metal2vulkan/src/bind/tile_reach.rs:270`, `crates/metal2vulkan/src/lower/stage_io/plan.rs:2514` (+1) | `app`: the tiles a pass's draws reach, binned on a device without shaderInt64 | +| `TileReach` | The tiles a render pass's primitives reach, binned on the device ([`tile_reach_module`](crate::bind::tile_reach_module)), on a device without what... | devices short of a Vulkan feature the site names; devices without a capability the site computes (`vec![int64]`); every device (not implemented) | 3: `crates/metal2vulkan/src/bind/tile_reach.rs:270`, `crates/metal2vulkan/src/lower/stage_io/plan.rs:2517` (+1) | `app`: the tiles a pass's draws reach, binned on a device without shaderInt64 | | `ProgramScopeBinding` | A program-scope buffer binding of MSL 3.2 (macOS 15 and later), `constant T* constant p [[buffer(n)]];` in Apple's `!air.global_bindings` list,... | - | via a helper: 2: `crates/metal2vulkan-air/src/abi/module.rs:77`, `crates/metal2vulkan/src/error/mod.rs:267` | `app`: MSL 3.2 program-scope buffer bindings (macOS 15 and later) | | `SeqCstFence` | A sequentially consistent fence (`seq_cst` `atomic_thread_fence`, an LLVM `fence seq_cst`, or a `seq_cst` barrier ordering device memory), whose... | devices short of a Vulkan feature the site names | 1: `crates/metal2vulkan/src/lower/sync/barrier.rs:443` | `rare`: a seq_cst fence in a vertex or fragment stage without its stores and atomics | | `PostDepthCoverage` | The coverage after the depth and stencil tests (`[[sample_mask, post_depth_coverage]]`), read through `VK_EXT_post_depth_coverage` | devices short of a Vulkan extension the site names; devices without VkExtension::ExtPostDepthCoverage | 2: `crates/metal2vulkan-runtime/src/families/features.rs:1217`, `crates/metal2vulkan/src/lower/stage_io/plan.rs:783` | `rare`: the coverage after early depth and stencil tests on a device without VK_EXT_post_depth_coverage | @@ -171,7 +172,7 @@ Generated at `e21cc1069`. | `HeapTextureMemory` | A heap texture whose image the heap's memory type does not take | every device (runtime piece not built) | 5: `crates/metal2vulkan-runtime/src/texture/heap.rs:1508`, `crates/metal2vulkan-runtime/src/texture/heap.rs:1515` (+3) | `app`: a heap texture the heap's memory type does not take | | `FunctionTablePastMaxBufferLength` | A visible-function table of more entries than one buffer of the device's `max_buffer_length` holds words for, or than its size word holds | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/function_table.rs:622` | `none`: a function table past one buffer | | `IndirectCommandBufferPastMaxBufferLength` | An indirect command buffer of more commands than one buffer of the device's `max_buffer_length` holds the records of | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/indirect_command_buffer.rs:522` | `none`: an ICB past one buffer | -| `IndirectRenderCommands` | What indirect command buffers lack of their render commands | every device (runtime piece not built) | 17: `crates/metal2vulkan-runtime/src/compute.rs:1122`, `crates/metal2vulkan-runtime/src/compute.rs:1203` (+15) | `rare`: indirect render commands' remaining pieces | +| `IndirectRenderCommands` | What indirect command buffers lack of their render commands | every device (runtime piece not built) | 17: `crates/metal2vulkan-runtime/src/compute.rs:1115`, `crates/metal2vulkan-runtime/src/compute.rs:1196` (+15) | `rare`: indirect render commands' remaining pieces | | `IndirectImageblockSize` | An indirect compute command's imageblock side past 65535, which Metal keeps | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/indirect_command_buffer.rs:3363` | `none`: an imageblock side past 65535 | | `CommandReplay` | The device replay of indirect command buffers | every device (runtime piece not built) | 2: `crates/metal2vulkan-runtime/src/binding.rs:720`, `crates/metal2vulkan-runtime/src/binding.rs:723` | `rare`: the device replay of indirect command buffers | | `RenderAttachments` | Render attachments and their binding forms | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/binding.rs:1871` | `rare`: render attachment forms not built | @@ -186,12 +187,12 @@ Generated at `e21cc1069`. | `ViewportDepthRange` | A viewport depth range past `[0, 1]`, which Metal takes, on a device without the features to take it natively or by the vertex stage's... | every device (runtime piece not built) | 7: `crates/metal2vulkan-runtime/src/render/draw_shape.rs:341`, `crates/metal2vulkan-runtime/src/render_state.rs:1039` (+5) | `rare`: viewport depth outside [0, 1] without the device features | | `NonFiniteDepthBias` | NaN or infinite depth bias factors whose effect differs between flat and sloped triangles, or a draw whose bias adds a clamp that moves a... | every device (runtime piece not built) | 5: `crates/metal2vulkan-runtime/src/render_state.rs:1603`, `crates/metal2vulkan-runtime/src/render_state.rs:1606` (+3) | `rare`: NaN or infinite depth bias | | `DepthNeverWithoutAttachment` | A draw under a depth compare of `Never` in a pass without a depth attachment, which fails every fragment, whose fragment function writes color... | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/depth_stencil.rs:147` | `rare`: depth compare Never with no depth attachment | -| `HiddenDepthStencil` | A draw whose depth/stencil state uses depth or the stencil that the pass lacks, which plain Metal tests against a hidden `float` depth of 1.0 and... | every device (runtime piece not built) | 2: `crates/metal2vulkan-runtime/src/attachment_stand_in.rs:563`, `crates/metal2vulkan-runtime/src/render.rs:6561` | `app`: a depth-stencil state using depth or stencil the pass lacks | -| `IndirectDrawArguments` | An indirect draw whose arguments the binding plan asks to read on the CPU (`DrawCommands::indirect_needs_arguments`) | every device (runtime piece not built) | 5: `crates/metal2vulkan-runtime/src/index_bounds.rs:91`, `crates/metal2vulkan-runtime/src/render.rs:3246` (+3) | `rare`: indirect draws whose arguments the CPU must read | +| `HiddenDepthStencil` | A draw whose depth/stencil state uses depth or the stencil that the pass lacks, which plain Metal tests against a hidden `float` depth of 1.0 and... | every device (runtime piece not built) | 2: `crates/metal2vulkan-runtime/src/attachment_stand_in.rs:563`, `crates/metal2vulkan-runtime/src/render.rs:6610` | `app`: a depth-stencil state using depth or stencil the pass lacks | +| `IndirectDrawArguments` | An indirect draw whose arguments the binding plan asks to read on the CPU (`DrawCommands::indirect_needs_arguments`) | every device (runtime piece not built) | 5: `crates/metal2vulkan-runtime/src/index_bounds.rs:91`, `crates/metal2vulkan-runtime/src/render.rs:3295` (+3) | `rare`: indirect draws whose arguments the CPU must read | | `DepthStencilResolve` | A depth/stencil resolve no Vulkan resolve mode of the device states | every device (runtime piece not built) | 7: `crates/metal2vulkan-runtime/src/depth_stencil_resolve.rs:441`, `crates/metal2vulkan-runtime/src/resolve.rs:1388` (+5) | `rare`: depth/stencil resolve modes a device lacks | | `TileAtSampleCount` | The tile memory of a render pass of a sample count Apple's GPUs lack (theirs are 1, 2 and 4), which a Vulkan device may have | every device (runtime piece not built) | 2: `crates/metal2vulkan-runtime/src/render_pass.rs:1611`, `crates/metal2vulkan-runtime/src/render_pass.rs:937` | `none`: tile memory at a sample count Apple's GPUs lack | -| `ImageblockMasters` | A draw or tile dispatch whose imageblock is of another size than the pass's, or a draw whose fragment function's layouts are of another alignment... | every device (runtime piece not built) | 2: `crates/metal2vulkan-runtime/src/render.rs:7294`, `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:930` | `rare`: imageblocks of mixed sizes in one pass | -| `TileAndFragmentImageblocks` | A render pass that reaches its imageblock storage, from a draw whose fragment function declares an explicit imageblock or a tile dispatch whose... | every device (runtime piece not built) | 3: `crates/metal2vulkan-runtime/src/render.rs:7286`, `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:797` (+1) | `rare`: explicit imageblocks shared by tile and fragment functions | +| `ImageblockMasters` | A draw or tile dispatch whose imageblock is of another size than the pass's, or a draw whose fragment function's layouts are of another alignment... | every device (runtime piece not built) | 2: `crates/metal2vulkan-runtime/src/render.rs:7343`, `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:930` | `rare`: imageblocks of mixed sizes in one pass | +| `TileAndFragmentImageblocks` | A render pass that reaches its imageblock storage, from a draw whose fragment function declares an explicit imageblock or a tile dispatch whose... | every device (runtime piece not built) | 3: `crates/metal2vulkan-runtime/src/render.rs:7335`, `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:797` (+1) | `rare`: explicit imageblocks shared by tile and fragment functions | | `Metal4Api` | Metal 4's API (`MTL4CommandQueue`, `MTL4CommandBuffer`, `MTL4ArgumentTable`, `MTL4Compiler` and the rest), with the features only its programming... (not scheduled) | every device (runtime piece not built) | family audit only: 3: `crates/metal2vulkan-runtime/src/families/features.rs:1495`, `crates/metal2vulkan-runtime/src/families/limits.rs:1022` (+1) | `app`: Metal 4 (the API is missing: METAL-COVERAGE.md) | | `CounterSampleBuffers` | Counter sample buffers (`MTLCounterSampleBuffer`) and the commands that sample into them (not scheduled) | every device (runtime piece not built) | family audit only: 1: `crates/metal2vulkan-runtime/src/families/limits.rs:1013` | `app`: GPU counters and timestamps by sample buffer (missing API) | | `ResidencySets` | Residency sets (`MTLResidencySet`) (not scheduled) | every device (runtime piece not built) | family audit only: 2: `crates/metal2vulkan-runtime/src/families/features.rs:1477`, `crates/metal2vulkan-runtime/src/families/limits.rs:1015` | `app`: residency sets (missing API) | @@ -215,9 +216,9 @@ Generated at `e21cc1069`. | `MappedTextureSampling` | A command that would sample a texture of an address-mode map (`TextureDescriptor::address_mode_map`) where the runtime cannot map it at bind... | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/address_map.rs:158` | `none`: a runtime extension's texture (address_mode_map) sampled where the runtime cannot map it; no Metal API path | | `LibrarySource` | A library compiled from Metal Shading Language source | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/library.rs:107` | `app`: a library compiled from Metal source (newLibraryWithSource:); the runtime takes metallibs and AIR | | `RestartedStrip` | An indexed strip after `set_primitive_restart_enabled` with an index Vulkan does not restart at, which the runtime draws as a list an index... | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/render/restart.rs:71` | `none`: a strip after the Apple-private setPrimitiveRestartEnabled:index: whose rewrite pass cannot run as Metal draws | -| `PrivatePrimitives` | A draw of one of Metal's private primitive types (`DrawPrimitiveType` | every device (runtime piece not built) | 2: `crates/metal2vulkan-runtime/src/render.rs:703`, `crates/metal2vulkan-runtime/src/render/restart.rs:72` | `none`: a draw of an Apple-private primitive type (OpenGL on Metal's quads and kin) whose list cannot draw as Metal draws: a primitive_id varying, a vertex start past 2^31 | +| `PrivatePrimitives` | A draw of one of Metal's private primitive types (`DrawPrimitiveType` | every device (runtime piece not built) | 2: `crates/metal2vulkan-runtime/src/render.rs:7927`, `crates/metal2vulkan-runtime/src/render/restart.rs:72` | `none`: a draw of an Apple-private primitive type (OpenGL on Metal's quads and kin) whose list cannot draw as Metal draws: a list past a u32 or one storage range, indices or arguments an unordered earlier draw wrote | | `ProvokingVertex` | A draw under Apple's last provoking vertex (`setProvokingVertexMode:` 1) on a device without `VK_EXT_provoking_vertex`'s last vertex, which the... | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/render/restart.rs:73` | `none`: a draw after the Apple-private setProvokingVertexMode: 1, on a device without the last provoking vertex, whose rotated list cannot draw as Metal draws | -| `PrimitiveIdIndices` | An indexed draw (`drawIndexedPrimitives:`) of a pipeline whose fragment function reads `[[primitive_id]]` on a device whose fragment stage cannot... | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/render.rs:7865` | `rare`: an indexed draw of a primitive_id pipeline, on a device without geometry or tessellation shaders, whose indices the encoder wrote since its last barrier | +| `PrimitiveIdIndices` | An indexed draw (`drawIndexedPrimitives:`) of a pipeline whose fragment function reads `[[primitive_id]]` on a device whose fragment stage cannot... | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/render.rs:7937` | `rare`: an indexed draw of a primitive_id pipeline, on a device without geometry or tessellation shaders, whose indices the encoder wrote since its last barrier | | `RotatedTexture` | A rotated texture (`TextureDescriptor::rotation`) where the runtime does not build what Metal does | every device (runtime piece not built) | 9: `crates/metal2vulkan-runtime/src/blit_texture.rs:1602`, `crates/metal2vulkan-runtime/src/buffer_texture.rs:715` (+7) | `rare`: a rotated drawable's views, blits with images over overlapping rows, rows past its buffer | | `DetachTextures` | A texture over a no-copy buffer's or heap's bytes (a heap's texture, or a texture over the buffer or over one of the heap's buffers) that no... | every device (runtime piece not built) | 8: `crates/metal2vulkan-runtime/src/buffer_descriptor.rs:625`, `crates/metal2vulkan-runtime/src/buffer_texture.rs:622` (+6) | `none`: a runtime extension's detach with a texture no stand-in presents exactly | | `TextureBufferLevels` | A texture buffer of more than one level (`TextureDescriptor::mipmap_level_count`, up to its width's full chain) from the device's, a heap's or the... | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/texture_descriptor.rs:540` | `rare`: a texture buffer of more than one level (public, unusual) | @@ -225,7 +226,7 @@ Generated at `e21cc1069`. | `DetachedTexelAccess` | `Texture::replace_region` or `get_bytes` of a texture whose bytes (a no-copy buffer's or heap's) are detached (`detach_backing`) | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/texture.rs:4922` | `none`: CPU texel access while a runtime extension detached the bytes | | `SurfaceDepthStencil` | A use of a texture of a depth or stencil format (`Depth16Unorm`, `Depth32Float`, `Depth32Float_Stencil8`, `Stencil8`, `X32_Stencil8`) over a plane... | every device (runtime piece not built) | 2: `crates/metal2vulkan-runtime/src/blit_texture.rs:269`, `crates/metal2vulkan-runtime/src/texture/surface_depth.rs:57` | `rare`: a blit of the stencil of a Depth32Float_Stencil8 texture over a plane of an IOSurface with planes, or a pass on an X32_Stencil8 one's view as Depth32Float_Stencil8 | | `ExtendedRangeResolve` | The multisample resolve (`MultisampleResolve`, `StoreAndMultisampleResolve`) of a color attachment of an extended-range format (`BGRA10_XR`,... | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/resolve.rs:604` | `rare`: a multisample resolve of a BGRA10_XR, BGR10_XR or sRGB twin attachment (EDR content drawn multisampled) | -| `PredicationDropsUngatedWork` | An unbalanced command-predication record (`ComputeCommandEncoder::encode_end_if` and the other ends, or `encode_start_else`, with no block open;... | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/predication.rs:762` | `none`: an unbalanced Apple-private command-predication record as its unit's first, after dispatches of the unit | +| `PredicationDropsUngatedWork` | An unbalanced command-predication record (`ComputeCommandEncoder::encode_end_if` and the other ends, or `encode_start_else`, with no block open;... | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/predication.rs:729` | `none`: an unbalanced Apple-private command-predication record as its unit's first, after dispatches of the unit | | `MultisampledBufferCopy` | A blit copy between a buffer and a multisampled texture (`copyFromBuffer:...toTexture:` into, or `copyFromTexture:...toBuffer:` out of, a texture... | every device (runtime piece not built) | 2: `crates/metal2vulkan-runtime/src/blit_texture.rs:527`, `crates/metal2vulkan-runtime/src/blit_texture.rs:674` | `rare`: a buffer<->multisampled-texture copy on a device without sample-rate shading, an integer multisample attachment at the count, or the copy format's storage; and, where maintenance8's depth/colour copies are missing or wrong, what the sample-rate draws cannot move: a 16-bit depth, or a depth or stencil texture they cannot sample or render to (emulated elsewhere; the consumer's Maps pans and screensaver make the copy) | | `MultisampledBufferLayout` | A blit copy between a buffer and a multisampled texture (as for `MultisampledBufferCopy`) in one of two buffer layouts that plain Metal copies by... | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/sample_interleave.rs:1020` | `rare`: a buffer<->multisampled-texture copy at a bytesPerRow of 0 from an offset that is a multiple of 16, or of pixels of 32 bytes or more at a pitch below a row or off the pixel: Metal copies these by rules not yet reduced, and its API validation rejects them | | `ColorAttachmentGroups` | What a render pass the device draws in color groups does not build | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/render/color_groups.rs:106` | `app`: in a render pass of more color attachments than the device draws at once (five or more on a device of four), or one at an index past them: a pipeline state of other colors, a tile state, an execution of render commands, a draw reading another group's attachment | @@ -247,9 +248,9 @@ Generated at `e21cc1069`. | `DescriptorRangeExceeded` | A descriptor-form slot's window exceeds the descriptor range limit (Profile F) | at the device's limit | 1: `crates/metal2vulkan/src/bind/instantiate.rs:653` | `app`: a buffer window past a device's descriptor range | | `TexelBufferTooLarge` | A texel buffer exceeds `maxTexelBufferElements` | at the device's limit | 1: `crates/metal2vulkan/src/bind/instantiate.rs:892` | `rare`: a texture buffer past maxTexelBufferElements | | `HeapTooLarge` | The set-1 heap's elements (one per resident texture a handle can name, plus the null element) exceed the pipeline's heap capacity | at the device's limit | 7: `crates/metal2vulkan/src/bind/heap.rs:1014`, `crates/metal2vulkan/src/bind/heap.rs:1748` (+5) | `rare`: more resident textures than the pipeline's heap holds (bindless at scale) | -| `TessellationFactorRange` | The tessellation factors a draw reads span more bytes (`needed`) than one storage-buffer descriptor can bind (`limit`, `maxStorageBufferRange`),... | at the device's limit | 1: `crates/metal2vulkan/src/bind/graphics.rs:3596` | `rare`: tessellation factors past one storage descriptor | -| `PatchIndexRange` | The patch indices a draw reads span more bytes (`needed`) than one storage-buffer descriptor can bind (`limit`, `maxStorageBufferRange`) | at the device's limit | 1: `crates/metal2vulkan/src/bind/graphics.rs:3640` | `rare`: patch indices past one storage descriptor | -| `ControlPointIndexRange` | The control-point indices a draw reads span more bytes (`needed`) than one storage-buffer descriptor can bind (`limit`, `maxStorageBufferRange`) | at the device's limit | 1: `crates/metal2vulkan/src/bind/graphics.rs:3678` | `rare`: control-point indices past one storage descriptor | +| `TessellationFactorRange` | The tessellation factors a draw reads span more bytes (`needed`) than one storage-buffer descriptor can bind (`limit`, `maxStorageBufferRange`),... | at the device's limit | 1: `crates/metal2vulkan/src/bind/graphics.rs:3613` | `rare`: tessellation factors past one storage descriptor | +| `PatchIndexRange` | The patch indices a draw reads span more bytes (`needed`) than one storage-buffer descriptor can bind (`limit`, `maxStorageBufferRange`) | at the device's limit | 1: `crates/metal2vulkan/src/bind/graphics.rs:3657` | `rare`: patch indices past one storage descriptor | +| `ControlPointIndexRange` | The control-point indices a draw reads span more bytes (`needed`) than one storage-buffer descriptor can bind (`limit`, `maxStorageBufferRange`) | at the device's limit | 1: `crates/metal2vulkan/src/bind/graphics.rs:3695` | `rare`: control-point indices past one storage descriptor | | `MissingStageInRegion` | The kernel reads the compute encoder's stage-in region (a `[[stage_in]]` attribute stepping by thread position, or `[[grid_origin]]` or... | at the device's limit | 1: `crates/metal2vulkan/src/bind/dispatch.rs:796` | `none`: a stage-in region never set, which Metal leaves undefined | | `UniformViewAliased` | A `device` buffer slot the pipeline reads through a uniform view (Profile F's per-stage storage-buffer fallback,... | at the device's limit | 1: `crates/metal2vulkan/src/bind/instantiate.rs:607` | `rare`: Profile F's uniform-view fallback aliased by a write | | `MissingDeviceAddress` | A device-address slot received a buffer without a device address | at the device's limit | 1: `crates/metal2vulkan/src/bind/plan/slots.rs:133` | `rare`: a slot reached through a pointer loaded from memory, bound with inline bytes or on a device without device addresses | @@ -326,10 +327,10 @@ Each refusal's sites, with the function that builds it. - `feature::Int64Atomics`: `crates/metal2vulkan/src/lower/access/atomic.rs:624 (select)`; `crates/metal2vulkan/src/lower/access/atomic.rs:633 (select)` - `feature::ImageAtomics`: `crates/metal2vulkan-runtime/src/families/formats.rs:464 (atomic_gap)`; `crates/metal2vulkan-runtime/src/families/formats.rs:468 (atomic_gap)`; `crates/metal2vulkan/src/lower/texture/slot.rs:900 (atomic_format)` - `feature::DescriptorCount`: `crates/metal2vulkan/src/lower/access/mod.rs:1684 (accept_placement)`; `crates/metal2vulkan/src/lower/select.rs:1641 (finish)`; `crates/metal2vulkan/src/pipeline/link.rs:1135 (limit_error)` -- `feature::BufferRange`: `crates/metal2vulkan-runtime/src/function_table.rs:569 (past_storage_buffer_range)`; `crates/metal2vulkan/src/bind/graphics.rs:3601 (patch_binding)`; `crates/metal2vulkan/src/bind/graphics.rs:3645 (patch_binding)`; `crates/metal2vulkan/src/bind/graphics.rs:3683 (patch_binding)`; `crates/metal2vulkan/src/bind/instantiate.rs:659 (bind_buffers)`; `crates/metal2vulkan/src/lower/access/function_table.rs:226 (select)`; `crates/metal2vulkan/src/lower/access/mod.rs:1184 (place_slots)` +- `feature::BufferRange`: `crates/metal2vulkan-runtime/src/function_table.rs:569 (past_storage_buffer_range)`; `crates/metal2vulkan/src/bind/graphics.rs:3618 (patch_binding)`; `crates/metal2vulkan/src/bind/graphics.rs:3662 (patch_binding)`; `crates/metal2vulkan/src/bind/graphics.rs:3700 (patch_binding)`; `crates/metal2vulkan/src/bind/instantiate.rs:659 (bind_buffers)`; `crates/metal2vulkan/src/lower/access/function_table.rs:226 (select)`; `crates/metal2vulkan/src/lower/access/mod.rs:1184 (place_slots)` - `feature::Int64Arithmetic`: `crates/metal2vulkan/src/lower/arith/legal.rs:582 (check_scalar)`; `crates/metal2vulkan/src/lower/select.rs:1133 (selector_form)` - `feature::Float64Arithmetic`: `crates/metal2vulkan/src/device/metal.rs:230 (unsupported_features)`; `crates/metal2vulkan/src/lower/arith/legal.rs:587 (check_scalar)` -- `feature::Format`: `crates/metal2vulkan-runtime/src/binding_view.rs:146 (binding_view)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:523 (check_formats)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:530 (check_formats)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:545 (check_formats)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:602 (pair_unit)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:694 (plan_levels_copy)`; `crates/metal2vulkan-runtime/src/blit_texture.rs:2118 (through_buffer)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:519 (make_texture_over)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:582 (make_texture_over)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:614 (make_texture_over)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:851 (texture_buffer_texel)`; `crates/metal2vulkan-runtime/src/copy_plan.rs:269 (colour_unit)`; `crates/metal2vulkan-runtime/src/copy_plan.rs:297 (copy_unit)`; `crates/metal2vulkan-runtime/src/copy_plan.rs:343 (copy_unit)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:346 (scratch)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:526 (usable_twin)`; `crates/metal2vulkan-runtime/src/families/features.rs:1633 (read_write_tier)`; `crates/metal2vulkan-runtime/src/families/formats.rs:1628 (sparse_missing)`; `crates/metal2vulkan-runtime/src/families/formats.rs:227 (none)`; `crates/metal2vulkan-runtime/src/families/formats.rs:271 (answers)`; `crates/metal2vulkan-runtime/src/families/formats.rs:291 (answers)`; `crates/metal2vulkan-runtime/src/families/formats.rs:306 (answers)`; `crates/metal2vulkan-runtime/src/families/formats.rs:353 (answers)`; `crates/metal2vulkan-runtime/src/families/formats.rs:392 (answers)`; `crates/metal2vulkan-runtime/src/families/formats.rs:474 (atomic_gap)`; `crates/metal2vulkan-runtime/src/families/formats.rs:508 (lacking)`; `crates/metal2vulkan-runtime/src/families/formats.rs:522 (unsupported)`; `crates/metal2vulkan-runtime/src/image_plan.rs:544 (check_own_memory)`; `crates/metal2vulkan-runtime/src/image_plan.rs:670 (plan_held)`; `crates/metal2vulkan-runtime/src/image_plan.rs:787 (plan_held)`; `crates/metal2vulkan-runtime/src/image_plan.rs:907 (plan_held)`; `crates/metal2vulkan-runtime/src/render.rs:2236 (viewing)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1031 (check_target)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1369 (layout)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1709 (target)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1802 (attachment_format)`; `crates/metal2vulkan-runtime/src/resolve.rs:409 (unmodelled_resolve)`; `crates/metal2vulkan-runtime/src/resolve.rs:616 (color)`; `crates/metal2vulkan-runtime/src/sample_copy.rs:176 (checked_twin)`; `crates/metal2vulkan-runtime/src/sample_copy.rs:204 (plan)`; `crates/metal2vulkan-runtime/src/sample_interleave.rs:301 (interleave_merge)`; `crates/metal2vulkan-runtime/src/shadow.rs:648 (unmerged)`; `crates/metal2vulkan-runtime/src/shadow.rs:655 (unmerged)`; `crates/metal2vulkan-runtime/src/texture.rs:2045 (texture_as)`; `crates/metal2vulkan-runtime/src/texture.rs:3586 (two_planes_refused)`; `crates/metal2vulkan-runtime/src/texture/decoded_twin.rs:498 (astc_texels)`; `crates/metal2vulkan-runtime/src/texture/decoded_twin.rs:534 (etc_texels)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:1947 (planned_heap_texture)`; `crates/metal2vulkan-runtime/src/texture/surface_two_planes.rs:80 (refused)`; `crates/metal2vulkan-runtime/src/texture/ycbcr_image.rs:115 (converted_storage)`; `crates/metal2vulkan-runtime/src/texture/ycbcr_image.rs:278 (ycbcr_write_shadow)`; `crates/metal2vulkan-runtime/src/texture/ycbcr_image.rs:384 (new_render_shadow)`; `crates/metal2vulkan-runtime/src/two_planes.rs:122 (unmeasured)`; `crates/metal2vulkan-runtime/src/view_plan.rs:380 (check_format)`; `crates/metal2vulkan-runtime/src/view_plan.rs:393 (check_format)`; `crates/metal2vulkan-runtime/src/view_plan.rs:400 (check_format)`; `crates/metal2vulkan-runtime/src/view_plan.rs:412 (check_format)`; `crates/metal2vulkan-runtime/src/view_plan.rs:422 (check_format)`; `crates/metal2vulkan-runtime/src/ycbcr.rs:285 (refused)`; `crates/metal2vulkan/src/bind/extended_shadow.rs:184 (extended_shadow_module)`; `crates/metal2vulkan/src/bind/plan/resources.rs:1134 (plain_texture)`; `crates/metal2vulkan/src/bind/plan/resources.rs:1814 (extended_sampler)`; `crates/metal2vulkan/src/bind/plan/resources.rs:193 (require_filter_features)`; `crates/metal2vulkan/src/bind/plan/resources.rs:959 (plain_texture)`; `crates/metal2vulkan/src/bind/sample_interleave.rs:304 (finish)`; `crates/metal2vulkan/src/bind/sample_interleave.rs:328 (interleave_split_module)`; `crates/metal2vulkan/src/bind/shadow_copy_in.rs:259 (shadow_copy_in_module)`; `crates/metal2vulkan/src/bind/unused_bits.rs:687 (unused_bits_module)`; `crates/metal2vulkan/src/lower/access/tile.rs:1029 (storage_format)`; `crates/metal2vulkan/src/lower/fragment/color.rs:160 (select_param)`; `crates/metal2vulkan/src/lower/fragment/color.rs:166 (select_param)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1138 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1159 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1165 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1171 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1196 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1373 (plan)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1764 (select_read)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1872 (select_output)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1899 (select_output)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1918 (select_output)`; `crates/metal2vulkan/src/lower/sampler/select.rs:1093 (select_extended)`; `crates/metal2vulkan/src/lower/sampler/select.rs:691 (texel_in)`; `crates/metal2vulkan/src/lower/stage_io/extended_color.rs:77 (plan)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:2352 (entry)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:896 (zeroed_output)`; `crates/metal2vulkan/src/lower/stage_io/word_color.rs:83 (plan)`; `crates/metal2vulkan/src/lower/texture/mod.rs:2347 (select)`; `crates/metal2vulkan/src/lower/texture/mod.rs:2989 (cross_class)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3161 (select_image)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3331 (select_read_as)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3368 (select_read_as)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3701 (select_write)`; `crates/metal2vulkan/src/lower/texture/slot.rs:1035 (declare_slot)`; `crates/metal2vulkan/src/lower/texture/slot.rs:1048 (declare_slot)`; `crates/metal2vulkan/src/lower/texture/slot.rs:1054 (declare_slot)`; `crates/metal2vulkan/src/lower/texture/slot.rs:739 (storage_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:742 (storage_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:753 (storage_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:771 (storage_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:791 (storage_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:815 (ulong_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:826 (ulong_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:873 (ulong_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:908 (atomic_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:917 (atomic_format)`; `crates/metal2vulkan/src/metal/format/mod.rs:1693 (vk_format)`; `crates/metal2vulkan/src/metal/format/mod.rs:1695 (vk_format)`; `crates/metal2vulkan/src/metal/format/mod.rs:1825 (candidates)`; `crates/metal2vulkan/src/metal/format/mod.rs:2783 (storage_choice_viewed)`; `crates/metal2vulkan/src/metal/format/mod.rs:2801 (held_storage_choice)`; `crates/metal2vulkan/src/metal/format/mod.rs:2809 (held_storage_choice)`; `crates/metal2vulkan/src/metal/format/mod.rs:2906 (held_storage_choice)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:1100 (extended_write_mask)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:428 (graphics_state)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:474 (graphics_state)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:546 (graphics_state)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:969 (reads_alpha_to_coverage)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:990 (reads_alpha_to_coverage)`; `crates/metal2vulkan/src/pipeline/rotated_blend.rs:449 (rotated_blend)`; `crates/metal2vulkan/src/pipeline/rotated_blend.rs:593 (alpha_in_red_blend)` +- `feature::Format`: `crates/metal2vulkan-runtime/src/binding_view.rs:146 (binding_view)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:523 (check_formats)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:530 (check_formats)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:545 (check_formats)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:602 (pair_unit)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:694 (plan_levels_copy)`; `crates/metal2vulkan-runtime/src/blit_texture.rs:2118 (through_buffer)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:519 (make_texture_over)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:582 (make_texture_over)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:614 (make_texture_over)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:851 (texture_buffer_texel)`; `crates/metal2vulkan-runtime/src/copy_plan.rs:269 (colour_unit)`; `crates/metal2vulkan-runtime/src/copy_plan.rs:297 (copy_unit)`; `crates/metal2vulkan-runtime/src/copy_plan.rs:343 (copy_unit)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:346 (scratch)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:526 (usable_twin)`; `crates/metal2vulkan-runtime/src/families/features.rs:1633 (read_write_tier)`; `crates/metal2vulkan-runtime/src/families/formats.rs:1628 (sparse_missing)`; `crates/metal2vulkan-runtime/src/families/formats.rs:227 (none)`; `crates/metal2vulkan-runtime/src/families/formats.rs:271 (answers)`; `crates/metal2vulkan-runtime/src/families/formats.rs:291 (answers)`; `crates/metal2vulkan-runtime/src/families/formats.rs:306 (answers)`; `crates/metal2vulkan-runtime/src/families/formats.rs:353 (answers)`; `crates/metal2vulkan-runtime/src/families/formats.rs:392 (answers)`; `crates/metal2vulkan-runtime/src/families/formats.rs:474 (atomic_gap)`; `crates/metal2vulkan-runtime/src/families/formats.rs:508 (lacking)`; `crates/metal2vulkan-runtime/src/families/formats.rs:522 (unsupported)`; `crates/metal2vulkan-runtime/src/image_plan.rs:544 (check_own_memory)`; `crates/metal2vulkan-runtime/src/image_plan.rs:670 (plan_held)`; `crates/metal2vulkan-runtime/src/image_plan.rs:787 (plan_held)`; `crates/metal2vulkan-runtime/src/image_plan.rs:907 (plan_held)`; `crates/metal2vulkan-runtime/src/render.rs:2285 (viewing)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1031 (check_target)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1369 (layout)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1709 (target)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1802 (attachment_format)`; `crates/metal2vulkan-runtime/src/resolve.rs:409 (unmodelled_resolve)`; `crates/metal2vulkan-runtime/src/resolve.rs:616 (color)`; `crates/metal2vulkan-runtime/src/sample_copy.rs:176 (checked_twin)`; `crates/metal2vulkan-runtime/src/sample_copy.rs:204 (plan)`; `crates/metal2vulkan-runtime/src/sample_interleave.rs:301 (interleave_merge)`; `crates/metal2vulkan-runtime/src/shadow.rs:648 (unmerged)`; `crates/metal2vulkan-runtime/src/shadow.rs:655 (unmerged)`; `crates/metal2vulkan-runtime/src/texture.rs:2045 (texture_as)`; `crates/metal2vulkan-runtime/src/texture.rs:3586 (two_planes_refused)`; `crates/metal2vulkan-runtime/src/texture/decoded_twin.rs:498 (astc_texels)`; `crates/metal2vulkan-runtime/src/texture/decoded_twin.rs:534 (etc_texels)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:1947 (planned_heap_texture)`; `crates/metal2vulkan-runtime/src/texture/surface_two_planes.rs:80 (refused)`; `crates/metal2vulkan-runtime/src/texture/ycbcr_image.rs:115 (converted_storage)`; `crates/metal2vulkan-runtime/src/texture/ycbcr_image.rs:278 (ycbcr_write_shadow)`; `crates/metal2vulkan-runtime/src/texture/ycbcr_image.rs:384 (new_render_shadow)`; `crates/metal2vulkan-runtime/src/two_planes.rs:122 (unmeasured)`; `crates/metal2vulkan-runtime/src/view_plan.rs:380 (check_format)`; `crates/metal2vulkan-runtime/src/view_plan.rs:393 (check_format)`; `crates/metal2vulkan-runtime/src/view_plan.rs:400 (check_format)`; `crates/metal2vulkan-runtime/src/view_plan.rs:412 (check_format)`; `crates/metal2vulkan-runtime/src/view_plan.rs:422 (check_format)`; `crates/metal2vulkan-runtime/src/ycbcr.rs:285 (refused)`; `crates/metal2vulkan/src/bind/extended_shadow.rs:184 (extended_shadow_module)`; `crates/metal2vulkan/src/bind/plan/resources.rs:1134 (plain_texture)`; `crates/metal2vulkan/src/bind/plan/resources.rs:1814 (extended_sampler)`; `crates/metal2vulkan/src/bind/plan/resources.rs:193 (require_filter_features)`; `crates/metal2vulkan/src/bind/plan/resources.rs:959 (plain_texture)`; `crates/metal2vulkan/src/bind/sample_interleave.rs:304 (finish)`; `crates/metal2vulkan/src/bind/sample_interleave.rs:328 (interleave_split_module)`; `crates/metal2vulkan/src/bind/shadow_copy_in.rs:259 (shadow_copy_in_module)`; `crates/metal2vulkan/src/bind/unused_bits.rs:687 (unused_bits_module)`; `crates/metal2vulkan/src/lower/access/tile.rs:1029 (storage_format)`; `crates/metal2vulkan/src/lower/fragment/color.rs:160 (select_param)`; `crates/metal2vulkan/src/lower/fragment/color.rs:166 (select_param)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1138 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1159 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1165 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1171 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1196 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1373 (plan)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1764 (select_read)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1872 (select_output)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1899 (select_output)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1918 (select_output)`; `crates/metal2vulkan/src/lower/sampler/select.rs:1093 (select_extended)`; `crates/metal2vulkan/src/lower/sampler/select.rs:691 (texel_in)`; `crates/metal2vulkan/src/lower/stage_io/extended_color.rs:77 (plan)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:2355 (entry)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:896 (zeroed_output)`; `crates/metal2vulkan/src/lower/stage_io/word_color.rs:83 (plan)`; `crates/metal2vulkan/src/lower/texture/mod.rs:2347 (select)`; `crates/metal2vulkan/src/lower/texture/mod.rs:2989 (cross_class)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3161 (select_image)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3331 (select_read_as)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3368 (select_read_as)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3701 (select_write)`; `crates/metal2vulkan/src/lower/texture/slot.rs:1035 (declare_slot)`; `crates/metal2vulkan/src/lower/texture/slot.rs:1048 (declare_slot)`; `crates/metal2vulkan/src/lower/texture/slot.rs:1054 (declare_slot)`; `crates/metal2vulkan/src/lower/texture/slot.rs:739 (storage_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:742 (storage_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:753 (storage_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:771 (storage_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:791 (storage_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:815 (ulong_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:826 (ulong_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:873 (ulong_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:908 (atomic_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:917 (atomic_format)`; `crates/metal2vulkan/src/metal/format/mod.rs:1693 (vk_format)`; `crates/metal2vulkan/src/metal/format/mod.rs:1695 (vk_format)`; `crates/metal2vulkan/src/metal/format/mod.rs:1825 (candidates)`; `crates/metal2vulkan/src/metal/format/mod.rs:2783 (storage_choice_viewed)`; `crates/metal2vulkan/src/metal/format/mod.rs:2801 (held_storage_choice)`; `crates/metal2vulkan/src/metal/format/mod.rs:2809 (held_storage_choice)`; `crates/metal2vulkan/src/metal/format/mod.rs:2906 (held_storage_choice)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:1100 (extended_write_mask)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:428 (graphics_state)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:474 (graphics_state)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:546 (graphics_state)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:969 (reads_alpha_to_coverage)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:990 (reads_alpha_to_coverage)`; `crates/metal2vulkan/src/pipeline/rotated_blend.rs:449 (rotated_blend)`; `crates/metal2vulkan/src/pipeline/rotated_blend.rs:593 (alpha_in_red_blend)` - `feature::DivergentImplicitLod`: `crates/metal2vulkan/src/lower/sampler/select.rs:352 (select_sampling)` - `feature::ImplicitLodOutsideFragment`: `crates/metal2vulkan/src/lower/sampler/constexpr.rs:136 (query_min_level)`; `crates/metal2vulkan/src/lower/sampler/select.rs:229 (query_level_measured)`; `crates/metal2vulkan/src/lower/sampler/select.rs:255 (query_min_level)` - `feature::MinLodClamp`: `crates/metal2vulkan/src/lower/sampler/select.rs:1572 (select_one)`; `crates/metal2vulkan/src/lower/sampler/select.rs:973 (min_lod)` @@ -345,27 +346,28 @@ Each refusal's sites, with the function that builds it. - `feature::PixelSamplerCompare`: `crates/metal2vulkan/src/lower/sampler/constexpr.rs:115 (lowered)` - `feature::TexelBuffer`: `crates/metal2vulkan/src/bind/instantiate.rs:880 (texel_ranges)`; `crates/metal2vulkan/src/bind/instantiate.rs:886 (texel_ranges)`; `crates/metal2vulkan/src/bind/plan/resources.rs:1147 (plain_texture)` - `feature::RasterOrderGroups`: `crates/metal2vulkan/src/device/metal.rs:242 (unsupported_features)`; `crates/metal2vulkan/src/lower/fragment/rog.rs:151 (mode)`; `crates/metal2vulkan/src/lower/fragment/rog.rs:172 (mode)`; `crates/metal2vulkan/src/lower/fragment/snapshot.rs:158 (finish)` -- `feature::FramebufferFetch`: `crates/metal2vulkan-runtime/src/families/features.rs:1016 (state)`; `crates/metal2vulkan-runtime/src/render.rs:5838 (next_instance)`; `crates/metal2vulkan-runtime/src/sample_planes.rs:120 (lacks)`; `crates/metal2vulkan-runtime/src/sample_planes.rs:147 (new)`; `crates/metal2vulkan-runtime/src/sample_planes.rs:518 (planes_merge)`; `crates/metal2vulkan/src/bind/extended_shadow.rs:190 (extended_shadow_module)`; `crates/metal2vulkan/src/bind/sample_planes.rs:477 (finish)`; `crates/metal2vulkan/src/device/metal.rs:252 (unsupported_features)`; `crates/metal2vulkan/src/lower/arith/extended_range/blend.rs:1198 (unorm8)`; `crates/metal2vulkan/src/lower/arith/extended_range/blend.rs:1216 (unorm8)`; `crates/metal2vulkan/src/lower/arith/extended_range/blend.rs:1230 (unorm8)`; `crates/metal2vulkan/src/lower/arith/extended_range/blend.rs:1273 (packed16)`; `crates/metal2vulkan/src/lower/fragment/color.rs:215 (select_param)`; `crates/metal2vulkan/src/lower/fragment/color.rs:279 (unordered)`; `crates/metal2vulkan/src/lower/fragment/depth_test.rs:195 (not_implemented)`; `crates/metal2vulkan/src/lower/fragment/depth_test.rs:272 (depth_test_form)`; `crates/metal2vulkan/src/lower/fragment/depth_test.rs:318 (stencil_test_form)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1024 (storage_form)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1114 (storage_form)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1151 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1718 (plan_sample)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:749 (not_implemented)`; `crates/metal2vulkan/src/pipeline/link/fetch.rs:164 (storage_attachments)` -- `feature::PrimitiveId`: `crates/metal2vulkan-runtime/src/families/features.rs:1125 (state)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:3179 (finish)`; `crates/metal2vulkan/src/pipeline/link/varyings.rs:240 (check_primitive_id)` -- `feature::VertexAmplification`: `crates/metal2vulkan/src/bind/graphics.rs:3942 (multiview_instances)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:1312 (own_index_store)`; `crates/metal2vulkan/src/lower/tessellation/mod.rs:718 (select_param)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:258 (vertex_amplification)`; `crates/metal2vulkan/src/pipeline/link/tessellation/mod.rs:228 (control_plan)` +- `feature::FramebufferFetch`: `crates/metal2vulkan-runtime/src/families/features.rs:1016 (state)`; `crates/metal2vulkan-runtime/src/render.rs:5887 (next_instance)`; `crates/metal2vulkan-runtime/src/sample_planes.rs:120 (lacks)`; `crates/metal2vulkan-runtime/src/sample_planes.rs:147 (new)`; `crates/metal2vulkan-runtime/src/sample_planes.rs:518 (planes_merge)`; `crates/metal2vulkan/src/bind/extended_shadow.rs:190 (extended_shadow_module)`; `crates/metal2vulkan/src/bind/sample_planes.rs:477 (finish)`; `crates/metal2vulkan/src/device/metal.rs:252 (unsupported_features)`; `crates/metal2vulkan/src/lower/arith/extended_range/blend.rs:1198 (unorm8)`; `crates/metal2vulkan/src/lower/arith/extended_range/blend.rs:1216 (unorm8)`; `crates/metal2vulkan/src/lower/arith/extended_range/blend.rs:1230 (unorm8)`; `crates/metal2vulkan/src/lower/arith/extended_range/blend.rs:1273 (packed16)`; `crates/metal2vulkan/src/lower/fragment/color.rs:215 (select_param)`; `crates/metal2vulkan/src/lower/fragment/color.rs:279 (unordered)`; `crates/metal2vulkan/src/lower/fragment/depth_test.rs:195 (not_implemented)`; `crates/metal2vulkan/src/lower/fragment/depth_test.rs:272 (depth_test_form)`; `crates/metal2vulkan/src/lower/fragment/depth_test.rs:318 (stencil_test_form)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1024 (storage_form)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1114 (storage_form)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1151 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1718 (plan_sample)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:749 (not_implemented)`; `crates/metal2vulkan/src/pipeline/link/fetch.rs:164 (storage_attachments)` +- `feature::PrimitiveId`: `crates/metal2vulkan-runtime/src/families/features.rs:1125 (state)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:3211 (finish)`; `crates/metal2vulkan/src/pipeline/link/varyings.rs:240 (check_primitive_id)` +- `feature::PrivatePrimitives`: `crates/metal2vulkan/src/lower/stage_io/plan.rs:2601 (indices_feature)` +- `feature::VertexAmplification`: `crates/metal2vulkan/src/bind/graphics.rs:3959 (multiview_instances)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:1312 (own_index_store)`; `crates/metal2vulkan/src/lower/tessellation/mod.rs:718 (select_param)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:258 (vertex_amplification)`; `crates/metal2vulkan/src/pipeline/link/tessellation/mod.rs:228 (control_plan)` - `feature::LayeredRendering`: `crates/metal2vulkan-runtime/src/render_pass.rs:1669 (target)`; `crates/metal2vulkan-runtime/src/render_state.rs:1107 (needs_viewports)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:778 (target_index)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:797 (target_index)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:1313 (own_index_store)`; `crates/metal2vulkan/src/pipeline/link/geometry.rs:150 (not_implemented)`; `crates/metal2vulkan/src/pipeline/link/geometry.rs:172 (refused)` - `feature::ClipDistance`: `crates/metal2vulkan/src/lower/mesh/mod.rs:934 (select)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:942 (select)` - `feature::DualSourceBlending`: `crates/metal2vulkan-runtime/src/families/formats.rs:386 (answers)`; `crates/metal2vulkan/src/metal/state.rs:37 (blend_factor)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:1157 (check_outputs)`; `crates/metal2vulkan/src/pipeline/rotated_blend.rs:463 (rotated_blend)`; `crates/metal2vulkan/src/pipeline/rotated_blend.rs:538 (rotated_blend)` -- `feature::Barycentrics`: `crates/metal2vulkan/src/device/metal.rs:263 (unsupported_features)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:1921 (input_builtin)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:745 (param)`; `crates/metal2vulkan/src/pipeline/link/geometry.rs:148 (not_implemented)`; `crates/metal2vulkan/src/pipeline/link/geometry.rs:170 (refused)` -- `feature::StencilExport`: `crates/metal2vulkan-runtime/src/families/features.rs:1112 (state)`; `crates/metal2vulkan/src/bind/graphics.rs:2638 (shadow_stencil_words)`; `crates/metal2vulkan/src/lower/fragment/stencil.rs:157 (device_form)`; `crates/metal2vulkan/src/lower/fragment/stencil.rs:168 (not_implemented)`; `crates/metal2vulkan/src/pipeline/link/stencil.rs:55 (shadow_stencil)`; `crates/metal2vulkan/src/pipeline/link/stencil.rs:73 (shadow_stencil)` +- `feature::Barycentrics`: `crates/metal2vulkan/src/device/metal.rs:263 (unsupported_features)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:1924 (input_builtin)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:745 (param)`; `crates/metal2vulkan/src/pipeline/link/geometry.rs:148 (not_implemented)`; `crates/metal2vulkan/src/pipeline/link/geometry.rs:170 (refused)` +- `feature::StencilExport`: `crates/metal2vulkan-runtime/src/families/features.rs:1112 (state)`; `crates/metal2vulkan/src/bind/graphics.rs:2655 (shadow_stencil_words)`; `crates/metal2vulkan/src/lower/fragment/stencil.rs:157 (device_form)`; `crates/metal2vulkan/src/lower/fragment/stencil.rs:168 (not_implemented)`; `crates/metal2vulkan/src/pipeline/link/stencil.rs:55 (shadow_stencil)`; `crates/metal2vulkan/src/pipeline/link/stencil.rs:73 (shadow_stencil)` - `feature::SampleRateShading`: `crates/metal2vulkan/src/pipeline/link/graphics.rs:844 (sample_invocations)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:846 (sample_invocations)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:928 (sample_invocations)` - `feature::PixelCoverageAtSampleRate`: `crates/metal2vulkan/src/lower/fragment/coverage.rs:296 (finish)`; `crates/metal2vulkan/src/lower/simd/mod.rs:754 (select_param)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:879 (sample_invocations)` - `feature::InterfaceComponents`: `crates/metal2vulkan/src/pipeline/compile/color_group.rs:202 (refusal)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:301 (graphics_state)`; `crates/metal2vulkan/src/pipeline/link/varyings.rs:409 (assign)`; `crates/metal2vulkan/src/pipeline/link/varyings.rs:90 (limit_error)` - `feature::UnmatchedVarying`: `crates/metal2vulkan/src/pipeline/link/varyings.rs:318 (mesh_fragment)`; `crates/metal2vulkan/src/pipeline/link/varyings.rs:537 (varyings)`; `crates/metal2vulkan/src/pipeline/link/varyings.rs:548 (varyings)` - `feature::KernelStageIn`: `crates/metal2vulkan-runtime/src/indirect_execute.rs:376 (record)`; `crates/metal2vulkan/src/bind/dispatch.rs:871 (instantiate)`; `crates/metal2vulkan/src/lower/stage_io/stage_in.rs:133 (select)` -- `feature::Tessellation`: `crates/metal2vulkan-air/src/canon/mod.rs:1256 (post_check)`; `crates/metal2vulkan-air/src/canon/mod.rs:1347 (post_check)`; `crates/metal2vulkan/src/bind/graphics.rs:3799 (tessellation_dispatch)`; `crates/metal2vulkan/src/lower/stage_io/fetch.rs:519 (select)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:1488 (primitive_id_output)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:1791 (input_builtin)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:828 (param)`; `crates/metal2vulkan/src/lower/tessellation/mod.rs:150 (not_implemented)`; `crates/metal2vulkan/src/lower/tessellation/mod.rs:489 (plan_entry)`; `crates/metal2vulkan/src/metal/vertex.rs:219 (fetch_as)`; `crates/metal2vulkan/src/pipeline/link/tessellation/mod.rs:212 (control_plan)`; `crates/metal2vulkan/src/pipeline/link/tessellation/mod.rs:292 (check_fragment)`; `crates/metal2vulkan/src/pipeline/link/tessellation/mod.rs:316 (push_offset)` -- `feature::MeshShading`: `crates/metal2vulkan/src/bind/graphics.rs:1562 (plan)`; `crates/metal2vulkan/src/bind/graphics.rs:3011 (mesh_limit)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:499 (check_payload)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:538 (plan_entry)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:572 (plan_entry)`; `crates/metal2vulkan/src/memory/plan.rs:2056 (reprs)`; `crates/metal2vulkan/src/pipeline/link/mesh.rs:95 (records)` +- `feature::Tessellation`: `crates/metal2vulkan-air/src/canon/mod.rs:1256 (post_check)`; `crates/metal2vulkan-air/src/canon/mod.rs:1347 (post_check)`; `crates/metal2vulkan/src/bind/graphics.rs:3816 (tessellation_dispatch)`; `crates/metal2vulkan/src/lower/stage_io/fetch.rs:519 (select)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:1508 (primitive_id_output)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:1794 (input_builtin)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:828 (param)`; `crates/metal2vulkan/src/lower/tessellation/mod.rs:150 (not_implemented)`; `crates/metal2vulkan/src/lower/tessellation/mod.rs:489 (plan_entry)`; `crates/metal2vulkan/src/metal/vertex.rs:219 (fetch_as)`; `crates/metal2vulkan/src/pipeline/link/tessellation/mod.rs:212 (control_plan)`; `crates/metal2vulkan/src/pipeline/link/tessellation/mod.rs:292 (check_fragment)`; `crates/metal2vulkan/src/pipeline/link/tessellation/mod.rs:316 (push_offset)` +- `feature::MeshShading`: `crates/metal2vulkan/src/bind/graphics.rs:1576 (plan)`; `crates/metal2vulkan/src/bind/graphics.rs:3028 (mesh_limit)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:499 (check_payload)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:538 (plan_entry)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:572 (plan_entry)`; `crates/metal2vulkan/src/memory/plan.rs:2056 (reprs)`; `crates/metal2vulkan/src/pipeline/link/mesh.rs:95 (records)` - `feature::TileShading`: `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:521 (scratch)`; `crates/metal2vulkan/src/bind/plan/compute.rs:237 (tile_memory)`; `crates/metal2vulkan/src/lower/access/tile.rs:151 (not_implemented)`; `crates/metal2vulkan/src/lower/sync/barrier.rs:275 (tile_shading)`; `crates/metal2vulkan/src/pipeline/compile/api.rs:690 (tile_pipeline)` - `feature::Imageblocks`: `crates/metal2vulkan/src/lower/access/imageblock.rs:98 (imageblocks)`; `crates/metal2vulkan/src/lower/access/mod.rs:908 (select_param)`; `crates/metal2vulkan/src/lower/fragment/imageblock.rs:104 (require)`; `crates/metal2vulkan/src/lower/fragment/imageblock.rs:412 (reach)`; `crates/metal2vulkan/src/lower/fragment/imageblock.rs:554 (plan_tests)`; `crates/metal2vulkan/src/lower/fragment/imageblock.rs:578 (plan_tests)`; `crates/metal2vulkan/src/lower/fragment/imageblock.rs:86 (not_implemented)`; `crates/metal2vulkan/src/lower/texture/mod.rs:2357 (select)`; `crates/metal2vulkan/src/lower/texture/slice.rs:139 (imageblocks)`; `crates/metal2vulkan/src/pipeline/link/imageblock.rs:50 (fragment_imageblock)` - `feature::RayTracing`: `crates/metal2vulkan/src/bind/acceleration.rs:202 (instance_record)`; `crates/metal2vulkan/src/bind/acceleration.rs:216 (instance_record)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:1087 (primitive_data_read)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:1202 (instance_count)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:1245 (intersect)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:1257 (intersect)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:1282 (intersect)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:1297 (intersect)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:1312 (intersect)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:344 (slot_of)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:385 (select_param)`; `crates/metal2vulkan/src/lower/select.rs:899 (route_air)` - `feature::Tensors`: `crates/metal2vulkan-air/src/canon/matmul2d/synth.rs:32 (refuse)`; `crates/metal2vulkan/src/lower/select.rs:903 (route_air)` - `feature::RasterizationRateMap`: `crates/metal2vulkan/src/lower/fragment/mod.rs:930 (select)` -- `feature::GpuEncodedIndirectCommands`: `crates/metal2vulkan/src/bind/replay.rs:556 (preprocess)`; `crates/metal2vulkan/src/bind/replay.rs:796 (replay_preprocess_module)`; `crates/metal2vulkan/src/bind/replay/draws.rs:280 (draw_replay_preprocess)`; `crates/metal2vulkan/src/bind/replay/draws.rs:482 (draw_replay_module)`; `crates/metal2vulkan/src/bind/replay/flat.rs:247 (flat_dispatch_module)`; `crates/metal2vulkan/src/bind/replay/merged.rs:242 (draw_merge_module)`; `crates/metal2vulkan/src/lower/access/encode.rs:394 (needs)`; `crates/metal2vulkan/src/lower/access/encode.rs:410 (needs)`; `crates/metal2vulkan/src/lower/access/encode.rs:527 (select_command)`; `crates/metal2vulkan/src/lower/access/mod.rs:1539 (plan_replay)`; `crates/metal2vulkan/src/lower/access/mod.rs:1562 (plan_replay)`; `crates/metal2vulkan/src/lower/access/mod.rs:1565 (plan_replay)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:2677 (merged)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:2733 (finish_merged)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:458 (param)`; `crates/metal2vulkan/src/pipeline/compile.rs:2124 (plan_one)`; `crates/metal2vulkan/src/pipeline/compile.rs:2129 (plan_one)` +- `feature::GpuEncodedIndirectCommands`: `crates/metal2vulkan/src/bind/replay.rs:556 (preprocess)`; `crates/metal2vulkan/src/bind/replay.rs:796 (replay_preprocess_module)`; `crates/metal2vulkan/src/bind/replay/draws.rs:280 (draw_replay_preprocess)`; `crates/metal2vulkan/src/bind/replay/draws.rs:482 (draw_replay_module)`; `crates/metal2vulkan/src/bind/replay/flat.rs:247 (flat_dispatch_module)`; `crates/metal2vulkan/src/bind/replay/merged.rs:242 (draw_merge_module)`; `crates/metal2vulkan/src/lower/access/encode.rs:394 (needs)`; `crates/metal2vulkan/src/lower/access/encode.rs:410 (needs)`; `crates/metal2vulkan/src/lower/access/encode.rs:527 (select_command)`; `crates/metal2vulkan/src/lower/access/mod.rs:1539 (plan_replay)`; `crates/metal2vulkan/src/lower/access/mod.rs:1562 (plan_replay)`; `crates/metal2vulkan/src/lower/access/mod.rs:1565 (plan_replay)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:2707 (merged)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:2763 (finish_merged)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:458 (param)`; `crates/metal2vulkan/src/pipeline/compile.rs:2126 (plan_one)`; `crates/metal2vulkan/src/pipeline/compile.rs:2131 (plan_one)` - `feature::VulkanVersion`: `crates/metal2vulkan/src/ash_interop/query.rs:926 (query)`; `crates/metal2vulkan/src/device/derive.rs:105 (with_deviations)` - `feature::Constant`: `crates/metal2vulkan-air/src/bitcode/constants.rs:210 (record)`; `crates/metal2vulkan-air/src/bitcode/constants.rs:268 (record)`; `crates/metal2vulkan/src/error/mod.rs:255 (from)` - `feature::Attribute`: `crates/metal2vulkan-air/src/bitcode/attrs.rs:493 (known)`; `crates/metal2vulkan/src/error/mod.rs:256 (from)` @@ -374,15 +376,15 @@ Each refusal's sites, with the function that builds it. - `feature::SubgroupOperations`: `crates/metal2vulkan-runtime/src/families/features.rs:1721 (simd)`; `crates/metal2vulkan/src/lower/simd/mod.rs:407 (finish)`; `crates/metal2vulkan/src/lower/simd/mod.rs:466 (full_quads)`; `crates/metal2vulkan/src/lower/simd/mod.rs:990 (select_group)` - `feature::DirectCall`: `crates/metal2vulkan-air/src/canon/mod.rs:1319 (post_check)` - `feature::WideSwitchLiteral`: `crates/metal2vulkan/src/structurize/emit.rs:207 (check_tree)` -- `feature::Lowering`: `crates/metal2vulkan/src/bind/plan/resources.rs:762 (level_views)`; `crates/metal2vulkan/src/lower/access/handle.rs:1062 (texture_target)`; `crates/metal2vulkan/src/lower/access/handle.rs:1073 (sampler_target)`; `crates/metal2vulkan/src/lower/access/handle.rs:318 (domain_kind)`; `crates/metal2vulkan/src/lower/access/imageblock.rs:175 (operand)`; `crates/metal2vulkan/src/lower/access/mod.rs:571 (not_lowered)`; `crates/metal2vulkan/src/lower/access/pulled.rs:76 (share)`; `crates/metal2vulkan/src/lower/arith/legal.rs:53 (not_lowered)`; `crates/metal2vulkan/src/lower/dispatch.rs:114 (not_lowered)`; `crates/metal2vulkan/src/lower/fragment/discard.rs:144 (not_lowered)`; `crates/metal2vulkan/src/lower/fragment/discard.rs:653 (plan)`; `crates/metal2vulkan/src/lower/fragment/mod.rs:123 (not_lowered)`; `crates/metal2vulkan/src/lower/fragment/snapshot.rs:168 (finish)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:147 (not_lowered)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:126 (not_lowered)`; `crates/metal2vulkan/src/lower/sampler/mod.rs:212 (refuse)`; `crates/metal2vulkan/src/lower/sampler/select.rs:30 (refuse)`; `crates/metal2vulkan/src/lower/select.rs:829 (not_lowered)`; `crates/metal2vulkan/src/lower/select.rs:918 (route_air)`; `crates/metal2vulkan/src/lower/simd/mod.rs:136 (not_lowered)`; `crates/metal2vulkan/src/lower/simd/mod.rs:747 (select_param)`; `crates/metal2vulkan/src/lower/simd/workgroup.rs:353 (check)`; `crates/metal2vulkan/src/lower/stage_io/fetch.rs:96 (not_lowered)`; `crates/metal2vulkan/src/lower/stage_io/mod.rs:179 (not_lowered)`; `crates/metal2vulkan/src/lower/sync/barrier.rs:72 (not_lowered)`; `crates/metal2vulkan/src/lower/sync/memory_model.rs:269 (not_implemented)`; `crates/metal2vulkan/src/lower/sync/memory_model.rs:310 (select)`; `crates/metal2vulkan/src/lower/tessellation/mod.rs:146 (not_lowered)`; `crates/metal2vulkan/src/lower/texture/mod.rs:180 (refuse)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3670 (select_write)`; `crates/metal2vulkan/src/memory/alloca.rs:54 (not_lowered)`; `crates/metal2vulkan/src/memory/leaf.rs:183 (not_lowered)`; `crates/metal2vulkan/src/memory/plan.rs:490 (not_lowered)`; `crates/metal2vulkan/src/memory/provenance.rs:665 (not_lowered)`; `crates/metal2vulkan/src/pipeline/link/tessellation/mod.rs:96 (patch_fetch_projection)` +- `feature::Lowering`: `crates/metal2vulkan/src/bind/plan/resources.rs:762 (level_views)`; `crates/metal2vulkan/src/lower/access/handle.rs:1062 (texture_target)`; `crates/metal2vulkan/src/lower/access/handle.rs:1073 (sampler_target)`; `crates/metal2vulkan/src/lower/access/handle.rs:318 (domain_kind)`; `crates/metal2vulkan/src/lower/access/imageblock.rs:175 (operand)`; `crates/metal2vulkan/src/lower/access/mod.rs:571 (not_lowered)`; `crates/metal2vulkan/src/lower/access/pulled.rs:76 (share)`; `crates/metal2vulkan/src/lower/arith/legal.rs:53 (not_lowered)`; `crates/metal2vulkan/src/lower/dispatch.rs:114 (not_lowered)`; `crates/metal2vulkan/src/lower/fragment/discard.rs:144 (not_lowered)`; `crates/metal2vulkan/src/lower/fragment/discard.rs:653 (plan)`; `crates/metal2vulkan/src/lower/fragment/mod.rs:123 (not_lowered)`; `crates/metal2vulkan/src/lower/fragment/snapshot.rs:168 (finish)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:147 (not_lowered)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:126 (not_lowered)`; `crates/metal2vulkan/src/lower/sampler/mod.rs:212 (refuse)`; `crates/metal2vulkan/src/lower/sampler/select.rs:30 (refuse)`; `crates/metal2vulkan/src/lower/select.rs:829 (not_lowered)`; `crates/metal2vulkan/src/lower/select.rs:918 (route_air)`; `crates/metal2vulkan/src/lower/simd/mod.rs:136 (not_lowered)`; `crates/metal2vulkan/src/lower/simd/mod.rs:747 (select_param)`; `crates/metal2vulkan/src/lower/simd/workgroup.rs:353 (check)`; `crates/metal2vulkan/src/lower/stage_io/fetch.rs:96 (not_lowered)`; `crates/metal2vulkan/src/lower/stage_io/mod.rs:182 (not_lowered)`; `crates/metal2vulkan/src/lower/sync/barrier.rs:72 (not_lowered)`; `crates/metal2vulkan/src/lower/sync/memory_model.rs:269 (not_implemented)`; `crates/metal2vulkan/src/lower/sync/memory_model.rs:310 (select)`; `crates/metal2vulkan/src/lower/tessellation/mod.rs:146 (not_lowered)`; `crates/metal2vulkan/src/lower/texture/mod.rs:180 (refuse)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3670 (select_write)`; `crates/metal2vulkan/src/memory/alloca.rs:54 (not_lowered)`; `crates/metal2vulkan/src/memory/leaf.rs:183 (not_lowered)`; `crates/metal2vulkan/src/memory/plan.rs:490 (not_lowered)`; `crates/metal2vulkan/src/memory/provenance.rs:665 (not_lowered)`; `crates/metal2vulkan/src/pipeline/link/tessellation/mod.rs:96 (patch_fetch_projection)` - `feature::SamplerAddressMode`: `crates/metal2vulkan/src/lower/sampler/constexpr.rs:176`; `crates/metal2vulkan/src/metal/sampler.rs:251 (check_sampler)` - `feature::AlphaToOne`: `crates/metal2vulkan/src/pipeline/link/graphics.rs:282 (graphics_state)` - `feature::StageStoresAndAtomics`: `crates/metal2vulkan/src/lower/access/tile_memory.rs:72 (written)` - `feature::FunctionConstantArgument`: `crates/metal2vulkan-air/src/canon/interface.rs:899 (absent_values)`; `crates/metal2vulkan/src/lower/access/absent.rs:100 (require)` - `feature::SamplerBicubicFilter`: `crates/metal2vulkan/src/bind/heap.rs:997 (new)`; `crates/metal2vulkan/src/bind/plan/resources.rs:1876 (bicubic_texels)`; `crates/metal2vulkan/src/bind/plan/slots.rs:503 (cubic_variant)`; `crates/metal2vulkan/src/lower/sampler/bicubic.rs:120 (refuse)`; `crates/metal2vulkan/src/lower/sampler/select.rs:35 (bicubic_refused)` -- `feature::GroupCount`: `crates/metal2vulkan/src/bind/dispatch.rs:379 (product)`; `crates/metal2vulkan/src/bind/dispatch.rs:455`; `crates/metal2vulkan/src/bind/dispatch.rs:953 (instantiate)`; `crates/metal2vulkan/src/bind/graphics.rs:3215 (mesh_draw)`; `crates/metal2vulkan/src/bind/graphics.rs:3266 (emulated_draw)` +- `feature::GroupCount`: `crates/metal2vulkan/src/bind/dispatch.rs:379 (product)`; `crates/metal2vulkan/src/bind/dispatch.rs:455`; `crates/metal2vulkan/src/bind/dispatch.rs:953 (instantiate)`; `crates/metal2vulkan/src/bind/graphics.rs:3232 (mesh_draw)`; `crates/metal2vulkan/src/bind/graphics.rs:3283 (emulated_draw)` - `feature::IntersectionFunctionTable`: `crates/metal2vulkan/src/bind/acceleration.rs:177 (geometry_table_offset)`; `crates/metal2vulkan/src/bind/acceleration.rs:183 (geometry_table_offset)`; `crates/metal2vulkan/src/bind/acceleration.rs:188 (geometry_table_offset)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:1222 (null_table)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:1251 (intersect)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:1272 (intersect)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:406 (table_of)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:422 (select_table)`; `crates/metal2vulkan/src/lower/select.rs:885 (route_air)` -- `feature::IndependentBlending`: `crates/metal2vulkan-runtime/src/render.rs:2117 (check_pipeline)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:1017 (uniform_blend)` +- `feature::IndependentBlending`: `crates/metal2vulkan-runtime/src/render.rs:2166 (check_pipeline)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:1017 (uniform_blend)` - `feature::RasterSampleCount`: `crates/metal2vulkan-runtime/src/families/limits.rs:1059 (sample_count)`; `crates/metal2vulkan/src/pipeline/graphics.rs:563 (sample_count_properties)` - `feature::TriangleFillLines`: `crates/metal2vulkan/src/metal/state.rs:347 (polygon_mode)` - `feature::DepthClipClamp`: `crates/metal2vulkan/src/metal/state.rs:363 (depth_clamp_enable)` @@ -395,7 +397,7 @@ Each refusal's sites, with the function that builds it. - `feature::TextureSwizzle`: `crates/metal2vulkan-runtime/src/binding_view.rs:167 (binding_view)`; `crates/metal2vulkan-runtime/src/texture.rs:994 (may_view)`; `crates/metal2vulkan/src/bind/plan/resources.rs:1102 (plain_texture)`; `crates/metal2vulkan/src/lower/sampler/select.rs:2587 (select_one)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3396 (select_read_as)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3743 (select_write)`; `crates/metal2vulkan/src/lower/texture/slice.rs:307 (select)` - `feature::MipmapGeneration`: `crates/metal2vulkan-runtime/src/blit_texture.rs:1818 (mipmaps)`; `crates/metal2vulkan-runtime/src/mipmap_pick.rs:37 (pick_mipmaps)`; `crates/metal2vulkan-runtime/src/mipmap_plan.rs:262 (plan_mipmaps)`; `crates/metal2vulkan-runtime/src/mipmap_plan.rs:270 (plan_mipmaps)`; `crates/metal2vulkan-runtime/src/mipmap_plan.rs:275 (plan_mipmaps)`; `crates/metal2vulkan-runtime/src/mipmap_plan.rs:304 (plan_mipmaps)`; `crates/metal2vulkan/src/bind/mipmap_filter.rs:973 (mipmap_filter_module)` - `feature::HostMemory`: `crates/metal2vulkan-runtime/src/host_memory.rs:430 (not_importable)`; `crates/metal2vulkan-runtime/src/host_memory.rs:470 (refuse_unwritable)`; `crates/metal2vulkan-runtime/src/host_memory.rs:689 (new)`; `crates/metal2vulkan-runtime/src/host_memory.rs:694 (new)`; `crates/metal2vulkan-runtime/src/host_memory.rs:712 (new)` -- `feature::GpuTimes`: `crates/metal2vulkan-runtime/src/command_buffer/mod.rs:2841 (gpu_times)` +- `feature::GpuTimes`: `crates/metal2vulkan-runtime/src/command_buffer/mod.rs:2855 (gpu_times)` - `feature::CountingVisibility`: `crates/metal2vulkan-runtime/src/visibility.rs:452 (check_mode)` - `feature::ViewFormatReinterpretation`: `crates/metal2vulkan-runtime/src/view_plan.rs:570 (reinterpretation_refused)` - `feature::SeparateMultisampledDepthStencil`: `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:188 (sampled_candidate)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:294 (by_draws)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:336 (scratch)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:376 (scratch)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:777 (plan)`; `crates/metal2vulkan-runtime/src/nan_clear.rs:658 (nan_write)`; `crates/metal2vulkan-runtime/src/texture/signed_depth.rs:191 (sample_strip)` @@ -412,9 +414,9 @@ Each refusal's sites, with the function that builds it. - `feature::RenderTargetSize`: `crates/metal2vulkan-runtime/src/render_pass.rs:1271 (framebuffer_fits)` - `feature::IndirectRenderState`: `crates/metal2vulkan/src/lower/access/encode.rs:568 (select_command)` - `feature::GlobalBuiltinInFragment`: `crates/metal2vulkan/src/lower/select.rs:912 (route_air)` -- `feature::PrivateRenderState`: `crates/metal2vulkan/src/bind/heap.rs:1300 (array)`; `crates/metal2vulkan/src/bind/plan/resources.rs:887 (write_rounding)`; `crates/metal2vulkan/src/lower/sampler/select.rs:2710 (clamps_reference)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:3406 (alpha_test_refused)`; `crates/metal2vulkan/src/lower/texture/mod.rs:2907 (mode_rounded_write)`; `crates/metal2vulkan/src/pipeline/private_state.rs:378 (logic_operation)`; `crates/metal2vulkan/src/pipeline/private_state.rs:97 (refused)` +- `feature::PrivateRenderState`: `crates/metal2vulkan/src/bind/heap.rs:1300 (array)`; `crates/metal2vulkan/src/bind/plan/resources.rs:887 (write_rounding)`; `crates/metal2vulkan/src/lower/sampler/select.rs:2710 (clamps_reference)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:3438 (alpha_test_refused)`; `crates/metal2vulkan/src/lower/texture/mod.rs:2907 (mode_rounded_write)`; `crates/metal2vulkan/src/pipeline/private_state.rs:378 (logic_operation)`; `crates/metal2vulkan/src/pipeline/private_state.rs:97 (refused)` - `feature::ExtendedRangeBlend`: `crates/metal2vulkan/src/lower/arith/extended_range/blend.rs:305 (refused)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1555 (plan)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1558 (plan)`; `crates/metal2vulkan/src/lower/fragment/input_blend.rs:153 (plan)` -- `feature::TileReach`: `crates/metal2vulkan/src/bind/tile_reach.rs:270 (tile_reach_module)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:2514 (capture)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:2540 (capture)` +- `feature::TileReach`: `crates/metal2vulkan/src/bind/tile_reach.rs:270 (tile_reach_module)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:2517 (capture)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:2543 (capture)` - `feature::ProgramScopeBinding`: `crates/metal2vulkan-air/src/abi/module.rs:77 (decode)`; `crates/metal2vulkan/src/error/mod.rs:267 (from)` - `feature::SeqCstFence`: `crates/metal2vulkan/src/lower/sync/barrier.rs:443 (require_seq_cst)` - `feature::PostDepthCoverage`: `crates/metal2vulkan-runtime/src/families/features.rs:1217 (state)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:783 (param)` @@ -427,14 +429,14 @@ Each refusal's sites, with the function that builds it. - `gap::HeapTextureMemory`: `crates/metal2vulkan-runtime/src/texture/heap.rs:1508 (heap_plan)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:1515 (heap_plan)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2057 (host_heap_plan)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2289 (memory_shadow)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:552 (memory_refusal)` - `gap::FunctionTablePastMaxBufferLength`: `crates/metal2vulkan-runtime/src/function_table.rs:622 (past_limit)` - `gap::IndirectCommandBufferPastMaxBufferLength`: `crates/metal2vulkan-runtime/src/indirect_command_buffer.rs:522 (new_indirect_command_buffer)` -- `gap::IndirectRenderCommands`: `crates/metal2vulkan-runtime/src/compute.rs:1122 (execute_range)`; `crates/metal2vulkan-runtime/src/compute.rs:1203 (execute_indirect_range)`; `crates/metal2vulkan-runtime/src/depth_stencil.rs:85 (gpu_resource_id)`; `crates/metal2vulkan-runtime/src/indirect_command_buffer.rs:4356 (render_state)`; `crates/metal2vulkan-runtime/src/indirect_command_buffer.rs:517 (new_indirect_command_buffer)`; `crates/metal2vulkan-runtime/src/pipeline/mod.rs:1632 (compile_error)`; `crates/metal2vulkan-runtime/src/render.rs:7140 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:7611 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:8016 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:8484 (draw_resident)`; `crates/metal2vulkan-runtime/src/render/executions.rs:1104 (back_memoryless)`; `crates/metal2vulkan-runtime/src/render/executions.rs:2008 (record)`; `crates/metal2vulkan-runtime/src/render/executions.rs:2051 (record)`; `crates/metal2vulkan-runtime/src/render/executions.rs:2900 (record_forms)`; `crates/metal2vulkan-runtime/src/render/executions.rs:380 (execute_range)`; `crates/metal2vulkan-runtime/src/render/executions.rs:439 (execute_indirect_range)`; `crates/metal2vulkan-runtime/src/render/executions.rs:454 (execute_indirect_range)` +- `gap::IndirectRenderCommands`: `crates/metal2vulkan-runtime/src/compute.rs:1115 (execute_range)`; `crates/metal2vulkan-runtime/src/compute.rs:1196 (execute_indirect_range)`; `crates/metal2vulkan-runtime/src/depth_stencil.rs:85 (gpu_resource_id)`; `crates/metal2vulkan-runtime/src/indirect_command_buffer.rs:4356 (render_state)`; `crates/metal2vulkan-runtime/src/indirect_command_buffer.rs:517 (new_indirect_command_buffer)`; `crates/metal2vulkan-runtime/src/pipeline/mod.rs:1632 (compile_error)`; `crates/metal2vulkan-runtime/src/render.rs:7189 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:7672 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:8088 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:8556 (draw_resident)`; `crates/metal2vulkan-runtime/src/render/executions.rs:1104 (back_memoryless)`; `crates/metal2vulkan-runtime/src/render/executions.rs:2008 (record)`; `crates/metal2vulkan-runtime/src/render/executions.rs:2051 (record)`; `crates/metal2vulkan-runtime/src/render/executions.rs:2900 (record_forms)`; `crates/metal2vulkan-runtime/src/render/executions.rs:380 (execute_range)`; `crates/metal2vulkan-runtime/src/render/executions.rs:439 (execute_indirect_range)`; `crates/metal2vulkan-runtime/src/render/executions.rs:454 (execute_indirect_range)` - `gap::IndirectImageblockSize`: `crates/metal2vulkan-runtime/src/indirect_command_buffer.rs:3363 (set_imageblock_size)` - `gap::CommandReplay`: `crates/metal2vulkan-runtime/src/binding.rs:720 (bind_into)`; `crates/metal2vulkan-runtime/src/binding.rs:723 (bind_into)` - `gap::RenderAttachments`: `crates/metal2vulkan-runtime/src/binding.rs:1871 (unexpected)` - `gap::AccelerationStructures`: `crates/metal2vulkan-runtime/src/binding.rs:1874 (unexpected)` - `gap::FeatureEnable`: `crates/metal2vulkan-runtime/src/enables.rs:1165 (of)` - `gap::ExtensionEnable`: `crates/metal2vulkan-runtime/src/enables.rs:1156 (of)` -- `gap::Render`: `crates/metal2vulkan-runtime/src/attachment_stand_in.rs:404 (stand_in_as)`; `crates/metal2vulkan-runtime/src/attachment_stand_in.rs:460 (stand_in_as)`; `crates/metal2vulkan-runtime/src/attachment_stand_in.rs:684 (check_copies)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:796 (attachment_twin)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:283 (check_sizes)`; `crates/metal2vulkan-runtime/src/kept_bytes.rs:138 (settle)`; `crates/metal2vulkan-runtime/src/linear_attachment.rs:293 (settle)`; `crates/metal2vulkan-runtime/src/nan_clear.rs:204 (plan)`; `crates/metal2vulkan-runtime/src/pipeline/render.rs:1169 (imageblock_sample_length)`; `crates/metal2vulkan-runtime/src/render.rs:2167 (check_pipeline)`; `crates/metal2vulkan-runtime/src/render.rs:5884 (next_instance)`; `crates/metal2vulkan-runtime/src/render.rs:7705 (draw_resident)`; `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:517 (scratch)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1313 (layout)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1676 (target)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1730 (target)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1791 (attachment_format)`; `crates/metal2vulkan-runtime/src/render_pass.rs:2024 (depth_stencil)`; `crates/metal2vulkan-runtime/src/resolve.rs:1035 (attach)`; `crates/metal2vulkan-runtime/src/resolve.rs:1103 (color_copy)`; `crates/metal2vulkan-runtime/src/resolve.rs:1150 (destination)`; `crates/metal2vulkan-runtime/src/resolve.rs:1167 (destination)`; `crates/metal2vulkan-runtime/src/resolve.rs:1232 (destination)` +- `gap::Render`: `crates/metal2vulkan-runtime/src/attachment_stand_in.rs:404 (stand_in_as)`; `crates/metal2vulkan-runtime/src/attachment_stand_in.rs:460 (stand_in_as)`; `crates/metal2vulkan-runtime/src/attachment_stand_in.rs:684 (check_copies)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:796 (attachment_twin)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:283 (check_sizes)`; `crates/metal2vulkan-runtime/src/kept_bytes.rs:138 (settle)`; `crates/metal2vulkan-runtime/src/linear_attachment.rs:293 (settle)`; `crates/metal2vulkan-runtime/src/nan_clear.rs:204 (plan)`; `crates/metal2vulkan-runtime/src/pipeline/render.rs:1169 (imageblock_sample_length)`; `crates/metal2vulkan-runtime/src/render.rs:2216 (check_pipeline)`; `crates/metal2vulkan-runtime/src/render.rs:5933 (next_instance)`; `crates/metal2vulkan-runtime/src/render.rs:7766 (draw_resident)`; `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:517 (scratch)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1313 (layout)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1676 (target)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1730 (target)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1791 (attachment_format)`; `crates/metal2vulkan-runtime/src/render_pass.rs:2024 (depth_stencil)`; `crates/metal2vulkan-runtime/src/resolve.rs:1035 (attach)`; `crates/metal2vulkan-runtime/src/resolve.rs:1103 (color_copy)`; `crates/metal2vulkan-runtime/src/resolve.rs:1150 (destination)`; `crates/metal2vulkan-runtime/src/resolve.rs:1167 (destination)`; `crates/metal2vulkan-runtime/src/resolve.rs:1232 (destination)` - `gap::TexelsPastBufferLength`: `crates/metal2vulkan-runtime/src/buffer_texture.rs:261 (refusal_error)`; `crates/metal2vulkan-runtime/src/texture/surface_depth.rs:105 (surface_depth_twin)` - `gap::OverlappingSurfaceRows`: `crates/metal2vulkan-runtime/src/buffer_texture.rs:263 (refusal_error)` - `gap::SamplePositionsAtBegin`: `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:145 (stencil_scratch)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1861 (positioned_stand_in)`; `crates/metal2vulkan-runtime/src/sample_positions.rs:185 (grid)` @@ -442,12 +444,12 @@ Each refusal's sites, with the function that builds it. - `gap::ViewportDepthRange`: `crates/metal2vulkan-runtime/src/render/draw_shape.rs:341 (settings)`; `crates/metal2vulkan-runtime/src/render_state.rs:1039`; `crates/metal2vulkan-runtime/src/render_state.rs:1208 (depth_ranges_refused)`; `crates/metal2vulkan-runtime/src/render_state.rs:1575 (bias_holds)`; `crates/metal2vulkan-runtime/src/render_state.rs:1594 (collapses)`; `crates/metal2vulkan-runtime/src/render_state.rs:527 (depth_range)`; `crates/metal2vulkan-runtime/src/render_state.rs:755 (compensation)` - `gap::NonFiniteDepthBias`: `crates/metal2vulkan-runtime/src/render_state.rs:1603 (collapses)`; `crates/metal2vulkan-runtime/src/render_state.rs:1606 (collapses)`; `crates/metal2vulkan-runtime/src/render_state.rs:365 (set_depth_bias)`; `crates/metal2vulkan-runtime/src/render_state.rs:463 (draw_viewports)`; `crates/metal2vulkan-runtime/src/render_state.rs:605 (compensation)` - `gap::DepthNeverWithoutAttachment`: `crates/metal2vulkan-runtime/src/depth_stencil.rs:147 (failing_draw)` -- `gap::HiddenDepthStencil`: `crates/metal2vulkan-runtime/src/attachment_stand_in.rs:563 (hidden)`; `crates/metal2vulkan-runtime/src/render.rs:6561 (hidden_depth_stencil)` -- `gap::IndirectDrawArguments`: `crates/metal2vulkan-runtime/src/index_bounds.rs:91 (new)`; `crates/metal2vulkan-runtime/src/render.rs:3246 (draw_indexed_primitives_indirect)`; `crates/metal2vulkan-runtime/src/render.rs:7447 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:7515 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:7546 (draw_resident)` +- `gap::HiddenDepthStencil`: `crates/metal2vulkan-runtime/src/attachment_stand_in.rs:563 (hidden)`; `crates/metal2vulkan-runtime/src/render.rs:6610 (hidden_depth_stencil)` +- `gap::IndirectDrawArguments`: `crates/metal2vulkan-runtime/src/index_bounds.rs:91 (new)`; `crates/metal2vulkan-runtime/src/render.rs:3295 (draw_indexed_primitives_indirect)`; `crates/metal2vulkan-runtime/src/render.rs:7507 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:7576 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:7607 (draw_resident)` - `gap::DepthStencilResolve`: `crates/metal2vulkan-runtime/src/depth_stencil_resolve.rs:441 (draws_run)`; `crates/metal2vulkan-runtime/src/resolve.rs:1388 (plan)`; `crates/metal2vulkan-runtime/src/resolve.rs:787 (depth_stencil)`; `crates/metal2vulkan-runtime/src/resolve.rs:885 (steps)`; `crates/metal2vulkan-runtime/src/resolve.rs:905 (steps)`; `crates/metal2vulkan-runtime/src/resolve.rs:946 (split_steps)`; `crates/metal2vulkan-runtime/src/resolve.rs:958 (split_steps)` - `gap::TileAtSampleCount`: `crates/metal2vulkan-runtime/src/render_pass.rs:1611 (layout)`; `crates/metal2vulkan-runtime/src/render_pass.rs:937` -- `gap::ImageblockMasters`: `crates/metal2vulkan-runtime/src/render.rs:7294 (draw_resident)`; `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:930 (dispatch_tiles_resident)` -- `gap::TileAndFragmentImageblocks`: `crates/metal2vulkan-runtime/src/render.rs:7286 (draw_resident)`; `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:797 (dispatch_tiles_resident)`; `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:922 (dispatch_tiles_resident)` +- `gap::ImageblockMasters`: `crates/metal2vulkan-runtime/src/render.rs:7343 (draw_resident)`; `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:930 (dispatch_tiles_resident)` +- `gap::TileAndFragmentImageblocks`: `crates/metal2vulkan-runtime/src/render.rs:7335 (draw_resident)`; `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:797 (dispatch_tiles_resident)`; `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:922 (dispatch_tiles_resident)` - `gap::Metal4Api`: `crates/metal2vulkan-runtime/src/families/features.rs:1495 (state)`; `crates/metal2vulkan-runtime/src/families/limits.rs:1022 (state)`; `crates/metal2vulkan-runtime/src/families/mod.rs:362 (audit)` - `gap::CounterSampleBuffers`: `crates/metal2vulkan-runtime/src/families/limits.rs:1013 (state)` - `gap::ResidencySets`: `crates/metal2vulkan-runtime/src/families/features.rs:1477 (state)`; `crates/metal2vulkan-runtime/src/families/limits.rs:1015 (state)` @@ -471,9 +473,9 @@ Each refusal's sites, with the function that builds it. - `gap::MappedTextureSampling`: `crates/metal2vulkan-runtime/src/address_map.rs:158 (resolve)` - `gap::LibrarySource`: `crates/metal2vulkan-runtime/src/library.rs:107 (new_library_with_source)` - `gap::RestartedStrip`: `crates/metal2vulkan-runtime/src/render/restart.rs:71 (gap)` -- `gap::PrivatePrimitives`: `crates/metal2vulkan-runtime/src/render.rs:703 (private_primitive_ids)`; `crates/metal2vulkan-runtime/src/render/restart.rs:72 (gap)` +- `gap::PrivatePrimitives`: `crates/metal2vulkan-runtime/src/render.rs:7927 (draw_resident)`; `crates/metal2vulkan-runtime/src/render/restart.rs:72 (gap)` - `gap::ProvokingVertex`: `crates/metal2vulkan-runtime/src/render/restart.rs:73 (gap)` -- `gap::PrimitiveIdIndices`: `crates/metal2vulkan-runtime/src/render.rs:7865 (draw_resident)` +- `gap::PrimitiveIdIndices`: `crates/metal2vulkan-runtime/src/render.rs:7937 (draw_resident)` - `gap::RotatedTexture`: `crates/metal2vulkan-runtime/src/blit_texture.rs:1602 (texel_copies)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:715 (turned_plane)`; `crates/metal2vulkan-runtime/src/rotated.rs:185 (new)`; `crates/metal2vulkan-runtime/src/rotated.rs:201 (new)`; `crates/metal2vulkan-runtime/src/shadow.rs:642 (unmerged)`; `crates/metal2vulkan-runtime/src/texture.rs:5092 (view)`; `crates/metal2vulkan-runtime/src/texture/rotation.rs:100 (check_rotated_reach)`; `crates/metal2vulkan-runtime/src/texture/rotation.rs:322 (copied_image)`; `crates/metal2vulkan-runtime/src/texture/usage_shadow.rs:238 (new_usage_shadow)` - `gap::DetachTextures`: `crates/metal2vulkan-runtime/src/buffer_descriptor.rs:625 (rebind_host_pages)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:622 (make_texture_over)`; `crates/metal2vulkan-runtime/src/detach.rs:172 (detach_host_pages)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2933 (heap_texture_at)`; `crates/metal2vulkan-runtime/src/texture/stand_in.rs:143 (new_stand_in)`; `crates/metal2vulkan-runtime/src/texture/stand_in.rs:248 (stand_in_while_detached)`; `crates/metal2vulkan-runtime/src/texture/stand_in.rs:298 (stand_ins)`; `crates/metal2vulkan-runtime/src/texture/stand_in.rs:304 (stand_ins)` - `gap::TextureBufferLevels`: `crates/metal2vulkan-runtime/src/texture_descriptor.rs:540 (check_made)` @@ -481,7 +483,7 @@ Each refusal's sites, with the function that builds it. - `gap::DetachedTexelAccess`: `crates/metal2vulkan-runtime/src/texture.rs:4922 (refuse_detached_texels)` - `gap::SurfaceDepthStencil`: `crates/metal2vulkan-runtime/src/blit_texture.rs:269 (unit)`; `crates/metal2vulkan-runtime/src/texture/surface_depth.rs:57 (surface_depth_twin)` - `gap::ExtendedRangeResolve`: `crates/metal2vulkan-runtime/src/resolve.rs:604 (color)` -- `gap::PredicationDropsUngatedWork`: `crates/metal2vulkan-runtime/src/predication.rs:762 (unbalanced)` +- `gap::PredicationDropsUngatedWork`: `crates/metal2vulkan-runtime/src/predication.rs:729 (unbalanced)` - `gap::MultisampledBufferCopy`: `crates/metal2vulkan-runtime/src/blit_texture.rs:527 (copy_from_buffer_to_texture)`; `crates/metal2vulkan-runtime/src/blit_texture.rs:674 (copy_from_texture_to_buffer)` - `gap::MultisampledBufferLayout`: `crates/metal2vulkan-runtime/src/sample_interleave.rs:1020 (plan)` - `gap::ColorAttachmentGroups`: `crates/metal2vulkan-runtime/src/render/color_groups.rs:106 (gap)` @@ -493,9 +495,9 @@ Each refusal's sites, with the function that builds it. - `bind::DescriptorRangeExceeded`: `crates/metal2vulkan/src/bind/instantiate.rs:653 (bind_buffers)` - `bind::TexelBufferTooLarge`: `crates/metal2vulkan/src/bind/instantiate.rs:892 (texel_ranges)` - `bind::HeapTooLarge`: `crates/metal2vulkan/src/bind/heap.rs:1014 (new)`; `crates/metal2vulkan/src/bind/heap.rs:1748 (directory_bytes)`; `crates/metal2vulkan/src/bind/heap.rs:1863 (listed_sampler_tables)`; `crates/metal2vulkan/src/bind/heap.rs:1913 (placed)`; `crates/metal2vulkan/src/bind/heap.rs:2069 (heap_elements)`; `crates/metal2vulkan/src/bind/heap.rs:949 (new)`; `crates/metal2vulkan/src/bind/heap.rs:965 (new)` -- `bind::TessellationFactorRange`: `crates/metal2vulkan/src/bind/graphics.rs:3596 (patch_binding)` -- `bind::PatchIndexRange`: `crates/metal2vulkan/src/bind/graphics.rs:3640 (patch_binding)` -- `bind::ControlPointIndexRange`: `crates/metal2vulkan/src/bind/graphics.rs:3678 (patch_binding)` +- `bind::TessellationFactorRange`: `crates/metal2vulkan/src/bind/graphics.rs:3613 (patch_binding)` +- `bind::PatchIndexRange`: `crates/metal2vulkan/src/bind/graphics.rs:3657 (patch_binding)` +- `bind::ControlPointIndexRange`: `crates/metal2vulkan/src/bind/graphics.rs:3695 (patch_binding)` - `bind::MissingStageInRegion`: `crates/metal2vulkan/src/bind/dispatch.rs:796 (instantiate)` - `bind::UniformViewAliased`: `crates/metal2vulkan/src/bind/instantiate.rs:607 (check_uniform_aliasing)` - `bind::MissingDeviceAddress`: `crates/metal2vulkan/src/bind/plan/slots.rs:133 (plan_buffer)` diff --git a/scripts/refusal-surface/reach.tsv b/scripts/refusal-surface/reach.tsv index 673a93848..3cdd0ae95 100644 --- a/scripts/refusal-surface/reach.tsv +++ b/scripts/refusal-surface/reach.tsv @@ -56,6 +56,7 @@ feature TexelBuffer app texture buffers past a device's texel-buffer limits feature RasterOrderGroups rare raster order groups feature FramebufferFetch system programmable blending (framebuffer fetch); macOS 26.6.2's login reaches it (two WindowServer and RenderBox pipelines fetch RGB10A8_2P_XR10 attachments, the consumer's boots) feature PrimitiveId rare primitive_id on a device without geometry or tessellation shaders, in an indexed draw or behind a mesh function +feature PrivatePrimitives rare a private primitive type drawn in the pulled list form (a vertex function that writes memory or the primitive_id varying, a vertex start past 2^31) on a device without device addresses feature VertexAmplification rare vertex amplification feature LayeredRendering rare layered rendering on a device without its features feature ClipDistance rare clip distances on a device without them @@ -218,7 +219,7 @@ budget Time none a translation past its deadline: a defect of ours to fix on any gap LibrarySource app a library compiled from Metal source (newLibraryWithSource:); the runtime takes metallibs and AIR gap RestartedStrip none a strip after the Apple-private setPrimitiveRestartEnabled:index: whose rewrite pass cannot run as Metal draws gap ProvokingVertex none a draw after the Apple-private setProvokingVertexMode: 1, on a device without the last provoking vertex, whose rotated list cannot draw as Metal draws -gap PrivatePrimitives none a draw of an Apple-private primitive type (OpenGL on Metal's quads and kin) whose list cannot draw as Metal draws: a primitive_id varying, a vertex start past 2^31 +gap PrivatePrimitives none a draw of an Apple-private primitive type (OpenGL on Metal's quads and kin) whose list cannot draw as Metal draws: a list past a u32 or one storage range, indices or arguments an unordered earlier draw wrote gap PrimitiveIdIndices rare an indexed draw of a primitive_id pipeline, on a device without geometry or tessellation shaders, whose indices the encoder wrote since its last barrier feature PrivateRenderState none Apple-private pipeline fields of OpenGL on Metal (no public header) gap SurfaceDepthStencil rare a blit of the stencil of a Depth32Float_Stencil8 texture over a plane of an IOSurface with planes, or a pass on an X32_Stencil8 one's view as Depth32Float_Stencil8