diff --git a/crates/metal2vulkan-runtime/README.md b/crates/metal2vulkan-runtime/README.md index 30065b3b8..78cae59ce 100644 --- a/crates/metal2vulkan-runtime/README.md +++ b/crates/metal2vulkan-runtime/README.md @@ -237,7 +237,9 @@ Calls Metal does not have, for a consumer that emulates a Metal device: - `execute_commands_in_buffer_checked` and `execute_commands_in_buffer_indirect_checked` (render and compute encoders) take an `IndirectCommandCheck`, which the host step that records an execution from records the GPU may have written calls with each command it will record, before it records - any. + any. `execute_commands_in_buffer_checked` takes what the check looks for too + (`IndirectCommandCheckNeeds`): a render execution whose records cannot hold any of it runs on + the GPU alone where it can, and never calls the check. - `HostMemory::with_dma_buf` and its `DmaBufSource`: dma-bufs of a no-copy object's pages, for a device that refuses their pointer. diff --git a/crates/metal2vulkan-runtime/examples/host_ab/gpu.rs b/crates/metal2vulkan-runtime/examples/host_ab/gpu.rs index f703ec916..3f981b786 100644 --- a/crates/metal2vulkan-runtime/examples/host_ab/gpu.rs +++ b/crates/metal2vulkan-runtime/examples/host_ab/gpu.rs @@ -64,6 +64,18 @@ pub trait Gpu { library: &Self::Library, kernel: &str, ) -> Self::ComputePipeline; + /// As `render_pipeline` of `vertex` and `fragment` into `BGRA8Unorm`, without blending, with + /// `supportIndirectCommandBuffers`. + fn indirect_render_pipeline( + &self, + library: &Self::Library, + vertex: &str, + fragment: &str, + ) -> Self::RenderPipeline; + /// `newIndirectCommandBufferWithDescriptor:maxCommandCount:options:` of `count` draws of + /// `Shared` storage whose commands inherit the pipeline state, not the buffers, and bind + /// `vertex_buffers` vertex buffers and no fragment buffer. + fn indirect_draws(&self, count: usize, vertex_buffers: usize) -> Self::IndirectCommands; /// `newIndirectCommandBufferWithDescriptor:maxCommandCount:options:` of `count` concurrent /// dispatches, each binding one kernel buffer and inheriting nothing, of `Private` storage. fn indirect_commands(&self, count: usize) -> Self::IndirectCommands; @@ -209,6 +221,15 @@ pub trait Gpu { /// `drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferOffset:` of triangles /// and 16-bit indices from the buffer's start. fn draw_indexed(&self, encoder: &mut Self::RenderEncoder, count: usize, indices: &Self::Buffer); + /// `useResource:usage:stages:` of `buffer`, read by the vertex stage. + fn use_in_vertex(&self, encoder: &mut Self::RenderEncoder, buffer: &Self::Buffer); + /// `executeCommandsInBuffer:withRange:` of draws `0..count`. + fn execute_draws( + &self, + encoder: &mut Self::RenderEncoder, + commands: &Self::IndirectCommands, + count: usize, + ); fn end_render(&self, encoder: Self::RenderEncoder); /// `computeCommandEncoder`. @@ -252,6 +273,13 @@ pub trait Gpu { ); fn end_compute(&self, encoder: Self::ComputeEncoder); + /// A blit encoder of one `resetCommandsInBuffer:withRange:` of commands `0..count`. + fn reset_commands( + &self, + command_buffer: &Self::CommandBuffer, + commands: &Self::IndirectCommands, + count: usize, + ); /// A blit encoder of one `fillBuffer:range:value:` over the buffer's first `length` bytes. fn fill(&self, command_buffer: &Self::CommandBuffer, buffer: &Self::Buffer, length: usize); /// A blit encoder of `copyFromBuffer:...toTexture:...` into each of `textures`, a diff --git a/crates/metal2vulkan-runtime/examples/host_ab/host_ab.metal b/crates/metal2vulkan-runtime/examples/host_ab/host_ab.metal index a2577a3c8..0feb0d5d5 100644 --- a/crates/metal2vulkan-runtime/examples/host_ab/host_ab.metal +++ b/crates/metal2vulkan-runtime/examples/host_ab/host_ab.metal @@ -309,3 +309,78 @@ kernel void icb_step3(device atomic_uint *data [[buffer(0)]], uint tid [[thread_position_in_grid]]) { atomic_fetch_add_explicit(&data[tid], 4u + uint(NONCE), memory_order_relaxed); } + +// The icb_draws workload's frame state and objects, as Apple's "Encoding Indirect Command Buffers +// on the GPU" lays them out: a translation and scale shared by every object, and each object's +// position, bounding radius and mesh vertex count. +struct IcbDrawFrame { + float2 translation; + float2 scale; +}; + +struct IcbDrawObject { + float2 position; + float radius; + uint vertices; +}; + +// The argument buffer that holds the indirect command buffer. +struct IcbDrawContainer { + command_buffer commands; +}; + +// Culls `object` against the view and, where it is visible, encodes its command: the frame state, +// the objects and the mesh as vertex buffers, and a draw of `type` of its mesh's vertices whose +// base instance is the object's index. An object out of view keeps the command the frame's reset +// left: nothing. +static void icb_draw_encode_object(uint object, constant IcbDrawFrame *frame, + device const IcbDrawObject *objects, device const float2 *mesh, + device const IcbDrawContainer *container, primitive_type type) { + float2 center = frame->scale * (frame->translation + objects[object].position); + float2 radius = frame->scale * objects[object].radius; + bool visible = all(center + radius >= float2(-1.0)) && all(center - radius <= float2(1.0)); + render_command command(container->commands, object); + if (visible) { + command.set_vertex_buffer(frame, 0); + command.set_vertex_buffer(objects, 1); + command.set_vertex_buffer(mesh, 2); + command.draw_primitives(type, 0, objects[object].vertices, 1, object); + } +} + +// Each thread encodes one object's command, a draw of triangles. +kernel void icb_draw_encode(uint object [[thread_position_in_grid]], + constant IcbDrawFrame *frame [[buffer(0)]], + device const IcbDrawObject *objects [[buffer(1)]], + device const float2 *mesh [[buffer(2)]], + device const IcbDrawContainer *container [[buffer(3)]]) { + icb_draw_encode_object(object, frame, objects, mesh, container, primitive_type::triangle); +} + +// icb_draw_encode, the draws' primitive type read from `type` (the CPU writes triangles), so the +// kernel's code does not tell which type its draws are of. +kernel void icb_draw_encode_any_type(uint object [[thread_position_in_grid]], + constant IcbDrawFrame *frame [[buffer(0)]], + device const IcbDrawObject *objects [[buffer(1)]], + device const float2 *mesh [[buffer(2)]], + device const IcbDrawContainer *container [[buffer(3)]], + constant uint &type [[buffer(4)]]) { + icb_draw_encode_object(object, frame, objects, mesh, container, primitive_type(type)); +} + +// An object's mesh vertex, moved to the object (its instance is the object's index). +vertex QuadOut icb_draw_vertex(uint vid [[vertex_id]], uint object [[instance_id]], + constant IcbDrawFrame *frame [[buffer(0)]], + device const IcbDrawObject *objects [[buffer(1)]], + device const float2 *mesh [[buffer(2)]]) { + QuadOut out; + float2 at = frame->scale * (frame->translation + objects[object].position + mesh[vid]); + out.position = float4(at, float(NONCE) * 1.0e-12, 1.0); + out.uv = mesh[vid] * 0.5 + 0.5; + return out; +} + +// The object's color from its mesh coordinates. +fragment float4 icb_draw_fragment(QuadOut in [[stage_in]]) { + return float4(in.uv, float(NONCE) * 1.0e-12, 1.0); +} diff --git a/crates/metal2vulkan-runtime/examples/host_ab/main.rs b/crates/metal2vulkan-runtime/examples/host_ab/main.rs index fee67da19..5198d6b6f 100644 --- a/crates/metal2vulkan-runtime/examples/host_ab/main.rs +++ b/crates/metal2vulkan-runtime/examples/host_ab/main.rs @@ -116,6 +116,15 @@ //! the encoding thread's through the commit, the process's CPU time, and on the runtime's side //! its queue submissions, barriers, dispatches and indirect dispatches (`rt_*`). The first //! frame's output is checked (`workloads::icb`). +//! - `icb_draws`: a frame of Apple's "Encoding Indirect Command Buffers on the GPU": a blit +//! resets an indirect command buffer of 65,536 draws whose commands inherit the pipeline state, +//! a kernel culls 65,536 objects on a grid a little wider than the view and encodes a command for +//! each visible one (three vertex buffers and a draw of its mesh's 18 vertices whose base +//! instance is its index), and a render pass into a 1920x1080 `BGRA8Unorm` target executes them +//! all. Per frame, as `many_draws`; `icb_draws_any_type_*`: the same, the kernel reading the +//! draws' primitive type (triangles) from a buffer, where the runtime cannot tell the type from +//! the kernel's code and so reads the records on the host. On the runtime's side, the commands +//! drawn on the GPU alone and the records read on the host per frame (`rt_*`). //! //! Options: `--rounds N` (3), `--draws N` (2000), `--timed N` (30), `--latency N` (200), //! `--heavy-iterations N` (64), `--heavy-runs N` (15), `--many-draws N` (6000), `--frames N` @@ -143,7 +152,7 @@ use std::process::{Command, Stdio}; use std::time::Instant; use workloads::Sizes; -const WORKLOADS: [&str; 13] = [ +const WORKLOADS: [&str; 14] = [ "encode", "fixed", "latency", @@ -157,6 +166,7 @@ const WORKLOADS: [&str; 13] = [ "drag", "burst", "icb", + "icb_draws", ]; struct Options { @@ -367,6 +377,7 @@ fn run(g: &G, opened: Instant, metallib: &Path, options: &Options) { "drag" => workloads::drag(g, &scene, sizes), "burst" => workloads::burst(g, &scene), "icb" => workloads::icb(g, &library, sizes), + "icb_draws" => workloads::icb_draws(g, &library, sizes), _ => unreachable!(), } } diff --git a/crates/metal2vulkan-runtime/examples/host_ab/native.rs b/crates/metal2vulkan-runtime/examples/host_ab/native.rs index 022e5cb2b..5adb9325e 100644 --- a/crates/metal2vulkan-runtime/examples/host_ab/native.rs +++ b/crates/metal2vulkan-runtime/examples/host_ab/native.rs @@ -14,9 +14,9 @@ use objc2_metal::{ MTLIndexType, MTLIndirectCommandBuffer, MTLIndirectCommandBufferDescriptor, MTLIndirectCommandType, MTLLibrary, MTLLoadAction, MTLOrigin, MTLPipelineOption, MTLPixelFormat, MTLPrimitiveType, MTLRegion, MTLRenderCommandEncoder, MTLRenderPassDescriptor, - MTLRenderPipelineDescriptor, MTLRenderPipelineState, MTLResourceOptions, MTLResourceUsage, - MTLSamplerDescriptor, MTLSamplerMinMagFilter, MTLSamplerState, MTLSize, MTLStorageMode, - MTLStoreAction, MTLTexture, MTLTextureDescriptor, MTLTextureUsage, MTLWinding, + MTLRenderPipelineDescriptor, MTLRenderPipelineState, MTLRenderStages, MTLResourceOptions, + MTLResourceUsage, MTLSamplerDescriptor, MTLSamplerMinMagFilter, MTLSamplerState, MTLSize, + MTLStorageMode, MTLStoreAction, MTLTexture, MTLTextureDescriptor, MTLTextureUsage, MTLWinding, }; use std::ffi::c_void; use std::path::Path; @@ -192,6 +192,43 @@ impl Gpu for Native { .expect("newIndirectCommandBufferWithDescriptor") } + fn indirect_render_pipeline( + &self, + library: &Self::Library, + vertex: &str, + fragment: &str, + ) -> Self::RenderPipeline { + let descriptor = MTLRenderPipelineDescriptor::new(); + descriptor.setVertexFunction(Some(&function(library, vertex))); + descriptor.setFragmentFunction(Some(&function(library, fragment))); + // SAFETY: attachment 0 exists. + let color = unsafe { descriptor.colorAttachments().objectAtIndexedSubscript(0) }; + color.setPixelFormat(MTLPixelFormat::BGRA8Unorm); + descriptor.setSupportIndirectCommandBuffers(true); + self.device + .newRenderPipelineStateWithDescriptor_error(&descriptor) + .expect("newRenderPipelineStateWithDescriptor") + } + + fn indirect_draws(&self, count: usize, vertex_buffers: usize) -> Self::IndirectCommands { + let descriptor = MTLIndirectCommandBufferDescriptor::new(); + descriptor.setCommandTypes(MTLIndirectCommandType::Draw); + descriptor.setInheritPipelineState(true); + descriptor.setInheritBuffers(false); + descriptor.setMaxVertexBufferBindCount(vertex_buffers); + descriptor.setMaxFragmentBufferBindCount(0); + // SAFETY: the descriptor is a draw buffer's, of a count above zero. + unsafe { + self.device + .newIndirectCommandBufferWithDescriptor_maxCommandCount_options( + &descriptor, + count, + MTLResourceOptions::StorageModeShared, + ) + } + .expect("newIndirectCommandBufferWithDescriptor") + } + fn commands_id(&self, commands: &Self::IndirectCommands) -> u64 { commands.gpuResourceID().to_raw() } @@ -572,6 +609,29 @@ impl Gpu for Native { }; } + fn use_in_vertex(&self, encoder: &mut Self::RenderEncoder, buffer: &Self::Buffer) { + encoder.useResource_usage_stages( + ProtocolObject::from_ref(&**buffer), + MTLResourceUsage::Read, + MTLRenderStages::Vertex, + ); + } + + fn execute_draws( + &self, + encoder: &mut Self::RenderEncoder, + commands: &Self::IndirectCommands, + count: usize, + ) { + let range = objc2_foundation::NSRange { + location: 0, + length: count, + }; + // SAFETY: the encoder's command buffer holds `commands` until it completes, the range + // lies within its commands, and they inherit the encoder's pipeline state. + unsafe { encoder.executeCommandsInBuffer_withRange(commands, range) }; + } + fn end_render(&self, encoder: Self::RenderEncoder) { encoder.endEncoding(); } @@ -662,6 +722,24 @@ impl Gpu for Native { encoder.endEncoding(); } + fn reset_commands( + &self, + command_buffer: &Self::CommandBuffer, + commands: &Self::IndirectCommands, + count: usize, + ) { + let blit = command_buffer + .blitCommandEncoder() + .expect("blitCommandEncoder"); + let range = objc2_foundation::NSRange { + location: 0, + length: count, + }; + // SAFETY: the range lies within the buffer's commands. + unsafe { blit.resetCommandsInBuffer_withRange(commands, range) }; + blit.endEncoding(); + } + fn fill(&self, command_buffer: &Self::CommandBuffer, buffer: &Self::Buffer, length: usize) { let blit = command_buffer .blitCommandEncoder() diff --git a/crates/metal2vulkan-runtime/examples/host_ab/runtime.rs b/crates/metal2vulkan-runtime/examples/host_ab/runtime.rs index d1f62f472..a4379081f 100644 --- a/crates/metal2vulkan-runtime/examples/host_ab/runtime.rs +++ b/crates/metal2vulkan-runtime/examples/host_ab/runtime.rs @@ -168,6 +168,40 @@ impl Gpu for Runtime { .expect("new_compute_pipeline_state") } + fn indirect_render_pipeline( + &self, + library: &rt::Library, + vertex: &str, + fragment: &str, + ) -> rt::RenderPipelineState { + let function = |name: &str| { + let function = library + .new_function_with_name(name) + .expect("new_function_with_name"); + StageSource::Function(function.function_descriptor()) + }; + let mut descriptor = RenderPipelineDescriptor::new(function(vertex)); + descriptor.fragment = Some(function(fragment)); + descriptor.color_attachments[0] = + Some(ColorAttachmentDescriptor::new(PixelFormat::BGRA8Unorm)); + descriptor.support_indirect_command_buffers = true; + self.device + .new_render_pipeline_state(&descriptor, &rt::PipelineOptions::default()) + .expect("new_render_pipeline_state") + } + + fn indirect_draws(&self, count: usize, vertex_buffers: usize) -> rt::IndirectCommandBuffer { + let mut descriptor = rt::IndirectCommandBufferDescriptor::new(); + descriptor.command_types = IndirectCommandType::DRAW; + descriptor.inherit_pipeline_state = true; + descriptor.inherit_buffers = false; + descriptor.max_vertex_buffer_bind_count = vertex_buffers as u32; + descriptor.max_fragment_buffer_bind_count = 0; + self.device + .new_indirect_command_buffer(&descriptor, count as u64, rt::ResourceOptions::shared()) + .expect("new_indirect_command_buffer") + } + fn indirect_commands(&self, count: usize) -> rt::IndirectCommandBuffer { let mut descriptor = rt::IndirectCommandBufferDescriptor::new(); descriptor.command_types = IndirectCommandType::CONCURRENT_DISPATCH; @@ -535,6 +569,27 @@ impl Gpu for Runtime { .expect("draw_indexed_primitives"); } + fn use_in_vertex(&self, encoder: &mut rt::RenderCommandEncoder, buffer: &rt::Buffer) { + encoder + .use_resource( + buffer.as_resource(), + ResourceUsage::READ, + metal2vulkan::metal::RenderStages::VERTEX, + ) + .expect("use_resource"); + } + + fn execute_draws( + &self, + encoder: &mut rt::RenderCommandEncoder, + commands: &rt::IndirectCommandBuffer, + count: usize, + ) { + encoder + .execute_commands_in_buffer(commands, 0..count as u64) + .expect("execute_commands_in_buffer"); + } + fn end_render(&self, encoder: rt::RenderCommandEncoder) { encoder.end_encoding().expect("end_encoding"); } @@ -630,6 +685,20 @@ impl Gpu for Runtime { encoder.end_encoding().expect("end_encoding"); } + fn reset_commands( + &self, + command_buffer: &rt::CommandBuffer, + commands: &rt::IndirectCommandBuffer, + count: usize, + ) { + let mut blit = command_buffer + .blit_command_encoder() + .expect("blit_command_encoder"); + blit.reset_commands_in_buffer(commands, 0..count as u64) + .expect("reset_commands_in_buffer"); + blit.end_encoding().expect("end_encoding"); + } + fn fill(&self, command_buffer: &rt::CommandBuffer, buffer: &rt::Buffer, length: usize) { let mut blit = command_buffer .blit_command_encoder() @@ -755,6 +824,8 @@ impl Gpu for Runtime { ("arena_pools_made", c.arena_pools_made), ("command_pools_made", c.command_pools_made), ("dispatches", replayed.cmd_dispatch), + ("gpu_form_commands", c.gpu_form_commands), + ("indirect_records_read", c.indirect_records_read), ("dispatches_indirect", replayed.cmd_dispatch_indirect), ] .into_iter() diff --git a/crates/metal2vulkan-runtime/examples/host_ab/workloads.rs b/crates/metal2vulkan-runtime/examples/host_ab/workloads.rs index 3f7359581..512f14aea 100644 --- a/crates/metal2vulkan-runtime/examples/host_ab/workloads.rs +++ b/crates/metal2vulkan-runtime/examples/host_ab/workloads.rs @@ -1936,3 +1936,160 @@ pub fn icb(g: &G, library: &G::Library, sizes: &Sizes) { } } } + +/// The icb_draws workload's objects, as many as Apple's "Encoding Indirect Command Buffers on the GPU" +/// draws (`AAPLNumObjects`), on a grid of `ICB_DRAW_GRID` columns. +const ICB_DRAW_OBJECTS: usize = 65536; +const ICB_DRAW_GRID: usize = 256; +/// Each object's mesh: a hexagon's six triangles. +const ICB_DRAW_VERTICES: usize = 18; + +/// The icb_draws workload's objects and their indirect command buffer (`main.rs`'s module docs). +struct IcbDraws { + encode: G::ComputePipeline, + draw: G::RenderPipeline, + /// The frame state, the objects, the mesh, the argument buffer holding the buffer's ID and the + /// draws' primitive type (`icb_draw_encode_any_type`'s). + frame: G::Buffer, + objects: G::Buffer, + mesh: G::Buffer, + container: G::Buffer, + primitive: G::Buffer, + commands: G::IndirectCommands, + target: G::Texture, +} + +impl IcbDraws { + /// The objects, encoded by `kernel`. + fn new(g: &G, library: &G::Library, kernel: &str) -> IcbDraws { + // The grid spans a little more than the view, so its edge objects are culled. + let span = 2.2f32; + let cell = span / ICB_DRAW_GRID as f32; + let mut objects = Vec::with_capacity(ICB_DRAW_OBJECTS * 16); + for object in 0..ICB_DRAW_OBJECTS { + let (column, row) = (object % ICB_DRAW_GRID, object / ICB_DRAW_GRID); + let x = -span / 2.0 + (column as f32 + 0.5) * cell; + let y = -span / 2.0 + (row as f32 + 0.5) * cell; + for word in [x.to_bits(), y.to_bits(), (cell * 0.4).to_bits()] { + objects.extend_from_slice(&word.to_le_bytes()); + } + objects.extend_from_slice(&(ICB_DRAW_VERTICES as u32).to_le_bytes()); + } + let mut mesh = Vec::with_capacity(ICB_DRAW_VERTICES * 8); + let corner = |k: usize| { + let angle = k as f32 * std::f32::consts::TAU / 6.0; + [angle.cos() * cell * 0.4, angle.sin() * cell * 0.4] + }; + for k in 0..6 { + for [x, y] in [[0.0, 0.0], corner(k), corner(k + 1)] { + mesh.extend_from_slice(&f32::to_le_bytes(x)); + mesh.extend_from_slice(&f32::to_le_bytes(y)); + } + } + let frame: Vec = [0.0f32, 0.0, 1.0, 1.0] + .iter() + .flat_map(|v| v.to_le_bytes()) + .collect(); + let commands = g.indirect_draws(ICB_DRAW_OBJECTS, 3); + IcbDraws { + encode: g.compute_pipeline(library, kernel), + draw: g.indirect_render_pipeline(library, "icb_draw_vertex", "icb_draw_fragment"), + frame: g.buffer_with(&frame), + objects: g.buffer_with(&objects), + mesh: g.buffer_with(&mesh), + container: g.buffer_with(&g.commands_id(&commands).to_le_bytes()), + // `MTLPrimitiveTypeTriangle`. + primitive: g.buffer_with(&3u32.to_le_bytes()), + commands, + target: g.texture(Format::Bgra8, 1920, 1080, true), + } + } + + /// One frame, as the sample's: a blit resets the commands, a kernel culls the objects and + /// encodes a command for each visible one, and a render pass executes them all. + fn encode(&self, g: &G, command_buffer: &G::CommandBuffer) { + g.reset_commands(command_buffer, &self.commands, ICB_DRAW_OBJECTS); + let mut encoder = g.compute_encoder(command_buffer); + g.set_compute_pipeline(&mut encoder, &self.encode); + g.set_buffer(&mut encoder, &self.frame, 0, 0); + g.set_buffer(&mut encoder, &self.objects, 0, 1); + g.set_buffer(&mut encoder, &self.mesh, 0, 2); + g.set_buffer(&mut encoder, &self.container, 0, 3); + g.set_buffer(&mut encoder, &self.primitive, 0, 4); + g.use_commands(&mut encoder, &self.commands); + g.dispatch(&mut encoder, ICB_DRAW_OBJECTS / 64, 64); + g.end_compute(encoder); + let mut encoder = g.render_encoder(command_buffer, &self.target, true); + g.set_render_pipeline(&mut encoder, &self.draw); + for buffer in [&self.frame, &self.objects, &self.mesh] { + g.use_in_vertex(&mut encoder, buffer); + } + g.execute_draws(&mut encoder, &self.commands, ICB_DRAW_OBJECTS); + g.end_render(encoder); + } +} + +/// The icb_draws workload (module docs of `main.rs`): per frame, the encoding thread's wall time +/// through `endEncoding`, the commit call's, the commit's return to the wait's, the whole frame's, +/// the process's CPU time, the encoding thread's CPU time through the commit's return, and the GPU +/// time where the side measures it; the same of commands whose primitive type the encoding kernel +/// reads from a buffer (`icb_draws_any_type`), and on the runtime's side its counts of commands +/// drawn on the GPU alone and records read on the host, per frame. +pub fn icb_draws(g: &G, library: &G::Library, sizes: &Sizes) { + for (name, kernel) in [ + ("icb_draws", "icb_draw_encode"), + ("icb_draws_any_type", "icb_draw_encode_any_type"), + ] { + let scene = IcbDraws::new(g, library, kernel); + let mut times: [Vec; 7] = Default::default(); + let mut counts = Vec::new(); + for frame in 0..sizes.timed + 3 { + if frame == 3 { + counts = g.work_counts(); + } + g.pool(|| { + let cpu = process_cpu(); + let thread = thread_cpu(); + let start = Instant::now(); + let command_buffer = g.command_buffer(); + scene.encode(g, &command_buffer); + let encoded = Instant::now(); + g.commit(&command_buffer); + let committed = Instant::now(); + let thread = thread_cpu() - thread; + g.wait(&command_buffer); + let done = Instant::now(); + let cpu = process_cpu() - cpu; + if frame < 3 { + return; + } + times[6].push(ms(thread)); + times[0].push(ms(encoded - start)); + times[1].push(ms(committed - encoded)); + times[2].push(ms(done - committed)); + times[3].push(ms(done - start)); + times[4].push(ms(cpu)); + if let Some(gpu) = g.gpu_seconds(&command_buffer) { + times[5].push(gpu * 1e3); + } + }); + } + let [encode, commit, wait, frame, cpu, gpu, thread] = &mut times; + emit(name, "encode", "ms", encode); + emit(name, "commit", "ms", commit); + emit(name, "commit_to_done", "ms", wait); + emit(name, "frame", "ms", frame); + emit(name, "cpu", "ms", cpu); + emit(name, "thread_cpu", "ms", thread); + if !gpu.is_empty() { + emit(name, "gpu", "ms", gpu); + } + let after = g.work_counts(); + for ((counted, before), (_, now)) in counts.iter().zip(&after) { + if matches!(*counted, "gpu_form_commands" | "indirect_records_read") { + let per_frame = (now - before) / sizes.timed as f64; + emit(name, &format!("rt_{counted}"), "count", &mut [per_frame]); + } + } + } +} diff --git a/crates/metal2vulkan-runtime/src/compute.rs b/crates/metal2vulkan-runtime/src/compute.rs index 605420465..68a02ce99 100644 --- a/crates/metal2vulkan-runtime/src/compute.rs +++ b/crates/metal2vulkan-runtime/src/compute.rs @@ -59,7 +59,9 @@ use super::fetch_reach; use super::function_table::VisibleFunctionTable; use super::heap::Heap; use super::heap_sets; -use super::indirect_command_buffer::{IndirectCommandBuffer, IndirectCommandCheck}; +use super::indirect_command_buffer::{ + IndirectCommandBuffer, IndirectCommandCheck, IndirectCommandCheckNeeds, +}; use super::indirect_dispatch::{ self, ArgumentDispatch, Arguments, FlatCall, FlatPreprocess, HostDispatch, STAGE_IN_REGION_BYTES, @@ -1051,26 +1053,29 @@ impl ComputeCommandEncoder { /// records the execution from the records as the GPU and the CPU left them (an encoder made /// `icb` resident for writing, or the execution lies inside a block of command predication), /// the step first calls `check` with each command it will record, in order, before it records - /// any of them ([`IndirectCommandCheck`]). An execution recorded at the commit from the CPU's - /// records never calls it, and one with a check never runs on the GPU alone - /// (`VK_EXT_device_generated_commands`), so the step always reads the records. Refused as - /// [`execute_commands_in_buffer`](Self::execute_commands_in_buffer) refuses. + /// any of them ([`IndirectCommandCheck`]); `needs` is what it looks for + /// ([`IndirectCommandCheckNeeds`], the render encoder's shape). An execution recorded at the + /// commit from the CPU's records never calls it, and one with a check never runs on the GPU + /// alone (`VK_EXT_device_generated_commands`), whatever its `needs`, so the step always reads + /// the records. Refused as [`execute_commands_in_buffer`](Self::execute_commands_in_buffer) + /// refuses. pub fn execute_commands_in_buffer_checked( &mut self, icb: &IndirectCommandBuffer, range: Range, check: IndirectCommandCheck, + needs: IndirectCommandCheckNeeds, ) -> Result<(), Error> { - self.execute_range(icb, range, Some(check)) + self.execute_range(icb, range, Some((check, needs))) } /// [`execute_commands_in_buffer`](Self::execute_commands_in_buffer), with `check` for its - /// host step where one is given. + /// host step where one is given, and what it looks for. fn execute_range( &mut self, icb: &IndirectCommandBuffer, range: Range, - check: Option, + check: Option<(IndirectCommandCheck, IndirectCommandCheckNeeds)>, ) -> Result<(), Error> { self.log(|_| ComputeCall::Execute(icb.clone(), range.clone())); const CALL: &str = indirect_execute::CALL; @@ -1137,17 +1142,18 @@ impl ComputeCommandEncoder { offset: u64, check: IndirectCommandCheck, ) -> Result<(), Error> { + let check = (check, IndirectCommandCheckNeeds::ALL); self.execute_indirect_range(icb, range_buffer, offset, Some(check)) } /// [`execute_commands_in_buffer_indirect`](Self::execute_commands_in_buffer_indirect), with - /// `check` for its host step where one is given. + /// `check` for its host step where one is given, and what it looks for. fn execute_indirect_range( &mut self, icb: &IndirectCommandBuffer, range_buffer: &Buffer, offset: u64, - check: Option, + check: Option<(IndirectCommandCheck, IndirectCommandCheckNeeds)>, ) -> Result<(), Error> { self.log(|_| ComputeCall::ExecuteIndirect(icb.clone(), range_buffer.clone(), offset)); const CALL: &str = indirect_execute::CALL_INDIRECT; @@ -1195,7 +1201,7 @@ impl ComputeCommandEncoder { icb: &IndirectCommandBuffer, range: ExecutionRange, pipeline: Option, - check: Option, + check: Option<(IndirectCommandCheck, IndirectCommandCheckNeeds)>, ) -> Result<(), Error> { self.sync_heaps(); // Its commands run the states their records name, where it inherits none. @@ -1234,7 +1240,7 @@ impl ComputeCommandEncoder { ordered: self.dispatch_type == DispatchType::Serial, gate, preprocess_gate, - check: check.map(Mutex::new), + check: check.map(|(check, needs)| (Mutex::new(check), needs)), })))?; // Its commands may name any pipeline state. self.command_encoded(true); diff --git a/crates/metal2vulkan-runtime/src/deferred.rs b/crates/metal2vulkan-runtime/src/deferred.rs index 594f14fd3..d606b68fe 100644 --- a/crates/metal2vulkan-runtime/src/deferred.rs +++ b/crates/metal2vulkan-runtime/src/deferred.rs @@ -74,7 +74,7 @@ pub(super) struct Prepared { /// Its recording, where `commit` recorded it. pub(super) recorded: Option, /// `commit` recorded it for good, though the GPU may write what it reads: it runs on the GPU - /// alone (`gpu_execute.rs`), and no host step records it. + /// alone (`gpu_execute.rs`, `render/executions/gpu.rs`), and no host step records it. pub(super) for_good: bool, /// What its host step needs. pub(super) inputs: StepInputs, @@ -126,8 +126,10 @@ impl Deferred { /// the CPU's records is watched by its buffer for a host step `commit` did not foresee. An /// indirect dispatch's step needs its variants ([`ArgumentDispatch::settle`]); it is never /// recorded before its step. A render pass is recorded now from the CPU's records, unless - /// its step records it; that step's draws need the variants and pipelines of the states its - /// records may name ([`DeferredPass::settle`]). + /// its step records it; a pass its step would record is recorded now for good where its + /// executions run on the GPU alone (`DeferredPass::record_on_gpu`); otherwise the step's draws + /// need the variants and pipelines of the states its records may name + /// ([`DeferredPass::settle`]). pub(super) fn prepare( &self, command_buffer: &CommandBuffer, @@ -194,12 +196,22 @@ impl Deferred { retained: None, pipelines: false, }), - // Its step's draws compile what `commit` cannot foresee alone: it settles their - // variants and pipelines now (`DeferredPass::settle`), held until the command buffer - // completes. + // Recorded now for good where every execution whose records the GPU may write runs + // on the GPU alone (`render/executions/gpu.rs`). Otherwise its step's draws compile + // what `commit` cannot foresee alone: it settles their variants and pipelines now + // (`DeferredPass::settle`), held until the command buffer completes. // The step waits for the pipelines its draws record too (`render/pending.rs`). // And makes now what the step would make (`render/executions/ahead.rs`). Deferred::RenderPass(pass) if step => { + if let Some(recorded) = pass.record_on_gpu(command_buffer)? { + return Ok(Prepared { + recorded: Some(recorded), + for_good: true, + inputs: StepInputs::RenderPass, + retained: None, + pipelines: false, + }); + } pass.make_ahead(command_buffer); Ok(Prepared { recorded: None, @@ -288,6 +300,19 @@ impl Deferred { } } + /// Whether a route encoded since `commit` recorded the work for good on the GPU may write + /// more than `commit` decided on (`DeferredPass::outgrown`): its host step records it + /// instead, before its batch is submitted. A render pass's executions' GPU form alone. + pub(super) fn outgrown(&self) -> bool { + match self { + Deferred::RenderPass(pass) => pass.outgrown(), + Deferred::Execute(_) + | Deferred::Dispatch(_) + | Deferred::SparseScrub(_) + | Deferred::Pending(_) => false, + } + } + /// Whether a pipeline the work records is still being made (`render/pending.rs`). pub(super) fn making(&self) -> bool { match self { diff --git a/crates/metal2vulkan-runtime/src/degradation.rs b/crates/metal2vulkan-runtime/src/degradation.rs index cf8cac65f..8372b67bd 100644 --- a/crates/metal2vulkan-runtime/src/degradation.rs +++ b/crates/metal2vulkan-runtime/src/degradation.rs @@ -643,12 +643,14 @@ degradations! { encoder, and back to its home layout at its end"; /// An execution of an indirect command buffer that an encoder made resident for writing /// (`executeCommandsInBuffer:withRange:`), or that lies inside a block of command - /// predication or reads its range from a buffer, which the GPU cannot run alone: one with - /// the caller's check (`execute_commands_in_buffer_checked`), of a range read from a - /// buffer, of a buffer that inherits the encoder's buffers, or whose records may name a - /// pipeline state whose kernel observes its threadgroup partition or fetches - /// `[[stage_in]]` attributes. The GPU may write the records it runs, so they are known - /// only once the work before it completed. + /// predication or reads its range from a buffer, which the GPU cannot run alone: a compute + /// execution with the caller's check (`execute_commands_in_buffer_checked`), of a range + /// read from a buffer, of a buffer that inherits the encoder's buffers, or whose records + /// may name a pipeline state whose kernel observes its threadgroup partition or fetches + /// `[[stage_in]]` attributes; a render execution whose records may hold, at the commit or + /// as its batch is ready, more than draws of one primitive type under the encoder's state, + /// or what its check looks for (`render/executions/gpu.rs`). The GPU may write the records + /// it runs, so they are known only once the work before it completed. HostReplayedIndirectCommands = "host-replayed-indirect-commands", Performance, "one GPU-to-CPU round trip per execution: its command buffer's work before it, and \ every batch submitted before that on any queue, completes before the CPU records \ diff --git a/crates/metal2vulkan-runtime/src/encoder.rs b/crates/metal2vulkan-runtime/src/encoder.rs index 40300962c..d9a8e0695 100644 --- a/crates/metal2vulkan-runtime/src/encoder.rs +++ b/crates/metal2vulkan-runtime/src/encoder.rs @@ -117,10 +117,13 @@ impl Segment { /// Whether the host step records it before its batch is submitted: the GPU may write what /// its work reads, whether it could at the call or only since (`Deferred::gpu_written` is /// for good), or `commit` left it for the pipelines it records; or `commit`'s recording on the - /// GPU alone must be made again ([`rerecords`](Self::rerecords)). + /// GPU alone must be made again ([`rerecords`](Self::rerecords)); or `commit` recorded it on + /// the GPU for good, and a route encoded since may write more than it decided on + /// (`Deferred::outgrown`). pub(super) fn needs_step(&self) -> bool { (!self.stepped && (self.host || self.pipelines || self.work.gpu_written())) || self.rerecords() + || self.work.outgrown() } /// Whether `commit` recorded it on the GPU alone with no barrier between its commands and its @@ -133,7 +136,7 @@ impl Segment { /// Whether its host step waits for the work submitted before it to complete: the GPU may /// write what its work reads. A step for its pipelines alone waits for them alone. pub(super) fn steps_after_the_gpu(&self) -> bool { - !self.stepped && (self.host || self.work.gpu_written()) + (!self.stepped && (self.host || self.work.gpu_written())) || self.work.outgrown() } /// Whether its host step waits for a pipeline still being made. diff --git a/crates/metal2vulkan-runtime/src/indirect_command_buffer.rs b/crates/metal2vulkan-runtime/src/indirect_command_buffer.rs index 39d323e8c..9787048a0 100644 --- a/crates/metal2vulkan-runtime/src/indirect_command_buffer.rs +++ b/crates/metal2vulkan-runtime/src/indirect_command_buffer.rs @@ -2800,6 +2800,44 @@ fn low_bits(size: Size) -> [u32; 3] { /// commands run. A command buffer dropped before its host step never calls it. pub type IndirectCommandCheck = Box; +/// What an [`IndirectCommandCheck`] looks for among an execution's commands (a runtime extension; +/// Metal has none), given with it to `execute_commands_in_buffer_checked`. Where what the +/// buffer's records may hold, as the runtime last decides on before the execution runs, rules out +/// every kind it names, the check has nothing to see: an execution that then runs on the GPU +/// alone never calls it, and no host step reads the records for it. Where it does not, a host +/// step calls the check with every command, as for [`IndirectCommandCheckNeeds::ALL`]. +#[non_exhaustive] +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)] +pub struct IndirectCommandCheckNeeds { + /// Draws of points (`MTLPrimitiveTypePoint`): ruled out where no record may hold one + /// ([`IndirectCommandBuffer::command_writes`]; a primitive type the writes do not state, or + /// a value Metal has no type for, counts as a point). + pub point_draws: bool, + /// Commands that run a pipeline state that may encode, reset or copy indirect commands + /// (`can_encode_indirect_commands`): ruled out where no state the commands may run can (the + /// encoder's state where the buffer inherits it, and those its records may name, + /// [`IndirectCommandBuffer::may_name_encoding_states`]). + pub encoding_states: bool, +} + +impl IndirectCommandCheckNeeds { + /// Every kind: draws of points and commands under states that may encode. Where what the + /// records may hold rules out both, the check still has nothing to see. + pub const ALL: IndirectCommandCheckNeeds = IndirectCommandCheckNeeds { + point_draws: true, + encoding_states: true, + }; + + /// A check that looks for draws of points where `point_draws`, and for commands under states + /// that may encode indirect commands where `encoding_states`. + pub const fn new(point_draws: bool, encoding_states: bool) -> IndirectCommandCheckNeeds { + IndirectCommandCheckNeeds { + point_draws, + encoding_states, + } + } +} + /// One command of an indirect command buffer, as [`IndirectCommandBuffer::commands`] reads it: a /// runtime extension standing for Metal's private getters. #[non_exhaustive] diff --git a/crates/metal2vulkan-runtime/src/indirect_execute.rs b/crates/metal2vulkan-runtime/src/indirect_execute.rs index 0c2f6c44c..940a9974a 100644 --- a/crates/metal2vulkan-runtime/src/indirect_execute.rs +++ b/crates/metal2vulkan-runtime/src/indirect_execute.rs @@ -77,7 +77,8 @@ use super::encoder::{EncoderCore, RecordedSegment}; use super::error::{internal, invalid, Error, Problem}; use super::executed_commands::{ExecutedCommand, RecordsRead}; use super::indirect_command_buffer::{ - IndirectCommandBuffer, IndirectCommandBufferProblem, IndirectCommandCheck, Reader, + IndirectCommandBuffer, IndirectCommandBufferProblem, IndirectCommandCheck, + IndirectCommandCheckNeeds, Reader, }; use super::pipeline::{BufferForms, ComputePipelineState, IndirectStates, Variant}; use super::predication::HostGate; @@ -146,9 +147,9 @@ pub(super) struct Execute { /// range, which the step before it writes (`Predication::gates`). pub(super) preprocess_gate: Option, /// The caller's check of the commands its host step records - /// (`execute_commands_in_buffer_checked`): the step calls it before it records them, and it - /// keeps the execution off the GPU-alone path (`gpu_execute.rs`). - pub(super) check: Option>, + /// (`execute_commands_in_buffer_checked`), and what it looks for: the step calls it before it + /// records them, and it keeps the execution off the GPU-alone path (`gpu_execute.rs`). + pub(super) check: Option<(Mutex, IndirectCommandCheckNeeds)>, } /// The commands an execution runs. @@ -453,7 +454,7 @@ impl Execute { }; let written = self.icb.written_records(range.clone())?; // The caller's check sees each command the step will record, before it records any. - if let Some(check) = &self.check { + if let Some((check, _)) = &self.check { self.icb .check_recorded(check, range.start, &written.records); } diff --git a/crates/metal2vulkan-runtime/src/lib.rs b/crates/metal2vulkan-runtime/src/lib.rs index 698c0e8b1..a858ce4cc 100644 --- a/crates/metal2vulkan-runtime/src/lib.rs +++ b/crates/metal2vulkan-runtime/src/lib.rs @@ -283,8 +283,8 @@ pub use host_memory::{Deallocator, HostMemory, KeepAlive}; pub use indirect_command_buffer::{ EncodedComputeCommand, EncodedRenderCommand, IndirectBufferBinding, IndirectCommand, IndirectCommandBuffer, IndirectCommandBufferDescriptor, IndirectCommandBufferProblem, - IndirectCommandCheck, IndirectComputeCommand, IndirectDispatch, IndirectDraw, - IndirectRenderCommand, + IndirectCommandCheck, IndirectCommandCheckNeeds, IndirectComputeCommand, IndirectDispatch, + IndirectDraw, IndirectRenderCommand, }; pub use interop::SemaphoreProblem; pub use library::{Function, FunctionDescriptor, Library}; diff --git a/crates/metal2vulkan-runtime/src/owned_kernel.rs b/crates/metal2vulkan-runtime/src/owned_kernel.rs index 2e95ba5a8..388be66f2 100644 --- a/crates/metal2vulkan-runtime/src/owned_kernel.rs +++ b/crates/metal2vulkan-runtime/src/owned_kernel.rs @@ -58,6 +58,9 @@ pub(super) enum OwnedModule { /// `bind::replay_preprocess_module`: a device replay's preprocess, which reads every buffer /// at its device address (no storage buffer; its push bytes, `gpu_execute.rs`). ReplayPreprocess, + /// `bind::draw_replay_module`: a draw replay's preprocess, which reads every buffer at its + /// device address (no storage buffer; its push bytes, `render/executions/gpu.rs`). + DrawReplayPreprocess, /// `bind::flat_dispatch_module`: an indirect dispatch's region record and group counts on its /// flat variant, from Metal's arguments (`indirect_dispatch.rs`). No descriptor: it reaches /// memory by device address. @@ -239,6 +242,15 @@ impl OwnedModule { metal2vulkan::bind::ReplayPreprocessModule::PUSH_BYTES, )) } + OwnedModule::DrawReplayPreprocess => { + let module = metal2vulkan::bind::draw_replay_module(device.compile_device()) + .map_err(Error::Compile)?; + Ok(( + module.spirv.to_vec(), + 0, + metal2vulkan::bind::DrawReplayModule::PUSH_BYTES, + )) + } OwnedModule::FlatDispatch => { let module = metal2vulkan::bind::flat_dispatch_module(device.compile_device()) .map_err(Error::Compile)?; @@ -452,6 +464,7 @@ pub(super) struct OwnedKernels { index_bounds_plan: Option, index_bounds_fill: Option, replay_preprocess: Option, + draw_replay_preprocess: Option, flat_dispatch: Option, shadow_merge: Option, depth_magnitude: Option, @@ -492,6 +505,7 @@ impl OwnedKernels { self.index_bounds_plan, self.index_bounds_fill, self.replay_preprocess, + self.draw_replay_preprocess, self.flat_dispatch, self.shadow_merge, self.depth_magnitude, @@ -612,6 +626,7 @@ impl OwnedKernels { OwnedModule::IndexBoundsPlan => &mut self.index_bounds_plan, OwnedModule::IndexBoundsFill => &mut self.index_bounds_fill, OwnedModule::ReplayPreprocess => &mut self.replay_preprocess, + OwnedModule::DrawReplayPreprocess => &mut self.draw_replay_preprocess, OwnedModule::FlatDispatch => &mut self.flat_dispatch, OwnedModule::ShadowMerge => &mut self.shadow_merge, OwnedModule::DepthMagnitude => &mut self.depth_magnitude, diff --git a/crates/metal2vulkan-runtime/src/pipeline/mod.rs b/crates/metal2vulkan-runtime/src/pipeline/mod.rs index 1cf375414..58448d5d6 100644 --- a/crates/metal2vulkan-runtime/src/pipeline/mod.rs +++ b/crates/metal2vulkan-runtime/src/pipeline/mod.rs @@ -1036,6 +1036,7 @@ impl ComputePipelineState { .dispatch_variant(dispatch) .map_err(Error::Bind)? .large_buffer_form(&self.0.base.pipeline().dependencies, shape), + BufferForms::Replay => return Err(internal("a dispatch in a draw replay's forms")), }; // A stand-in compile is never dispatched: a plan whose bound formats are the stand-ins' // takes a variant of its own (the same compile, from the shader cache). @@ -1046,7 +1047,7 @@ impl ComputePipelineState { let plan = variant.plan(&self.0.device, shape)?; let settled = plan.dispatch_variant(dispatch).map_err(Error::Bind)?; let runs = match forms { - BufferForms::Bound => settled == variant.key, + BufferForms::Bound | BufferForms::Replay => settled == variant.key, BufferForms::Large => variant.key.covers(&settled), }; if !runs { @@ -1075,6 +1076,7 @@ impl ComputePipelineState { BufferForms::Large => plan .variant .large_buffer_form(&self.0.base.pipeline().dependencies, shape), + BufferForms::Replay => return Err(internal("a dispatch in a draw replay's forms")), }; let mut keys = vec![key.clone()]; // One thread: a threadgroup no tier runs as whole simdgroups. @@ -1270,6 +1272,10 @@ pub(super) enum BufferForms { /// aligned block within the buffer are contained, and an out-of-bounds load reads 0 under /// `robustBufferAccess` too. On a device without device addresses, as `Bound`. Large, + /// A draw replay's (`render/gpu_executions.rs`): the vertex and fragment functions read every + /// buffer through the slot table of the replayed command (`VariantKey::replay_bindings`), so + /// no buffer is bound. A render pipeline's alone. + Replay, } /// The states of a device made with `supportIndirectCommandBuffers` as they were at a moment, diff --git a/crates/metal2vulkan-runtime/src/pipeline/render.rs b/crates/metal2vulkan-runtime/src/pipeline/render.rs index d49de9efe..b80d7bf51 100644 --- a/crates/metal2vulkan-runtime/src/pipeline/render.rs +++ b/crates/metal2vulkan-runtime/src/pipeline/render.rs @@ -1886,6 +1886,11 @@ impl GraphicsState { BufferForms::Large => plan .variant .large_buffer_form(&base.pipeline.dependencies, shape), + BufferForms::Replay => { + let mut key = plan.variant.clone(); + key.replay_bindings = true; + key + } }; // A stand-in compile is never drawn: a plan whose bound formats are the stand-ins' takes // a variant of its own (the same compile, from the shader cache). @@ -1895,7 +1900,7 @@ impl GraphicsState { let variant = self.variant(&wanted)?; let plan = variant.plan(&self.0.device, shape)?; let runs = match forms { - BufferForms::Bound => plan.variant == variant.key, + BufferForms::Bound | BufferForms::Replay => plan.variant == variant.key, BufferForms::Large => variant.key.covers(&plan.variant), }; if !runs { diff --git a/crates/metal2vulkan-runtime/src/render.rs b/crates/metal2vulkan-runtime/src/render.rs index 8f6836af8..4f9930f1c 100644 --- a/crates/metal2vulkan-runtime/src/render.rs +++ b/crates/metal2vulkan-runtime/src/render.rs @@ -1169,8 +1169,12 @@ pub struct RenderCommandEncoder { keeping: capture::Keeping, /// The buffer forms its draws' variants take (`BufferForms`): the large-buffer form where it /// records an execution's commands at its host step, or settles their variants at commit - /// (`render/executions.rs`), so no buffer a command binds asks for another variant. + /// (`render/executions.rs`), so no buffer a command binds asks for another variant; the + /// replay form where it records an execution's GPU form (`render/executions/gpu.rs`). forms: BufferForms, + /// Where it records an execution's GPU form, the replay's draws, which its draw records in + /// place of its own (`render/executions/gpu.rs`). + replayed: Option, /// Where the encoder records an execution's commands, the tracked uses of the pass's draws /// before the execution, in the stages a draw runs in inside its pass (`PASS_DRAW_STAGES`): /// which an emulated mesh command's dispatches, recorded before the pass, must not touch but @@ -1720,6 +1724,7 @@ impl RenderCommandEncoder { rerouting: false, keeping, forms: BufferForms::Bound, + replayed: None, drawn_before: Vec::new(), run_barrier: false, command_barrier: false, @@ -8337,6 +8342,12 @@ impl RenderCommandEncoder { }; // The draw's push bytes, filled in place, over the last draw's (`LiveBind::pushes`). binding::push_writes_into(&commands.push_constants, &bound.holes, &mut live.pushes)?; + // A device replay's draws read each command's slot tables (`render/executions/gpu.rs`): + // the first command's, in place of the root tables the binder made. + let replay_holes = match &self.replayed { + Some(replayed) => replayed.first_tables(&commands.push_holes, &mut live.pushes)?, + None => Vec::new(), + }; let push = &live.pushes; // A plan that draws one amplification at a time records the draw once per amplification, // in order, each after that amplification's push writes. @@ -8783,6 +8794,21 @@ impl RenderCommandEncoder { if inline.is_none() && split_inline.is_none() { self.begin_new_draws(&mut next)?; } + // A device replay's draws record as one recording of the draw's, each command's after it + // (`ReplayedDraws::record`), which its decision at commit holds to. + if self.replayed.is_some() + && (pushes.len() != 1 + || vk_draws.len() != 1 + || !chunked.is_empty() + || pair_base.is_some() + || !matches!(draw_states, DrawStates::Whole(_)) + || !matches!(draw_pipeline, DrawPipeline::Made(_)) + || !matches!(self.inline, inline_first::Inline::Never)) + { + return Err(internal( + "a draw replay's draw of other recordings than one", + )); + } // Recording starts here: nothing below can be refused. self.driver_restarts |= tessellation.is_some_and(|t| !t.emulated); if !pushed.is_empty() { @@ -9075,7 +9101,14 @@ impl RenderCommandEncoder { true => &mut self.held_bound, false => &mut self.current.bound, }; - states_recorded += unsafe { recording.record(bound) } + // A device replay's: each command's draw after it + // (`render/executions/gpu.rs`). + states_recorded += match &self.replayed { + Some(replayed) => unsafe { + replayed.record(&recording, bound, &replay_holes) + }, + None => unsafe { recording.record(bound) }, + } } (None, _) => owned.push(recording.owned()), } diff --git a/crates/metal2vulkan-runtime/src/render/executions.rs b/crates/metal2vulkan-runtime/src/render/executions.rs index 322b9fb8f..aee7f227a 100644 --- a/crates/metal2vulkan-runtime/src/render/executions.rs +++ b/crates/metal2vulkan-runtime/src/render/executions.rs @@ -19,8 +19,10 @@ //! of no draws that resolve after the last). `commit` records the segment from the CPU's //! records; where an //! encoder made a buffer the pass executes resident for writing -//! (`IndirectCommandBuffer::gpu_written`), the scheduler's host step records it once the work -//! before it completed, which the device announces once +//! (`IndirectCommandBuffer::gpu_written`), `commit` records it for good where every such +//! execution of the pass runs on the GPU alone (`executions/gpu.rs`, which states which do and +//! when the decision is taken again), and otherwise the scheduler's host step records it once +//! the work before it completed, which the device announces once //! (`Degradation::HostReplayedIndirectCommands`). The step draws in the large-buffer form, //! whose variant no command's buffer lengths change (`BufferForms::Large`), and the commit //! settles what it will draw (the step compiled each draw's variant and `VkPipeline` as it met @@ -272,7 +274,8 @@ use crate::error::{internal, invalid, vulkan, Error, Problem, RuntimeGap}; use crate::executed_commands::{ExecutedCommand, RecordsRead}; use crate::fragment_imageblock::PassImageblock; use crate::indirect_command_buffer::{ - IndirectCommandBuffer, IndirectCommandBufferProblem, IndirectCommandCheck, Reader, + IndirectCommandBuffer, IndirectCommandBufferProblem, IndirectCommandCheck, + IndirectCommandCheckNeeds, Reader, }; use crate::indirect_dispatch; use crate::indirect_execute::{self, ExecutionRange}; @@ -295,22 +298,25 @@ use crate::tracker::{ Barrier, EncoderUses, GeometryWrites, IndirectReads, Summary, UnorderedWrites, Use, }; use crate::visibility::{Lent, Visibility}; -use crate::written_commands::Writers; +use crate::written_commands::{Writers, WrittenCommands}; use crate::Device; use ahead::Ahead; use ash::vk; +use gpu::GpuForm; +pub(super) use gpu::ReplayedDraws; use metal2vulkan::bind::indirect_commands::{Action, BufferStage, CommandRecord}; use metal2vulkan::bind::{DrawCall, ReplayFaults, ViewSetup}; use metal2vulkan::metal::{ IndexType, IndirectCommandType, PrimitiveTopologyClass, PrimitiveType, VertexStepFunction, }; -use metal2vulkan::pipeline::VertexStride; +use metal2vulkan::pipeline::{CommandWrites, VertexStride}; use std::borrow::Cow; use std::collections::{BTreeMap, BTreeSet}; use std::ops::Range; use std::sync::{Arc, Mutex, OnceLock}; mod ahead; +mod gpu; /// The call an execution's refusals name. const CALL: &str = "execute_commands_in_buffer"; @@ -359,29 +365,33 @@ impl RenderCommandEncoder { } /// [`execute_commands_in_buffer`](Self::execute_commands_in_buffer) with a check of the - /// commands its host step runs (a runtime extension; Metal has none): where a host step - /// records the pass from the records as the GPU and the CPU left them (an encoder made `icb` - /// resident for writing, `IndirectCommandBuffer::gpu_written`), the step first calls `check` - /// with each command of the range it will record, in order, before it records any of them - /// ([`IndirectCommandCheck`]). An execution `commit` records from the CPU's records never - /// calls it. Refused as [`execute_commands_in_buffer`](Self::execute_commands_in_buffer) - /// refuses. + /// commands its host step runs (a runtime extension; Metal has none), which looks for `needs`: + /// where a host step records the pass from the records as the GPU and the CPU left them (an + /// encoder made `icb` resident for writing, `IndirectCommandBuffer::gpu_written`), the step + /// first calls `check` with each command of the range it will record, in order, before it + /// records any of them ([`IndirectCommandCheck`]). An execution `commit` records from the CPU's + /// records never calls it; nor does one that runs on the GPU alone (`render/executions/gpu.rs`), + /// which it may only where what `icb`'s records may hold, at the commit and again as the + /// pass's batch is ready to submit, rules out every kind `needs` names + /// ([`IndirectCommandCheckNeeds`], [`IndirectCommandCheckNeeds::ALL`] included). Refused as + /// [`execute_commands_in_buffer`](Self::execute_commands_in_buffer) refuses. pub fn execute_commands_in_buffer_checked( &mut self, icb: &IndirectCommandBuffer, range: Range, check: IndirectCommandCheck, + needs: IndirectCommandCheckNeeds, ) -> Result<(), Error> { - self.execute_range(icb, range, Some(check)) + self.execute_range(icb, range, Some((check, needs))) } /// [`execute_commands_in_buffer`](Self::execute_commands_in_buffer), with `check` for its - /// host step where one is given. + /// host step where one is given, and what it looks for. fn execute_range( &mut self, icb: &IndirectCommandBuffer, range: Range, - check: Option, + check: Option<(IndirectCommandCheck, IndirectCommandCheckNeeds)>, ) -> Result<(), Error> { self.log(|_| RenderCall::Execute(icb.clone(), range.clone())); self.core.check_device(CALL, icb.device())?; @@ -456,17 +466,18 @@ impl RenderCommandEncoder { offset: u64, check: IndirectCommandCheck, ) -> Result<(), Error> { + let check = (check, IndirectCommandCheckNeeds::ALL); self.execute_indirect_range(icb, range_buffer, offset, Some(check)) } /// [`execute_commands_in_buffer_indirect`](Self::execute_commands_in_buffer_indirect), with - /// `check` for its host step where one is given. + /// `check` for its host step where one is given, and what it looks for. fn execute_indirect_range( &mut self, icb: &IndirectCommandBuffer, range_buffer: &Buffer, offset: u64, - check: Option, + check: Option<(IndirectCommandCheck, IndirectCommandCheckNeeds)>, ) -> Result<(), Error> { self.log(|_| RenderCall::ExecuteIndirect(icb.clone(), range_buffer.clone(), offset)); const CALL_INDIRECT: &str = indirect_execute::CALL_INDIRECT; @@ -551,7 +562,7 @@ impl RenderCommandEncoder { icb: &IndirectCommandBuffer, range: ExecutionRange, pipeline: Option, - check: Option, + check: Option<(IndirectCommandCheck, IndirectCommandCheckNeeds)>, ) -> Result<(), Error> { self.sync_heaps(); // Its commands run the states their records name, where it inherits none. @@ -764,7 +775,10 @@ impl RenderCommandEncoder { snapshot, shadows, lent, - check: check.map(Mutex::new), + needs: check + .as_ref() + .map_or(IndirectCommandCheckNeeds::ALL, |(_, needs)| *needs), + check: check.map(|(check, _)| Mutex::new(check)), }); // Its commands may name any pipeline state, reading handles in any stage. self.command_encoded(every_render_stage()); @@ -818,6 +832,9 @@ pub(crate) struct RenderExecution { /// The caller's check of the commands the host step records /// (`execute_commands_in_buffer_checked`), which the step calls before it records them. check: Option>, + /// What the check looks for, which decides whether the execution may run on the GPU alone + /// (`gpu.rs`): every kind where it has no check. + needs: IndirectCommandCheckNeeds, } /// The encoder's state an execution's draws take: as the call found it, its tables only where @@ -1799,18 +1816,23 @@ impl RenderExecution { /// part `None` where no draw made it yet), in a pass whose instances `rendered` lays out, /// with `residency`, the command buffer's (`residency.rs`): from the CPU's records as they /// stand now, or, for the host step (`step`), from the records as the GPU and the CPU left - /// them. Commands that run as several back the pass's memoryless attachments - /// (`Rendered::back_memoryless`). + /// them; or in its GPU form (`gpu`), whose records the host never reads (`gpu.rs`). Commands + /// that run as several back the pass's memoryless attachments (`Rendered::back_memoryless`). fn record( &self, core: EncoderCore, (command_buffer, residency): (&CommandBuffer, &Residency), - (step, splits): (bool, bool), + (step, splits, gpu): (bool, bool, Option<&GpuForm>), found: &mut Found, (storage, rendered): (PassStorage, &mut Rendered), ) -> Result { let snapshot = &self.snapshot; let device = command_buffer.device().clone(); + if let Some(form) = gpu { + let encoder = + self.record_gpu(core, (command_buffer, residency), form, (storage, rendered))?; + return self.finish(encoder, found, rendered, &device); + } let (commands, faults) = self.commands(&device, step)?; found.faults = ReplayFaults(found.faults.0 | faults.0); // What the commands run, for the command buffer's handlers (`executed_commands.rs`). @@ -2002,6 +2024,21 @@ impl RenderExecution { } } } + self.finish(encoder, found, rendered, &device) + } + + /// The recording `encoder` made of the commands, its runs ended (`record`'s): what its draws + /// noted into `found`, the pass's memoryless attachments backed into `rendered` where its + /// commands ran as several, and each run's steps. + fn finish( + &self, + mut encoder: RenderCommandEncoder, + found: &mut Found, + rendered: &mut Rendered, + device: &Device, + ) -> Result { + let snapshot = &self.snapshot; + let raw = device.shared().vk(); // The lent query, or the last spare the replay took, ends in the last run; every spare // left begins and ends there, empty. encoder.visibility.end(raw, encoder.current.draws); @@ -2054,7 +2091,7 @@ impl RenderExecution { }; let steps = match &other { Some((shape, _)) if !shape.storage.is_empty() || !framed.is_empty() => { - RunSteps::plan(&device, &layout, pass, (&shape.storage, &framed))? + RunSteps::plan(device, &layout, pass, (&shape.storage, &framed))? } Some(_) | None => None, }; @@ -2193,6 +2230,7 @@ impl RenderExecution { rerouting: false, keeping: super::capture::Keeping::Stopped, forms, + replayed: None, drawn_before: snapshot.drawn.clone(), run_barrier: false, command_barrier: false, @@ -2398,6 +2436,11 @@ pub(crate) struct DeferredPass { shadowed: bool, /// What the commit made ahead for the host step that records it (`ahead.rs`), once made. ahead: OnceLock>, + /// Where `commit` recorded the pass with executions in their GPU form (`gpu.rs`), what each + /// such execution's buffer's records may hold as the decision found it: a route encoded + /// since that adds to it sends the pass to the host step ([`outgrown`](Self::outgrown)), + /// which empties it. + on_gpu: Mutex, CommandWrites)>>, } /// One render pass instance of a [`DeferredPass`]. @@ -2465,6 +2508,7 @@ impl DeferredPass { bare, shadowed, ahead: OnceLock::new(), + on_gpu: Mutex::new(Vec::new()), } } @@ -2594,8 +2638,73 @@ impl DeferredPass { &self, command_buffer: &CommandBuffer, step: bool, + ) -> Result { + self.record_forms(command_buffer, step, &[]) + } + + /// Record the pass at commit, for good, where every execution whose records the GPU may write + /// takes its GPU form (`gpu.rs`, [`RenderExecution::gpu_form`]) and the others read the CPU's + /// records as they stand now; `None` where one does not, and a host step records the pass. + /// The pipelines its draws record are waited for first. + pub(crate) fn record_on_gpu( + &self, + command_buffer: &CommandBuffer, + ) -> Result, Error> { + if self.shadowed || self.executions.iter().any(|e| e.range.indirect()) { + return Ok(None); + } + let residency = command_buffer.residency()?; + let mut core = EncoderCore::segment(command_buffer, false)?; + let mut forms = Vec::with_capacity(self.executions.len()); + for execution in &self.executions { + if !execution.icb.gpu_written() { + forms.push(None); + continue; + } + let (back, form) = execution.gpu_form(core, (self.storage.clone(), &residency)); + core = back; + match form { + Some(form) => forms.push(Some(form)), + None => return Ok(None), + } + } + drop(core); + self.wait_made(); + if self.making() || self.failed() { + return Ok(None); + } + let recorded = self.record_forms(command_buffer, false, &forms)?; + let decided = (self.executions.iter().zip(&forms)).filter_map(|(execution, form)| { + Some((Arc::clone(execution.icb.written()), form.as_ref()?.decided)) + }); + *lock(&self.on_gpu) = decided.collect(); + // What a host step needs where a route outgrows the decision (`outgrown`), made now on + // the committing thread, as for any pass a host step records. + self.make_ahead(command_buffer); + Ok(Some(recorded)) + } + + /// Whether a route encoded since `commit` recorded the pass with executions in their GPU form + /// may write more into one of their buffers than the decision found (`gpu.rs`): a route that + /// runs before the pass, which a command buffer enqueued before its own and committed after it + /// may hold, may have written commands the GPU form does not run. Until its batch is + /// submitted, the host step records the pass instead (`Deferred::outgrown`). + pub(crate) fn outgrown(&self) -> bool { + lock(&self.on_gpu) + .iter() + .any(|(written, decided)| written.writes() != *decided) + } + + /// [`record`](Self::record), each execution with a GPU form among `forms` (by index) in it. + fn record_forms( + &self, + command_buffer: &CommandBuffer, + step: bool, + forms: &[Option], ) -> Result { if step { + // The host step records what a GPU form left to it, for good. + lock(&self.on_gpu).clear(); self.degrade_repeated_start(command_buffer.device())?; } // The executions resolve and bind against the command buffer's resident resources, @@ -2636,10 +2745,11 @@ impl DeferredPass { .iter() .any(|piece| matches!(*piece, Piece::Execution(x) if x == at)) }); + let gpu = forms.get(at).and_then(Option::as_ref); let back = execution.record( core, (command_buffer, &residency), - (step, splits), + (step, splits, gpu), &mut found, (storage, &mut rendered), )?; diff --git a/crates/metal2vulkan-runtime/src/render/executions/gpu.rs b/crates/metal2vulkan-runtime/src/render/executions/gpu.rs new file mode 100644 index 000000000..893445e79 --- /dev/null +++ b/crates/metal2vulkan-runtime/src/render/executions/gpu.rs @@ -0,0 +1,601 @@ +//! The GPU form of an execution of render commands the GPU may write: its records never return +//! to the host. `commit` records the pass for good where every such execution of it takes this +//! form ([`DeferredPass::record_on_gpu`](super::DeferredPass::record_on_gpu)); otherwise a host +//! step records the pass from the records as the GPU and the CPU left them (the module docs of +//! `render/executions.rs`), which the device announces (`Degradation::HostReplayedIndirectCommands`). +//! +//! - **What takes it** ([`RenderExecution::gpu_form`]), decided at commit from the call and from +//! what the buffer's records may hold (`written_commands.rs`), never from the records: an +//! execution of a range given at the call, not empty, with no visibility result mode set, whose +//! caller's check, if it has one (`execute_commands_in_buffer_checked`), has nothing to see +//! there (`IndirectCommandCheckNeeds`: no draw of points, a primitive type the writes do not +//! state counting as one, where it looks for them; the encoder's state encodes no indirect +//! commands, where it looks for such states), so it is never called; of a buffer of draws of primitives alone (`IndirectCommandType::DRAW`) that +//! inherits the encoder's pipeline state and not its buffers, and whose records the CPU and +//! every encoder that made it resident for writing may fill with draws of one primitive type, +//! buffers, resets and cleared barriers alone; in a pass with no shadowed texture, whose +//! fragment stages wrote no bytes before the call (no copy of them is read, +//! `render/pass_start_reads.rs`), with no tile threadgroup memory argument set. The state is +//! one the pass takes (`check_pipeline`), neither a tessellation nor a mesh one, whose fragment +//! function writes no memory, nor its vertex function where it rasterizes (no command's draw +//! waits on another's, `render_target::after_geometry_writes`), and whose vertex function +//! fetches no attribute; its replay variant (`VariantKey::replay_bindings`) +//! compiles and draws in the execution's instance as one indirect draw whose arguments the +//! device reads (`DrawCommands::indirect_needs_arguments` clear): no amplification drawn apart, +//! view, rate map, fragment imageblock, fetched or storage attachment, shader-side stencil or +//! depth test, or color in another format. And the device has device addresses +//! (`bind::draw_replay_preprocess`). +//! - **What runs.** Before the pass, the replay's preprocess (`bind::draw_replay_module`, an +//! owned kernel) over the range: it reads each record where the GPU and the CPU left it, checks +//! it as the host's decode does, and writes the command's vertex and fragment slot tables and +//! its `VkDrawIndirectCommand` into the scratch, a region of the command buffer's upload arena; +//! then a barrier from everything before to everything after. In the execution's instance, one +//! draw per command, in order, of the inherited state's replay variant: the first command's +//! draws through the encoder's draw (`RenderCommandEncoder::draw`, `BufferForms::Replay`), which +//! binds the pipeline, the sets, the dynamic state and the push constants with its slot tables, +//! and each later command's pushes its own slot tables and draws (`vkCmdDrawIndirect` of one +//! draw at its arguments). Its `vertex_id`, `instance_id` and `base_instance` are the command's +//! own, as Metal's. +//! - **What the commands reach.** Their buffers' addresses resolve in the replay's resident set: +//! the command buffer's resident resources, then the device's live buffers Metal reaches +//! unnamed (`live_buffers.rs`), as the host step resolves them. One in neither is unbound +//! (reading zero) and counted in the execution report (its resident misses), and the command +//! draws, as the host step's. +//! - **Decided again as the batch is ready.** What the records may hold can grow after the +//! commit: a CPU setter, or a route encoded since. Where it grew by the time the pass's batch is +//! otherwise ready to submit (`DeferredPass::outgrown`, `Segment::needs_step`), the host step +//! records the pass instead, as for any pass whose records the GPU may write, and calls the +//! caller's check. Every writer the runtime orders before the pass was committed by then: a +//! queue's batches go in commit order, and a batch that waits for an event is ready only once a +//! submitted signal reaches it. A CPU write after that races the GPU, as on Metal. +//! - **Faults.** A record the host's decode refuses draws nothing, and the execution report +//! states why (`bind::ReplayFaults`), as the host step's; the others draw. + +use std::ops::Range; +use std::sync::Arc; + +use super::super::bound::{Bound, Recorded}; +use super::super::pass_start_reads::PassStartTables; +use super::super::{Assembly, DrawBuffers, Recording, RenderCommandEncoder}; +use super::{PassStorage, RenderExecution, Rendered, CALL}; +use crate::binding::PushWrite; +use crate::blit::{reads_by, writes_by}; +use crate::command_buffer::CommandBuffer; +use crate::device::lock; +use crate::draw_source::DrawSource; +use crate::encoder::EncoderCore; +use crate::error::{internal, Error}; +use crate::executed_commands::RecordsRead; +use crate::indirect_execute::ExecutionRange; +use crate::live_buffers::LiveTable; +use crate::owned_kernel::OwnedModule; +use crate::pipeline::{BufferForms, RenderStateKind, Settled}; +use crate::residency::Residency; +use crate::sampler::ArgumentSamplers; +use crate::tracker::{Access, Barrier}; +use crate::visibility::Visibility; +use crate::Device; +use ash::vk; +use metal2vulkan::bind::{ + draw_replay_preprocess, BindState, DrawCall, DrawReplay, DrawReplayLayout, + DrawReplayPreprocess, IndirectRef, NeutralResource, PushHole, ViewSetup, DRAW_ARGUMENT_BYTES, +}; +use metal2vulkan::metal::{IndirectCommandType, PrimitiveType}; +use metal2vulkan::pipeline::{CommandWrites, SlotClass, Stage}; + +/// What the records of an execution that takes the GPU form may hold beside draws: buffers, +/// resets and cleared barriers. +const GPU_FORM_WRITES: u32 = CommandWrites::DRAW + | CommandWrites::BUFFER + | CommandWrites::RESET + | CommandWrites::CLEAR_BARRIER; + +/// An execution's GPU form, decided at commit ([`RenderExecution::gpu_form`]). +pub(super) struct GpuForm { + /// What the buffer's records may hold, as the decision found it: a route encoded since that + /// adds to it sends the pass to the host step (`DeferredPass::outgrown`). + pub(super) decided: CommandWrites, + /// The primitive type every command that draws draws. + primitive_type: PrimitiveType, + /// The replay's preprocess over the command buffer's resident set and `live`'s buffers. + pre: DrawReplayPreprocess, + /// The device's live buffers the resident set holds. + live: Arc, +} + +/// The slot table one push hole of a replayed draw names: the vertex function's or the fragment +/// function's. +#[derive(Clone, Copy)] +enum Table { + Vertex, + Fragment, +} + +/// A push hole of a replayed draw that takes a command's slot table: its stages and offset. +pub(in crate::render) struct TableHole { + stages: vk::ShaderStageFlags, + offset: u32, + table: Table, +} + +/// A draw replay's draws, which the encoder that records an execution's GPU form records in +/// place of its draw's own (`RenderCommandEncoder::draw`): every command's of the range, the +/// first through the draw's recording. +pub(in crate::render) struct ReplayedDraws { + /// The scratch's device address, and its `VkBuffer` and offset there. + address: u64, + buffer: vk::Buffer, + offset: u64, + layout: DrawReplayLayout, +} + +impl ReplayedDraws { + /// The holes of `holes` (the draw's push holes) that take a slot table, each filled in + /// `pushes` (the draw's push writes) with the first command's: the binder's root tables + /// are none of the commands'. Refused (internal) for a hole of other stages than one + /// function's, or one no push write covers. + pub(in crate::render) fn first_tables( + &self, + holes: &[PushHole], + pushes: &mut [PushWrite], + ) -> Result, Error> { + let mut tables = Vec::new(); + for hole in holes { + let PushHole::RootTableAddress { stages, offset } = *hole else { + continue; + }; + let stages: vk::ShaderStageFlags = stages.into(); + let table = match stages { + vk::ShaderStageFlags::VERTEX => Table::Vertex, + vk::ShaderStageFlags::FRAGMENT => Table::Fragment, + _ => return Err(internal("a replayed draw's slot table of several stages")), + }; + let hole = TableHole { + stages, + offset, + table, + }; + let write = pushes + .iter_mut() + .find(|(of, start, bytes)| { + *of == stages + && *start <= offset + && offset as usize + 8 <= *start as usize + bytes.len() + }) + .ok_or_else(|| internal("no push write covers a replayed draw's slot table"))?; + let at = (offset - write.1) as usize; + write.2[at..at + 8].copy_from_slice(&self.table(&hole, 0).to_le_bytes()); + tables.push(hole); + } + Ok(tables) + } + + /// The device address of `hole`'s slot table of the `command`th command of the range. + fn table(&self, hole: &TableHole, command: u32) -> u64 { + self.address + + match hole.table { + Table::Vertex => self.layout.vertex_table_offset(command), + Table::Fragment => self.layout.fragment_table_offset(command), + } + } + + /// Record the commands' draws: `first`, the first command's recording, then for each later + /// command the push writes of its slot tables at `holes` and one `vkCmdDrawIndirect` of one + /// draw at its arguments, in order; the pipeline, sets and dynamic state `first` bound hold + /// for them all. The state commands they recorded. + /// + /// # Safety + /// + /// As [`Recording::record`]'s; the scratch is live until the command buffer completes. + pub(in crate::render) unsafe fn record( + &self, + first: &Recording<'_>, + bound: &mut Bound, + holes: &[TableHole], + ) -> Recorded { + // SAFETY: the caller's contract. + let mut recorded = unsafe { first.record(bound) }; + let (raw, command_buffer, layout) = (first.raw, first.command_buffer, first.layout); + let mut writes: Vec = holes + .iter() + .map(|hole| (hole.stages, hole.offset, vec![0; 8])) + .collect(); + for command in 1..self.layout.commands { + for (write, hole) in writes.iter_mut().zip(holes) { + write + .2 + .copy_from_slice(&self.table(hole, command).to_le_bytes()); + } + // SAFETY: the caller's contract; each write lies in a push range of its stages under + // `layout`, as the first command's write it lies in did, and the arguments lie in the + // scratch, which holds `INDIRECT_BUFFER` usage as every upload chunk does. + unsafe { + if !writes.is_empty() && bound.pushes(layout, &writes) { + for (stages, offset, bytes) in &writes { + raw.cmd_push_constants(command_buffer, layout, *stages, *offset, bytes); + } + recorded.states += 1; + } + raw.cmd_draw_indirect( + command_buffer, + self.buffer, + self.offset + self.layout.argument_offset(command, 0), + 1, + DRAW_ARGUMENT_BYTES as u32, + ); + } + } + recorded + } +} + +impl RenderExecution { + /// The execution's GPU form, settled through an encoder of `core` that records nothing, over + /// the pass's `storage`, with `residency`, the command buffer's (the module docs); `None` + /// where it takes the host step. Returns the core. Announces nothing: it draws nothing. + pub(super) fn gpu_form( + &self, + core: EncoderCore, + (storage, residency): (PassStorage, &Residency), + ) -> (EncoderCore, Option) { + let (Some((decided, primitive_type, range)), Some(pipeline)) = + (self.gpu_commands(), &self.pipeline) + else { + return (core, None); + }; + let RenderStateKind::Graphics(state) = pipeline.kind() else { + return (core, None); + }; + let snapshot = &self.snapshot; + let visibility = Visibility::settling(snapshot.layout.visibility.clone(), None); + let mut encoder = self.replay_encoder( + core, + (vk::CommandBuffer::null(), visibility), + (storage, snapshot.layout.clone(), residency), + BufferForms::Replay, + ); + let slots = encoder.check_pipeline(CALL, pipeline).and_then(|()| { + encoder.pipeline = Some(pipeline.clone()); + encoder.replay_draw_of(state, primitive_type) + }); + let RenderCommandEncoder { core, .. } = encoder; + let form = match slots { + Ok(Some(slots)) => { + let commands = (decided, primitive_type, range); + self.preprocess(core.device(), residency, commands, slots) + } + Ok(None) | Err(_) => None, + }; + (core, form) + } + + /// What the buffer's records may hold, the primitive type and the range of an execution that + /// may take the GPU form, from the call and that alone (the module docs); `None` for any + /// other. + fn gpu_commands(&self) -> Option<(CommandWrites, PrimitiveType, Range)> { + let ExecutionRange::Fixed(range) = &self.range else { + return None; + }; + let descriptor = self.icb.descriptor(); + let written = self.icb.written().writes(); + let takes = !range.is_empty() + && self.check_has_nothing_to_see(written) + && self.lent.is_none() + && descriptor.command_types == IndirectCommandType::DRAW + && descriptor.inherit_pipeline_state + && !descriptor.inherit_buffers + && written.operations & !GPU_FORM_WRITES == 0 + && written.may(CommandWrites::DRAW) + && written.primitive_types.count_ones() == 1 + && !self.reaches_tile_memory() + && self.shadows.is_empty() + && !self.snapshot.pass_start.fragment_wrote(); + if !takes { + return None; + } + let primitive_type = + PrimitiveType::try_from(written.primitive_types.trailing_zeros()).ok()?; + Some((written, primitive_type, range.clone())) + } + + /// Whether the caller's check, if any, has nothing to see among commands whose records may + /// hold `written`, under the encoder's state, which the buffer inherits: neither draws of + /// points (a primitive type the writes do not state counts as one) nor a state that may encode + /// indirect commands where it looks for them (`IndirectCommandCheckNeeds`). + fn check_has_nothing_to_see(&self, written: CommandWrites) -> bool { + let needs = self.needs; + let points = written.may_draw_primitive_type(PrimitiveType::Point.as_raw()); + let encodes = self + .pipeline + .as_ref() + .is_none_or(|pipeline| pipeline.can_encode_indirect_commands()); + self.check.is_none() + || !((needs.point_draws && points) || (needs.encoding_states && encodes)) + } + + /// The replay's preprocess of commands `range` drawing `primitive_type`, each stage's slot + /// table holding `slots` (the vertex function's, then the fragment function's), over + /// `residency`'s resident resources and the device's live buffers, decided on the records' + /// `decided` writes; `None` where the binder refuses it (a device without device addresses + /// among others). + fn preprocess( + &self, + device: &Device, + residency: &Residency, + (decided, primitive_type, range): (CommandWrites, PrimitiveType, Range), + (vertex_slots, fragment_slots): (u32, u32), + ) -> Option { + let capacity = u32::try_from(self.icb.size()).ok()?; + let live = device.shared().live_buffers.table(device).ok()?; + let mut state = BindState::default(); + state.used_resources = residency.used_resources(); + state.resident_ranges = live.ranges().collect(); + let count = range.end - range.start; + let mut replay = + DrawReplay::new(capacity, range.start, count, vec![primitive_type.as_raw()]); + replay.inheritance = self.icb.inheritance(); + replay.vertex_slots = vertex_slots; + replay.fragment_slots = fragment_slots; + let pre = draw_replay_preprocess(device.compile_device(), &state, &replay).ok()?; + Some(GpuForm { + decided, + primitive_type, + pre, + live, + }) + } + + /// Record the execution's GPU form `form` (the module docs) through `core`, a segment of + /// `command_buffer` with `residency` (the command buffer's): the preprocess and the barrier + /// after it, then the commands' draws into a secondary begun against the execution's + /// instance, over the pass's `storage`, in the call's layout as `rendered` backs it. Returns + /// the encoder that drew them, its runs to end ([`finish`](Self::finish)). + pub(super) fn record_gpu( + &self, + mut core: EncoderCore, + (command_buffer, residency): (&CommandBuffer, &Residency), + form: &GpuForm, + (storage, rendered): (PassStorage, &mut Rendered), + ) -> Result { + let snapshot = &self.snapshot; + let device = command_buffer.device().clone(); + let pipeline = (self.pipeline.as_ref()) + .ok_or_else(|| internal("an execution's GPU form without its pipeline state"))?; + // The GPU reads the records: the handlers learn the state their commands run. + command_buffer.report_executed(&self.icb, RecordsRead::Gpu, residency, || { + (Vec::new(), pipeline.can_encode_indirect_commands()) + }); + let pre = &form.pre; + let kernel = device.owned_kernel(OwnedModule::DrawReplayPreprocess)?; + let no_address = || internal("a draw replay on a device without device addresses"); + let records = self.icb.storage(); + let records_address = records.device_address().ok_or_else(no_address)?; + let (scratch, status) = { + let mut cb = command_buffer.state(); + let sink = cb + .uploads + .upload(&device, &[], u64::from(NeutralResource::SINK_BYTES))? + .device_address() + .ok_or_else(no_address)?; + let head = scratch_head(pre, sink)?; + let scratch = cb.uploads.upload(&device, &head, pre.layout.bytes)?; + let status = cb.status_address(&device)?.ok_or_else(no_address)?; + (scratch, status) + }; + let address = scratch.device_address().ok_or_else(no_address)?; + let mut push = pre.push_constants.clone(); + for hole in &pre.push_holes { + let (offset, value) = match *hole { + PushHole::RootTableAddress { offset, .. } => { + (offset, address + pre.layout.resident_offset) + } + PushHole::ExecutionStatusAddress { offset, .. } => (offset, status), + PushHole::CommandRecordsAddress { offset, .. } => (offset, records_address), + _ => { + return Err(internal( + "a draw replay preprocess hole the runtime does not fill", + )) + } + }; + push.get_mut(offset as usize..offset as usize + 8) + .ok_or_else(|| internal("a draw replay preprocess hole past its push bytes"))? + .copy_from_slice(&value.to_le_bytes()); + } + // The preprocess reads the records and writes the scratch past what the host uploaded. + let compute = vk::PipelineStageFlags2::COMPUTE_SHADER; + let (chunk, at) = scratch.buffer(); + let uses = [ + reads_by( + records, + 0..records.length(), + Access::new(compute, vk::AccessFlags2::SHADER_STORAGE_READ), + ), + writes_by( + chunk, + at + pre.layout.uploaded..at + pre.layout.bytes, + Access::new(compute, vk::AccessFlags2::SHADER_STORAGE_WRITE), + ), + ]; + let group_count = pre.group_count; + core.command(compute, &uses, |raw, command_buffer| { + // SAFETY: the segment's command buffer is recording outside a render pass; the kernel + // is the device's, and its push bytes name the scratch, the status words and the + // records, which live until the command buffer completes. + unsafe { + raw.cmd_bind_pipeline( + command_buffer, + vk::PipelineBindPoint::COMPUTE, + kernel.pipeline, + ); + raw.cmd_push_constants( + command_buffer, + kernel.layout, + vk::ShaderStageFlags::COMPUTE, + 0, + &push, + ); + let [x, y, z] = group_count; + raw.cmd_dispatch(command_buffer, x, y, z); + } + }); + // Its writes before the draws' indirect reads and their functions' reads of the slot + // tables, the pass begun after it. + core.barrier(Barrier::everything()); + // Its resident set, resolved now: the command buffer's first submission finds whether + // the live buffers and what its encoders made resident still lie there. + core.resolved(form.live.ranges().chain(residency.resident_ranges())); + let draws = command_buffer.begin_draws(&snapshot.compatible)?; + let raw = device.shared().vk(); + let visibility = + Visibility::borrowing(snapshot.layout.visibility.clone(), None, raw, draws); + let layout = rendered.backing(&snapshot.layout)?; + let mut encoder = self.replay_encoder( + core, + (draws, visibility), + (storage, layout, residency), + BufferForms::Replay, + ); + // The first command's draw reads its arguments where the preprocess wrote them. + let first = DrawSource::new( + chunk, + at + pre.layout.argument_offset(0, 0), + DRAW_ARGUMENT_BYTES, + 4, + false, + false, + )?; + let draw = DrawCall::Indirect { + indirect: IndirectRef::new(0, first.at), + indexed: None, + }; + encoder.replayed = Some(ReplayedDraws { + address, + buffer: scratch.raw(), + offset: scratch.offset(), + layout: pre.layout, + }); + encoder.check_pipeline(CALL, pipeline)?; + encoder.pipeline = Some(pipeline.clone()); + let buffers = DrawBuffers { + indirect: Some(first), + ..DrawBuffers::default() + }; + let assembly = Assembly::Primitives(form.primitive_type); + encoder.draw(CALL, assembly, draw, buffers, false)?; + encoder.replayed = None; + (device.shared().counts).gpu_form_commands(u64::from(pre.layout.commands)); + Ok(encoder) + } +} + +/// The bytes of a draw replay's scratch the host uploads: the parameters, the resident root +/// table with its sink entry's `host` field at `sink`, the resident roots' extents and the +/// encoder's buffers, each at its layout offset; the slot tables and arguments past them are +/// the preprocess's to write. +fn scratch_head(pre: &DrawReplayPreprocess, sink: u64) -> Result, Error> { + let layout = pre.layout; + let len = + usize::try_from(layout.uploaded).map_err(|_| internal("a replay scratch too large"))?; + let mut bytes = vec![0u8; len]; + let mut resident = pre.resident.bytes.clone(); + let at = metal2vulkan::bind::RootTable::SINK_HOST_OFFSET as usize; + resident + .get_mut(at..at + 8) + .ok_or_else(|| internal("a resident root table without a sink entry"))? + .copy_from_slice(&sink.to_le_bytes()); + for (offset, part) in [ + (layout.params_offset(), &pre.params), + (layout.resident_offset, &resident), + (layout.extents_offset, &pre.extents), + (layout.parent_offset, &pre.parent), + ] { + let offset = offset as usize; + bytes + .get_mut(offset..offset + part.len()) + .ok_or_else(|| internal("a replay scratch section past what the host uploads"))? + .copy_from_slice(part); + } + Ok(bytes) +} + +impl RenderCommandEncoder { + /// The buffer slots the vertex and fragment functions of a command's draw of `state` as + /// `primitive_type` read, through this encoder (an execution's at its call, in the replay + /// form), where that draw records as the GPU form's draws do (the module docs); `None` where + /// it does not. Announces nothing: it draws nothing. + fn replay_draw_of( + &self, + state: &crate::pipeline::GraphicsState, + primitive_type: PrimitiveType, + ) -> Result, Error> { + let graphics = &state.base().graphics; + if crate::tessellation::patches(graphics).is_some() + || state.descriptor().vertex().is_none() + || state.reads_tile_memory() + || (graphics.vertex_writes_memory && !graphics.rasterizer_discard) + || graphics.fragment_writes_memory + || graphics.fragment_imageblock.is_some() + || graphics.shadow_stencil.is_some() + || graphics.shader_tests.is_some() + || !graphics.input_attachments.is_empty() + || !self.storage_attachments(graphics)?.is_empty() + || self.rate_map.is_some() + { + return Ok(None); + } + let settings = + self.draw_settings(CALL, state, Assembly::Primitives(primitive_type), false)?; + if *self.current.shape.locations != *settings.routing.locations + || !self.reformats(state, &settings.routing)?.is_empty() + { + return Ok(None); + } + let mut argument_samplers = ArgumentSamplers::taken(self.core.device()); + let function_tables = state.function_tables(); + let live = Arc::clone(&self.live); + let pass_start = PassStartTables::default(); + let sampler_maps = self.sampler_maps(state, &pass_start)?; + let mut live = lock(&live); + let Settled { variant, plan, .. } = self.settle_draw( + &mut live, + (state, &settings), + (&pass_start, &sampler_maps), + (&mut argument_samplers, &mut None), + (&function_tables, &mut None), + )?; + let draw = DrawCall::Indirect { + indirect: IndirectRef::new(0, 0), + indexed: None, + }; + let commands = plan + .instantiate_draw(&live.state, &draw) + .map_err(Error::Bind)?; + let one_function = commands.push_holes.iter().all(|hole| match *hole { + PushHole::RootTableAddress { stages, .. } => { + let stages: vk::ShaderStageFlags = stages.into(); + stages == vk::ShaderStageFlags::VERTEX || stages == vk::ShaderStageFlags::FRAGMENT + } + _ => true, + }); + if commands.indirect_needs_arguments + || commands.index_bounds_pass + || commands.mesh_dispatch.is_some() + || commands.tessellation_dispatch.is_some() + || !commands.amplifications.is_empty() + || plan.views != ViewSetup::default() + || !plan.vertex_buffers.is_empty() + || variant.key().primitive_id_indices.is_some() + || !one_function + { + return Ok(None); + } + let slots = |stage: Stage| { + (variant.pipeline().interface.slots.keys()) + .filter(|slot| slot.stage == stage && slot.class == SlotClass::Buffer) + .map(|slot| slot.index + 1) + .max() + .unwrap_or(0) + }; + Ok(Some((slots(Stage::Vertex), slots(Stage::Fragment)))) + } +} diff --git a/crates/metal2vulkan-runtime/src/render/pass_start_reads.rs b/crates/metal2vulkan-runtime/src/render/pass_start_reads.rs index 2177c407f..2ea056709 100644 --- a/crates/metal2vulkan-runtime/src/render/pass_start_reads.rs +++ b/crates/metal2vulkan-runtime/src/render/pass_start_reads.rs @@ -169,6 +169,12 @@ impl PassStartReads { } } + /// Whether a fragment stage of the pass wrote any bytes so far: a later draw's stages before + /// its fragments read none from a copy, wherever they read. + pub(super) fn fragment_wrote(&self) -> bool { + !self.fragment.0.is_empty() + } + /// What the pass noted so far, without its copies: what an execution's recording starts from /// (`render/executions.rs`), whose copies are its own. pub(super) fn notes(&self) -> PassStartReads { diff --git a/crates/metal2vulkan-runtime/src/upload.rs b/crates/metal2vulkan-runtime/src/upload.rs index 96199221a..a2671e84b 100644 --- a/crates/metal2vulkan-runtime/src/upload.rs +++ b/crates/metal2vulkan-runtime/src/upload.rs @@ -217,6 +217,12 @@ impl Upload { self.buffer.at(self.offset).1 } + /// The buffer the region is in, and the region's offset there: a draw replay's scratch is + /// its draws' indirect buffer (`render/executions/gpu.rs`). + pub(super) fn buffer(&self) -> (&Buffer, u64) { + (&self.buffer, self.offset) + } + /// The region's length. pub(super) fn len(&self) -> u64 { self.len diff --git a/crates/metal2vulkan-runtime/src/work_counts.rs b/crates/metal2vulkan-runtime/src/work_counts.rs index e9b5950d9..e074cd6e3 100644 --- a/crates/metal2vulkan-runtime/src/work_counts.rs +++ b/crates/metal2vulkan-runtime/src/work_counts.rs @@ -103,6 +103,7 @@ pub(crate) struct Counters { visibility_queries_begun: AtomicU64, indirect_draws_recorded: AtomicU64, indirect_records_read: AtomicU64, + gpu_form_commands: AtomicU64, gpu_pool_blocks_made: AtomicU64, gpu_pool_blocks_released: AtomicU64, gpu_pool_leases_peak: AtomicU64, @@ -783,6 +784,12 @@ impl Counters { .fetch_add(count, Ordering::Relaxed); } + /// `count` commands of an execution of render commands were recorded in its GPU form + /// (`render/executions/gpu.rs`): the device reads their records. + pub(crate) fn gpu_form_commands(&self, count: u64) { + self.gpu_form_commands.fetch_add(count, Ordering::Relaxed); + } + /// A command buffer's lease made its queue's block of a GPU pool: the queue held none /// (`gpu_pools.rs`). pub(crate) fn gpu_pool_block_made(&self) { @@ -2522,6 +2529,9 @@ pub struct WorkCounts { /// `IndirectCommandCheck`) or `IndirectCommandBuffer::commands` reads it; a setter's own /// read of the command it changes is not counted. pub indirect_records_read: u64, + /// Commands of executions of render commands recorded in their GPU form, one a command each + /// time (`render/executions/gpu.rs`): the device read their records, the host none. + pub gpu_form_commands: u64, /// Blocks of the GPU pools made: a queue's index pool block (for its index bounds passes and /// index rewrites) or its mesh records pool block, made by the first command buffer of the /// queue that needs one where the queue holds none. A queue's command buffers share its block @@ -3739,6 +3749,7 @@ impl Device { visibility_queries_begun: counters.visibility_queries_begun.load(Ordering::Relaxed), indirect_draws_recorded: counters.indirect_draws_recorded.load(Ordering::Relaxed), indirect_records_read: counters.indirect_records_read.load(Ordering::Relaxed), + gpu_form_commands: counters.gpu_form_commands.load(Ordering::Relaxed), gpu_pool_blocks_made: counters.gpu_pool_blocks_made.load(Ordering::Relaxed), gpu_pool_blocks_released: counters.gpu_pool_blocks_released.load(Ordering::Relaxed), gpu_pool_leases_peak: counters.gpu_pool_leases_peak.load(Ordering::Relaxed), diff --git a/crates/metal2vulkan-validation/src/runtime_lane.rs b/crates/metal2vulkan-validation/src/runtime_lane.rs index b63e8e8ff..e3eb1c5b8 100644 --- a/crates/metal2vulkan-validation/src/runtime_lane.rs +++ b/crates/metal2vulkan-validation/src/runtime_lane.rs @@ -655,6 +655,8 @@ mod render_barriers; #[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))] mod render_executions; #[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))] +mod render_gpu_executions; +#[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))] mod render_state; #[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))] mod renders; diff --git a/crates/metal2vulkan-validation/src/runtime_lane/dispatch_executions.rs b/crates/metal2vulkan-validation/src/runtime_lane/dispatch_executions.rs index 108ee5668..98edb9497 100644 --- a/crates/metal2vulkan-validation/src/runtime_lane/dispatch_executions.rs +++ b/crates/metal2vulkan-validation/src/runtime_lane/dispatch_executions.rs @@ -534,6 +534,7 @@ fn checked_and_indirect_range_executions_keep_the_host_step() { Box::new(move |_, _| { seen.fetch_add(1, std::sync::atomic::Ordering::Relaxed); }), + metal2vulkan_runtime::IndirectCommandCheckNeeds::ALL, ) .unwrap(); } diff --git a/crates/metal2vulkan-validation/src/runtime_lane/indirect_host_steps.rs b/crates/metal2vulkan-validation/src/runtime_lane/indirect_host_steps.rs index c9ade8fc1..b29fd6352 100644 --- a/crates/metal2vulkan-validation/src/runtime_lane/indirect_host_steps.rs +++ b/crates/metal2vulkan-validation/src/runtime_lane/indirect_host_steps.rs @@ -48,8 +48,8 @@ use metal2vulkan_runtime::{ ComputeCommandEncoder, ComputePipelineState, Deallocator, Degradation, Device, DeviceOptions, Error, EventRef, ExecutedCommands, ExecutedCommandsHandler, ExecutedPipeline, Execution, IdPlacement, IndirectCommand, IndirectCommandBuffer, IndirectCommandBufferDescriptor, - IndirectCommandBufferProblem, Invalid, PipelineOptions, Problem, RecordsRead, ResourceId, - ResourceOptions, Size, + IndirectCommandBufferProblem, IndirectCommandCheckNeeds, Invalid, PipelineOptions, Problem, + RecordsRead, ResourceId, ResourceOptions, Size, }; use std::ptr::NonNull; use std::sync::atomic::{AtomicUsize, Ordering}; @@ -456,6 +456,7 @@ fn a_checked_execution_checks_each_written_command_before_its_step_records_it() ); log.lock().unwrap().push((index, dispatches, untouched)); }), + IndirectCommandCheckNeeds::ALL, ) .unwrap(); encoder.end_encoding().unwrap(); @@ -488,6 +489,7 @@ fn a_checked_execution_checks_each_written_command_before_its_step_records_it() Box::new(move |_, _| { counted.fetch_add(1, Ordering::SeqCst); }), + IndirectCommandCheckNeeds::ALL, ) .unwrap(); encoder.end_encoding().unwrap(); @@ -522,6 +524,7 @@ fn a_checked_host_step_reads_each_record_once() { &setup.icb, 0..COMMANDS, Box::new(move |_, command| log.lock().unwrap().push(format!("{command:?}"))), + IndirectCommandCheckNeeds::ALL, ) .unwrap(); encoder.end_encoding().unwrap(); diff --git a/crates/metal2vulkan-validation/src/runtime_lane/render_executions.rs b/crates/metal2vulkan-validation/src/runtime_lane/render_executions.rs index 691d6718c..527627be8 100644 --- a/crates/metal2vulkan-validation/src/runtime_lane/render_executions.rs +++ b/crates/metal2vulkan-validation/src/runtime_lane/render_executions.rs @@ -69,21 +69,21 @@ use metal2vulkan_runtime::{LoadAction, StoreAction, TextureDescriptor}; const CALL: &str = "execute_commands_in_buffer"; /// The words of one window of `params` and of `out`. -const WINDOW: usize = 64; +pub(super) const WINDOW: usize = 64; /// The windows of `params` and `out`. const WINDOWS: usize = 4; /// The template's state, `params` (each window's words as `indirect_host_steps::param` gives /// them) and `out` (zero). -struct Setup { - state: RenderPipelineState, - params: Buffer, - out: Buffer, +pub(super) struct Setup { + pub(super) state: RenderPipelineState, + pub(super) params: Buffer, + pub(super) out: Buffer, } impl Setup { - fn new(device: &Device) -> Setup { + pub(super) fn new(device: &Device) -> Setup { let params: Vec = (0..WINDOWS * WINDOW) .map(|word| param(word / WINDOW, word % WINDOW)) .flat_map(u32::to_le_bytes) @@ -127,7 +127,7 @@ impl Setup { } /// Make `params` and `out` resident for `encoder`'s vertex stage. - fn resident(&self, encoder: &mut RenderCommandEncoder) { + pub(super) fn resident(&self, encoder: &mut RenderCommandEncoder) { encoder .use_resource( self.params.as_resource(), @@ -145,7 +145,7 @@ impl Setup { } /// `out`, read back. - fn output(&self) -> Vec { + pub(super) fn output(&self) -> Vec { read_buffer(&self.out, 0, self.out.length()) .unwrap() .as_chunks::<4>() @@ -157,7 +157,7 @@ impl Setup { /// [`Setup::new`]'s, with `params` and `out` placed in a heap of their own ([`shared_heap`]), /// which it returns. - fn in_heap(device: &Device) -> (Setup, Heap) { + pub(super) fn in_heap(device: &Device) -> (Setup, Heap) { let own = Setup::new(device); let heap = shared_heap(device); let place = @@ -194,16 +194,16 @@ fn placed(heap: &Heap, bytes: &[u8]) -> Buffer { } /// A draw over a window: `count` vertices from `start`, `instances` instances from `base`. -struct Drawn { - window: usize, - start: usize, - count: usize, - instances: usize, - base: usize, +pub(super) struct Drawn { + pub(super) window: usize, + pub(super) start: usize, + pub(super) count: usize, + pub(super) instances: usize, + pub(super) base: usize, } /// `out` after `draws`, zero where none wrote. -fn expected(draws: &[Drawn]) -> Vec { +pub(super) fn expected(draws: &[Drawn]) -> Vec { let mut out = vec![0; WINDOWS * WINDOW]; for draw in draws { let (p0, p1) = (param(draw.window, 0), param(draw.window, 1)); @@ -218,7 +218,7 @@ fn expected(draws: &[Drawn]) -> Vec { } /// A buffer of `count` render commands as `descriptor` describes. -fn icb( +pub(super) fn icb( device: &Device, descriptor: &IndirectCommandBufferDescriptor, count: u64, @@ -238,7 +238,7 @@ fn descriptor() -> IndirectCommandBufferDescriptor { } /// A 1x1 pass without attachments. -fn pass() -> RenderPassDescriptor { +pub(super) fn pass() -> RenderPassDescriptor { let mut pass = RenderPassDescriptor::new(); pass.render_target_width = 1; pass.render_target_height = 1; @@ -248,7 +248,7 @@ fn pass() -> RenderPassDescriptor { /// The kinds a test's steps force beside its own, where the device has not announced them: the /// makings of the pipeline states of `made`, and the `Shared` buffers' system memory. -fn forced_with( +pub(super) fn forced_with( device: &Device, made: &[metal2vulkan::pipeline::RenderPipelineDescriptor], ) -> std::collections::BTreeSet { diff --git a/crates/metal2vulkan-validation/src/runtime_lane/render_gpu_executions.rs b/crates/metal2vulkan-validation/src/runtime_lane/render_gpu_executions.rs new file mode 100644 index 000000000..1762efecd --- /dev/null +++ b/crates/metal2vulkan-validation/src/runtime_lane/render_gpu_executions.rs @@ -0,0 +1,481 @@ +//! Executions of render commands a kernel writes, in their GPU form (the runtime's +//! `render/executions/gpu.rs`), on the device the cfg selects, under the validation layer. The +//! commands draw `render_executions`' template (rasterization disabled: vertex `vid` of instance +//! `iid` writes `params[0] * (vid + 1) + params[1] + 1000 * iid` to word `16 * iid + vid` of +//! `out`) under the encoder's state, which the buffer inherits. The point writer +//! (`icb_render_replay_encode_draw_only`) draws 4 points from vertex `4 * tid` in command `tid`; +//! the triangle writer (`kernel_icb_encode_render_commands`) binds `params` as vertex buffer 0 +//! and fragment buffer 1 and draws one triangle from vertex `3 * tid`; the CPU writes the rest. +//! They draw as the host step draws them, as Metal's: +//! +//! - on the GPU, the host reading no record, each with its own vertex start, instance count and +//! base instance; a reset command draws nothing; +//! - a check that looks for every kind keeps the host step, which calls it and draws the same; +//! - a check that looks for what the records cannot hold (points, where only triangles are +//! written) is never called, and the commands draw on the GPU; where the CPU writes a point +//! draw after the commit, before the pass's batch is ready, the host step records the pass +//! instead and calls the check; +//! - two executions of one buffer in one pass draw each its own range; +//! - a buffer that may hold a barrier takes the host step, announced once; +//! - an address outside the resident resources misses, counted, while its neighbours draw; +//! - a record past the descriptor's bind count sets the sticky encoding fault: nothing draws, and +//! the execution report says why. + +use super::degrade_notices::{assert_made_once, on_device}; +use super::indirect_host_steps::{self, complete, HOST_STEPS}; +use super::render_executions::{expected, forced_with, icb, pass, Drawn, Setup, WINDOW}; +use super::{buffer_with, read_buffer, WAIT}; +use crate::air_library::AirLibrary; +use metal2vulkan::bind::ReplayFaults; +use metal2vulkan::metal::{IndirectCommandType, PrimitiveType, ResourceUsage}; +use metal2vulkan::pipeline::{ComputePipelineDescriptor, StageSource}; +use metal2vulkan_devtools::{fixtures_dir, llvm_assemble}; +use metal2vulkan_runtime::{ + Buffer, CommandBuffer, CommandBufferStatus, ComputePipelineState, Device, EventRef, + IndirectCommandBuffer, IndirectCommandBufferDescriptor, IndirectCommandCheckNeeds, + PipelineOptions, Size, +}; +use std::sync::{Arc, Mutex}; + +/// Draw commands of two vertex buffers and `fragment` fragment buffers that inherit the encoder's +/// pipeline state. +fn inheriting(fragment: u32) -> IndirectCommandBufferDescriptor { + let mut descriptor = IndirectCommandBufferDescriptor::new(); + descriptor.command_types = IndirectCommandType::DRAW; + descriptor.inherit_pipeline_state = true; + descriptor.max_vertex_buffer_bind_count = 2; + descriptor.max_fragment_buffer_bind_count = fragment; + descriptor +} + +/// Bind window `window` of `setup`'s `params` and `out` as command `index`'s vertex buffers 0 +/// and 1. +fn buffers(setup: &Setup, icb: &IndirectCommandBuffer, index: u64, window: usize) { + let command = icb.indirect_render_command_at(index).unwrap(); + let offset = (window * WINDOW * 4) as u64; + command + .set_vertex_buffer(Some(&setup.params), offset, 0) + .unwrap(); + command + .set_vertex_buffer(Some(&setup.out), offset, 1) + .unwrap(); +} + +/// How an execution is encoded. +enum Call { + Plain, + /// With a caller's check (`execute_commands_in_buffer_checked`) that looks for what the + /// needs say, noting each command it is called with. + Checked(IndirectCommandCheckNeeds, Arc>>), +} + +impl Call { + /// A check that looks for `needs`, and the commands it will be called with. + fn checked(needs: IndirectCommandCheckNeeds) -> (Call, Arc>>) { + let seen = Arc::default(); + (Call::Checked(needs, Arc::clone(&seen)), seen) + } +} + +/// What a test runs: the template's `setup`, a writer's state, and the buffer its third argument +/// is. +struct Writing<'a> { + setup: &'a Setup, + writer: &'a ComputePipelineState, + out: &'a Buffer, +} + +/// Encode, in one command buffer of a new queue, what [`encode_into`] does. +fn encode( + device: &Device, + writing: &Writing<'_>, + (icb, threads): (&IndirectCommandBuffer, u64), + (ranges, call): (&[(u64, u64)], &Call), +) -> CommandBuffer { + let queue = device.new_command_queue().unwrap(); + let command_buffer = queue.command_buffer().unwrap(); + encode_into(&command_buffer, writing, (icb, threads), (ranges, call)); + command_buffer +} + +/// Encode into `command_buffer`: the writer over `threads` threads writing `icb` (its arguments +/// the buffer's ID, `params`, and `writing.out`), then one render encoder that sets the template's +/// state, makes `params` and `out` resident and executes `ranges` of `icb` (each its start and +/// end) as `call` says. +fn encode_into( + command_buffer: &CommandBuffer, + writing: &Writing<'_>, + (icb, threads): (&IndirectCommandBuffer, u64), + (ranges, call): (&[(u64, u64)], &Call), +) { + let setup = writing.setup; + let device = command_buffer.device(); + let arguments = buffer_with(device, &icb.gpu_resource_id().0.to_le_bytes()).unwrap(); + let mut encoder = command_buffer.compute_command_encoder().unwrap(); + encoder.set_compute_pipeline_state(writing.writer).unwrap(); + encoder.set_buffer(Some(&arguments), 0, 0).unwrap(); + encoder.set_buffer(Some(&setup.params), 0, 1).unwrap(); + encoder.set_buffer(Some(writing.out), 0, 2).unwrap(); + encoder + .use_resource(icb.as_resource(), ResourceUsage::WRITE) + .unwrap(); + let grid = Size::new(threads, 1, 1); + encoder.dispatch_threads(grid, grid).unwrap(); + encoder.end_encoding().unwrap(); + let mut encoder = command_buffer.render_command_encoder(&pass()).unwrap(); + encoder.set_render_pipeline_state(&setup.state).unwrap(); + setup.resident(&mut encoder); + for &(start, end) in ranges { + match call { + Call::Plain => encoder.execute_commands_in_buffer(icb, start..end), + Call::Checked(needs, seen) => { + let seen = Arc::clone(seen); + encoder.execute_commands_in_buffer_checked( + icb, + start..end, + Box::new(move |index, _| seen.lock().unwrap().push(index)), + *needs, + ) + } + } + .unwrap(); + } + encoder.end_encoding().unwrap(); +} + +/// The point writer's state. +fn points(device: &Device) -> ComputePipelineState { + indirect_host_steps::state(device, "icb_render_replay_encode_draw_only", false) +} + +/// The triangle writer's state. +fn triangles(device: &Device) -> ComputePipelineState { + let bitcode = + llvm_assemble(&fixtures_dir().join("kernel_icb_encode_render_commands.ll")).unwrap(); + let library = device.new_library_with_air(&bitcode).unwrap(); + let function = library + .new_function_with_name("kernel_icb_encode_render_commands") + .unwrap(); + let descriptor = + ComputePipelineDescriptor::new(StageSource::Function(function.function_descriptor())); + device + .new_compute_pipeline_state(&descriptor, &PipelineOptions::default()) + .unwrap() +} + +/// A buffer of 4 commands, each over its own window: the point writer's draws in commands 0 and +/// 1 (dispatched over 2 threads), the CPU's draw of 2 vertices from 1, 2 instances from 1, in +/// command 2, and command 3 reset after a draw. +fn written(device: &Device, setup: &Setup) -> IndirectCommandBuffer { + let icb = icb(device, &inheriting(1), 4); + for index in 0..4 { + buffers(setup, &icb, index, index as usize); + } + let command = icb.indirect_render_command_at(2).unwrap(); + command + .draw_primitives(PrimitiveType::Point, 1, 2, 2, 1) + .unwrap(); + let reset = icb.indirect_render_command_at(3).unwrap(); + reset + .draw_primitives(PrimitiveType::Point, 0, 4, 1, 0) + .unwrap(); + reset.reset().unwrap(); + icb +} + +/// What [`written`]'s commands draw. +fn written_draws() -> Vec { + vec![ + drawn(0, 0, 4), + drawn(1, 4, 4), + Drawn { + window: 2, + start: 1, + count: 2, + instances: 2, + base: 1, + }, + ] +} + +/// A draw of `count` vertices from `start` in window `window`, one instance. +fn drawn(window: usize, start: usize, count: usize) -> Drawn { + Drawn { + window, + start, + count, + instances: 1, + base: 0, + } +} + +/// A buffer of 4 commands for the triangle writer, each of whose vertex buffer 1 is window 0 of +/// `out` (the writer binds vertex buffer 0, window 0 of `params`), with room for its fragment +/// buffer 1. +fn for_triangles(device: &Device, setup: &Setup) -> IndirectCommandBuffer { + let icb = icb(device, &inheriting(2), 4); + for index in 0..4 { + buffers(setup, &icb, index, 0); + } + icb +} + +/// The commands' GPU form and host reads across `run`: commands recorded in the GPU form, and +/// records the host read. +fn counted(device: &Device, run: impl FnOnce()) -> (u64, u64) { + let before = device.work_counts(); + run(); + let after = device.work_counts(); + ( + after.gpu_form_commands - before.gpu_form_commands, + after.indirect_records_read - before.indirect_records_read, + ) +} + +/// Commands a kernel and the CPU write draw on the GPU, the host reading no record, each with its +/// own vertex start, instance count and base instance (`vertex_id`, `instance_id`); a reset +/// command draws nothing. No host step is announced. +#[test] +fn written_commands_draw_on_the_gpu_with_their_own_arguments() { + on_device(|device, messages| { + let setup = Setup::new(device); + let writer = points(device); + let writing = Writing { + setup: &setup, + writer: &writer, + out: &setup.out, + }; + let icb = written(device, &setup); + let (gpu, read) = counted(device, || { + complete(&encode( + device, + &writing, + (&icb, 2), + (&[(0, 4)], &Call::Plain), + )); + }); + assert_eq!(setup.output(), expected(&written_draws())); + assert_eq!((gpu, read), (4, 0), "drawn in the GPU form"); + assert_made_once(messages, &[], &forced_with(device, &[])); + }); +} + +/// A check that looks for every kind keeps the host step, which reads every record and calls it +/// with each command before any runs; the same commands in their GPU form draw what it drew. +#[test] +fn the_gpu_form_draws_what_the_host_step_draws() { + on_device(|device, messages| { + let writer = points(device); + let (checked, seen) = Call::checked(IndirectCommandCheckNeeds::ALL); + let mut outputs = Vec::new(); + for call in [checked, Call::Plain] { + let setup = Setup::new(device); + let writing = Writing { + setup: &setup, + writer: &writer, + out: &setup.out, + }; + let icb = written(device, &setup); + let (gpu, read) = counted(device, || { + complete(&encode(device, &writing, (&icb, 2), (&[(0, 4)], &call))); + }); + match call { + Call::Checked(..) => assert!(gpu == 0 && read >= 4, "{gpu} {read}"), + Call::Plain => assert_eq!((gpu, read), (4, 0)), + } + outputs.push(setup.output()); + } + assert_eq!(*seen.lock().unwrap(), [0, 1, 2, 3], "each command checked"); + assert_eq!(outputs[0], expected(&written_draws()), "the host step"); + assert_eq!(outputs[1], outputs[0], "the GPU form"); + assert_made_once(messages, &HOST_STEPS, &forced_with(device, &[])); + }); +} + +/// A check that looks for draws of points and for states that may encode, of commands the +/// triangle writer writes under the template's state, which encodes none, has nothing to see: it +/// is never called, and the commands draw on the GPU, the host reading no record. +#[test] +fn a_check_with_nothing_to_see_is_never_called() { + on_device(|device, messages| { + let setup = Setup::new(device); + let writer = triangles(device); + let scratch = buffer_with(device, &[0; 64]).unwrap(); + let writing = Writing { + setup: &setup, + writer: &writer, + out: &scratch, + }; + let icb = for_triangles(device, &setup); + let (call, seen) = Call::checked(IndirectCommandCheckNeeds::ALL); + let (gpu, read) = counted(device, || { + complete(&encode(device, &writing, (&icb, 4), (&[(0, 4)], &call))); + }); + assert_eq!((gpu, read), (4, 0), "drawn in the GPU form"); + assert!(seen.lock().unwrap().is_empty(), "the check was called"); + assert_eq!(setup.output(), expected(&[drawn(0, 0, 12)])); + assert_made_once(messages, &[], &forced_with(device, &[])); + }); +} + +/// Where the CPU writes a draw of points after the commit, before the pass's batch is ready (its +/// command buffer waits for an event the test signals after the write), the check, which looks +/// for points, has something to see: the host step records the pass instead of the GPU form the +/// commit recorded, calls the check with each command, and draws the point draw too. +#[test] +fn facts_that_grow_before_the_batch_is_ready_take_the_host_step() { + on_device(|device, messages| { + let setup = Setup::new(device); + let writer = triangles(device); + let scratch = buffer_with(device, &[0; 64]).unwrap(); + let writing = Writing { + setup: &setup, + writer: &writer, + out: &scratch, + }; + let icb = for_triangles(device, &setup); + let (call, seen) = Call::checked(IndirectCommandCheckNeeds::new(true, false)); + let event = device.new_shared_event().unwrap(); + let queue = device.new_command_queue().unwrap(); + let command_buffer = queue.command_buffer().unwrap(); + command_buffer + .encode_wait_for_event(EventRef::from(&event), 1) + .unwrap(); + encode_into(&command_buffer, &writing, (&icb, 2), (&[(0, 4)], &call)); + let (gpu, _) = counted(device, || command_buffer.commit().unwrap()); + assert_eq!(gpu, 4, "the commit recorded the GPU form"); + buffers(&setup, &icb, 2, 2); + icb.indirect_render_command_at(2) + .unwrap() + .draw_primitives(PrimitiveType::Point, 0, 4, 1, 0) + .unwrap(); + let (_, read) = counted(device, || { + event.set_signaled_value(1); + indirect_host_steps::wait(&command_buffer); + }); + assert!(read >= 4, "the host step read the records: {read}"); + assert_eq!(*seen.lock().unwrap(), [0, 1, 2, 3], "each command checked"); + assert_eq!(setup.output(), expected(&[drawn(0, 0, 6), drawn(2, 0, 4)])); + assert_made_once(messages, &HOST_STEPS, &forced_with(device, &[])); + }); +} + +/// Two executions of one buffer in one pass, of ranges that overlap, draw each its own range in +/// the GPU form. +#[test] +fn two_ranges_of_one_buffer_draw_on_the_gpu() { + on_device(|device, _| { + let setup = Setup::new(device); + let writer = points(device); + let writing = Writing { + setup: &setup, + writer: &writer, + out: &setup.out, + }; + let icb = written(device, &setup); + let (gpu, read) = counted(device, || { + let ranges = [(0, 2), (1, 4)]; + complete(&encode( + device, + &writing, + (&icb, 2), + (&ranges, &Call::Plain), + )); + }); + assert_eq!(setup.output(), expected(&written_draws())); + assert_eq!((gpu, read), (5, 0)); + }); +} + +/// A buffer the CPU set a barrier in, even one cleared since (its records may hold one), takes +/// the host step, announced once, and draws as before. +#[test] +fn a_buffer_that_may_hold_a_barrier_takes_the_host_step() { + on_device(|device, messages| { + let setup = Setup::new(device); + let writer = points(device); + let writing = Writing { + setup: &setup, + writer: &writer, + out: &setup.out, + }; + let icb = written(device, &setup); + let command = icb.indirect_render_command_at(2).unwrap(); + command.set_barrier().unwrap(); + command.clear_barrier().unwrap(); + let (gpu, read) = counted(device, || { + complete(&encode( + device, + &writing, + (&icb, 2), + (&[(0, 4)], &Call::Plain), + )); + }); + assert_eq!(setup.output(), expected(&written_draws())); + assert_eq!(gpu, 0); + assert!(read >= 4, "{read}"); + assert_made_once(messages, &HOST_STEPS, &forced_with(device, &[])); + }); +} + +/// A command's buffers in a heap no encoder of the command buffer used miss: unbound, counted in +/// the execution report, as the host step counts them; its neighbours draw. +#[test] +fn addresses_outside_the_resident_resources_miss_on_the_gpu() { + on_device(|device, _| { + let setup = Setup::new(device); + let (away, _heap) = Setup::in_heap(device); + let writer = points(device); + let writing = Writing { + setup: &setup, + writer: &writer, + out: &setup.out, + }; + let icb = icb(device, &inheriting(1), 2); + buffers(&setup, &icb, 0, 0); + buffers(&away, &icb, 1, 1); + let command_buffer = encode(device, &writing, (&icb, 2), (&[(0, 2)], &Call::Plain)); + let (gpu, read) = counted(device, || { + command_buffer.commit().unwrap(); + command_buffer.wait_until_completed_for(WAIT).unwrap(); + }); + assert_eq!(command_buffer.status(), CommandBufferStatus::Completed); + assert_eq!((gpu, read), (2, 0)); + assert_eq!(setup.output(), expected(&[drawn(0, 0, 4)])); + assert_eq!(away.output(), expected(&[])); + let report = command_buffer.execution_report().unwrap(); + assert!(report.resident_miss); + assert_eq!(report.resident_misses, 2); + }); +} + +/// A record the triangle writer encodes with a fragment buffer past the descriptor's count sets +/// the header's sticky encoding fault: in the GPU form no command draws, and the execution report +/// says why. +#[test] +fn an_encoding_fault_draws_nothing_on_the_gpu_and_is_reported() { + on_device(|device, _| { + let setup = Setup::new(device); + let writer = triangles(device); + let scratch = buffer_with(device, &[0; 64]).unwrap(); + let writing = Writing { + setup: &setup, + writer: &writer, + out: &scratch, + }; + let icb = icb(device, &inheriting(1), 2); + let command_buffer = encode(device, &writing, (&icb, 2), (&[(0, 2)], &Call::Plain)); + let (gpu, read) = counted(device, || { + command_buffer.commit().unwrap(); + command_buffer.wait_until_completed_for(WAIT).unwrap(); + }); + assert_eq!(command_buffer.status(), CommandBufferStatus::Completed); + let report = command_buffer.execution_report().unwrap(); + assert!(report.replay_fault); + assert_eq!(report.replay_faults, ReplayFaults::ENCODING); + assert_eq!((gpu, read), (2, 0)); + assert_eq!(setup.output(), expected(&[])); + let written = read_buffer(&scratch, 0, 8).unwrap(); + assert_eq!(written, [2, 0, 0, 0, 7, 0, 0, 0], "the writer ran"); + }); +} diff --git a/crates/metal2vulkan/src/bind/replay/draws.rs b/crates/metal2vulkan/src/bind/replay/draws.rs index aadd980ea..8209279f9 100644 --- a/crates/metal2vulkan/src/bind/replay/draws.rs +++ b/crates/metal2vulkan/src/bind/replay/draws.rs @@ -28,7 +28,9 @@ //! draw's own). A buffer whose address no resident allocation holds is unbound (its slot reads //! as a buffer never set), and counted as a resident miss ([`StatusBits::RESIDENT_MISS`], the //! [`StatusWord::ResidentMisses`] count), as the host's step leaves it unbound and counts it; -//! the command still draws. +//! the command still draws. A command's own buffer that no slot table holds (past the slots its +//! stage's function reads, or of the object or mesh stage) is resolved for the count alone, as +//! the host's step resolves every buffer below its stage's count. //! - **What it does not run** draws nothing and sets [`StatusBits::REPLAY_FAULT`] with its //! reasons ([`ReplayFaults`]) in the command buffer's `ExecutionStatus`: a record the host's //! decode refuses (`RECORD`, `ENCODING`), a draw of a primitive type the execution does not @@ -463,6 +465,26 @@ fn no_binding(_: &Symbol) -> Option { None } +/// The root `guest` resolves to in the resident set at `resident`, its offset there, and whether +/// it lies inside the root's unpadded extent (`extents`, a `u64` per root): a hit. +fn resolved( + fb: &mut FunctionBuilder<'_>, + t: Types, + (resident, extents): (Value, Value), + guest: Value, +) -> BResult<(Value, Value, Value)> { + let (root, offset) = roots::resolve(fb, resident, guest)?; + let null = k64(fb, roots::NULL_ROOT)?; + let found = fb.binary(BinOp::INotEqual, root, null)?; + let eight = k64(fb, 8)?; + let extent_rel = fb.binary(BinOp::IMul, root, eight)?; + let extent_at = fb.binary(BinOp::IAdd, extents, extent_rel)?; + let extent = load64(fb, t, extent_at)?; + let inside = fb.binary(BinOp::ULessThan, offset, extent)?; + let hit = fb.binary(BinOp::LogicalAnd, found, inside)?; + Ok((root, offset, hit)) +} + /// Write zero into every argument of the command whose arguments start at `base`. fn zero_draws(fb: &mut FunctionBuilder<'_>, t: Types, base: Value, types: Value) -> BResult<()> { count_loop(fb, t, types, move |fb, k| { @@ -641,6 +663,9 @@ pub fn typed_module() -> BResult { let dynamic_allowed = fb.binary(BinOp::INotEqual, dynamic_bits, zero32)?; let static_stride = k64(fb, u64::MAX)?; let bad_bindings = counter(fb, t, 0)?; + let unresolved = counter(fb, t, 0)?; + let extents_off = wide(fb, t, extents_at)?; + let extents = fb.binary(BinOp::IAdd, resident, extents_off)?; let all = k32(fb, layout::ALL_BINDINGS as u32)?; count_loop(fb, t, all, |fb, n| { let n64 = wide(fb, t, n)?; @@ -684,7 +709,42 @@ pub fn typed_module() -> BResult { let refused_stride = fb.binary(BinOp::LogicalOr, refused_stride, strideless)?; let bad_stride = fb.binary(BinOp::LogicalAnd, dynamic, refused_stride)?; let bad = fb.binary(BinOp::LogicalOr, past, bad_stride)?; - flag(fb, bad_bindings, bad, 1) + flag(fb, bad_bindings, bad, 1)?; + // A buffer of the command's own below its stage's count that no slot table holds (past + // the slots its stage's function reads, or of another stage) is resolved too, so that its + // miss counts as the host step's does. + let first_address = k64(fb, BufferBinding::MIN_BUFFER_ADDRESS)?; + let names = fb.binary(BinOp::UGreaterThanEqual, address, first_address)?; + let below = fb.binary(BinOp::ULessThan, slot, stage_count)?; + let mut held = [zero64; 2]; + for (h, (stage_index, slots)) in held + .iter_mut() + .zip([(1u32, vertex_slots), (2, fragment_slots)]) + { + let k = k32(fb, stage_index)?; + let is = fb.binary(BinOp::IEqual, stage, k)?; + let inside = fb.binary(BinOp::ULessThan, slot, slots)?; + *h = fb.binary(BinOp::LogicalAnd, is, inside)?; + } + let covered = fb.binary(BinOp::LogicalOr, held[0], held[1])?; + let uncovered = fb.unary(UnOp::LogicalNot, covered)?; + let own = fb.unary(UnOp::LogicalNot, inherit_buffers)?; + let counted = fb.binary(BinOp::LogicalAnd, names, below)?; + let counted = fb.binary(BinOp::LogicalAnd, counted, uncovered)?; + let counted = fb.binary(BinOp::LogicalAnd, counted, own)?; + let count: ArmFn<'_, ()> = Box::new(move |fb, _| { + let (_, _, hit) = resolved(fb, t, (resident, extents), address)?; + let missed = fb.unary(UnOp::LogicalNot, hit)?; + let one = k32(fb, 1)?; + let zero = k32(fb, 0)?; + let add = fb.select(missed, one, zero)?; + let u = fb.load(unresolved, MemAccess::default())?; + let u = fb.binary(BinOp::IAdd, u, add)?; + fb.store(unresolved, u, MemAccess::default())?; + Ok(ArmEnd::FallThrough(Vec::new())) + }); + fb.if_(&mut (), counted, count, None)?; + Ok(()) })?; let bad = fb.load(bad_bindings, MemAccess::default())?; let bad = fb.binary(BinOp::INotEqual, bad, zero32)?; @@ -735,12 +795,15 @@ pub fn typed_module() -> BResult { let parent_off = wide(fb, t, parent_at)?; let parent = fb.binary(BinOp::IAdd, resident, parent_off)?; let source = fb.select(inherit_buffers, parent, rec)?; - let extents_off = wide(fb, t, extents_at)?; - let extents = fb.binary(BinOp::IAdd, resident, extents_off)?; let runs = fb.load(fault, MemAccess::default())?; let runs = fb.binary(BinOp::IEqual, runs, zero32)?; let runs = fb.binary(BinOp::LogicalAnd, runs, draw)?; + // The misses of a command that draws: those of the buffers no slot table holds, and below + // those of its tables'. let misses = counter(fb, t, 0)?; + let unresolved = fb.load(unresolved, MemAccess::default())?; + let unresolved = fb.select(runs, unresolved, zero32)?; + fb.store(misses, unresolved, MemAccess::default())?; let sink_entry = roots::SINK_ROOT * roots::ENTRY_BYTES; let sink_at = at(fb, resident, sink_entry + roots::HOST)?; let sink = load64(fb, t, sink_at)?; @@ -780,16 +843,8 @@ pub fn typed_module() -> BResult { let first_address = k64(fb, BufferBinding::MIN_BUFFER_ADDRESS)?; let bound = fb.binary(BinOp::UGreaterThanEqual, guest, first_address)?; let live = fb.binary(BinOp::LogicalAnd, runs, bound)?; - let (root, offset) = roots::resolve(fb, resident, guest)?; - let null = k64(fb, roots::NULL_ROOT)?; - let found = fb.binary(BinOp::INotEqual, root, null)?; + let (root, offset, hit) = resolved(fb, t, (resident, extents), guest)?; let size = roots::entry_field(fb, resident, root, roots::SIZE)?; - let eight = k64(fb, 8)?; - let extent_rel = fb.binary(BinOp::IMul, root, eight)?; - let extent_at = fb.binary(BinOp::IAdd, extents, extent_rel)?; - let extent = load64(fb, t, extent_at)?; - let inside = fb.binary(BinOp::ULessThan, offset, extent)?; - let hit = fb.binary(BinOp::LogicalAnd, found, inside)?; let missed = fb.unary(UnOp::LogicalNot, hit)?; let miss = fb.binary(BinOp::LogicalAnd, live, missed)?; let one = k32(fb, 1)?; diff --git a/crates/metal2vulkan/src/bind/replay/draws/tests.rs b/crates/metal2vulkan/src/bind/replay/draws/tests.rs index c65b2491d..3fa25f2c8 100644 --- a/crates/metal2vulkan/src/bind/replay/draws/tests.rs +++ b/crates/metal2vulkan/src/bind/replay/draws/tests.rs @@ -399,6 +399,32 @@ fn a_buffer_no_allocation_holds_is_unbound_and_counted() { assert_eq!(ran.fragment(0, 0), [0; 4]); } +/// A buffer of the command's own that no slot table holds (past the slots its stage's function +/// reads, or of a stage that reads none) is resolved too: its miss counts, as the host step's +/// does, though no slot holds it. A nil buffer's offset counts none, nor does a command that draws +/// nothing. +#[test] +fn a_buffer_past_the_slots_read_counts_its_miss() { + let mut replay = DrawReplay::new(2, 0, 2, vec![3]); + replay.vertex_slots = 1; + replay.fragment_slots = 0; + let buffers = |action| { + record( + action, + &[(0, A.0), (1, AWAY), (2, B.0), (3, 0x40)], + &[(0, AWAY), (1, AWAY)], + ) + }; + let records = [buffers(draw(3, 0, 3, [1, 0])), buffers(Action::Empty)]; + let ran = preprocess(&replay, &records, clean(2)); + assert!(!ran.status.replay_fault); + assert!(ran.status.resident_miss); + assert_eq!(ran.status.resident_misses, 3); + assert_eq!(ran.args(0, 0), [3, 1, 0, 0]); + assert_eq!(ran.vertex(0, 0), [A.1, A.0, padded(A.2), 0]); + assert_eq!(ran.args(1, 0), [0; 4]); +} + /// Where the commands inherit buffers, every command's tables hold the encoder's, and a command /// that sets one of its own draws nothing (`BUFFERS`). #[test] diff --git a/docs/API.md b/docs/API.md index 4be8cfcb7..cbf340843 100644 --- a/docs/API.md +++ b/docs/API.md @@ -1319,10 +1319,12 @@ fast forms record, and each `PrecisionNote`'s rustdoc states its bound. - `metal2vulkan-degrade-host-replayed-indirect-commands` (performance). `HostReplayedIndirectCommands`: An execution of an indirect command buffer that an encoder made resident for writing, or that lies inside a block of command predication or reads its range from - a buffer, which the GPU cannot run alone: one with the caller's check + a buffer, which the GPU cannot run alone: a compute execution with the caller's check (`execute_commands_in_buffer_checked`), of a range read from a buffer, of a buffer that inherits the encoder's buffers, or whose records may name a pipeline state whose kernel observes its - threadgroup partition or fetches `[[stage_in]]` attributes. The GPU may write the records it + threadgroup partition or fetches `[[stage_in]]` attributes; a render execution whose records may + hold, at the commit or as its batch is ready, more than draws of one primitive type under the + encoder's state, or what its check looks for. The GPU may write the records it runs, so they are known only once the work before it completed. Cost: one GPU-to-CPU round trip per execution: its command buffer's work before it, and every batch submitted before that on any queue, completes before the CPU records its commands from their records and submits the rest; the device's scheduler submits nothing else @@ -2717,6 +2719,17 @@ each item named states the rule in full. where Metal orders them only where their uses meet: the uses are the records', which the GPU writes. In a concurrent encoder its commands run together where no route that wrote the records may set a barrier (`IndirectCommandBuffer::command_writes`), and one after another otherwise. +- **Render commands the GPU may write run on the GPU alone** where the commit can tell from what + the records may hold (`IndirectCommandBuffer::command_writes`) that every command is a draw of one + primitive type under the encoder's pipeline state, which the buffer inherits with none of its + buffers: one indirect draw per command, in order, from what a preprocess wrote. Otherwise, and + where what the records may hold grew by the time the pass's batch is ready to submit, a host step + records the pass. +- **A checked execution states what its check looks for** + (`execute_commands_in_buffer_checked`'s `IndirectCommandCheckNeeds`, no Metal counterpart): draws + of points, and commands under states that may encode indirect commands. Where what the records + may hold rules out every kind the check names (`IndirectCommandCheckNeeds::ALL` names both), the + check has nothing to see, is never called, and the execution may run on the GPU alone. - **Command predication** (`encode_start_if`, `encode_start_else`, `encode_end_if` and the while and do-while loops) runs Metal's blocks and loops. A loop is laid down as 64 copies (16 inside another loop); one that runs past them fails its command buffer diff --git a/docs/REFUSALS.md b/docs/REFUSALS.md index 83f7b76b6..233dc2cea 100644 --- a/docs/REFUSALS.md +++ b/docs/REFUSALS.md @@ -14,7 +14,7 @@ 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 `9b16f2898`. +Generated at `bd0d48296`. ## Totals @@ -64,8 +64,8 @@ Generated at `9b16f2898`. | `CoherentMemory` | `coherent(device)` accesses (Vulkan memory model) | devices short of a Vulkan feature the site names | 1: `crates/metal2vulkan/src/lower/sync/memory_model.rs:207` | `rare`: coherent(device) accesses | | `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:1669`, `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:3530` (+5) | `app`: a buffer window past a device's descriptor range | +| `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:3535` (+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:462` (+119) | `system`: pixel formats a device lacks for a use (CoreVideo's 4:2:x and 10-bit formats among them) | @@ -84,27 +84,27 @@ Generated at `9b16f2898`. | `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:853`, `crates/metal2vulkan/src/bind/instantiate.rs:859` (+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) | 26: `crates/metal2vulkan-runtime/src/families/features.rs:1007`, `crates/metal2vulkan-runtime/src/render.rs:5501` (+24) | `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) | +| `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) | 26: `crates/metal2vulkan-runtime/src/families/features.rs:1007`, `crates/metal2vulkan-runtime/src/render.rs:5506` (+24) | `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:1115`, `crates/metal2vulkan/src/lower/stage_io/plan.rs:3008` (+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:3871`, `crates/metal2vulkan/src/lower/stage_io/plan.rs:1258` (+3) | `rare`: vertex amplification | +| `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:3876`, `crates/metal2vulkan/src/lower/stage_io/plan.rs:1258` (+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:1578`, `crates/metal2vulkan-runtime/src/render_state.rs:1078` (+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:1853` (+3) | `rare`: barycentric coordinates | -| `StencilExport` | Stencil export | devices without VkExtension::ExtShaderStencilExport; every device (not implemented) | 6: `crates/metal2vulkan-runtime/src/families/features.rs:1102`, `crates/metal2vulkan/src/bind/graphics.rs:2580` (+4) | `rare`: stencil from the shader | +| `StencilExport` | Stencil export | devices without VkExtension::ExtShaderStencilExport; every device (not implemented) | 6: `crates/metal2vulkan-runtime/src/families/features.rs:1102`, `crates/metal2vulkan/src/bind/graphics.rs:2585` (+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:832`, `crates/metal2vulkan/src/pipeline/link/graphics.rs:834` (+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:291`, `crates/metal2vulkan/src/lower/simd/mod.rs:739` (+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:342`, `crates/metal2vulkan/src/bind/dispatch.rs:877` (+1) | `rare`: kernel stage-in combinations Metal leaves unestablished | +| `KernelStageIn` | Kernel `[[stage_in]]` | every device (not implemented) | 3: `crates/metal2vulkan-runtime/src/indirect_execute.rs:343`, `crates/metal2vulkan/src/bind/dispatch.rs:877` (+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:1536`, `crates/metal2vulkan/src/bind/graphics.rs:2940` (+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:1536`, `crates/metal2vulkan/src/bind/graphics.rs:2945` (+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:518`, `crates/metal2vulkan/src/bind/plan/compute.rs:237` (+3) | `rare`: tile shaders (Apple GPU families) | | `Imageblocks` | An imageblock outside the single-sample forms implemented | devices without a capability the site computes (`missing`); every device (not implemented) | 7: `crates/metal2vulkan/src/lower/access/imageblock.rs:98`, `crates/metal2vulkan/src/lower/access/mod.rs:908` (+5) | `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) | | `Tensors` | | every device (not implemented) | 2: `crates/metal2vulkan-air/src/canon/matmul2d/synth.rs:32`, `crates/metal2vulkan/src/lower/select.rs:903` | `rare`: shader tensors | | `RasterizationRateMap` | | every device (not implemented) | 1: `crates/metal2vulkan/src/lower/fragment/mod.rs:925` | `rare`: rasterization rate maps | -| `GpuEncodedIndirectCommands` | | devices short of a Vulkan feature the site names; devices without buffer device addresses (`addressed_needs`); every device (no Vulkan mechanism); every device (not implemented) | 11: `crates/metal2vulkan/src/bind/replay.rs:530`, `crates/metal2vulkan/src/bind/replay.rs:772` (+9) | `rare`: indirect command buffers encoded by a kernel | +| `GpuEncodedIndirectCommands` | | devices short of a Vulkan feature the site names; devices without buffer device addresses (`addressed_needs`); every device (no Vulkan mechanism); every device (not implemented) | 13: `crates/metal2vulkan/src/bind/replay.rs:541`, `crates/metal2vulkan/src/bind/replay.rs:783` (+11) | `rare`: indirect command buffers encoded by a kernel | | `VulkanVersion` | The device's Vulkan version is below the 1.2 floor | devices without ApiVersion::V1_2 | 2: `crates/metal2vulkan/src/ash_interop/query.rs:915`, `crates/metal2vulkan/src/device/derive.rs:105` | `none`: a device below Vulkan 1.2 | | `Constant` | A bitcode constant record outside the typed model (block address, inline asm, `select` and other constant expressions the IR has no form for) | - | via a helper: 3: `crates/metal2vulkan-air/src/bitcode/constants.rs:210`, `crates/metal2vulkan-air/src/bitcode/constants.rs:268` (+1) | `none`: LLVM constant forms AIR does not emit | | `Attribute` | An LLVM attribute kind that changes the calling ABI and that AIR does not use (`inalloca`, `preallocated`, `byref`, `nest`, the `swift*` kinds) | - | via a helper: 2: `crates/metal2vulkan-air/src/bitcode/attrs.rs:493`, `crates/metal2vulkan/src/error/mod.rs:256` | `none`: LLVM ABI attributes AIR does not use | @@ -121,7 +121,7 @@ Generated at `9b16f2898`. | `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:461` (+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:6681`, `crates/metal2vulkan/src/pipeline/link/graphics.rs:1005` | `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:6686`, `crates/metal2vulkan/src/pipeline/link/graphics.rs:1005` | `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:545` | `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 | @@ -130,8 +130,8 @@ Generated at `9b16f2898`. | `SparseTexture` | A sparse texture (`MTLTexture.isSparse`) bound at `slot`, where a function observes the residency of its accesses (`sparse_color::resident()`) and... | - | via a helper: 2: `crates/metal2vulkan/src/bind/plan/slots.rs:583`, `crates/metal2vulkan/src/bind/plan/slots.rs:607` | `rare`: sparse residency reads | | `TextureSize` | A texture whose extent, array layers, or level count is past what the device takes for its format, type, and usage (`Capability::Limit` names the... | devices short of a device limit the site names | 1: `crates/metal2vulkan-runtime/src/image_plan.rs:1191` | `app`: a texture past a device's image limits | | `TextureSampleCount` | A texture sample count the device does not take for its format, type, and usage | devices short of a Vulkan property the site names; devices without VkFeature::MultisampleArrayImage; every device (no Vulkan mechanism) | 3: `crates/metal2vulkan-runtime/src/image_plan.rs:1239`, `crates/metal2vulkan-runtime/src/image_plan.rs:593` (+1) | `app`: a sample count a device lacks for the texture | -| `TextureView` | A texture view Vulkan cannot make exactly on this image | every device (no Vulkan mechanism); every device (not implemented) | 7: `crates/metal2vulkan-runtime/src/binding_view.rs:156`, `crates/metal2vulkan-runtime/src/texture.rs:5013` (+5) | `app`: a texture view Vulkan cannot make exactly | -| `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:976` (+5) | `app`: texture swizzles whose Metal behaviour is unmeasured | +| `TextureView` | A texture view Vulkan cannot make exactly on this image | every device (no Vulkan mechanism); every device (not implemented) | 7: `crates/metal2vulkan-runtime/src/binding_view.rs:156`, `crates/metal2vulkan-runtime/src/texture.rs:5023` (+5) | `app`: a texture view Vulkan cannot make exactly | +| `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:980` (+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:1787`, `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:393`, `crates/metal2vulkan-runtime/src/host_memory.rs:433` (+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:2186` | `rare`: GPU times on a queue without timestamps | @@ -164,14 +164,14 @@ Generated at `9b16f2898`. |---|---|---|---|---| | `Textures` | Textures and texture buffers | every device (runtime piece not built) | 9: `crates/metal2vulkan-runtime/src/blit_texture.rs:163`, `crates/metal2vulkan-runtime/src/buffer_texture.rs:1554` (+7) | `rare`: texture forms the runtime has not built (texture buffers of some forms, X24Stencil8 views) | | `ResourceHeap` | The resource-ID heap, descriptor set 1 | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/binding.rs:1780` | `rare`: the resource-ID heap's remaining forms | -| `SparseHeaps` | Sparse heaps and their textures | every device (runtime piece not built) | 3: `crates/metal2vulkan-runtime/src/sparse/encoder.rs:456`, `crates/metal2vulkan-runtime/src/texture.rs:1625` (+1) | `rare`: sparse heaps | +| `SparseHeaps` | Sparse heaps and their textures | every device (runtime piece not built) | 3: `crates/metal2vulkan-runtime/src/sparse/encoder.rs:456`, `crates/metal2vulkan-runtime/src/texture.rs:1629` (+1) | `rare`: sparse heaps | | `SparseTileMaps` | What the runtime's emulation of sparse textures does not build yet | every device (runtime piece not built) | 3: `crates/metal2vulkan-runtime/src/binding.rs:501`, `crates/metal2vulkan-runtime/src/sparse/texture.rs:30` (+1) | `rare`: sparse texture emulation's unbuilt pieces | | `HeapPastMaxBufferSize` | A heap larger than the device's `maxBufferSize`, which the device can allocate | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/heap.rs:694` | `rare`: a heap past maxBufferSize | | `HeapTextureAlignment` | A heap texture whose image needs an alignment past the heap memory's base alignment (256 KiB) | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/texture/heap.rs:980` | `rare`: a heap texture needing more than 256 KiB alignment | | `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:1418`, `crates/metal2vulkan-runtime/src/texture/heap.rs:1425` (+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:516` | `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:1079`, `crates/metal2vulkan-runtime/src/compute.rs:1157` (+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:1084`, `crates/metal2vulkan-runtime/src/compute.rs:1163` (+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:2757` | `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:642`, `crates/metal2vulkan-runtime/src/binding.rs:645` | `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:1603` | `rare`: render attachment forms not built | @@ -183,15 +183,15 @@ Generated at `9b16f2898`. | `OverlappingSurfaceRows` | A texture of an IOSurface plane (`Buffer::new_texture_with_iosurface_plane`, the stand-in for `newTextureWithDescriptor:iosurface:plane:`) whose... | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/buffer_texture.rs:263` | `rare`: an IOSurface plane whose rows overlap | | `SamplePositionsAtBegin` | A render pass whose custom sample positions Vulkan takes only through what the runtime does not build | every device (runtime piece not built) | 3: `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:145`, `crates/metal2vulkan-runtime/src/render_pass.rs:1770` (+1) | `rare`: custom sample positions Vulkan takes only at begin | | `SharedEventAcrossDevices` | A shared event handle opened on a device other than its event's | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/event.rs:376` | `rare`: a shared event opened on another device | -| `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.rs:9354`, `crates/metal2vulkan-runtime/src/render_state.rs:1010` (+5) | `rare`: viewport depth outside [0, 1] without the device features | +| `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.rs:9387`, `crates/metal2vulkan-runtime/src/render_state.rs:1010` (+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:1573`, `crates/metal2vulkan-runtime/src/render_state.rs:1576` (+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:6235` | `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:2910` (+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:6240` | `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:2915` (+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:1247` (+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/tile_dispatch.rs:599`, `crates/metal2vulkan-runtime/src/render_pass.rs:1520` | `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:7417`, `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:967` | `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:7409`, `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:834` (+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:7422`, `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:967` | `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:7414`, `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:834` (+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:1460`, `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:1442`, `crates/metal2vulkan-runtime/src/families/limits.rs:1015` | `app`: residency sets (missing API) | @@ -208,19 +208,19 @@ Generated at `9b16f2898`. | `FunctionOptions` | A function descriptor's options beyond `CompileToBinary` and `StoreFunctionInMetalPipelinesScript` (`Library::new_function_with_descriptor`) | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/library.rs:215` | `rare`: function descriptor options beyond CompileToBinary | | `OverlappingTextureCopies` | A blit copy between overlapping regions of one texture's texels (`copyFromTexture:...` with the source's region meeting the destination's, through... (not scheduled) | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/blit_texture.rs:1242` | `rare`: overlapping texture copies (Metal races) | | `RebindTextures` | `Buffer::rebind_bytes_no_copy` of a no-copy buffer with a live texture over its bytes, given memory at another offset in its page than the old | every device (runtime piece not built) | 5: `crates/metal2vulkan-runtime/src/buffer_descriptor.rs:597`, `crates/metal2vulkan-runtime/src/texture/heap.rs:2431` (+3) | `none`: a runtime extension's rebind with a live texture | -| `PvrtcBlockOrder` | A PVRTC texture's blocks in a Metal block order the runtime does not lay out | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/texture.rs:5556` | `rare`: PVRTC regions off whole levels | -| `DecodedHeapTexture` | A heap's or a sparse heap's texture of an ASTC format on a device without that ASTC format (`astc.rs`), or a sparse heap's texture of an ETC2 or... | every device (runtime piece not built) | 2: `crates/metal2vulkan-runtime/src/texture.rs:1633`, `crates/metal2vulkan-runtime/src/texture/heap.rs:1281` | `app`: an ASTC texture in a heap on a device without ASTC | +| `PvrtcBlockOrder` | A PVRTC texture's blocks in a Metal block order the runtime does not lay out | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/texture.rs:5566` | `rare`: PVRTC regions off whole levels | +| `DecodedHeapTexture` | A heap's or a sparse heap's texture of an ASTC format on a device without that ASTC format (`astc.rs`), or a sparse heap's texture of an ETC2 or... | every device (runtime piece not built) | 2: `crates/metal2vulkan-runtime/src/texture.rs:1637`, `crates/metal2vulkan-runtime/src/texture/heap.rs:1281` | `app`: an ASTC texture in a heap on a device without ASTC | | `VertexFetchPast4GiB` | A draw (`drawPrimitives:` and its forms, or an indirect command buffer's command) that may read a vertex attribute the pipeline fetches in its... | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/render/vertex_reach.rs:72` | `rare`: vertex fetch past 4 GiB of a bind offset | | `StageInFetchPast4GiB` | A dispatch (`dispatchThreads:threadsPerThreadgroup:` and its forms, or an indirect command buffer's command) whose kernel may read a... | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/fetch_reach.rs:126` | `rare`: stage-in fetch past 4 GiB of a bind offset | | `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) | 2: `crates/metal2vulkan-runtime/src/index_rewrite.rs:110`, `crates/metal2vulkan-runtime/src/render.rs:7521` | `none`: a strip after the Apple-private setPrimitiveRestartEnabled:index: whose rewrite pass cannot run 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:7895` | `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 | +| `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) | 2: `crates/metal2vulkan-runtime/src/index_rewrite.rs:110`, `crates/metal2vulkan-runtime/src/render.rs:7526` | `none`: a strip after the Apple-private setPrimitiveRestartEnabled:index: whose rewrite pass cannot run 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:7900` | `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:1571`, `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:601`, `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) | | `WriteSwizzle` | A texture of `TextureDescriptor::write_swizzle_enabled` whose swizzle is not the default, with `ShaderWrite` or `RenderTarget` usage, from the... | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/texture_descriptor.rs:547` | `none`: Apple-private writeSwizzleEnabled with a swizzle that writes | -| `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:4801` | `none`: CPU texel access while a runtime extension detached the bytes | +| `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:4811` | `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:236`, `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 | | `HostHeapUncompressedMultisample` | A multisample texture in a heap over host pages (`Device::new_heap_with_bytes_no_copy`) that Metal keeps uncompressed | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/texture/heap.rs:1924` | `none`: a multisample texture Metal keeps uncompressed in a runtime extension's heap over host pages | | `PredicationUnbalanced` | 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) | 4: `crates/metal2vulkan-runtime/src/predication.rs:354`, `crates/metal2vulkan-runtime/src/predication.rs:386` (+2) | `none`: an unbalanced Apple-private command-predication record, whose dropped work Metal decides by no rule measured | @@ -252,9 +252,9 @@ Generated at `9b16f2898`. | `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:626` | `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:865` | `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:3525` | `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:3569` | `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:3607` | `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:3530` | `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:3574` | `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:3612` | `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:802` | `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:580` | `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 | @@ -330,11 +330,11 @@ Each refusal's sites, with the function that builds it. - `feature::CoherentMemory`: `crates/metal2vulkan/src/lower/sync/memory_model.rs:207 (check)` - `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:1669 (accept_placement)`; `crates/metal2vulkan/src/lower/select.rs:1641 (finish)`; `crates/metal2vulkan/src/pipeline/link.rs:1061 (limit_error)` -- `feature::BufferRange`: `crates/metal2vulkan-runtime/src/function_table.rs:569 (past_storage_buffer_range)`; `crates/metal2vulkan/src/bind/graphics.rs:3530 (patch_binding)`; `crates/metal2vulkan/src/bind/graphics.rs:3574 (patch_binding)`; `crates/metal2vulkan/src/bind/graphics.rs:3612 (patch_binding)`; `crates/metal2vulkan/src/bind/instantiate.rs:632 (bind_buffers)`; `crates/metal2vulkan/src/lower/access/function_table.rs:226 (select)`; `crates/metal2vulkan/src/lower/access/mod.rs:1184 (place_slots)` +- `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:1061 (limit_error)` +- `feature::BufferRange`: `crates/metal2vulkan-runtime/src/function_table.rs:569 (past_storage_buffer_range)`; `crates/metal2vulkan/src/bind/graphics.rs:3535 (patch_binding)`; `crates/metal2vulkan/src/bind/graphics.rs:3579 (patch_binding)`; `crates/metal2vulkan/src/bind/graphics.rs:3617 (patch_binding)`; `crates/metal2vulkan/src/bind/instantiate.rs:632 (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:462 (check_formats)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:469 (check_formats)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:484 (check_formats)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:541 (pair_unit)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:633 (plan_levels_copy)`; `crates/metal2vulkan-runtime/src/blit_texture.rs:2087 (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:1598 (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:539 (check_own_memory)`; `crates/metal2vulkan-runtime/src/image_plan.rs:665 (plan_held)`; `crates/metal2vulkan-runtime/src/image_plan.rs:782 (plan_held)`; `crates/metal2vulkan-runtime/src/image_plan.rs:902 (plan_held)`; `crates/metal2vulkan-runtime/src/render.rs:6800 (viewing)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1282 (layout)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1618 (target)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1711 (attachment_format)`; `crates/metal2vulkan-runtime/src/render_pass.rs:944 (check_target)`; `crates/metal2vulkan-runtime/src/resolve.rs:392 (unmodelled_resolve)`; `crates/metal2vulkan-runtime/src/resolve.rs:482 (color)`; `crates/metal2vulkan-runtime/src/sample_copy.rs:177 (checked_twin)`; `crates/metal2vulkan-runtime/src/sample_copy.rs:205 (plan)`; `crates/metal2vulkan-runtime/src/sample_interleave.rs:296 (interleave_merge)`; `crates/metal2vulkan-runtime/src/shadow.rs:644 (unmerged)`; `crates/metal2vulkan-runtime/src/shadow.rs:651 (unmerged)`; `crates/metal2vulkan-runtime/src/texture.rs:1996 (texture_as)`; `crates/metal2vulkan-runtime/src/texture.rs:3527 (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:1810 (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:114 (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:410 (check_format)`; `crates/metal2vulkan-runtime/src/view_plan.rs:420 (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:657 (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:1371 (plan)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1762 (select_read)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1870 (select_output)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1897 (select_output)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1916 (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:2262 (entry)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:842 (zeroed_output)`; `crates/metal2vulkan/src/lower/stage_io/word_color.rs:83 (plan)`; `crates/metal2vulkan/src/lower/texture/mod.rs:2342 (select)`; `crates/metal2vulkan/src/lower/texture/mod.rs:2984 (cross_class)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3156 (select_image)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3326 (select_read_as)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3363 (select_read_as)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3696 (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:1657 (vk_format)`; `crates/metal2vulkan/src/metal/format/mod.rs:1659 (vk_format)`; `crates/metal2vulkan/src/metal/format/mod.rs:1789 (candidates)`; `crates/metal2vulkan/src/metal/format/mod.rs:2745 (storage_choice_viewed)`; `crates/metal2vulkan/src/metal/format/mod.rs:2763 (held_storage_choice)`; `crates/metal2vulkan/src/metal/format/mod.rs:2771 (held_storage_choice)`; `crates/metal2vulkan/src/metal/format/mod.rs:2868 (held_storage_choice)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:1087 (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:957 (reads_alpha_to_coverage)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:978 (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:462 (check_formats)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:469 (check_formats)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:484 (check_formats)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:541 (pair_unit)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:633 (plan_levels_copy)`; `crates/metal2vulkan-runtime/src/blit_texture.rs:2087 (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:1598 (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:539 (check_own_memory)`; `crates/metal2vulkan-runtime/src/image_plan.rs:665 (plan_held)`; `crates/metal2vulkan-runtime/src/image_plan.rs:782 (plan_held)`; `crates/metal2vulkan-runtime/src/image_plan.rs:902 (plan_held)`; `crates/metal2vulkan-runtime/src/render.rs:6805 (viewing)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1282 (layout)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1618 (target)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1711 (attachment_format)`; `crates/metal2vulkan-runtime/src/render_pass.rs:944 (check_target)`; `crates/metal2vulkan-runtime/src/resolve.rs:392 (unmodelled_resolve)`; `crates/metal2vulkan-runtime/src/resolve.rs:482 (color)`; `crates/metal2vulkan-runtime/src/sample_copy.rs:177 (checked_twin)`; `crates/metal2vulkan-runtime/src/sample_copy.rs:205 (plan)`; `crates/metal2vulkan-runtime/src/sample_interleave.rs:296 (interleave_merge)`; `crates/metal2vulkan-runtime/src/shadow.rs:644 (unmerged)`; `crates/metal2vulkan-runtime/src/shadow.rs:651 (unmerged)`; `crates/metal2vulkan-runtime/src/texture.rs:2000 (texture_as)`; `crates/metal2vulkan-runtime/src/texture.rs:3531 (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:1810 (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:114 (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:410 (check_format)`; `crates/metal2vulkan-runtime/src/view_plan.rs:420 (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:657 (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:1371 (plan)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1762 (select_read)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1870 (select_output)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1897 (select_output)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1916 (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:2262 (entry)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:842 (zeroed_output)`; `crates/metal2vulkan/src/lower/stage_io/word_color.rs:83 (plan)`; `crates/metal2vulkan/src/lower/texture/mod.rs:2342 (select)`; `crates/metal2vulkan/src/lower/texture/mod.rs:2984 (cross_class)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3156 (select_image)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3326 (select_read_as)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3363 (select_read_as)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3696 (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:1657 (vk_format)`; `crates/metal2vulkan/src/metal/format/mod.rs:1659 (vk_format)`; `crates/metal2vulkan/src/metal/format/mod.rs:1789 (candidates)`; `crates/metal2vulkan/src/metal/format/mod.rs:2745 (storage_choice_viewed)`; `crates/metal2vulkan/src/metal/format/mod.rs:2763 (held_storage_choice)`; `crates/metal2vulkan/src/metal/format/mod.rs:2771 (held_storage_choice)`; `crates/metal2vulkan/src/metal/format/mod.rs:2868 (held_storage_choice)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:1087 (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:957 (reads_alpha_to_coverage)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:978 (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)` @@ -350,27 +350,27 @@ 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:853 (texel_ranges)`; `crates/metal2vulkan/src/bind/instantiate.rs:859 (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:1007 (state)`; `crates/metal2vulkan-runtime/src/render.rs:5501 (next_instance)`; `crates/metal2vulkan-runtime/src/sample_planes.rs:116 (lacks)`; `crates/metal2vulkan-runtime/src/sample_planes.rs:143 (new)`; `crates/metal2vulkan-runtime/src/sample_planes.rs:514 (planes_merge)`; `crates/metal2vulkan/src/bind/extended_shadow.rs:190 (extended_shadow_module)`; `crates/metal2vulkan/src/bind/graphics.rs:1453 (plan)`; `crates/metal2vulkan/src/bind/graphics.rs:1490 (plan)`; `crates/metal2vulkan/src/bind/graphics.rs:1509 (plan)`; `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:1716 (plan_sample)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:749 (not_implemented)`; `crates/metal2vulkan/src/pipeline/link/fetch.rs:164 (storage_attachments)` +- `feature::FramebufferFetch`: `crates/metal2vulkan-runtime/src/families/features.rs:1007 (state)`; `crates/metal2vulkan-runtime/src/render.rs:5506 (next_instance)`; `crates/metal2vulkan-runtime/src/sample_planes.rs:116 (lacks)`; `crates/metal2vulkan-runtime/src/sample_planes.rs:143 (new)`; `crates/metal2vulkan-runtime/src/sample_planes.rs:514 (planes_merge)`; `crates/metal2vulkan/src/bind/extended_shadow.rs:190 (extended_shadow_module)`; `crates/metal2vulkan/src/bind/graphics.rs:1453 (plan)`; `crates/metal2vulkan/src/bind/graphics.rs:1490 (plan)`; `crates/metal2vulkan/src/bind/graphics.rs:1509 (plan)`; `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:1716 (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:1115 (state)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:3008 (finish)`; `crates/metal2vulkan/src/pipeline/link/varyings.rs:240 (check_primitive_id)` -- `feature::VertexAmplification`: `crates/metal2vulkan/src/bind/graphics.rs:3871 (multiview_instances)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:1258 (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::VertexAmplification`: `crates/metal2vulkan/src/bind/graphics.rs:3876 (multiview_instances)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:1258 (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:1578 (target)`; `crates/metal2vulkan-runtime/src/render_state.rs:1078 (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:1259 (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:1144 (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:1853 (input_builtin)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:719 (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:1102 (state)`; `crates/metal2vulkan/src/bind/graphics.rs:2580 (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::StencilExport`: `crates/metal2vulkan-runtime/src/families/features.rs:1102 (state)`; `crates/metal2vulkan/src/bind/graphics.rs:2585 (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:832 (sample_invocations)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:834 (sample_invocations)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:916 (sample_invocations)` - `feature::PixelCoverageAtSampleRate`: `crates/metal2vulkan/src/lower/fragment/coverage.rs:291 (finish)`; `crates/metal2vulkan/src/lower/simd/mod.rs:739 (select_param)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:867 (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:342 (record)`; `crates/metal2vulkan/src/bind/dispatch.rs:877 (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:3728 (tessellation_dispatch)`; `crates/metal2vulkan/src/lower/stage_io/fetch.rs:519 (select)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:1434 (primitive_id_output)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:1727 (input_builtin)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:776 (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:1536 (plan)`; `crates/metal2vulkan/src/bind/graphics.rs:2940 (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::KernelStageIn`: `crates/metal2vulkan-runtime/src/indirect_execute.rs:343 (record)`; `crates/metal2vulkan/src/bind/dispatch.rs:877 (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:3733 (tessellation_dispatch)`; `crates/metal2vulkan/src/lower/stage_io/fetch.rs:519 (select)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:1434 (primitive_id_output)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:1727 (input_builtin)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:776 (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:1536 (plan)`; `crates/metal2vulkan/src/bind/graphics.rs:2945 (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:518 (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:687 (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:103 (require)`; `crates/metal2vulkan/src/lower/fragment/imageblock.rs:85 (not_implemented)`; `crates/metal2vulkan/src/lower/texture/mod.rs:2352 (select)`; `crates/metal2vulkan/src/lower/texture/slice.rs:139 (imageblocks)`; `crates/metal2vulkan/src/pipeline/link/imageblock.rs:46 (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:925 (select)` -- `feature::GpuEncodedIndirectCommands`: `crates/metal2vulkan/src/bind/replay.rs:530 (preprocess)`; `crates/metal2vulkan/src/bind/replay.rs:772 (replay_preprocess_module)`; `crates/metal2vulkan/src/bind/replay/flat.rs:247 (flat_dispatch_module)`; `crates/metal2vulkan/src/lower/access/encode.rs:393 (needs)`; `crates/metal2vulkan/src/lower/access/encode.rs:409 (needs)`; `crates/metal2vulkan/src/lower/access/encode.rs:526 (select_command)`; `crates/metal2vulkan/src/lower/access/mod.rs:1538 (plan_replay)`; `crates/metal2vulkan/src/lower/access/mod.rs:1551 (plan_replay)`; `crates/metal2vulkan/src/lower/access/mod.rs:1554 (plan_replay)`; `crates/metal2vulkan/src/pipeline/compile.rs:2110 (plan_one)`; `crates/metal2vulkan/src/pipeline/compile.rs:2115 (plan_one)` +- `feature::GpuEncodedIndirectCommands`: `crates/metal2vulkan/src/bind/replay.rs:541 (preprocess)`; `crates/metal2vulkan/src/bind/replay.rs:783 (replay_preprocess_module)`; `crates/metal2vulkan/src/bind/replay/draws.rs:264 (draw_replay_preprocess)`; `crates/metal2vulkan/src/bind/replay/draws.rs:431 (draw_replay_module)`; `crates/metal2vulkan/src/bind/replay/flat.rs:247 (flat_dispatch_module)`; `crates/metal2vulkan/src/lower/access/encode.rs:393 (needs)`; `crates/metal2vulkan/src/lower/access/encode.rs:409 (needs)`; `crates/metal2vulkan/src/lower/access/encode.rs:526 (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/pipeline/compile.rs:2110 (plan_one)`; `crates/metal2vulkan/src/pipeline/compile.rs:2115 (plan_one)` - `feature::VulkanVersion`: `crates/metal2vulkan/src/ash_interop/query.rs:915 (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)` @@ -385,9 +385,9 @@ Each refusal's sites, with the function that builds it. - `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:461`; `crates/metal2vulkan/src/bind/dispatch.rs:959 (instantiate)`; `crates/metal2vulkan/src/bind/graphics.rs:3144 (mesh_draw)`; `crates/metal2vulkan/src/bind/graphics.rs:3195 (emulated_draw)` +- `feature::GroupCount`: `crates/metal2vulkan/src/bind/dispatch.rs:379 (product)`; `crates/metal2vulkan/src/bind/dispatch.rs:461`; `crates/metal2vulkan/src/bind/dispatch.rs:959 (instantiate)`; `crates/metal2vulkan/src/bind/graphics.rs:3149 (mesh_draw)`; `crates/metal2vulkan/src/bind/graphics.rs:3200 (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:6681 (check_pipeline)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:1005 (uniform_blend)` +- `feature::IndependentBlending`: `crates/metal2vulkan-runtime/src/render.rs:6686 (check_pipeline)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:1005 (uniform_blend)` - `feature::RasterSampleCount`: `crates/metal2vulkan-runtime/src/families/limits.rs:1059 (sample_count)`; `crates/metal2vulkan/src/pipeline/graphics.rs:545 (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)` @@ -396,8 +396,8 @@ Each refusal's sites, with the function that builds it. - `feature::SparseTexture`: `crates/metal2vulkan/src/bind/plan/slots.rs:583 (check_sparse_textures)`; `crates/metal2vulkan/src/bind/plan/slots.rs:607 (check_sparse_textures)` - `feature::TextureSize`: `crates/metal2vulkan-runtime/src/image_plan.rs:1191 (check_image_limits)` - `feature::TextureSampleCount`: `crates/metal2vulkan-runtime/src/image_plan.rs:1239 (check_image_limits)`; `crates/metal2vulkan-runtime/src/image_plan.rs:593 (plan_held)`; `crates/metal2vulkan-runtime/src/image_plan.rs:603 (plan_held)` -- `feature::TextureView`: `crates/metal2vulkan-runtime/src/binding_view.rs:156 (binding_view)`; `crates/metal2vulkan-runtime/src/texture.rs:5013 (view)`; `crates/metal2vulkan-runtime/src/texture/decoded_twin.rs:1420 (make_second_twin)`; `crates/metal2vulkan-runtime/src/texture/view_shadow.rs:298 (apart_refusal)`; `crates/metal2vulkan-runtime/src/view_plan.rs:431 (check_format)`; `crates/metal2vulkan-runtime/src/view_plan.rs:481 (check_view)`; `crates/metal2vulkan-runtime/src/view_plan.rs:503 (check_view)` -- `feature::TextureSwizzle`: `crates/metal2vulkan-runtime/src/binding_view.rs:167 (binding_view)`; `crates/metal2vulkan-runtime/src/texture.rs:976 (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:3391 (select_read_as)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3738 (select_write)`; `crates/metal2vulkan/src/lower/texture/slice.rs:307 (select)` +- `feature::TextureView`: `crates/metal2vulkan-runtime/src/binding_view.rs:156 (binding_view)`; `crates/metal2vulkan-runtime/src/texture.rs:5023 (view)`; `crates/metal2vulkan-runtime/src/texture/decoded_twin.rs:1420 (make_second_twin)`; `crates/metal2vulkan-runtime/src/texture/view_shadow.rs:298 (apart_refusal)`; `crates/metal2vulkan-runtime/src/view_plan.rs:431 (check_format)`; `crates/metal2vulkan-runtime/src/view_plan.rs:481 (check_view)`; `crates/metal2vulkan-runtime/src/view_plan.rs:503 (check_view)` +- `feature::TextureSwizzle`: `crates/metal2vulkan-runtime/src/binding_view.rs:167 (binding_view)`; `crates/metal2vulkan-runtime/src/texture.rs:980 (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:3391 (select_read_as)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3738 (select_write)`; `crates/metal2vulkan/src/lower/texture/slice.rs:307 (select)` - `feature::MipmapGeneration`: `crates/metal2vulkan-runtime/src/blit_texture.rs:1787 (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:393 (not_importable)`; `crates/metal2vulkan-runtime/src/host_memory.rs:433 (refuse_unwritable)`; `crates/metal2vulkan-runtime/src/host_memory.rs:652 (new)`; `crates/metal2vulkan-runtime/src/host_memory.rs:657 (new)`; `crates/metal2vulkan-runtime/src/host_memory.rs:675 (new)` - `feature::GpuTimes`: `crates/metal2vulkan-runtime/src/command_buffer/mod.rs:2186 (gpu_times)` @@ -423,36 +423,36 @@ Each refusal's sites, with the function that builds it. - `feature::CommandPredication`: `crates/metal2vulkan/src/bind/replay/predication.rs:414 (predication_step_module)` - `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)` -- `gap::Textures`: `crates/metal2vulkan-runtime/src/blit_texture.rs:163 (check_depth_view)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:1554 (view_usage)`; `crates/metal2vulkan-runtime/src/pipeline/mod.rs:1484 (compile_error)`; `crates/metal2vulkan-runtime/src/texture.rs:1441 (image_error)`; `crates/metal2vulkan-runtime/src/texture.rs:2161 (storage_over_buffer)`; `crates/metal2vulkan-runtime/src/texture.rs:2973 (new_image_starting)`; `crates/metal2vulkan-runtime/src/texture.rs:4016 (image)`; `crates/metal2vulkan-runtime/src/texture.rs:5484 (host_copy)`; `crates/metal2vulkan-runtime/src/texture/surface_two_planes.rs:207 (new_surface_planes_texture)` +- `gap::Textures`: `crates/metal2vulkan-runtime/src/blit_texture.rs:163 (check_depth_view)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:1554 (view_usage)`; `crates/metal2vulkan-runtime/src/pipeline/mod.rs:1490 (compile_error)`; `crates/metal2vulkan-runtime/src/texture.rs:1445 (image_error)`; `crates/metal2vulkan-runtime/src/texture.rs:2165 (storage_over_buffer)`; `crates/metal2vulkan-runtime/src/texture.rs:2977 (new_image_starting)`; `crates/metal2vulkan-runtime/src/texture.rs:4021 (image)`; `crates/metal2vulkan-runtime/src/texture.rs:5494 (host_copy)`; `crates/metal2vulkan-runtime/src/texture/surface_two_planes.rs:207 (new_surface_planes_texture)` - `gap::ResourceHeap`: `crates/metal2vulkan-runtime/src/binding.rs:1780 (descriptor)` -- `gap::SparseHeaps`: `crates/metal2vulkan-runtime/src/sparse/encoder.rs:456 (first_slice)`; `crates/metal2vulkan-runtime/src/texture.rs:1625 (plan_sparse_texture)`; `crates/metal2vulkan-runtime/src/texture.rs:4708 (make_aliasable)` -- `gap::SparseTileMaps`: `crates/metal2vulkan-runtime/src/binding.rs:501 (slot_tile_map)`; `crates/metal2vulkan-runtime/src/sparse/texture.rs:30 (sparse_refusal)`; `crates/metal2vulkan-runtime/src/texture.rs:1658 (plan_sparse_texture)` +- `gap::SparseHeaps`: `crates/metal2vulkan-runtime/src/sparse/encoder.rs:456 (first_slice)`; `crates/metal2vulkan-runtime/src/texture.rs:1629 (plan_sparse_texture)`; `crates/metal2vulkan-runtime/src/texture.rs:4713 (make_aliasable)` +- `gap::SparseTileMaps`: `crates/metal2vulkan-runtime/src/binding.rs:501 (slot_tile_map)`; `crates/metal2vulkan-runtime/src/sparse/texture.rs:30 (sparse_refusal)`; `crates/metal2vulkan-runtime/src/texture.rs:1662 (plan_sparse_texture)` - `gap::HeapPastMaxBufferSize`: `crates/metal2vulkan-runtime/src/heap.rs:694 (heap_size)` - `gap::HeapTextureAlignment`: `crates/metal2vulkan-runtime/src/texture/heap.rs:980 (check_heap_base)` - `gap::HeapTextureMemory`: `crates/metal2vulkan-runtime/src/texture/heap.rs:1418 (heap_plan)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:1425 (heap_plan)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:1919 (host_heap_plan)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2132 (memory_shadow)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:489 (memory_refusal)` - `gap::FunctionTablePastMaxBufferLength`: `crates/metal2vulkan-runtime/src/function_table.rs:622 (past_limit)` - `gap::IndirectCommandBufferPastMaxBufferLength`: `crates/metal2vulkan-runtime/src/indirect_command_buffer.rs:516 (new_indirect_command_buffer)` -- `gap::IndirectRenderCommands`: `crates/metal2vulkan-runtime/src/compute.rs:1079 (execute_range)`; `crates/metal2vulkan-runtime/src/compute.rs:1157 (execute_indirect_range)`; `crates/metal2vulkan-runtime/src/depth_stencil.rs:85 (gpu_resource_id)`; `crates/metal2vulkan-runtime/src/indirect_command_buffer.rs:3600 (render_state)`; `crates/metal2vulkan-runtime/src/indirect_command_buffer.rs:511 (new_indirect_command_buffer)`; `crates/metal2vulkan-runtime/src/pipeline/mod.rs:1491 (compile_error)`; `crates/metal2vulkan-runtime/src/render.rs:7280 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:7644 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:8046 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:8478 (draw_resident)`; `crates/metal2vulkan-runtime/src/render/executions.rs:1883 (record)`; `crates/metal2vulkan-runtime/src/render/executions.rs:1926 (record)`; `crates/metal2vulkan-runtime/src/render/executions.rs:2612 (record)`; `crates/metal2vulkan-runtime/src/render/executions.rs:390 (execute_range)`; `crates/metal2vulkan-runtime/src/render/executions.rs:477 (execute_indirect_range)`; `crates/metal2vulkan-runtime/src/render/executions.rs:492 (execute_indirect_range)`; `crates/metal2vulkan-runtime/src/render/executions.rs:988 (back_memoryless)` +- `gap::IndirectRenderCommands`: `crates/metal2vulkan-runtime/src/compute.rs:1084 (execute_range)`; `crates/metal2vulkan-runtime/src/compute.rs:1163 (execute_indirect_range)`; `crates/metal2vulkan-runtime/src/depth_stencil.rs:85 (gpu_resource_id)`; `crates/metal2vulkan-runtime/src/indirect_command_buffer.rs:3637 (render_state)`; `crates/metal2vulkan-runtime/src/indirect_command_buffer.rs:511 (new_indirect_command_buffer)`; `crates/metal2vulkan-runtime/src/pipeline/mod.rs:1497 (compile_error)`; `crates/metal2vulkan-runtime/src/render.rs:7285 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:7649 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:8051 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:8489 (draw_resident)`; `crates/metal2vulkan-runtime/src/render/executions.rs:1006 (back_memoryless)`; `crates/metal2vulkan-runtime/src/render/executions.rs:1906 (record)`; `crates/metal2vulkan-runtime/src/render/executions.rs:1949 (record)`; `crates/metal2vulkan-runtime/src/render/executions.rs:2722 (record_forms)`; `crates/metal2vulkan-runtime/src/render/executions.rs:401 (execute_range)`; `crates/metal2vulkan-runtime/src/render/executions.rs:489 (execute_indirect_range)`; `crates/metal2vulkan-runtime/src/render/executions.rs:504 (execute_indirect_range)` - `gap::IndirectImageblockSize`: `crates/metal2vulkan-runtime/src/indirect_command_buffer.rs:2757 (set_imageblock_size)` - `gap::CommandReplay`: `crates/metal2vulkan-runtime/src/binding.rs:642 (bind)`; `crates/metal2vulkan-runtime/src/binding.rs:645 (bind)` - `gap::RenderAttachments`: `crates/metal2vulkan-runtime/src/binding.rs:1603 (unexpected)` - `gap::AccelerationStructures`: `crates/metal2vulkan-runtime/src/binding.rs:1606 (unexpected)` - `gap::FeatureEnable`: `crates/metal2vulkan-runtime/src/enables.rs:1155 (of)` - `gap::ExtensionEnable`: `crates/metal2vulkan-runtime/src/enables.rs:1146 (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:197 (plan)`; `crates/metal2vulkan-runtime/src/pipeline/render.rs:1131 (imageblock_sample_length)`; `crates/metal2vulkan-runtime/src/render.rs:5547 (next_instance)`; `crates/metal2vulkan-runtime/src/render.rs:6731 (check_pipeline)`; `crates/metal2vulkan-runtime/src/render.rs:7738 (draw_resident)`; `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:514 (scratch)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1226 (layout)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1585 (target)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1639 (target)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1700 (attachment_format)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1933 (depth_stencil)`; `crates/metal2vulkan-runtime/src/resolve.rs:1010 (destination)`; `crates/metal2vulkan-runtime/src/resolve.rs:1027 (destination)`; `crates/metal2vulkan-runtime/src/resolve.rs:1091 (destination)`; `crates/metal2vulkan-runtime/src/resolve.rs:901 (attach)`; `crates/metal2vulkan-runtime/src/resolve.rs:969 (color_copy)` +- `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:197 (plan)`; `crates/metal2vulkan-runtime/src/pipeline/render.rs:1131 (imageblock_sample_length)`; `crates/metal2vulkan-runtime/src/render.rs:5552 (next_instance)`; `crates/metal2vulkan-runtime/src/render.rs:6736 (check_pipeline)`; `crates/metal2vulkan-runtime/src/render.rs:7743 (draw_resident)`; `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:514 (scratch)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1226 (layout)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1585 (target)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1639 (target)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1700 (attachment_format)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1933 (depth_stencil)`; `crates/metal2vulkan-runtime/src/resolve.rs:1010 (destination)`; `crates/metal2vulkan-runtime/src/resolve.rs:1027 (destination)`; `crates/metal2vulkan-runtime/src/resolve.rs:1091 (destination)`; `crates/metal2vulkan-runtime/src/resolve.rs:901 (attach)`; `crates/metal2vulkan-runtime/src/resolve.rs:969 (color_copy)` - `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:1770 (positioned_stand_in)`; `crates/metal2vulkan-runtime/src/sample_positions.rs:185 (grid)` - `gap::SharedEventAcrossDevices`: `crates/metal2vulkan-runtime/src/event.rs:376 (new_shared_event_with_handle)` -- `gap::ViewportDepthRange`: `crates/metal2vulkan-runtime/src/render.rs:9354 (draw_settings)`; `crates/metal2vulkan-runtime/src/render_state.rs:1010`; `crates/metal2vulkan-runtime/src/render_state.rs:1178 (depth_ranges_refused)`; `crates/metal2vulkan-runtime/src/render_state.rs:1545 (bias_holds)`; `crates/metal2vulkan-runtime/src/render_state.rs:1564 (collapses)`; `crates/metal2vulkan-runtime/src/render_state.rs:503 (depth_range)`; `crates/metal2vulkan-runtime/src/render_state.rs:731 (compensation)` +- `gap::ViewportDepthRange`: `crates/metal2vulkan-runtime/src/render.rs:9387 (draw_settings)`; `crates/metal2vulkan-runtime/src/render_state.rs:1010`; `crates/metal2vulkan-runtime/src/render_state.rs:1178 (depth_ranges_refused)`; `crates/metal2vulkan-runtime/src/render_state.rs:1545 (bias_holds)`; `crates/metal2vulkan-runtime/src/render_state.rs:1564 (collapses)`; `crates/metal2vulkan-runtime/src/render_state.rs:503 (depth_range)`; `crates/metal2vulkan-runtime/src/render_state.rs:731 (compensation)` - `gap::NonFiniteDepthBias`: `crates/metal2vulkan-runtime/src/render_state.rs:1573 (collapses)`; `crates/metal2vulkan-runtime/src/render_state.rs:1576 (collapses)`; `crates/metal2vulkan-runtime/src/render_state.rs:347 (set_depth_bias)`; `crates/metal2vulkan-runtime/src/render_state.rs:439 (draw_viewports)`; `crates/metal2vulkan-runtime/src/render_state.rs:581 (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:6235 (hidden_depth_stencil)` -- `gap::IndirectDrawArguments`: `crates/metal2vulkan-runtime/src/index_bounds.rs:91 (new)`; `crates/metal2vulkan-runtime/src/render.rs:2910 (draw_indexed_primitives_indirect)`; `crates/metal2vulkan-runtime/src/render.rs:7494 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:7548 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:7579 (draw_resident)` +- `gap::HiddenDepthStencil`: `crates/metal2vulkan-runtime/src/attachment_stand_in.rs:563 (hidden)`; `crates/metal2vulkan-runtime/src/render.rs:6240 (hidden_depth_stencil)` +- `gap::IndirectDrawArguments`: `crates/metal2vulkan-runtime/src/index_bounds.rs:91 (new)`; `crates/metal2vulkan-runtime/src/render.rs:2915 (draw_indexed_primitives_indirect)`; `crates/metal2vulkan-runtime/src/render.rs:7499 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:7553 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:7584 (draw_resident)` - `gap::DepthStencilResolve`: `crates/metal2vulkan-runtime/src/depth_stencil_resolve.rs:441 (draws_run)`; `crates/metal2vulkan-runtime/src/resolve.rs:1247 (plan)`; `crates/metal2vulkan-runtime/src/resolve.rs:653 (depth_stencil)`; `crates/metal2vulkan-runtime/src/resolve.rs:751 (steps)`; `crates/metal2vulkan-runtime/src/resolve.rs:771 (steps)`; `crates/metal2vulkan-runtime/src/resolve.rs:812 (split_steps)`; `crates/metal2vulkan-runtime/src/resolve.rs:824 (split_steps)` - `gap::TileAtSampleCount`: `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:599`; `crates/metal2vulkan-runtime/src/render_pass.rs:1520 (layout)` -- `gap::ImageblockMasters`: `crates/metal2vulkan-runtime/src/render.rs:7417 (draw_resident)`; `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:967 (dispatch_tiles_resident)` -- `gap::TileAndFragmentImageblocks`: `crates/metal2vulkan-runtime/src/render.rs:7409 (draw_resident)`; `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:834 (dispatch_tiles_resident)`; `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:959 (dispatch_tiles_resident)` +- `gap::ImageblockMasters`: `crates/metal2vulkan-runtime/src/render.rs:7422 (draw_resident)`; `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:967 (dispatch_tiles_resident)` +- `gap::TileAndFragmentImageblocks`: `crates/metal2vulkan-runtime/src/render.rs:7414 (draw_resident)`; `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:834 (dispatch_tiles_resident)`; `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:959 (dispatch_tiles_resident)` - `gap::Metal4Api`: `crates/metal2vulkan-runtime/src/families/features.rs:1460 (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:1442 (state)`; `crates/metal2vulkan-runtime/src/families/limits.rs:1015 (state)` @@ -469,19 +469,19 @@ Each refusal's sites, with the function that builds it. - `gap::FunctionOptions`: `crates/metal2vulkan-runtime/src/library.rs:215 (new_function_with_descriptor)` - `gap::OverlappingTextureCopies`: `crates/metal2vulkan-runtime/src/blit_texture.rs:1242 (texture_copies_of_bytes)` - `gap::RebindTextures`: `crates/metal2vulkan-runtime/src/buffer_descriptor.rs:597 (rebind_host_pages)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2431 (rebound_heap_images)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2446 (rebound_heap_images)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2457 (rebound_heap_images)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2500 (dma_buf_heap_images_again)` -- `gap::PvrtcBlockOrder`: `crates/metal2vulkan-runtime/src/texture.rs:5556 (host_copy)` -- `gap::DecodedHeapTexture`: `crates/metal2vulkan-runtime/src/texture.rs:1633 (plan_sparse_texture)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:1281 (heap_plan)` +- `gap::PvrtcBlockOrder`: `crates/metal2vulkan-runtime/src/texture.rs:5566 (host_copy)` +- `gap::DecodedHeapTexture`: `crates/metal2vulkan-runtime/src/texture.rs:1637 (plan_sparse_texture)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:1281 (heap_plan)` - `gap::VertexFetchPast4GiB`: `crates/metal2vulkan-runtime/src/render/vertex_reach.rs:72 (check_vertex_reach)` - `gap::StageInFetchPast4GiB`: `crates/metal2vulkan-runtime/src/fetch_reach.rs:126 (check_stage_in_reach)` - `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/index_rewrite.rs:110 (new)`; `crates/metal2vulkan-runtime/src/render.rs:7521 (draw_resident)` -- `gap::PrimitiveIdIndices`: `crates/metal2vulkan-runtime/src/render.rs:7895 (draw_resident)` -- `gap::RotatedTexture`: `crates/metal2vulkan-runtime/src/blit_texture.rs:1571 (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:638 (unmerged)`; `crates/metal2vulkan-runtime/src/texture.rs:4971 (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::RestartedStrip`: `crates/metal2vulkan-runtime/src/index_rewrite.rs:110 (new)`; `crates/metal2vulkan-runtime/src/render.rs:7526 (draw_resident)` +- `gap::PrimitiveIdIndices`: `crates/metal2vulkan-runtime/src/render.rs:7900 (draw_resident)` +- `gap::RotatedTexture`: `crates/metal2vulkan-runtime/src/blit_texture.rs:1571 (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:638 (unmerged)`; `crates/metal2vulkan-runtime/src/texture.rs:4981 (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:601 (rebind_host_pages)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:622 (make_texture_over)`; `crates/metal2vulkan-runtime/src/detach.rs:149 (detach_host_pages)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2639 (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)` - `gap::WriteSwizzle`: `crates/metal2vulkan-runtime/src/texture_descriptor.rs:547 (check_made)` -- `gap::DetachedTexelAccess`: `crates/metal2vulkan-runtime/src/texture.rs:4801 (refuse_detached_texels)` +- `gap::DetachedTexelAccess`: `crates/metal2vulkan-runtime/src/texture.rs:4811 (refuse_detached_texels)` - `gap::SurfaceDepthStencil`: `crates/metal2vulkan-runtime/src/blit_texture.rs:236 (unit)`; `crates/metal2vulkan-runtime/src/texture/surface_depth.rs:57 (surface_depth_twin)` - `gap::HostHeapUncompressedMultisample`: `crates/metal2vulkan-runtime/src/texture/heap.rs:1924 (host_heap_plan)` - `gap::PredicationUnbalanced`: `crates/metal2vulkan-runtime/src/predication.rs:354 (nil)`; `crates/metal2vulkan-runtime/src/predication.rs:386 (start_else)`; `crates/metal2vulkan-runtime/src/predication.rs:438 (end_if)`; `crates/metal2vulkan-runtime/src/predication.rs:558 (end_loop)` @@ -503,9 +503,9 @@ Each refusal's sites, with the function that builds it. - `bind::DescriptorRangeExceeded`: `crates/metal2vulkan/src/bind/instantiate.rs:626 (bind_buffers)` - `bind::TexelBufferTooLarge`: `crates/metal2vulkan/src/bind/instantiate.rs:865 (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:3525 (patch_binding)` -- `bind::PatchIndexRange`: `crates/metal2vulkan/src/bind/graphics.rs:3569 (patch_binding)` -- `bind::ControlPointIndexRange`: `crates/metal2vulkan/src/bind/graphics.rs:3607 (patch_binding)` +- `bind::TessellationFactorRange`: `crates/metal2vulkan/src/bind/graphics.rs:3530 (patch_binding)` +- `bind::PatchIndexRange`: `crates/metal2vulkan/src/bind/graphics.rs:3574 (patch_binding)` +- `bind::ControlPointIndexRange`: `crates/metal2vulkan/src/bind/graphics.rs:3612 (patch_binding)` - `bind::MissingStageInRegion`: `crates/metal2vulkan/src/bind/dispatch.rs:802 (instantiate)` - `bind::UniformViewAliased`: `crates/metal2vulkan/src/bind/instantiate.rs:580 (check_uniform_aliasing)` - `bind::MissingDeviceAddress`: `crates/metal2vulkan/src/bind/plan/slots.rs:133 (plan_buffer)` diff --git a/docs/RUNTIME-PORTING.md b/docs/RUNTIME-PORTING.md index 1e96a0bc8..0f0d3ca1d 100644 --- a/docs/RUNTIME-PORTING.md +++ b/docs/RUNTIME-PORTING.md @@ -166,7 +166,7 @@ narrow refusal that the call's rustdoc describes. | `EncodeStartWhile` | `encodeStartWhile:offset:comparison:referenceValue:` (SPI) | `ComputeCommandEncoder::encode_start_while`, as Metal runs it, laid down as `encode_start_do_while`'s loops are; refused as there, and as `encode_start_if` refuses its word *(partial)* | | `EndEncoding` | `endEncoding` | `ComputeCommandEncoder::end_encoding` | | `ExecuteCommandsIndirect` | `executeCommandsInBuffer:indirectBuffer:indirectBufferOffset:` | `ComputeCommandEncoder::execute_commands_in_buffer_indirect`; `_checked` adds an `IndirectCommandCheck` its host step calls on each command first | -| `ExecuteCommandsInBuffer` | `executeCommandsInBuffer:withRange:` | `ComputeCommandEncoder::execute_commands_in_buffer`; `_checked` adds an `IndirectCommandCheck` a host step calls on each command first | +| `ExecuteCommandsInBuffer` | `executeCommandsInBuffer:withRange:` | `ComputeCommandEncoder::execute_commands_in_buffer`; `_checked` adds an `IndirectCommandCheck` a host step calls on each command first, and the `IndirectCommandCheckNeeds` it looks for | | `CompressedTextureReinterpretationFlush` | `insertCompressedTextureReinterpretationFlush` (SPI) | `ComputeCommandEncoder::insert_compressed_texture_reinterpretation_flush`: a no-op | | `MemoryBarrierWithResources` | `memoryBarrierWithResources:count:` | `ComputeCommandEncoder::memory_barrier_with_resources` | | `MemoryBarrierWithScope` | `memoryBarrierWithScope:` | `ComputeCommandEncoder::memory_barrier_with_scope` | @@ -387,7 +387,7 @@ narrow refusal that the call's rustdoc describes. | `DrawPrimitivesBase` | `drawPrimitives:vertexStart:vertexCount:instanceCount:baseInstance:` | `RenderCommandEncoder::draw_primitives` *(partial)* | | `EndEncoding` | `endEncoding` | `RenderCommandEncoder::end_encoding` | | `ExecuteCommandsIndirect` | `executeCommandsInBuffer:indirectBuffer:indirectBufferOffset:` | `RenderCommandEncoder::execute_commands_in_buffer_indirect`: the pass is recorded at a host step (announced once); `_checked` adds an `IndirectCommandCheck` the step calls on each command first *(partial)* | -| `ExecuteCommandsInBuffer` | `executeCommandsInBuffer:withRange:` | `RenderCommandEncoder::execute_commands_in_buffer`: the records as they stand at commit, or at a host step where the GPU writes them; `_checked` adds an `IndirectCommandCheck` that step calls on each command first *(partial)* | +| `ExecuteCommandsInBuffer` | `executeCommandsInBuffer:withRange:` | `RenderCommandEncoder::execute_commands_in_buffer`: the records as they stand at commit, on the GPU alone where the commit can tell every command draws one primitive type under the inherited state, or at a host step where the GPU writes them otherwise; `_checked` adds an `IndirectCommandCheck` that step calls on each command first, and the `IndirectCommandCheckNeeds` it looks for, which the GPU alone may rule out *(partial)* | | `MemoryBarrierWithScope` | `memoryBarrierWithScope:afterStages:beforeStages:` | `RenderCommandEncoder::memory_barrier_with_scope` | | `SetAlphaTestReferenceValue` | `setAlphaTestReferenceValue:` (SPI) | `RenderCommandEncoder::set_alpha_test_reference_value`: a no-op (no runtime pipeline has an alpha test) | | `SetBlendColorRed` | `setBlendColorRed:green:blue:alpha:` | `RenderCommandEncoder::set_blend_color` |