From 1d494932f7a9a9abdbd16d2fcad89dec84cef3dc Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Fri, 23 Oct 2026 01:44:47 +0300 Subject: [PATCH] Clear the object-grid lane's targets to zero before reading them as drawn nothing The steps this packet landed as, in order: - Run any object grid Metal runs, in pieces within the task stage's limits - Upload a folded object draw's fold when it launches nothing too - Run an unfolded object stage's direct grid as Metal does when its threads wrap - Bump the semantics, artifact format and runtime versions for the seventh stack - Pin the runtime sources of the seventh stack - Bless the golden hash tables over the seventh stack Content: the tree of `development` at a6f6b269ad, unchanged. --- .../src/command_buffer/mod.rs | 18 +- .../metal2vulkan-runtime/src/device/prime.rs | 3 +- crates/metal2vulkan-runtime/src/enables.rs | 1 + crates/metal2vulkan-runtime/src/error.rs | 15 +- crates/metal2vulkan-runtime/src/exit_guard.rs | 1 + .../metal2vulkan-runtime/src/owned_kernel.rs | 8 +- .../metal2vulkan-runtime/src/recorder/log.rs | 45 ++ .../metal2vulkan-runtime/src/recorder/mod.rs | 40 +- .../src/recorder/thunks.rs | 10 + crates/metal2vulkan-runtime/src/render.rs | 129 +++++- .../metal2vulkan-runtime/src/render/mesh.rs | 25 +- .../src/render/mesh_arguments.rs | 94 +++- .../fixtures/public/engine/TOOLCHAIN | 1 + .../public/engine/mesh_object_grid.air.ll | 146 ++++++ .../public/engine/mesh_object_grid.ll | 144 ++++++ .../public/engine/mesh_object_grid.metal | 49 ++ .../runtime-sources.sha256 | 2 +- .../src/candidate/platform/enables.rs | 1 + .../src/runtime_lane/mesh_draws.rs | 335 +++++++++++--- crates/metal2vulkan/src/ash_interop/query.rs | 1 + crates/metal2vulkan/src/bind/graphics.rs | 159 ++++++- .../metal2vulkan/src/bind/graphics/tests.rs | 143 ++++++ crates/metal2vulkan/src/bind/instantiate.rs | 4 +- .../metal2vulkan/src/bind/mesh_arguments.rs | 437 +++++++++++++++--- .../src/bind/mesh_arguments/tests.rs | 277 ++++++++++- crates/metal2vulkan/src/bind/mod.rs | 5 +- crates/metal2vulkan/src/bind/plan.rs | 5 + crates/metal2vulkan/src/bind/status.rs | 9 +- crates/metal2vulkan/src/cache/codec.rs | 2 +- crates/metal2vulkan/src/cache/mod.rs | 6 +- crates/metal2vulkan/src/device/enables.rs | 2 +- crates/metal2vulkan/src/device/khronos.rs | 1 + .../metal2vulkan/src/device/requirements.rs | 3 + crates/metal2vulkan/src/lower/access/mod.rs | 10 +- crates/metal2vulkan/src/lower/dispatch.rs | 46 +- .../metal2vulkan/src/lower/dispatch/tests.rs | 1 + crates/metal2vulkan/src/lower/mesh/mod.rs | 15 + crates/metal2vulkan/src/pipeline/api_tests.rs | 7 + .../metal2vulkan/src/pipeline/compile/api.rs | 5 +- .../src/spirv/requirements/mod.rs | 5 + crates/metal2vulkan/src/tests/engine_mesh.rs | 50 ++ crates/metal2vulkan/src/vk/draw.rs | 9 + crates/metal2vulkan/tests/api_surface.rs | 12 + crates/metal2vulkan/tests/golden_hashes.tsv | 38 +- .../tests/golden_hashes_exact.tsv | 28 +- docs/API.md | 26 +- docs/FAST-PATHS.md | 14 +- docs/METAL-COVERAGE.md | 2 +- docs/REFUSALS.md | 152 +++--- scripts/metal-coverage/coverage.tsv | 2 +- 50 files changed, 2192 insertions(+), 351 deletions(-) create mode 100644 crates/metal2vulkan-validation/fixtures/public/engine/mesh_object_grid.air.ll create mode 100644 crates/metal2vulkan-validation/fixtures/public/engine/mesh_object_grid.ll create mode 100644 crates/metal2vulkan-validation/fixtures/public/engine/mesh_object_grid.metal diff --git a/crates/metal2vulkan-runtime/src/command_buffer/mod.rs b/crates/metal2vulkan-runtime/src/command_buffer/mod.rs index f6cad056b..5f553c28d 100644 --- a/crates/metal2vulkan-runtime/src/command_buffer/mod.rs +++ b/crates/metal2vulkan-runtime/src/command_buffer/mod.rs @@ -605,6 +605,9 @@ pub(super) struct State { pub(super) descriptors: DescriptorArena, /// The execution status words the commands share, once a command reaches them. status_words: Option, + /// A direct mesh draw's object grid lay past what runs (`render/mesh_arguments.rs`): the + /// command buffer fails as for `ExecutionStatus`'s `MESH_GRID_PAST_LIMITS`. + mesh_grid_past: bool, /// The captured passes' tile masks, which its completion counts (`render/capture.rs`). pub(super) capture_tallies: Vec, /// The index pool of the commands' index bounds and rewrite passes (`index_bounds.rs`, @@ -1565,6 +1568,12 @@ impl State { Ok(self.status_words(device)?.device_address()) } + /// A direct mesh draw's object grid lies past what runs (`render/mesh_arguments.rs`): the + /// command buffer fails as Metal's GPU fails it. + pub(crate) fn mesh_grid_past_limits(&mut self) { + self.mesh_grid_past = true; + } + /// The command buffer's execution status words, uploaded (all zero, `ExecutionStatus::initial`) /// when a command first reaches them. pub(super) fn status_words(&mut self, device: &Device) -> Result { @@ -1710,6 +1719,7 @@ impl CommandBuffer { shadows_copied_in: Vec::new(), descriptors: DescriptorArena::default(), status_words: None, + mesh_grid_past: false, capture_tallies: Vec::new(), index_pool: None, mesh_pool: None, @@ -4062,9 +4072,11 @@ impl CommandBufferShared { CommandBufferError::PREDICATION_OPEN_AT_UNIT_END_DESCRIPTION.to_owned(), ); } - // An indirect mesh draw's object grid lay past the device's task limits - // (`render/mesh_arguments.rs`): the command buffer failed. - if report.mesh_grid_past_limits && state.error.is_none() { + // A mesh draw's object grid lay past what runs (`render/mesh_arguments.rs`): + // the command buffer failed, as Metal's GPU fails it. + if (report.mesh_grid_past_limits || state.mesh_grid_past) + && state.error.is_none() + { state.status = CommandBufferStatus::Error; state.error = Some(CommandBufferError::MeshGridPastLimits); } diff --git a/crates/metal2vulkan-runtime/src/device/prime.rs b/crates/metal2vulkan-runtime/src/device/prime.rs index 690e984ae..60762d8c3 100644 --- a/crates/metal2vulkan-runtime/src/device/prime.rs +++ b/crates/metal2vulkan-runtime/src/device/prime.rs @@ -96,12 +96,13 @@ use super::QueueSlot; /// and of an execution of commands the GPU generates, which take pipelines of their own kinds. /// The first release of each in the process, and the first replay of each command /// (`recorder`), registers the hook again as its section ends (`exit_guard::called`). -pub(crate) const UNPRIMED: [Call; 7] = [ +pub(crate) const UNPRIMED: [Call; 8] = [ Call::DestroyDevice, Call::DestroyDebugUtilsMessenger, Call::DestroyInstance, Call::CmdDrawMeshTasks, Call::CmdDrawMeshTasksIndirect, + Call::CmdDrawMeshTasksIndirectCount, Call::CmdExecuteGeneratedCommands, Call::CmdPreprocessGeneratedCommands, ]; diff --git a/crates/metal2vulkan-runtime/src/enables.rs b/crates/metal2vulkan-runtime/src/enables.rs index 0da519f0d..d83201c12 100644 --- a/crates/metal2vulkan-runtime/src/enables.rs +++ b/crates/metal2vulkan-runtime/src/enables.rs @@ -699,6 +699,7 @@ members! { V12.v12.descriptor_binding_variable_descriptor_count => DescriptorBindingVariableDescriptorCount; V12.v12.runtime_descriptor_array => RuntimeDescriptorArray; V12.v12.sampler_filter_minmax => SamplerFilterMinmax; + V12.v12.draw_indirect_count => DrawIndirectCount; V12.v12.scalar_block_layout => ScalarBlockLayout; V12.v12.uniform_buffer_standard_layout => UniformBufferStandardLayout; V12.v12.shader_subgroup_extended_types => ShaderSubgroupExtendedTypes; diff --git a/crates/metal2vulkan-runtime/src/error.rs b/crates/metal2vulkan-runtime/src/error.rs index b05107160..bf2b5d985 100644 --- a/crates/metal2vulkan-runtime/src/error.rs +++ b/crates/metal2vulkan-runtime/src/error.rs @@ -1627,12 +1627,15 @@ pub enum CommandBufferError { /// the device's budget, so nothing is drawn short silently. The first records fault of the /// command buffer, where it is a tessellation draw's, as its scan saw it. TessellationRecordsOverflow(TessellationRecordsOverflow), - /// An indirect mesh draw's object grid, as the GPU wrote it, lay past the device's task - /// stage limits (`maxTaskWorkGroupCount`, `maxTaskWorkGroupTotalCount`): such draws drew - /// nothing. Metal draws every object grid measured (16,777,216 threadgroups along `x` on an M3 - /// Max), and Vulkan cannot launch one past the limits, so nothing is drawn short silently. A - /// direct draw of such a grid is refused as it is encoded (`Unsupported{MeshShading}` naming - /// the limit). + /// A mesh draw's object grid lay past what runs, and such draws drew nothing: 2^29 or more + /// threadgroups, whose draw Metal's GPU fails after its watchdog's 5 seconds + /// (`MTLCommandBufferErrorInternal`, measured on an M3 Max: 2^28 completes in 2.5 seconds), + /// so the code is Metal's. On a device that does not fold object grids (without device + /// addresses, `shaderInt64`, `multiDrawIndirect` or `drawIndirectCount`), an indirect draw's + /// grid, as the GPU wrote it, past the task stage's limits (`maxTaskWorkGroupCount`, + /// `maxTaskWorkGroupTotalCount`) too, which Metal draws: nothing is drawn short silently. A + /// direct draw of such a grid there is refused as it is encoded (`Unsupported{MeshShading}` + /// naming the limit). MeshGridPastLimits, /// A host step refused a command it recorded from an indirect command buffer's records /// (`Degradation::HostReplayedIndirectCommands`): what `commit` refuses where the CPU wrote diff --git a/crates/metal2vulkan-runtime/src/exit_guard.rs b/crates/metal2vulkan-runtime/src/exit_guard.rs index 3db9bbd18..0b00f8f8d 100644 --- a/crates/metal2vulkan-runtime/src/exit_guard.rs +++ b/crates/metal2vulkan-runtime/src/exit_guard.rs @@ -502,6 +502,7 @@ calls! { // ([`UNPRIMED`](crate::device::prime::UNPRIMED)). CmdDrawMeshTasks => c"vkCmdDrawMeshTasksEXT", CmdDrawMeshTasksIndirect => c"vkCmdDrawMeshTasksIndirectEXT", + CmdDrawMeshTasksIndirectCount => c"vkCmdDrawMeshTasksIndirectCountEXT", CmdExecuteGeneratedCommands => c"vkCmdExecuteGeneratedCommandsEXT", CmdPreprocessGeneratedCommands => c"vkCmdPreprocessGeneratedCommandsEXT", } diff --git a/crates/metal2vulkan-runtime/src/owned_kernel.rs b/crates/metal2vulkan-runtime/src/owned_kernel.rs index c44bb19ce..80a00e2f8 100644 --- a/crates/metal2vulkan-runtime/src/owned_kernel.rs +++ b/crates/metal2vulkan-runtime/src/owned_kernel.rs @@ -112,7 +112,8 @@ pub(super) enum OwnedModule { /// draw (`render/mesh.rs`). MeshScan, /// `bind::mesh_arguments_module` of one form: an indirect mesh draw's group counts, as Metal - /// draws them within the device's limits (`render/mesh_arguments.rs`). + /// draws them within the device's limits, or a folded object function's pieces + /// (`render/mesh_arguments.rs`). MeshArguments(metal2vulkan::bind::MeshArgumentsForm), /// `bind::plane_words_module`: a blit's color words of a two-plane extended-range texture /// moved between its texels and a buffer (`two_planes.rs`). @@ -523,6 +524,7 @@ pub(super) struct OwnedKernels { mesh_scan: Option, mesh_arguments_mesh: Option, mesh_arguments_object: Option, + mesh_arguments_folded: Option, plane_words: Option, plane_copy: Option, index_rewrites: HashMap<(RewriteProgram, RewritePhase), OwnedKernel>, @@ -565,6 +567,7 @@ impl OwnedKernels { self.mesh_scan, self.mesh_arguments_mesh, self.mesh_arguments_object, + self.mesh_arguments_folded, self.plane_words, self.plane_copy, self.rotate_texels, @@ -712,6 +715,9 @@ impl OwnedKernels { OwnedModule::MeshArguments(metal2vulkan::bind::MeshArgumentsForm::Object) => { &mut self.mesh_arguments_object } + OwnedModule::MeshArguments(metal2vulkan::bind::MeshArgumentsForm::FoldedObject) => { + &mut self.mesh_arguments_folded + } OwnedModule::PlaneWords => &mut self.plane_words, OwnedModule::PlaneCopy => &mut self.plane_copy, OwnedModule::RotateTexels => &mut self.rotate_texels, diff --git a/crates/metal2vulkan-runtime/src/recorder/log.rs b/crates/metal2vulkan-runtime/src/recorder/log.rs index 08c2e9bb0..895770d71 100644 --- a/crates/metal2vulkan-runtime/src/recorder/log.rs +++ b/crates/metal2vulkan-runtime/src/recorder/log.rs @@ -265,6 +265,15 @@ enum Logged { BindIndexBuffer2(vk::Buffer, vk::DeviceSize, vk::DeviceSize, vk::IndexType), DrawMeshTasks(u32, u32, u32), DrawMeshTasksIndirect(vk::Buffer, vk::DeviceSize, u32, u32), + /// The commands' buffer and offset, the count's, the most draws and the stride. + DrawMeshTasksIndirectCount( + vk::Buffer, + vk::DeviceSize, + vk::Buffer, + vk::DeviceSize, + u32, + u32, + ), /// Preprocessed, and the info's place in its arena. ExecuteGeneratedCommands(vk::Bool32, Span), /// The info's place, and the state command buffer where it is another than this one. @@ -1166,6 +1175,25 @@ impl Log { self.op(Logged::DrawMeshTasksIndirect(buffer, offset, count, stride)); } + pub(super) unsafe fn cmd_draw_mesh_tasks_indirect_count( + &mut self, + buffer: vk::Buffer, + offset: vk::DeviceSize, + count_buffer: vk::Buffer, + count_offset: vk::DeviceSize, + max_count: u32, + stride: u32, + ) { + self.op(Logged::DrawMeshTasksIndirectCount( + buffer, + offset, + count_buffer, + count_offset, + max_count, + stride, + )); + } + /// The info, copied, its chain checked empty. /// /// # Safety @@ -1720,6 +1748,23 @@ impl Log { count, stride ), + Logged::DrawMeshTasksIndirectCount( + buffer, + offset, + count_buffer, + count_offset, + max_count, + stride, + ) => call!( + CmdDrawMeshTasksIndirectCount, + vk::PFN_vkCmdDrawMeshTasksIndirectCountEXT, + buffer, + offset, + count_buffer, + count_offset, + max_count, + stride + ), Logged::ExecuteGeneratedCommands(preprocessed, info) => call!( CmdExecuteGeneratedCommands, unsafe extern "system" fn( diff --git a/crates/metal2vulkan-runtime/src/recorder/mod.rs b/crates/metal2vulkan-runtime/src/recorder/mod.rs index d2cb143dd..56645bc57 100644 --- a/crates/metal2vulkan-runtime/src/recorder/mod.rs +++ b/crates/metal2vulkan-runtime/src/recorder/mod.rs @@ -266,15 +266,17 @@ pub(crate) unsafe fn reserve_end(raw: vk::CommandBuffer) { pub(crate) struct MeshDraws { draw: vk::PFN_vkCmdDrawMeshTasksEXT, indirect: vk::PFN_vkCmdDrawMeshTasksIndirectEXT, + indirect_count: vk::PFN_vkCmdDrawMeshTasksIndirectCountEXT, } impl MeshDraws { /// The commands of `loaded`, through `slot` where the device has one. pub(crate) fn new(loaded: &ash::ext::mesh_shader::Device, slot: Option<&Slot>) -> MeshDraws { let functions = loaded.fp(); - let (draw, indirect) = ( + let (draw, indirect, indirect_count) = ( functions.cmd_draw_mesh_tasks_ext, functions.cmd_draw_mesh_tasks_indirect_ext, + functions.cmd_draw_mesh_tasks_indirect_count_ext, ); match slot { // SAFETY: each is the device's command of that name. @@ -282,9 +284,15 @@ impl MeshDraws { MeshDraws { draw: slot.route(Command::CmdDrawMeshTasks, draw), indirect: slot.route(Command::CmdDrawMeshTasksIndirect, indirect), + indirect_count: slot + .route(Command::CmdDrawMeshTasksIndirectCount, indirect_count), } }, - None => MeshDraws { draw, indirect }, + None => MeshDraws { + draw, + indirect, + indirect_count, + }, } } @@ -320,4 +328,32 @@ impl MeshDraws { // SAFETY: the caller's. unsafe { (self.indirect)(command_buffer, buffer, offset, draw_count, stride) } } + + /// `vkCmdDrawMeshTasksIndirectCountEXT`, its count in `buffer` too (the device enabled + /// `drawIndirectCount` wherever a pipeline draws it, `bind::mesh_arguments`). + /// + /// # Safety + /// + /// As the command's. + pub(crate) unsafe fn cmd_draw_mesh_tasks_indirect_count( + &self, + command_buffer: vk::CommandBuffer, + buffer: vk::Buffer, + (offset, count_offset): (vk::DeviceSize, vk::DeviceSize), + max_draw_count: u32, + stride: u32, + ) { + // SAFETY: the caller's. + unsafe { + (self.indirect_count)( + command_buffer, + buffer, + offset, + buffer, + count_offset, + max_draw_count, + stride, + ) + } + } } diff --git a/crates/metal2vulkan-runtime/src/recorder/thunks.rs b/crates/metal2vulkan-runtime/src/recorder/thunks.rs index 89d7a262f..0690463b2 100644 --- a/crates/metal2vulkan-runtime/src/recorder/thunks.rs +++ b/crates/metal2vulkan-runtime/src/recorder/thunks.rs @@ -405,6 +405,16 @@ commands! { CmdDrawMeshTasks cmd_draw_mesh_tasks c"vkCmdDrawMeshTasksEXT" (x: u32, y: u32, z: u32); CmdDrawMeshTasksIndirect cmd_draw_mesh_tasks_indirect c"vkCmdDrawMeshTasksIndirectEXT" (buffer: vk::Buffer, offset: vk::DeviceSize, count: u32, stride: u32); + CmdDrawMeshTasksIndirectCount cmd_draw_mesh_tasks_indirect_count + c"vkCmdDrawMeshTasksIndirectCountEXT" + ( + buffer: vk::Buffer, + offset: vk::DeviceSize, + count_buffer: vk::Buffer, + count_offset: vk::DeviceSize, + max_count: u32, + stride: u32 + ); CmdExecuteGeneratedCommands cmd_execute_generated_commands c"vkCmdExecuteGeneratedCommandsEXT" (preprocessed: vk::Bool32, info: *const GeneratedCommandsInfo); diff --git a/crates/metal2vulkan-runtime/src/render.rs b/crates/metal2vulkan-runtime/src/render.rs index 96f4e9300..7648f0687 100644 --- a/crates/metal2vulkan-runtime/src/render.rs +++ b/crates/metal2vulkan-runtime/src/render.rs @@ -7390,6 +7390,11 @@ impl RenderLowering { || commands.mesh_dispatch.as_ref().is_some_and(|dispatch| { matches!(dispatch.mesh, MeshGroups::Direct(groups) if groups.contains(&0)) }); + // A folded object function's direct draw of a grid past what runs draws nothing and fails + // the command buffer, as Metal's GPU fails it (`render/mesh_arguments.rs`). + if commands.object_fold.is_some_and(|fold| fold.past) && !culled { + self.core.command_buffer().state().mesh_grid_past_limits(); + } // Set 1, the heap: its writes at the elements of their resource IDs, and the device's // texture and sampler tables at the handle tables. let compiled = variant.pipeline(); @@ -7937,6 +7942,45 @@ impl RenderLowering { }) } }; + // An indirect mesh draw's arguments pass, whose scratch its draw reads, and a folded + // object function's direct draw's uploaded fold (`render/mesh_arguments.rs`). + let arguments = match ( + commands.mesh_arguments, + buffers.indirect.as_ref(), + empty || culled, + ) { + (Some(form), Some(source), false) => { + let threads = match draw { + DrawCall::MeshThreadgroupsIndirect { + threads_per_object_group, + .. + } => threads_per_object_group, + _ => [1; 3], + }; + Some(mesh_arguments::ArgumentsPass::new( + &mut self.core, + source, + form, + threads, + )?) + } + (Some(_), None, false) => { + return Err(internal("a mesh arguments pass without its arguments")) + } + _ => None, + }; + // Uploaded for a draw that launches nothing too: its object stage's hole takes the + // record's address all the same. + let fold = match &commands.object_fold { + Some(fold) => Some(mesh_arguments::FoldUpload::new(&mut self.core, fold)?), + None => None, + }; + // A folded object function reads its region record at its scratch's address. + let region_record = match (&arguments, &fold) { + (Some(pass), _) => pass.record()?, + (None, Some(fold)) => Some(fold.record()?), + (None, None) => None, + }; let stages = [ (Stage::Vertex, pass_start.or(Stage::Vertex, &self.vertex)), (Stage::Fragment, &self.fragment), @@ -8019,6 +8063,7 @@ impl RenderLowering { if let Some((buffer, offset)) = buffers.control_point_indices { tables = tables.with_control_point_indices(buffer, offset); } + tables.region_record = region_record; // An emulated mesh draw's work buffer and records (`render/mesh.rs`), and an emulated // tessellation draw's (`render/tessellation_scan.rs`). let mesh_work = commands @@ -8486,19 +8531,6 @@ impl RenderLowering { (self.core.set_zero(&objects, (&mut writes, offsets))?, &[]) } }; - // An indirect mesh draw's arguments pass, whose scratch its draw reads - // (`render/mesh_arguments.rs`). - let arguments = match (commands.mesh_arguments, indirect, empty || culled) { - (Some(form), Some(source), false) => Some(mesh_arguments::ArgumentsPass::new( - &mut self.core, - source, - form, - )?), - (Some(_), None, false) => { - return Err(internal("a mesh arguments pass without its arguments")) - } - _ => None, - }; // The Vulkan draws: the binder's, the index bounds pass's two, or the index rewrite // pass's one. let sized = device.shared().sized_index_bind; @@ -8520,6 +8552,61 @@ impl RenderLowering { } (Some(pass), ..) => one(pass.draw(sized)), (_, Some(pass), Some(source), _, _) => (pass.draws(source, commands.draw, sized)?, 2), + // A folded object function's direct draw's pieces are its uploaded fold's. + ( + _, + _, + _, + _, + metal2vulkan::vk::DrawCommand::DrawMeshTasksIndirect { + offset, + draw_count, + stride, + }, + ) if fold.is_some() => { + let (raw, at) = fold + .as_ref() + .map(mesh_arguments::FoldUpload::commands) + .ok_or_else(|| internal("a folded object grid's upload gone"))?; + one(( + None, + Some(raw), + metal2vulkan::vk::DrawCommand::DrawMeshTasksIndirect { + offset: at + offset, + draw_count, + stride, + }, + )) + } + // A folded object function's indirect draw's pieces are its arguments pass's, both + // offsets into its scratch. + ( + _, + _, + _, + _, + metal2vulkan::vk::DrawCommand::DrawMeshTasksIndirectCount { + offset, + count_offset, + max_draw_count, + stride, + }, + ) if arguments.is_some() => { + let (raw, at) = arguments + .as_ref() + .map(mesh_arguments::ArgumentsPass::scratch) + .ok_or_else(|| internal("a mesh arguments pass gone"))?; + one(( + None, + Some(raw), + metal2vulkan::vk::DrawCommand::DrawMeshTasksIndirectCount { + offset: at + offset, + count_offset: at + count_offset, + max_draw_count, + stride, + }, + )) + } // An indirect mesh draw's counts are its arguments pass's. ( _, @@ -10983,6 +11070,22 @@ impl Recording<'_> { mesh.cmd_draw_mesh_tasks_indirect(cb, buffer, offset, draw_count, stride); } } + metal2vulkan::vk::DrawCommand::DrawMeshTasksIndirectCount { + offset, + count_offset, + max_draw_count, + stride, + } => { + if let (Some(mesh), Some(buffer)) = (self.mesh, self.indirect) { + mesh.cmd_draw_mesh_tasks_indirect_count( + cb, + buffer, + (offset, count_offset), + max_draw_count, + stride, + ); + } + } } } Recorded { diff --git a/crates/metal2vulkan-runtime/src/render/mesh.rs b/crates/metal2vulkan-runtime/src/render/mesh.rs index a6262260a..274129f6c 100644 --- a/crates/metal2vulkan-runtime/src/render/mesh.rs +++ b/crates/metal2vulkan-runtime/src/render/mesh.rs @@ -35,7 +35,8 @@ //! assembly; its key takes a triangle list, under which Vulkan biases the depth of a mesh //! function's triangles and of none of its lines or points, as Metal does. //! - **Refused**, as the binder refuses them: a threadgroup or a grid past the device's limits -//! for its stage (`Unsupported{MeshShading}` naming the limit), a `drawMeshThreads` that +//! for its stage (`Unsupported{MeshShading}` naming the limit; an object grid only on a device +//! that does not fold object grids), a `drawMeshThreads` that //! leaves a partial object threadgroup (`NotImplemented(MeshShading)`: splitting the draw into //! regions of their own threadgroup sizes would reorder its primitives), and an object //! function's arena with the lengths `setObjectThreadgroupMemoryLength:atIndex:` set @@ -43,11 +44,16 @@ //! memory for the object stage (`Unsupported{ThreadgroupMemorySize}` naming the limit). //! - **Metal's grids**, measured on the M3 Max (macOS 27.0.1), direct and indirect alike: without //! an object function a grid with an axis past 65,535 draws nothing, as does one of more than -//! 1,048,575 threadgroups (`bind::mesh_arguments`); with one, every object grid measured -//! draws. On a device with `VK_EXT_mesh_shader` an indirect draw reads the counts its arguments -//! pass writes (`render/mesh_arguments.rs`): Metal's, or none where Metal draws nothing, and an -//! object grid past the device's task limits draws nothing and fails the command buffer -//! (`CommandBufferError::MeshGridPastLimits`). +//! 1,048,575 threadgroups (`bind::mesh_arguments`); with one, every object grid its GPU finishes +//! draws (2^28 threadgroups in 2.5 seconds), and one of 2^29 or more fails the command buffer +//! after the GPU's watchdog. On a device with `VK_EXT_mesh_shader` an indirect draw reads the +//! counts its arguments pass writes (`render/mesh_arguments.rs`): Metal's, or none where Metal +//! draws nothing. Where the device folds object grids (device addresses, `shaderInt64`, +//! `multiDrawIndirect`, `drawIndirectCount`: every committed profile with the extension), an +//! object grid runs in pieces within the task stage's limits, its object function compiled +//! folded; one of 2^29 threadgroups or more draws nothing and fails the command buffer +//! (`CommandBufferError::MeshGridPastLimits`, Metal's code), and so, elsewhere, does an indirect +//! draw's grid past the device's task limits. //! - **Emulated** on a device without `VK_EXT_mesh_shader`, whose pipeline's object and mesh //! functions are compute stages and whose mesh function writes records //! (`GraphicsState::mesh_records`): each draw has a work buffer ([`MeshWork`], uploaded per draw) @@ -848,9 +854,10 @@ impl RenderCommandEncoder { /// [`draw_mesh_threadgroups`](Self::draw_mesh_threadgroups) is, as an indirect draw's /// arguments are (`render.rs`'s module docs), and for an indirect buffer of another device. /// On a device with `VK_EXT_mesh_shader` the draw's counts are an arguments pass's: Metal's - /// where Metal draws them, and an object grid past the device's task limits fails the command - /// buffer (`CommandBufferError::MeshGridPastLimits`). On one without it, a draw of a pipeline - /// with an object function is `NotImplemented(MeshShading)` (the module docs). + /// where Metal draws them, an object grid in pieces where the device folds object grids, and + /// an object grid past what runs fails the command buffer + /// (`CommandBufferError::MeshGridPastLimits`, the module docs). On one without it, a draw of a + /// pipeline with an object function is `NotImplemented(MeshShading)` (the module docs). pub fn draw_mesh_threadgroups_indirect( &mut self, indirect_buffer: &Buffer, diff --git a/crates/metal2vulkan-runtime/src/render/mesh_arguments.rs b/crates/metal2vulkan-runtime/src/render/mesh_arguments.rs index ace22dc6b..cfcf505b4 100644 --- a/crates/metal2vulkan-runtime/src/render/mesh_arguments.rs +++ b/crates/metal2vulkan-runtime/src/render/mesh_arguments.rs @@ -1,5 +1,6 @@ //! The arguments pass of an indirect mesh draw on a device with `VK_EXT_mesh_shader` -//! (`DrawCommands::mesh_arguments`; the module and its rule are `bind::MeshArguments`'s). +//! (`DrawCommands::mesh_arguments`; the module and its rule are `bind::MeshArguments`'s), and a +//! folded object function's direct draw's fold (`DrawCommands::object_fold`). //! //! `vkCmdDrawMeshTasksIndirectEXT` requires every group count within the device's limits for the //! draw's first stage, which Metal's GPU-written arguments need not be, and Metal draws nothing @@ -7,17 +8,24 @@ //! //! - **Before the pass** (hoisted, as an emulated mesh draw's dispatches are, `render/mesh.rs`): //! one invocation of the device's module of the draw's form reads Metal's arguments and writes -//! the draw's counts into 12 bytes of the command buffer's upload arena: Metal's where Metal -//! draws them and the device launches them, else zero. A barrier from everything before, and -//! one to everything after. -//! - **In the pass**, the draw's `vkCmdDrawMeshTasksIndirectEXT` from those bytes. +//! the draw's scratch in the command buffer's upload arena: the mesh form's 12 bytes of counts, +//! Metal's where Metal draws them and the device launches them, else zero; or a folded object +//! function's region record, pieces and commands (`bind::fold_object_grid`). A barrier from +//! everything before, and one to everything after. +//! - **In the pass**, the draw's `vkCmdDrawMeshTasksIndirectEXT` from those bytes, or a folded +//! object function's `vkCmdDrawMeshTasksIndirectCountEXT` of its pieces, its object stage reading +//! the record at the scratch's address (`binding::Tables::region_record`). //! - **Where it records**: as an emulated mesh draw's steps (`render.rs`): before the render pass, //! or, where an earlier draw or tile dispatch of the encoder wrote the arguments behind a memory //! barrier, before the draw's own render pass instance, after the writer's. A write since the //! last barrier, which Metal does not order before the draw, is read as it was before the pass. -//! - **An object grid past the device's task limits**, which Metal draws (every count measured, -//! 16,777,216 along `x`), draws nothing and fails the command buffer -//! (`CommandBufferError::MeshGridPastLimits`): nothing is drawn short silently. +//! - **A folded object function's direct draw** uploads its fold ([`FoldUpload`]): the record its +//! object stage reads, and its pieces' commands where it has more than one. +//! - **An object grid past what runs**: one of 2^29 threadgroups or more (whose draw Metal's GPU +//! fails after its watchdog's 5 seconds, `MTLCommandBufferErrorInternal`), and, on a device that +//! does not fold object grids, an indirect one past the device's task limits. It draws nothing +//! and fails the command buffer (`CommandBufferError::MeshGridPastLimits`, Metal's code): +//! nothing is drawn short silently. use crate::device::functions::Vk; use crate::draw_source::DrawSource; @@ -29,25 +37,28 @@ use crate::tracker::{Access, Barrier, Use, UseRange}; use crate::upload::Upload; use ash::vk; use metal2vulkan::bind::{ - ExecutionStatus, IndirectRef, MeshArguments, MeshArgumentsForm, MeshArgumentsModule, + ExecutionStatus, IndirectRef, MeshArguments, MeshArgumentsForm, MeshArgumentsModule, ObjectFold, }; /// One draw's pass, planned: its scratch, kernel and set, and its read of Metal's arguments. pub(crate) struct ArgumentsPass { scratch: Upload, + form: MeshArgumentsForm, kernel: OwnedKernel, sets: OwnedSets, - push: [u8; 4], + push: [u8; 8], uses: Vec>, } impl ArgumentsPass { - /// The pass of the indirect mesh draw of `form` that reads its arguments from `indirect`, in - /// `core`'s command buffer. Refused as uploads, kernels and descriptor sets are. + /// The pass of the indirect mesh draw of `form`, of `threads` threads per object threadgroup, + /// that reads its arguments from `indirect`, in `core`'s command buffer. Refused as uploads, + /// kernels and descriptor sets are. pub(crate) fn new( core: &mut EncoderCore, indirect: &DrawSource<'_>, form: MeshArgumentsForm, + threads: [u32; 3], ) -> Result { let device = core.device().clone(); let alignment = device @@ -55,15 +66,15 @@ impl ArgumentsPass { .description .limits .min_storage_buffer_offset_alignment; - let pass = MeshArguments::new(IndirectRef::new(0, indirect.at), form, alignment) - .ok_or_else(|| internal("a mesh arguments pass at an offset not a multiple of 4"))?; + let pass = MeshArguments::new(IndirectRef::new(0, indirect.at), form, alignment, threads) + .ok_or_else(|| { + internal("a mesh arguments pass at an offset not a multiple of 4") + })?; let kernel = device.owned_kernel(OwnedModule::MeshArguments(form))?; let (scratch, status) = { let mut state = core.command_buffer().state(); - let scratch = - state - .uploads - .upload(&device, &[], u64::from(MeshArguments::SCRATCH_BYTES))?; + let bytes = u64::from(MeshArguments::scratch_bytes(form)); + let scratch = state.uploads.upload(&device, &[], bytes)?; (scratch, state.status_words(&device)?) }; let mut set = [(vk::Buffer::null(), 0, 0); 3]; @@ -79,6 +90,7 @@ impl ArgumentsPass { let sets = OwnedSets::write(&device, &kernel, &[set.to_vec()])?; Ok(ArgumentsPass { scratch, + form, kernel, sets, push: pass.push_constants, @@ -91,6 +103,19 @@ impl ArgumentsPass { (self.scratch.raw(), self.scratch.offset()) } + /// The device address of a folded object function's region record in the scratch, which its + /// object stage reads; `None` for every other form. + pub(crate) fn record(&self) -> Result, Error> { + if self.form != MeshArgumentsForm::FoldedObject { + return Ok(None); + } + let address = self + .scratch + .device_address() + .ok_or_else(|| internal("a folded object grid without device addresses"))?; + Ok(Some(address + u64::from(MeshArguments::OBJECT_RECORD))) + } + /// Hold the pass's set in `core`'s command buffer until it completes; what is left records /// its dispatch (`render.rs`). Call it once the draw records. pub(crate) fn into_steps(self, core: &mut EncoderCore) -> ArgumentsSteps { @@ -126,7 +151,7 @@ fn reads(indirect: &DrawSource<'_>) -> Vec> { pub(crate) struct ArgumentsSteps { kernel: OwnedKernel, sets: Vec, - push: [u8; 4], + push: [u8; 8], uses: Vec>, } @@ -202,3 +227,34 @@ impl ArgumentsSteps { } } } + +/// A folded object function's direct draw's fold, uploaded into `core`'s command buffer's arena +/// (`DrawCommands::object_fold`): the record its object stage reads, and its pieces' commands. +pub(crate) struct FoldUpload { + upload: Upload, +} + +impl FoldUpload { + /// The upload of `fold`. Refused as uploads are. + pub(crate) fn new(core: &mut EncoderCore, fold: &ObjectFold) -> Result { + let device = core.device().clone(); + let mut state = core.command_buffer().state(); + let bytes = fold.bytes(); + let upload = state.uploads.upload(&device, &bytes, bytes.len() as u64)?; + Ok(FoldUpload { upload }) + } + + /// The device address of the record its object stage reads. + pub(crate) fn record(&self) -> Result { + let address = self + .upload + .device_address() + .ok_or_else(|| internal("a folded object grid without device addresses"))?; + Ok(address + u64::from(MeshArguments::OBJECT_RECORD)) + } + + /// The upload's `VkBuffer` and offset: its pieces' commands, at the draw's offset past it. + pub(crate) fn commands(&self) -> (vk::Buffer, u64) { + (self.upload.raw(), self.upload.offset()) + } +} diff --git a/crates/metal2vulkan-validation/fixtures/public/engine/TOOLCHAIN b/crates/metal2vulkan-validation/fixtures/public/engine/TOOLCHAIN index c96b614df..2151c8bdc 100644 --- a/crates/metal2vulkan-validation/fixtures/public/engine/TOOLCHAIN +++ b/crates/metal2vulkan-validation/fixtures/public/engine/TOOLCHAIN @@ -160,6 +160,7 @@ fixture mesh_barrier: metal: Apple metal version 32023.921 (metalfe-32023.921.6) fixture mesh_commands: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425) fixture mesh_draws: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425) fixture mesh_gated: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425) +fixture mesh_object_grid: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425) fixture mesh_object_memory: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425) fixture mesh_order: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425) fixture mesh_outputs: metal: Apple metal version 32023.921 (metalfe-32023.921.6); macosx-sdk: 27.0 (26A425) diff --git a/crates/metal2vulkan-validation/fixtures/public/engine/mesh_object_grid.air.ll b/crates/metal2vulkan-validation/fixtures/public/engine/mesh_object_grid.air.ll new file mode 100644 index 000000000..0c014c932 --- /dev/null +++ b/crates/metal2vulkan-validation/fixtures/public/engine/mesh_object_grid.air.ll @@ -0,0 +1,146 @@ +; Generated by scripts/regen-air-fixtures from mesh_object_grid.metal (typed pointers; xcrun metal-as reassembles it). Do not edit. +; ModuleID = '-' +source_filename = "-" +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-n8:16:32" +target triple = "air64_v28-apple-macosx26.0.0" + +%struct._mesh_grid_properties_t = type opaque +%"struct.metal::_atomic" = type { i32 } +%struct._mesh_t = type opaque + +; Function Attrs: mustprogress nounwind willreturn +define void @mesh_object_grid_object(%struct._mesh_grid_properties_t addrspace(3)* %0, i32 noundef %1, <3 x i32> noundef %2, <3 x i32> noundef %3, <3 x i32> noundef %4, %"struct.metal::_atomic" addrspace(1)* nocapture noundef "air-buffer-no-alias" %5) local_unnamed_addr #0 { + %7 = icmp eq i32 %1, 0 + br i1 %7, label %8, label %45 + +8: ; preds = %6 + %9 = extractelement <3 x i32> %2, i64 0 + %10 = extractelement <3 x i32> %3, i64 0 + %11 = extractelement <3 x i32> %2, i64 1 + %12 = extractelement <3 x i32> %3, i64 1 + %13 = extractelement <3 x i32> %2, i64 2 + %14 = mul i32 %12, %13 + %15 = add i32 %14, %11 + %16 = mul i32 %15, %10 + %17 = add i32 %16, %9 + %18 = getelementptr inbounds %"struct.metal::_atomic", %"struct.metal::_atomic" addrspace(1)* %5, i64 0, i32 0 + %19 = tail call i32 @air.atomic.global.add.u.i32(i32 addrspace(1)* nocapture %18, i32 1, i32 0, i32 2, i1 true) #5 + %20 = getelementptr inbounds %"struct.metal::_atomic", %"struct.metal::_atomic" addrspace(1)* %5, i64 1, i32 0 + %21 = tail call i32 @air.atomic.global.add.u.i32(i32 addrspace(1)* nocapture %20, i32 %17, i32 0, i32 2, i1 true) #5 + %22 = mul i32 %17, %17 + %23 = getelementptr inbounds %"struct.metal::_atomic", %"struct.metal::_atomic" addrspace(1)* %5, i64 2, i32 0 + %24 = tail call i32 @air.atomic.global.add.u.i32(i32 addrspace(1)* nocapture %23, i32 %22, i32 0, i32 2, i1 true) #5 + %25 = getelementptr inbounds %"struct.metal::_atomic", %"struct.metal::_atomic" addrspace(1)* %5, i64 3, i32 0 + %26 = tail call i32 @air.atomic.global.max.u.i32(i32 addrspace(1)* nocapture %25, i32 %17, i32 0, i32 2, i1 true) #5 + %27 = getelementptr inbounds %"struct.metal::_atomic", %"struct.metal::_atomic" addrspace(1)* %5, i64 4, i32 0 + %28 = tail call i32 @air.atomic.global.or.u.i32(i32 addrspace(1)* nocapture %27, i32 %10, i32 0, i32 2, i1 true) #5 + %29 = getelementptr inbounds %"struct.metal::_atomic", %"struct.metal::_atomic" addrspace(1)* %5, i64 8, i32 0 + %30 = tail call i32 @air.atomic.global.and.u.i32(i32 addrspace(1)* nocapture %29, i32 %10, i32 0, i32 2, i1 true) #5 + %31 = getelementptr inbounds %"struct.metal::_atomic", %"struct.metal::_atomic" addrspace(1)* %5, i64 5, i32 0 + %32 = tail call i32 @air.atomic.global.or.u.i32(i32 addrspace(1)* nocapture %31, i32 %12, i32 0, i32 2, i1 true) #5 + %33 = getelementptr inbounds %"struct.metal::_atomic", %"struct.metal::_atomic" addrspace(1)* %5, i64 9, i32 0 + %34 = tail call i32 @air.atomic.global.and.u.i32(i32 addrspace(1)* nocapture %33, i32 %12, i32 0, i32 2, i1 true) #5 + %35 = extractelement <3 x i32> %3, i64 2 + %36 = getelementptr inbounds %"struct.metal::_atomic", %"struct.metal::_atomic" addrspace(1)* %5, i64 6, i32 0 + %37 = tail call i32 @air.atomic.global.or.u.i32(i32 addrspace(1)* nocapture %36, i32 %35, i32 0, i32 2, i1 true) #5 + %38 = getelementptr inbounds %"struct.metal::_atomic", %"struct.metal::_atomic" addrspace(1)* %5, i64 10, i32 0 + %39 = tail call i32 @air.atomic.global.and.u.i32(i32 addrspace(1)* nocapture %38, i32 %35, i32 0, i32 2, i1 true) #5 + %40 = extractelement <3 x i32> %4, i64 0 + %41 = getelementptr inbounds %"struct.metal::_atomic", %"struct.metal::_atomic" addrspace(1)* %5, i64 7, i32 0 + %42 = tail call i32 @air.atomic.global.or.u.i32(i32 addrspace(1)* nocapture %41, i32 %40, i32 0, i32 2, i1 true) #5 + %43 = getelementptr inbounds %"struct.metal::_atomic", %"struct.metal::_atomic" addrspace(1)* %5, i64 11, i32 0 + %44 = tail call i32 @air.atomic.global.and.u.i32(i32 addrspace(1)* nocapture %43, i32 %40, i32 0, i32 2, i1 true) #5 + tail call void @air.set_threadgroups_per_grid_mesh_properties(%struct._mesh_grid_properties_t addrspace(3)* nocapture %0, <3 x i32> ) #6 + br label %45 + +45: ; preds = %8, %6 + ret void +} + +; Function Attrs: mustprogress nounwind willreturn +define void @mesh_object_grid_mesh(%struct._mesh_t addrspace(7)* %0, i32 noundef %1) local_unnamed_addr #1 { + %3 = icmp eq i32 %1, 0 + br i1 %3, label %4, label %5 + +4: ; preds = %2 + tail call void @air.set_primitive_count_mesh(%struct._mesh_t addrspace(7)* nocapture %0, i32 0) #6 + br label %5 + +5: ; preds = %4, %2 + ret void +} + +; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn +define <4 x i32> @mesh_object_grid_fragment() local_unnamed_addr #2 { + ret <4 x i32> +} + +; Function Attrs: mustprogress nounwind willreturn +declare i32 @air.atomic.global.or.u.i32(i32 addrspace(1)* nocapture, i32, i32, i32, i1) local_unnamed_addr #3 + +; Function Attrs: mustprogress nounwind willreturn +declare i32 @air.atomic.global.and.u.i32(i32 addrspace(1)* nocapture, i32, i32, i32, i1) local_unnamed_addr #3 + +; Function Attrs: argmemonly mustprogress nounwind willreturn +declare void @air.set_threadgroups_per_grid_mesh_properties(%struct._mesh_grid_properties_t addrspace(3)* nocapture, <3 x i32>) local_unnamed_addr #4 + +; Function Attrs: mustprogress nounwind willreturn +declare i32 @air.atomic.global.add.u.i32(i32 addrspace(1)* nocapture, i32, i32, i32, i1) local_unnamed_addr #3 + +; Function Attrs: mustprogress nounwind willreturn +declare i32 @air.atomic.global.max.u.i32(i32 addrspace(1)* nocapture, i32, i32, i32, i1) local_unnamed_addr #3 + +; Function Attrs: argmemonly mustprogress nounwind willreturn +declare void @air.set_primitive_count_mesh(%struct._mesh_t addrspace(7)* nocapture, i32) local_unnamed_addr #4 + +attributes #0 = { mustprogress nounwind willreturn "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="96" "no-builtins" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" } +attributes #1 = { mustprogress nounwind willreturn "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="0" "no-builtins" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" } +attributes #2 = { mustprogress nofree norecurse nosync nounwind readnone willreturn "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="128" "no-builtins" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" } +attributes #3 = { mustprogress nounwind willreturn } +attributes #4 = { argmemonly mustprogress nounwind willreturn } +attributes #5 = { nounwind willreturn } +attributes #6 = { argmemonly nounwind willreturn } + +!llvm.module.flags = !{!0, !1, !2, !3, !4, !5, !6, !7, !8} +!air.object = !{!9} +!air.mesh = !{!19} +!air.fragment = !{!25} +!air.compile_options = !{!28, !29, !30} +!llvm.ident = !{!31} +!air.version = !{!32} +!air.language_version = !{!33} + +!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 27, i32 0]} +!1 = !{i32 1, !"wchar_size", i32 4} +!2 = !{i32 7, !"frame-pointer", i32 2} +!3 = !{i32 7, !"air.max_device_buffers", i32 31} +!4 = !{i32 7, !"air.max_constant_buffers", i32 31} +!5 = !{i32 7, !"air.max_threadgroup_buffers", i32 31} +!6 = !{i32 7, !"air.max_textures", i32 128} +!7 = !{i32 7, !"air.max_read_write_textures", i32 8} +!8 = !{i32 7, !"air.max_samplers", i32 16} +!9 = !{void (%struct._mesh_grid_properties_t addrspace(3)*, i32, <3 x i32>, <3 x i32>, <3 x i32>, %"struct.metal::_atomic" addrspace(1)*)* @mesh_object_grid_object, !10, !11} +!10 = !{} +!11 = !{!12, !13, !14, !15, !16, !17} +!12 = !{i32 0, !"air.mesh_grid_properties", !"air.arg_type_name", !"mesh_grid_properties", !"air.arg_name", !"grid"} +!13 = !{i32 1, !"air.thread_index_in_threadgroup", !"air.arg_type_name", !"uint", !"air.arg_name", !"tid"} +!14 = !{i32 2, !"air.threadgroup_position_in_grid", !"air.arg_type_name", !"uint3", !"air.arg_name", !"group"} +!15 = !{i32 3, !"air.threadgroups_per_grid", !"air.arg_type_name", !"uint3", !"air.arg_name", !"groups"} +!16 = !{i32 4, !"air.threads_per_grid", !"air.arg_type_name", !"uint3", !"air.arg_name", !"tpg"} +!17 = !{i32 5, !"air.buffer", !"air.location_index", i32 0, i32 1, !"air.read_write", !"air.address_space", i32 1, !"air.struct_type_info", !18, !"air.arg_type_size", i32 4, !"air.arg_type_align_size", i32 4, !"air.arg_type_name", !"metal::_atomic", !"air.arg_name", !"n"} +!18 = !{i32 0, i32 4, i32 0, !"uint", !"__s"} +!19 = !{void (%struct._mesh_t addrspace(7)*, i32)* @mesh_object_grid_mesh, !10, !20} +!20 = !{!21, !13} +!21 = !{i32 0, !"air.mesh", !22, !"air.arg_type_name", !"mesh", !"air.arg_name", !"out"} +!22 = !{!"air.mesh_type_info", !23, !10, i32 3, i32 1, !"air.triangle"} +!23 = !{!24} +!24 = !{!"air.position", !"air.arg_type_name", !"float4", !"air.arg_name", !"position"} +!25 = !{<4 x i32> ()* @mesh_object_grid_fragment, !26, !10} +!26 = !{!27} +!27 = !{!"air.render_target", i32 0, i32 0, !"air.arg_type_name", !"uint4"} +!28 = !{!"air.compile.denorms_disable"} +!29 = !{!"air.compile.fast_math_enable"} +!30 = !{!"air.compile.framebuffer_fetch_enable"} +!31 = !{!"Apple metal version 32023.921 (metalfe-32023.921.6)"} +!32 = !{i32 2, i32 8, i32 0} +!33 = !{!"Metal", i32 4, i32 0, i32 0} diff --git a/crates/metal2vulkan-validation/fixtures/public/engine/mesh_object_grid.ll b/crates/metal2vulkan-validation/fixtures/public/engine/mesh_object_grid.ll new file mode 100644 index 000000000..41e9a331e --- /dev/null +++ b/crates/metal2vulkan-validation/fixtures/public/engine/mesh_object_grid.ll @@ -0,0 +1,144 @@ +; Generated by scripts/regen-air-fixtures from mesh_object_grid.metal (llvm-dis of mesh_object_grid.air). Do not edit. +; ModuleID = '' +source_filename = "-" +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-n8:16:32" +target triple = "air64_v28-apple-macosx26.0.0" + +%"struct.metal::_atomic" = type { i32 } + +; Function Attrs: mustprogress nounwind willreturn +define void @mesh_object_grid_object(ptr addrspace(3) %0, i32 noundef %1, <3 x i32> noundef %2, <3 x i32> noundef %3, <3 x i32> noundef %4, ptr addrspace(1) noundef captures(none) "air-buffer-no-alias" %5) local_unnamed_addr #0 { + %7 = icmp eq i32 %1, 0 + br i1 %7, label %8, label %45 + +8: ; preds = %6 + %9 = extractelement <3 x i32> %2, i64 0 + %10 = extractelement <3 x i32> %3, i64 0 + %11 = extractelement <3 x i32> %2, i64 1 + %12 = extractelement <3 x i32> %3, i64 1 + %13 = extractelement <3 x i32> %2, i64 2 + %14 = mul i32 %12, %13 + %15 = add i32 %14, %11 + %16 = mul i32 %15, %10 + %17 = add i32 %16, %9 + %18 = getelementptr inbounds %"struct.metal::_atomic", ptr addrspace(1) %5, i64 0, i32 0 + %19 = tail call i32 @air.atomic.global.add.u.i32(ptr addrspace(1) captures(none) %18, i32 1, i32 0, i32 2, i1 true) #5 + %20 = getelementptr inbounds %"struct.metal::_atomic", ptr addrspace(1) %5, i64 1, i32 0 + %21 = tail call i32 @air.atomic.global.add.u.i32(ptr addrspace(1) captures(none) %20, i32 %17, i32 0, i32 2, i1 true) #5 + %22 = mul i32 %17, %17 + %23 = getelementptr inbounds %"struct.metal::_atomic", ptr addrspace(1) %5, i64 2, i32 0 + %24 = tail call i32 @air.atomic.global.add.u.i32(ptr addrspace(1) captures(none) %23, i32 %22, i32 0, i32 2, i1 true) #5 + %25 = getelementptr inbounds %"struct.metal::_atomic", ptr addrspace(1) %5, i64 3, i32 0 + %26 = tail call i32 @air.atomic.global.max.u.i32(ptr addrspace(1) captures(none) %25, i32 %17, i32 0, i32 2, i1 true) #5 + %27 = getelementptr inbounds %"struct.metal::_atomic", ptr addrspace(1) %5, i64 4, i32 0 + %28 = tail call i32 @air.atomic.global.or.u.i32(ptr addrspace(1) captures(none) %27, i32 %10, i32 0, i32 2, i1 true) #5 + %29 = getelementptr inbounds %"struct.metal::_atomic", ptr addrspace(1) %5, i64 8, i32 0 + %30 = tail call i32 @air.atomic.global.and.u.i32(ptr addrspace(1) captures(none) %29, i32 %10, i32 0, i32 2, i1 true) #5 + %31 = getelementptr inbounds %"struct.metal::_atomic", ptr addrspace(1) %5, i64 5, i32 0 + %32 = tail call i32 @air.atomic.global.or.u.i32(ptr addrspace(1) captures(none) %31, i32 %12, i32 0, i32 2, i1 true) #5 + %33 = getelementptr inbounds %"struct.metal::_atomic", ptr addrspace(1) %5, i64 9, i32 0 + %34 = tail call i32 @air.atomic.global.and.u.i32(ptr addrspace(1) captures(none) %33, i32 %12, i32 0, i32 2, i1 true) #5 + %35 = extractelement <3 x i32> %3, i64 2 + %36 = getelementptr inbounds %"struct.metal::_atomic", ptr addrspace(1) %5, i64 6, i32 0 + %37 = tail call i32 @air.atomic.global.or.u.i32(ptr addrspace(1) captures(none) %36, i32 %35, i32 0, i32 2, i1 true) #5 + %38 = getelementptr inbounds %"struct.metal::_atomic", ptr addrspace(1) %5, i64 10, i32 0 + %39 = tail call i32 @air.atomic.global.and.u.i32(ptr addrspace(1) captures(none) %38, i32 %35, i32 0, i32 2, i1 true) #5 + %40 = extractelement <3 x i32> %4, i64 0 + %41 = getelementptr inbounds %"struct.metal::_atomic", ptr addrspace(1) %5, i64 7, i32 0 + %42 = tail call i32 @air.atomic.global.or.u.i32(ptr addrspace(1) captures(none) %41, i32 %40, i32 0, i32 2, i1 true) #5 + %43 = getelementptr inbounds %"struct.metal::_atomic", ptr addrspace(1) %5, i64 11, i32 0 + %44 = tail call i32 @air.atomic.global.and.u.i32(ptr addrspace(1) captures(none) %43, i32 %40, i32 0, i32 2, i1 true) #5 + tail call void @air.set_threadgroups_per_grid_mesh_properties(ptr addrspace(3) captures(none) %0, <3 x i32> ) #6 + br label %45 + +45: ; preds = %8, %6 + ret void +} + +; Function Attrs: mustprogress nounwind willreturn +define void @mesh_object_grid_mesh(ptr addrspace(7) %0, i32 noundef %1) local_unnamed_addr #1 { + %3 = icmp eq i32 %1, 0 + br i1 %3, label %4, label %5 + +4: ; preds = %2 + tail call void @air.set_primitive_count_mesh(ptr addrspace(7) captures(none) %0, i32 0) #6 + br label %5 + +5: ; preds = %4, %2 + ret void +} + +; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) +define <4 x i32> @mesh_object_grid_fragment() local_unnamed_addr #2 { + ret <4 x i32> splat (i32 1) +} + +; Function Attrs: mustprogress nounwind willreturn +declare i32 @air.atomic.global.or.u.i32(ptr addrspace(1) captures(none), i32, i32, i32, i1) local_unnamed_addr #3 + +; Function Attrs: mustprogress nounwind willreturn +declare i32 @air.atomic.global.and.u.i32(ptr addrspace(1) captures(none), i32, i32, i32, i1) local_unnamed_addr #3 + +; Function Attrs: mustprogress nounwind willreturn memory(argmem: readwrite) +declare void @air.set_threadgroups_per_grid_mesh_properties(ptr addrspace(3) captures(none), <3 x i32>) local_unnamed_addr #4 + +; Function Attrs: mustprogress nounwind willreturn +declare i32 @air.atomic.global.add.u.i32(ptr addrspace(1) captures(none), i32, i32, i32, i1) local_unnamed_addr #3 + +; Function Attrs: mustprogress nounwind willreturn +declare i32 @air.atomic.global.max.u.i32(ptr addrspace(1) captures(none), i32, i32, i32, i1) local_unnamed_addr #3 + +; Function Attrs: mustprogress nounwind willreturn memory(argmem: readwrite) +declare void @air.set_primitive_count_mesh(ptr addrspace(7) captures(none), i32) local_unnamed_addr #4 + +attributes #0 = { mustprogress nounwind willreturn "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="96" "no-builtins" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" } +attributes #1 = { mustprogress nounwind willreturn "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="0" "no-builtins" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" } +attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) "approx-func-fp-math"="true" "frame-pointer"="all" "min-legal-vector-width"="128" "no-builtins" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" } +attributes #3 = { mustprogress nounwind willreturn } +attributes #4 = { mustprogress nounwind willreturn memory(argmem: readwrite) } +attributes #5 = { nounwind willreturn } +attributes #6 = { nounwind willreturn memory(argmem: readwrite) } + +!llvm.module.flags = !{!0, !1, !2, !3, !4, !5, !6, !7, !8} +!air.object = !{!9} +!air.mesh = !{!19} +!air.fragment = !{!25} +!air.compile_options = !{!28, !29, !30} +!llvm.ident = !{!31} +!air.version = !{!32} +!air.language_version = !{!33} + +!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 27, i32 0]} +!1 = !{i32 1, !"wchar_size", i32 4} +!2 = !{i32 7, !"frame-pointer", i32 2} +!3 = !{i32 7, !"air.max_device_buffers", i32 31} +!4 = !{i32 7, !"air.max_constant_buffers", i32 31} +!5 = !{i32 7, !"air.max_threadgroup_buffers", i32 31} +!6 = !{i32 7, !"air.max_textures", i32 128} +!7 = !{i32 7, !"air.max_read_write_textures", i32 8} +!8 = !{i32 7, !"air.max_samplers", i32 16} +!9 = !{ptr @mesh_object_grid_object, !10, !11} +!10 = !{} +!11 = !{!12, !13, !14, !15, !16, !17} +!12 = !{i32 0, !"air.mesh_grid_properties", !"air.arg_type_name", !"mesh_grid_properties", !"air.arg_name", !"grid"} +!13 = !{i32 1, !"air.thread_index_in_threadgroup", !"air.arg_type_name", !"uint", !"air.arg_name", !"tid"} +!14 = !{i32 2, !"air.threadgroup_position_in_grid", !"air.arg_type_name", !"uint3", !"air.arg_name", !"group"} +!15 = !{i32 3, !"air.threadgroups_per_grid", !"air.arg_type_name", !"uint3", !"air.arg_name", !"groups"} +!16 = !{i32 4, !"air.threads_per_grid", !"air.arg_type_name", !"uint3", !"air.arg_name", !"tpg"} +!17 = !{i32 5, !"air.buffer", !"air.location_index", i32 0, i32 1, !"air.read_write", !"air.address_space", i32 1, !"air.struct_type_info", !18, !"air.arg_type_size", i32 4, !"air.arg_type_align_size", i32 4, !"air.arg_type_name", !"metal::_atomic", !"air.arg_name", !"n"} +!18 = !{i32 0, i32 4, i32 0, !"uint", !"__s"} +!19 = !{ptr @mesh_object_grid_mesh, !10, !20} +!20 = !{!21, !13} +!21 = !{i32 0, !"air.mesh", !22, !"air.arg_type_name", !"mesh", !"air.arg_name", !"out"} +!22 = !{!"air.mesh_type_info", !23, !10, i32 3, i32 1, !"air.triangle"} +!23 = !{!24} +!24 = !{!"air.position", !"air.arg_type_name", !"float4", !"air.arg_name", !"position"} +!25 = !{ptr @mesh_object_grid_fragment, !26, !10} +!26 = !{!27} +!27 = !{!"air.render_target", i32 0, i32 0, !"air.arg_type_name", !"uint4"} +!28 = !{!"air.compile.denorms_disable"} +!29 = !{!"air.compile.fast_math_enable"} +!30 = !{!"air.compile.framebuffer_fetch_enable"} +!31 = !{!"Apple metal version 32023.921 (metalfe-32023.921.6)"} +!32 = !{i32 2, i32 8, i32 0} +!33 = !{!"Metal", i32 4, i32 0, i32 0} diff --git a/crates/metal2vulkan-validation/fixtures/public/engine/mesh_object_grid.metal b/crates/metal2vulkan-validation/fixtures/public/engine/mesh_object_grid.metal new file mode 100644 index 000000000..1719dae31 --- /dev/null +++ b/crates/metal2vulkan-validation/fixtures/public/engine/mesh_object_grid.metal @@ -0,0 +1,49 @@ +// Owned fixture: object grids of any count, for the runtime lane `mesh_draws` and Metal probe 5. +// Thread 0 of each object threadgroup counts it in `n` (its buffer 0): one more threadgroup, its +// linear position and that position's square added (each wrapping), the largest position, and the +// grid and threads per grid it read, each or-ed into one word and and-ed into another (equal words +// say every threadgroup read the same); it launches no mesh threadgroup. Loop-free. +#include +using namespace metal; + +struct GridVertex { + float4 position [[position]]; +}; + +using GridMesh = metal::mesh; + +// `n[i]` or-ed with `v`, and `n[i + 4]` and-ed with it. +static void both(device atomic_uint* n, uint i, uint v) { + atomic_fetch_or_explicit(&n[i], v, memory_order_relaxed); + atomic_fetch_and_explicit(&n[i + 4], v, memory_order_relaxed); +} + +[[object]] void mesh_object_grid_object(mesh_grid_properties grid, + uint tid [[thread_index_in_threadgroup]], + uint3 group [[threadgroup_position_in_grid]], + uint3 groups [[threadgroups_per_grid]], + uint3 tpg [[threads_per_grid]], + device atomic_uint* n [[buffer(0)]]) { + if (tid == 0) { + uint linear = group.x + groups.x * (group.y + groups.y * group.z); + atomic_fetch_add_explicit(&n[0], 1u, memory_order_relaxed); + atomic_fetch_add_explicit(&n[1], linear, memory_order_relaxed); + atomic_fetch_add_explicit(&n[2], linear * linear, memory_order_relaxed); + atomic_fetch_max_explicit(&n[3], linear, memory_order_relaxed); + both(n, 4, groups.x); + both(n, 5, groups.y); + both(n, 6, groups.z); + both(n, 7, tpg.x); + grid.set_threadgroups_per_grid(uint3(0, 1, 1)); + } +} + +[[mesh]] void mesh_object_grid_mesh(GridMesh out, uint tid [[thread_index_in_threadgroup]]) { + if (tid == 0) { + out.set_primitive_count(0); + } +} + +fragment uint4 mesh_object_grid_fragment() { + return uint4(1); +} diff --git a/crates/metal2vulkan-validation/runtime-sources.sha256 b/crates/metal2vulkan-validation/runtime-sources.sha256 index 2d5277243..f9035c10d 100644 --- a/crates/metal2vulkan-validation/runtime-sources.sha256 +++ b/crates/metal2vulkan-validation/runtime-sources.sha256 @@ -1 +1 @@ -344869af7b191df34c7084d67ec1c8e53103a78857b28ac3ff4d46ca34c71157 +31c9b9c54aeba7d2aa24700a420594fa3f03775c2b57dc5517a62bab80952ca9 diff --git a/crates/metal2vulkan-validation/src/candidate/platform/enables.rs b/crates/metal2vulkan-validation/src/candidate/platform/enables.rs index 6c57148b7..9d4a8e7fc 100644 --- a/crates/metal2vulkan-validation/src/candidate/platform/enables.rs +++ b/crates/metal2vulkan-validation/src/candidate/platform/enables.rs @@ -1022,6 +1022,7 @@ members! { Some(F::DescriptorBindingVariableDescriptorCount); V12.v12.runtime_descriptor_array => Some(F::RuntimeDescriptorArray); V12.v12.sampler_filter_minmax => Some(F::SamplerFilterMinmax); + V12.v12.draw_indirect_count => Some(F::DrawIndirectCount); V12.v12.scalar_block_layout => Some(F::ScalarBlockLayout); V12.v12.uniform_buffer_standard_layout => Some(F::UniformBufferStandardLayout); V12.v12.shader_subgroup_extended_types => Some(F::ShaderSubgroupExtendedTypes); diff --git a/crates/metal2vulkan-validation/src/runtime_lane/mesh_draws.rs b/crates/metal2vulkan-validation/src/runtime_lane/mesh_draws.rs index a34f62306..98d0f7e8b 100644 --- a/crates/metal2vulkan-validation/src/runtime_lane/mesh_draws.rs +++ b/crates/metal2vulkan-validation/src/runtime_lane/mesh_draws.rs @@ -24,9 +24,11 @@ //! writes, which must draw Metal's words too; a grid Metal draws nothing for (an axis past 65,535, //! or more than 1,048,575 threadgroups: [`PAST_CASES`], measured on the M3 Max under macOS 27.0.1, //! direct and indirect alike) draws nothing, and an object threadgroup that sets one launches -//! nothing ([`OBJECT_PAST_CASES`]); an object grid past the device's task limits, which -//! Metal draws, fails the command buffer typed -//! (`CommandBufferError::MeshGridPastLimits`, [`object_grids_past_the_task_limits_fail_typed`]). +//! nothing ([`OBJECT_PAST_CASES`]). Object grids of any count run as Metal runs them (the owned +//! fixture `mesh_object_grid` and Metal probe 5, [`object_grids_run_as_metal_runs_them`]): in +//! pieces within the task stage's limits, threads per grid wrapped to 32 bits as Metal's, and +//! one of 2^29 threadgroups, which Metal's GPU fails, failing the command buffer typed +//! (`CommandBufferError::MeshGridPastLimits`). //! A `drawMeshThreads` that leaves a partial object threadgroup is refused //! (`NotImplemented(MeshShading)`); Metal's answers for it are printed (a partial object //! threadgroup runs the threads left). What Metal's validation @@ -46,7 +48,7 @@ use super::degrade_notices::{assert_made_once, made_mesh_kinds}; use super::gpu_times::read_kinds; use super::render_state::{texels, texture}; use super::shared_kinds; -use super::{buffer_with, validated_device, Messages, ScratchCache, WAIT}; +use super::{buffer_with, read_buffer, validated_device, Messages, ScratchCache, WAIT}; use crate::air_library::AirLibrary; use crate::gpu::TEST_DEVICE; use metal2vulkan::device::{VkExtension, VkFeature}; @@ -575,70 +577,293 @@ fn object_draws_store_metals_words() { ); } -/// An indirect draw of 70,000 object threadgroups, each launching no mesh threadgroup (`ctl` -/// zero), which Metal runs and draws nothing for: on a device whose task stage launches no more -/// than 65,536 along `x` (RADV, lavapipe) the arguments pass draws nothing and the command buffer -/// fails with `CommandBufferError::MeshGridPastLimits`; on one that launches them (NVIDIA's -/// 4,194,304) it completes, drawing nothing; an emulated draw is refused as the object case's. +/// One case of Metal probe 5 over the owned fixture `mesh_object_grid`: the draw's object +/// threadgroups and their threads, whether it is direct, and the twelve counter words the M3 Max +/// (macOS 27.0.1) left: the threadgroups counted, their linear positions and those positions' +/// squares summed (each wrapping), the largest position, then the grid's `x`, `y`, `z` and the +/// threads per grid's `x` each threadgroup read, or-ed, then and-ed (from all ones). +struct GridCase { + groups: [u32; 3], + threads: [u64; 3], + direct: bool, + words: [u32; 12], +} + +/// The words of a draw that ran no object threadgroup. +const RAN_NONE: [u32; 12] = [0, 0, 0, 0, 0, 0, 0, 0, !0, !0, !0, !0]; + +/// The words of `n` threadgroups in a row along `x`, each reading a grid of `grid` (and threads +/// per grid of `threads` along `x`): the sums Metal's counters wrap to. +const fn row(n: u32, sum: u32, squares: u32, grid: [u32; 3], threads: u32) -> [u32; 12] { + let [x, y, z] = grid; + [n, sum, squares, n - 1, x, y, z, threads, x, y, z, threads] +} + +/// Probe 5's cases, each as Metal ran it (the module docs): grids past every device's task axis +/// and total, which run in pieces; grids whose threads per grid wrap to 32 bits, which a direct +/// draw runs as the wrapped threads fill and an indirect one whole, reporting the wrapped grid; +/// and grids with a zero count. lavapipe does not run a case of more than 1,048,576 threadgroups in +/// time, and skips it. +const OBJECT_GRID_CASES: [GridCase; 17] = { + const fn case(groups: [u32; 3], threads: [u64; 3], direct: bool, words: [u32; 12]) -> GridCase { + GridCase { + groups, + threads, + direct, + words, + } + } + let one = [1, 1, 1]; + [ + case( + [70_000, 1, 1], + one, + true, + row(70_000, 2_449_965_000, 3_148_892_776, [70_000, 1, 1], 70_000), + ), + case( + [70_000, 1, 1], + one, + false, + row(70_000, 2_449_965_000, 3_148_892_776, [70_000, 1, 1], 70_000), + ), + case( + [300, 300, 2], + [4, 2, 1], + true, + row(180_000, 3_315_008_112, 4_292_449_072, [300, 300, 2], 1200), + ), + case( + [300, 300, 2], + [4, 2, 1], + false, + row(180_000, 3_315_008_112, 4_292_449_072, [300, 300, 2], 1200), + ), + case( + [131_070, 2, 1], + one, + true, + row( + 262_140, + 4_293_787_658, + 1_436_942_306, + [131_070, 2, 1], + 131_070, + ), + ), + case( + [131_070, 2, 1], + one, + false, + row( + 262_140, + 4_293_787_658, + 1_436_942_306, + [131_070, 2, 1], + 131_070, + ), + ), + case( + [65536, 70, 1], + one, + true, + row( + 4_587_520, + 4_292_673_536, + 1_432_420_352, + [65536, 70, 1], + 65536, + ), + ), + case( + [65536, 70, 1], + one, + false, + row( + 4_587_520, + 4_292_673_536, + 1_432_420_352, + [65536, 70, 1], + 65536, + ), + ), + case( + [4_194_307, 1, 1], + one, + true, + row( + 4_194_307, + 10_485_763, + 1_457_520_645, + [4_194_307, 1, 1], + 4_194_307, + ), + ), + case( + [4_194_307, 1, 1], + one, + false, + row( + 4_194_307, + 10_485_763, + 1_457_520_645, + [4_194_307, 1, 1], + 4_194_307, + ), + ), + case( + [2, 16_777_217, 1], + [1, 128, 1], + true, + row(33_554_434, 50_331_649, 2_936_012_801, [2, 16_777_217, 1], 2), + ), + case([3, 0, 1], one, true, RAN_NONE), + case([3, 0, 1], one, false, RAN_NONE), + case([33_554_432, 1, 1], [128, 1, 1], true, RAN_NONE), + case( + [33_554_432, 1, 1], + [128, 1, 1], + false, + row(33_554_432, 4_278_190_080, 2_868_903_936, [0, 1, 1], 0), + ), + case( + [33_554_433, 1, 1], + [128, 1, 1], + true, + row(1, 0, 0, [1, 1, 1], 128), + ), + case( + [33_554_433, 1, 1], + [128, 1, 1], + false, + row(33_554_433, 16_777_216, 2_868_903_936, [1, 1, 1], 128), + ), + ] +}; + +/// Object grids of 2^29 threadgroups, direct and indirect, which the M3 Max fails after its GPU's +/// watchdog (`MTLCommandBufferErrorInternal`, none of the command buffer's writes landing): +/// drawn nothing, failing the command buffer with Metal's code +/// (`CommandBufferError::MeshGridPastLimits`). +const PAST_GRID: [u32; 3] = [1 << 29, 1, 1]; + +/// Each of [`OBJECT_GRID_CASES`] leaves Metal's words on a device with `VK_EXT_mesh_shader`, its +/// grid folded into the task stage's limits where it passes them, and each draw of [`PAST_GRID`] +/// draws nothing and fails its command buffer typed; the emulation refuses what passes its compute +/// limits, and its indirect draws (`Unsupported{MeshShading}`), printed. #[test] -fn object_grids_past_the_task_limits_fail_typed() { +fn object_grids_run_as_metal_runs_them() { let cache = ScratchCache::new().unwrap(); let messages = Messages::default(); { let device = validated_device(TEST_DEVICE, &messages, cache.path()).unwrap(); let name = device.name().to_owned(); - let lane = Lane::new(device); - let state = match lane.pipeline(Some("mesh_draws_object"), "mesh_draws_mesh") { - Ok(state) => state, - Err(refused) if mesh_refused(&refused, &name) => return, - Err(error) => panic!("mesh_draws_object on {name}: {error}"), + let bitcode = llvm_assemble(&engine_dir().join("mesh_object_grid.ll")).unwrap(); + let library = device.new_library_with_air(&bitcode).unwrap(); + let function = |name| { + StageSource::Function( + library + .new_function_with_name(name) + .unwrap() + .function_descriptor(), + ) }; - let counts = [70_000u32, 1, 1]; - let task = lane - .device - .compile_device() - .profile() - .limits() - .mesh - .max_task_work_group_count; - let targets = [0, 1].map(|_| texture(&lane.device, PixelFormat::RGBA32Uint, SIDE)); - let mut pass = RenderPassDescriptor::new(); - for (attachment, target) in pass.color_attachments.iter_mut().zip(&targets) { + let mut descriptor = MeshPipelineDescriptor::new(function("mesh_object_grid_mesh")); + descriptor.object = Some(function("mesh_object_grid_object")); + descriptor.fragment = Some(function("mesh_object_grid_fragment")); + descriptor.color_attachments[0] = + Some(ColorAttachmentDescriptor::new(PixelFormat::RGBA32Uint)); + let state = + match device.new_mesh_render_pipeline_state(&descriptor, &PipelineOptions::default()) { + Ok(state) => state, + Err(refused) if mesh_refused(&refused, &name) => return, + Err(error) => panic!("mesh_object_grid on {name}: {error}"), + }; + let queue = device.new_command_queue().unwrap(); + let target = texture(&device, PixelFormat::RGBA32Uint, SIDE); + let run = |groups: [u32; 3], threads: [u64; 3], direct: bool| { + let mut pass = RenderPassDescriptor::new(); + let attachment = &mut pass.color_attachments[0]; attachment.texture = Some(target.clone()); attachment.load_action = LoadAction::Clear; attachment.store_action = StoreAction::Store; + let mut initial = vec![0u8; 32]; + initial.extend([0xFF; 16]); + let counters = buffer_with(&device, &initial).unwrap(); + let bytes: Vec = groups.iter().flat_map(|w| w.to_le_bytes()).collect(); + let arguments = buffer_with(&device, &bytes).unwrap(); + let command_buffer = queue.command_buffer().unwrap(); + let mut encoder = command_buffer.render_command_encoder(&pass).unwrap(); + encoder.set_render_pipeline_state(&state).unwrap(); + encoder.set_object_buffer(Some(&counters), 0, 0).unwrap(); + let one = Size::new(1, 1, 1); + let drawn = match direct { + true => { + encoder.draw_mesh_threadgroups(size(groups.map(u64::from)), size(threads), one) + } + false => encoder.draw_mesh_threadgroups_indirect(&arguments, 0, size(threads), one), + }; + encoder.end_encoding().unwrap(); + let started = std::time::Instant::now(); + command_buffer.commit().unwrap(); + command_buffer.wait_until_completed_for(WAIT).unwrap(); + let words: Vec = read_buffer(&counters, 0, 48) + .unwrap() + .as_chunks::<4>() + .0 + .iter() + .map(|w| u32::from_le_bytes(*w)) + .collect(); + let what = format!( + "{groups:?} of {threads:?}, {} on {name}", + if direct { "direct" } else { "indirect" } + ); + eprintln!( + "TIMING {what}: {} ms, {:?}", + started.elapsed().as_millis(), + command_buffer.error() + ); + (drawn, command_buffer.error(), words, what) + }; + // The emulation's refusals: an indirect draw with an object function, and a grid past its + // compute limits. + let refused = |drawn: &Result<(), Error>| match drawn { + Err(Error::Bind(BindError::Unsupported(u))) if u.feature == Feature::MeshShading => { + emulates(&device) + } + _ => false, + }; + for c in &OBJECT_GRID_CASES { + // The threadgroups Metal ran. + if cfg!(m2v_cpu_icd) && c.words[0] > 1 << 20 { + continue; + } + let (drawn, error, words, what) = run(c.groups, c.threads, c.direct); + if refused(&drawn) { + eprintln!("{what}: refused, emulated: {drawn:?}"); + continue; + } + if let Err(e) = drawn { + panic!("{what}: {e}"); + } + assert_eq!(error, None, "{what}"); + assert_eq!(words, c.words, "{what}"); } - let ctl = buffer_with(&lane.device, &[0u8; 16]).unwrap(); - let bytes: Vec = counts.iter().flat_map(|w| w.to_le_bytes()).collect(); - let arguments = buffer_with(&lane.device, &bytes).unwrap(); - let command_buffer = lane.queue.command_buffer().unwrap(); - let mut encoder = command_buffer.render_command_encoder(&pass).unwrap(); - encoder.set_render_pipeline_state(&state).unwrap(); - encoder.set_object_buffer(Some(&ctl), 0, 0).unwrap(); - let one = Size::new(1, 1, 1); - let drawn = encoder.draw_mesh_threadgroups_indirect(&arguments, 0, one, Size::new(2, 1, 1)); - encoder.end_encoding().unwrap(); - command_buffer.commit().unwrap(); - command_buffer.wait_until_completed_for(WAIT).unwrap(); - match drawn { - Err(Error::Bind(BindError::Unsupported(u))) - if u.feature == Feature::MeshShading - && u.needs == Needs::NotImplemented - && emulates(&lane.device) => - { - eprintln!("object grid past the task limits on {name}: refused, emulated"); + for direct in [true, false] { + let (drawn, error, words, what) = run(PAST_GRID, [1; 3], direct); + if refused(&drawn) { + eprintln!("{what}: refused, emulated: {drawn:?}"); + continue; } - Ok(()) => { - let past = counts[0] > task[0]; - let want = past.then_some(CommandBufferError::MeshGridPastLimits); - assert_eq!(command_buffer.error(), want, "{name}: task limits {task:?}"); - assert!(texels(&targets[0], 16).iter().all(|&b| b == 0), "{name}"); - eprintln!( - "object grid past the task limits on {name} (task limits {task:?}): {:?}", - command_buffer.error() - ); + if let Err(e) = drawn { + panic!("{what}: {e}"); } - Err(error) => panic!("object grid past the task limits on {name}: {error}"), + assert_eq!( + error, + Some(CommandBufferError::MeshGridPastLimits), + "{what}" + ); + assert_eq!(words, RAN_NONE, "{what}"); } } let reported = messages.take(); diff --git a/crates/metal2vulkan/src/ash_interop/query.rs b/crates/metal2vulkan/src/ash_interop/query.rs index 475f961dd..22439b911 100644 --- a/crates/metal2vulkan/src/ash_interop/query.rs +++ b/crates/metal2vulkan/src/ash_interop/query.rs @@ -669,6 +669,7 @@ feature_sources! { c, x; ShaderResourceResidency => on(c.core.shader_resource_residency); SamplerAnisotropy => on(c.core.sampler_anisotropy); SamplerFilterMinmax => on(c.v12.sampler_filter_minmax); + DrawIndirectCount => on(c.v12.draw_indirect_count); SamplerMirrorClampToEdge => on(c.v12.sampler_mirror_clamp_to_edge); ShaderStorageImageMultisample => on(c.core.shader_storage_image_multisample); ShaderStorageImageExtendedFormats => on(c.core.shader_storage_image_extended_formats); diff --git a/crates/metal2vulkan/src/bind/graphics.rs b/crates/metal2vulkan/src/bind/graphics.rs index 31324c23f..19364c6a5 100644 --- a/crates/metal2vulkan/src/bind/graphics.rs +++ b/crates/metal2vulkan/src/bind/graphics.rs @@ -271,7 +271,8 @@ //! 0, each `DispatchRegion` written all the same); a threadgroup of no thread or of more than //! Metal's 1024, a grid of none, and indirect arguments at an offset that is not a multiple of 4 //! launch nothing, as plain Metal draws nothing. A threadgroup or a grid past the device's limits -//! for its stage is `Unsupported{MeshShading}` naming the limit. An object function's threadgroup +//! for its stage is `Unsupported{MeshShading}` naming the limit (an object grid only where the +//! object function is not folded, below). An object function's threadgroup //! memory arguments are the encoder's lengths (`setObjectThreadgroupMemoryLength:atIndex:`, the //! object stage's `threadgroup_lengths`, 0 where unset), each rounded up to 16 as a kernel's //! are; its arena with them past the object stage's workgroup memory limit is @@ -280,7 +281,11 @@ //! draws nothing for (an axis past 65,535, or more than 1,048,575 threadgroups: //! `bind::mesh_arguments`) launches nothing. An indirect draw reads the counts an arguments //! pass writes (`DrawCommands::mesh_arguments`, `MeshArguments`): Metal's where Metal draws -//! them and the device's first stage launches them, else none. A mesh function writes `Layer` in every variant: a pass of more layers than +//! them and the device's first stage launches them, else none. A folded object function +//! (`lower::mesh::folds_object_grids`) runs any object grid in pieces within the task stage's +//! limits instead, reading its grid from its region record: a direct draw's fold is the +//! consumer's upload (`DrawCommands::object_fold`), an indirect one's its arguments pass's. +//! A mesh function writes `Layer` in every variant: a pass of more layers than //! `maxMeshOutputLayers`, into which a mesh function choosing its slice could render, is //! `Unsupported{MeshShading}` naming it. A view mapping with a viewport offset, or with a slice //! offset where the mesh function chooses its slice, is not implemented: the mesh function does @@ -311,7 +316,10 @@ use crate::bind::instantiate::{ DescriptorRange, FieldBytes, IndexBufferRef, IndirectRef, PushConstantWrite, PushHole, RangeError, RootTable, }; -use crate::bind::mesh_arguments::{metal_mesh_grid_draws_nothing, MeshArgumentsForm}; +use crate::bind::mesh_arguments::{ + fold_object_grid, metal_mesh_grid_draws_nothing, metal_object_grid, MeshArguments, + MeshArgumentsForm, MeshGridLimits, ObjectFold, +}; use crate::bind::neutral::{zero_buffer_bytes, NeutralResource}; use crate::bind::plan::compute::{internal, not_implemented, spec_key, tile_memory}; use crate::bind::plan::resources::{separate_samplers, ResourcePlanner}; @@ -527,7 +535,24 @@ pub struct DrawCommands { /// arguments (`draw` keeps Metal's offset; the consumer substitutes the scratch's buffer and /// offset). Its read of Metal's 12 bytes is among `uses`, in the compute stage. `None` for /// every other draw. + /// + /// The folded object form's (`MeshArgumentsForm::FoldedObject`, a folded object function's + /// draw) `draw` is `DrawMeshTasksIndirectCount`, both of whose offsets are into the scratch + /// (the consumer adds the scratch's offset), and the object stage's + /// `PushHole::ReplayRegionAddress` takes the scratch's device address (plus + /// [`MeshArguments::OBJECT_RECORD`](crate::bind::MeshArguments::OBJECT_RECORD)); its scratch + /// needs `SHADER_DEVICE_ADDRESS` usage and a 16-aligned address. pub mesh_arguments: Option, + /// A direct mesh draw of a folded object function's pipeline: the fold of its object grid + /// ([`ObjectFold`](crate::bind::ObjectFold)), whose [`bytes`](crate::bind::ObjectFold::bytes) + /// the consumer uploads at a 16-aligned device address of a buffer of `SHADER_DEVICE_ADDRESS` + /// and `INDIRECT_BUFFER` usage, where the host's write is visible to the draw. The object + /// stage's `PushHole::ReplayRegionAddress` takes that address, and a `draw` of + /// `DrawMeshTasksIndirect` (its pieces) reads its commands from the upload, its offset into + /// it. A fold `past` what runs draws nothing (`draw` launches no threadgroup), and the consumer + /// fails the command buffer as Metal's GPU does (as `ExecutionStatus`'s + /// `MESH_GRID_PAST_LIMITS`). `None` for every other draw. + pub object_fold: Option, } /// No draw's commands: empty vectors and a draw of no vertices, which @@ -554,6 +579,7 @@ impl Default for DrawCommands { index_overrun: None, index_bounds_pass: false, mesh_arguments: None, + object_fold: None, amplifications: Vec::new(), specialization: None, mesh_dispatch: None, @@ -1695,6 +1721,7 @@ fn plan(p: &RenderPipeline, device: &Device, shape: &BindShape) -> Result reads_root_table = true, @@ -1750,6 +1777,9 @@ fn plan(p: &RenderPipeline, device: &Device, shape: &BindShape) -> Result {} + // A folded object function's region record (`bind::mesh_arguments`): the + // consumer's hole. + PushField::ReplayRegionAddress if stage == Stage::Object => {} // The draw's viewport compensation, which instantiation reads from the state. PushField::ViewportCompensation if stage == Stage::Vertex => {} // The draw's point guard band, which instantiation reads from the state. @@ -2399,6 +2429,10 @@ fn plan(p: &RenderPipeline, device: &Device, shape: &BindShape) -> Result, + /// A direct draw's fold of its object grid, of a folded object function + /// (`DrawCommands::object_fold`). + fold: Option, } impl MeshDraw { @@ -3178,7 +3215,10 @@ fn size_value(keys: &DispatchKeys, key: SpecKey, l: [u32; 3]) -> Option { /// partial object threadgroup is not implemented (Metal runs that threadgroup with the threads /// left, probe 4, and splitting the draw by the regions would reorder its primitives in two /// dimensions); a draw whose object threadgroup Metal draws nothing for (no thread, or past 1024) -/// launches nothing. +/// launches nothing. A direct draw's object grid is Metal's ([`metal_object_grid`], measured): each +/// axis's threads per grid wrap at 2^32, the draw runs the threadgroups the wrapped threads fill, +/// and the builtins report the wrapped threads, from the object stage's region (`MultiRegion` 1) +/// where they leave a partial threadgroup. /// /// A draw that launches threadgroups has each stage's threadgroup checked against the device's /// limits for it ([`check_group`]: the mesh stage's `maxMeshWorkGroup*`, the task stage's @@ -3188,6 +3228,13 @@ fn size_value(keys: &DispatchKeys, key: SpecKey, l: [u32; 3]) -> Option { /// indirect draw, whose counts its arguments pass writes within the device's limits /// (`DrawCommands::mesh_arguments`). A draw that launches nothing is made with the smallest /// threadgroups its stages can be made with. +/// +/// A folded object function (`MeshTemplate::folded`) reads its grid from its region record +/// instead, and its draws run their object grids in pieces within the task stage's limits +/// (`bind::mesh_arguments`): a direct one's fold ([`fold_object_grid`], `DrawCommands::object_fold`) +/// is `vkCmdDrawMeshTasksEXT` of its one piece, or `vkCmdDrawMeshTasksIndirectEXT` of its pieces' +/// commands in the uploaded fold, and an indirect one is `vkCmdDrawMeshTasksIndirectCountEXT` of +/// its arguments pass's pieces. Its grid is held to no device limit. fn mesh_draw( t: &MeshTemplate, draw: &DrawCall, @@ -3217,6 +3264,22 @@ fn mesh_draw( } (Some(_), _) => command, }; + let folded = t.folded && t.object.is_some(); + // An unfolded object stage's direct grid as Metal runs it (`metal_object_grid`): each axis's + // threads per grid wrap at 2^32, the draw runs the threadgroups the wrapped threads fill, and + // the builtins report the wrapped threads. + let (command, wrapped) = match command { + vk::DrawCommand::DrawMeshTasks { + group_count_x: x, + group_count_y: y, + group_count_z: z, + } if t.object.is_some() && !folded => { + let (runs, threads) = metal_object_grid([x, y, z], lo, true).unwrap_or_default(); + let runs = if runs.contains(&0) { [0; 3] } else { runs }; + (mesh_tasks(runs, lo), Some((threads, runs))) + } + other => (other, None), + }; let groups = match command { vk::DrawCommand::DrawMeshTasks { group_count_x, @@ -3227,6 +3290,12 @@ fn mesh_draw( other => return Err(internal(format!("a mesh draw of {other:?}"))), }; let launches = groups.is_none_or(|g| !g.contains(&0)); + // Where the wrapped threads leave a partial threadgroup, `NumWorkgroups · L` passes them: the + // object stage reads its grid from its region (`MultiRegion` 1). + let partial = launches + && wrapped.is_some_and(|(threads, runs)| { + (0..3).any(|i| u64::from(runs[i]) * u64::from(lo[i]) != u64::from(threads[i])) + }); // The multiples are subgroup sizes, powers of two, so their largest is a multiple of each. let smallest = t.multiples.iter().copied().max().unwrap_or(1).max(1); let size = |l: [u32; 3]| if launches { l } else { [smallest, 1, 1] }; @@ -3242,6 +3311,7 @@ fn mesh_draw( // An emulated mesh function's threadgroups are folded into rows, so its direct grid is // held to no axis limit. match (groups, t.object.as_ref(), &t.records) { + (Some(_), Some(_), _) if folded => {} (Some(g), Some(o), _) => check_grid(o, g)?, (Some(g), None, None) => check_grid(&t.mesh, g)?, (Some(_), None, Some(_)) | (None, _, _) => {} @@ -3257,22 +3327,65 @@ fn mesh_draw( } }; let object = t.object.is_some(); + // A folded object function reads every grid builtin from its region record, and an unfolded + // one whose wrapped grid leaves a partial threadgroup from its region (`MultiRegion` 1). let specialization = spec_key(&t.spec, |k| { size_value(&mesh_keys, k, lm) + .or_else(|| ((folded || partial) && k == object_keys.multi_region).then_some(1)) .or_else(|| object.then(|| size_value(&object_keys, k, lo)).flatten()) .or_else(|| t.fixed.iter().find(|(key, _)| *key == k).map(|f| f.1)) }); + // A folded object function's draw runs its pieces (`bind::mesh_arguments`). + let (command, fold) = match (folded, groups, &t.object) { + (true, Some(g), Some(o)) => { + let task = MeshGridLimits { + axes: o.count, + total: o.total.unwrap_or(u32::MAX), + }; + let g = if launches { g } else { [0; 3] }; + let fold = fold_object_grid(g, lo, task, true) + .ok_or_else(|| internal(format!("a fold of threadgroups of {lo:?} threads")))?; + let command = match fold.pieces { + 0 | 1 => vk::DrawCommand::DrawMeshTasks { + group_count_x: fold.dispatch[0], + group_count_y: fold.dispatch[1], + group_count_z: fold.dispatch[2], + }, + pieces => vk::DrawCommand::DrawMeshTasksIndirect { + offset: u64::from(MeshArguments::OBJECT_COMMANDS), + draw_count: pieces, + stride: 12, + }, + }; + (command, Some(fold)) + } + (true, None, _) => ( + vk::DrawCommand::DrawMeshTasksIndirectCount { + offset: u64::from(MeshArguments::OBJECT_COMMANDS), + count_offset: u64::from(MeshArguments::OBJECT_COUNT), + max_draw_count: MeshArguments::OBJECT_PIECES, + stride: 12, + }, + None, + ), + _ => (command, None), + }; // The grid Metal reports of the first stage's threadgroups (`MultiRegion` 0 reads // `NumWorkgroups` instead): 0 for an indirect draw, whose counts only the GPU knows, and for - // the mesh stage under an object function, whose grid the object function sets. + // the mesh stage under an object function, whose grid the object function sets; an unfolded + // object function's wrapped threads; a folded one reads its record instead. let first = if object { lo } else { lm }; let mut grid = [0u32; 3]; - for (i, g) in groups.unwrap_or_default().into_iter().enumerate() { - grid[i] = g.checked_mul(first[i]).ok_or_else(|| { - BindError::Unsupported(Unsupported::not_representable(Feature::GroupCount { - axis: Some([Axis::X, Axis::Y, Axis::Z][i]), - })) - })?; + let counted = groups.filter(|_| !folded).unwrap_or_default(); + for (i, g) in counted.into_iter().enumerate() { + grid[i] = match wrapped { + Some((threads, _)) => threads[i], + None => g.checked_mul(first[i]).ok_or_else(|| { + BindError::Unsupported(Unsupported::not_representable(Feature::GroupCount { + axis: Some([Axis::X, Axis::Y, Axis::Z][i]), + })) + })?, + }; } let region = |grid, l: [u32; 3]| { region_bytes([0; 3], grid, l) @@ -3289,6 +3402,7 @@ fn mesh_draw( object_region, mesh_region, dispatch, + fold, }) } @@ -4201,6 +4315,7 @@ fn instantiate( mesh_dispatch: mesh_dispatch_out, tessellation_dispatch: tessellation_dispatch_out, mesh_arguments: mesh_arguments_out, + object_fold: object_fold_out, } = out; let overrun = index_overrun(t.robust_index_fetch, draw); let (command, base) = vk_draw(draw, overrun); @@ -4296,7 +4411,8 @@ fn instantiate( | PushField::CaptureAddress | PushField::CaptureIndexAddress | PushField::MergedDrawAddress - | PushField::SnapshotPhase => { + | PushField::SnapshotPhase + | PushField::ReplayRegionAddress => { let PushLoc::Push { offset } = f.loc else { return Err(not_implemented(Feature::Lowering(LowerFamily::StageIo))); }; @@ -4313,6 +4429,9 @@ fn instantiate( PushField::MergedDrawAddress => { PushHole::MergedDrawAddress { stages, offset } } + PushField::ReplayRegionAddress => { + PushHole::ReplayRegionAddress { stages, offset } + } _ => PushHole::CaptureIndexAddress { stages, offset }, }); continue; @@ -4610,11 +4729,18 @@ fn instantiate( // An indirect mesh draw's GPU-written group counts must lie within the device's limits // (`VUID-VkDrawMeshTasksIndirectCommandEXT-TaskEXT-07326` and its siblings): the arguments // pass writes the counts the draw reads. + // A folded object function's direct draw reads its uploaded fold instead. + let object_fold = mesh.as_ref().and_then(|m| m.fold); let mesh_arguments = match (command, &t.mesh) { - (vk::DrawCommand::DrawMeshTasksIndirect { .. }, Some(m)) => Some(match m.object { - Some(_) => MeshArgumentsForm::Object, - None => MeshArgumentsForm::Mesh, - }), + (vk::DrawCommand::DrawMeshTasksIndirectCount { .. }, Some(_)) => { + Some(MeshArgumentsForm::FoldedObject) + } + (vk::DrawCommand::DrawMeshTasksIndirect { .. }, Some(m)) if object_fold.is_none() => { + Some(match m.object { + Some(_) => MeshArgumentsForm::Object, + None => MeshArgumentsForm::Mesh, + }) + } _ => None, }; let index_unbounded = indirect_indices_unbounded(t.robust_index_fetch, draw); @@ -4647,6 +4773,7 @@ fn instantiate( *indirect_needs_arguments = arguments_elsewhere || index_unbounded; *index_bounds_pass = index_unbounded && !arguments_elsewhere; *mesh_arguments_out = mesh_arguments; + *object_fold_out = object_fold; *draw_command = command; *overrun_out = overrun; *amplifications_out = amplifications; diff --git a/crates/metal2vulkan/src/bind/graphics/tests.rs b/crates/metal2vulkan/src/bind/graphics/tests.rs index 29f253a4a..59a459274 100644 --- a/crates/metal2vulkan/src/bind/graphics/tests.rs +++ b/crates/metal2vulkan/src/bind/graphics/tests.rs @@ -1522,6 +1522,7 @@ fn mesh_template(flat: bool, multiples: Vec) -> GraphicsTemplate { stage: GroupStage::Mesh, }, object: None, + folded: false, records: None, }), shader_tests: None, @@ -1709,6 +1710,28 @@ fn object_draws_specialize_each_stage_within_its_limits() { ] { assert_eq!(instantiate(&t, &state, &draw).err(), refusal, "{draw:?}"); } + // Threads per grid wrapped to 32 bits: the threadgroups they fill, rounded up (Metal's), none + // where they wrap to 0, held to the task limits; the region reports them, read (`MultiRegion` + // 1) where they leave a partial threadgroup. + for (counts, lo, runs, reported, multi_region) in [ + ([33_554_433, 1, 1], [128, 1, 1], [1, 1, 1], [128, 1, 1], 0), + ([44_739_243, 1, 1], [96, 1, 1], [1, 1, 1], [32, 1, 1], 1), + ([33_554_432, 1, 1], [128, 1, 1], [0, 0, 0], [0, 1, 1], 0), + ] { + let cmds = instantiate(&t, &state, &groups(counts, lo, [2, 1, 1])).expect("wraps"); + let [x, y, z] = runs; + assert_eq!(cmds.draw, tasks(x, y, z), "{counts:?}"); + if runs[0] == 0 { + continue; + } + let key = cmds.specialization.as_ref().expect("a mesh draw's key"); + assert!(values(key).contains(&(8, multi_region)), "{counts:?}"); + assert_eq!( + cmds.push_constants[0].bytes, + region(reported, lo), + "{counts:?}" + ); + } // Indirect: its object threadgroups' counts, through the object form of the arguments pass; // an object threadgroup Metal draws nothing for reads none. let indirect = |lo| DrawCall::MeshThreadgroupsIndirect { @@ -1728,6 +1751,126 @@ fn object_draws_specialize_each_stage_within_its_limits() { assert!(cmds.uses.is_empty() && cmds.mesh_arguments.is_none()); } +/// A folded object function's draws (`MeshTemplate::folded`): a direct draw runs its object grid +/// in the pieces of its fold within the task limits, as `vkCmdDrawMeshTasksEXT` of its one piece or +/// `vkCmdDrawMeshTasksIndirectEXT` of its pieces' uploaded commands, its object stage reading the +/// fold's record at its `ReplayRegionAddress` hole and every grid builtin from it (`MultiRegion` +/// 1); a grid past what runs draws nothing and says so; threads per grid wrap as Metal's; and an +/// indirect draw is `vkCmdDrawMeshTasksIndirectCountEXT` of the folded arguments pass's pieces. +#[test] +fn folded_object_draws_run_their_grid_in_pieces() { + use crate::bind::mesh_arguments::{fold_object_grid, MeshArguments, MeshGridLimits}; + use crate::pipeline::interface::PlacedField; + let state = BindState::default(); + let mut t = object_template(); + t.stages[0].fields = vec![PlacedField { + field: PushField::ReplayRegionAddress, + loc: PushLoc::Push { offset: 0 }, + size: 8, + }]; + t.stages[0].push_range = Some((0, 8)); + t.mesh.as_mut().expect("a mesh template").folded = true; + let task = MeshGridLimits { + axes: [65535; 3], + total: 1 << 22, + }; + let groups = |groups, lo| DrawCall::MeshThreadgroups { + groups, + threads_per_object_group: lo, + threads_per_mesh_group: [2, 1, 1], + }; + let tasks = |[x, y, z]: [u32; 3]| vk::DrawCommand::DrawMeshTasks { + group_count_x: x, + group_count_y: y, + group_count_z: z, + }; + let hole = PushHole::ReplayRegionAddress { + stages: vk::ShaderStageFlags::TASK_EXT, + offset: 0, + }; + // One piece, a grid past the task stage's axis among them: no refusal. + for (counts, lo, dispatch) in [ + ([3, 1, 1], [4, 2, 1], [3, 1, 1]), + ([1, 1, 65536], [1; 3], [65535, 2, 1]), + ([131_070, 2, 1], [1; 3], [65535, 4, 1]), + ] { + let cmds = instantiate(&t, &state, &groups(counts, lo)).expect("one piece"); + let fold = fold_object_grid(counts, lo, task, true).expect("fold"); + assert_eq!(fold.dispatch, dispatch, "{counts:?}"); + assert_eq!(cmds.draw, tasks(dispatch), "{counts:?}"); + assert_eq!(cmds.object_fold, Some(fold), "{counts:?}"); + assert!(cmds.push_holes.contains(&hole), "{counts:?}"); + assert!( + cmds.mesh_arguments.is_none() && cmds.uses.is_empty(), + "{counts:?}" + ); + let key = cmds.specialization.as_ref().expect("a mesh draw's key"); + let multi_region = key.entries.iter().find(|e| e.constant_id == 8).map(|e| { + let at = e.offset as usize; + u32::from_le_bytes(key.data[at..at + 4].try_into().expect("4 bytes")) + }); + assert_eq!(multi_region, Some(1), "{counts:?}"); + } + // Pieces: the uploaded commands, at their offset in the upload. + let cmds = instantiate(&t, &state, &groups([70_000, 100, 1], [1; 3])).expect("pieces"); + assert_eq!( + cmds.draw, + vk::DrawCommand::DrawMeshTasksIndirect { + offset: u64::from(MeshArguments::OBJECT_COMMANDS), + draw_count: 2, + stride: 12, + } + ); + let fold = cmds.object_fold.expect("a fold"); + assert_eq!( + (fold.dispatch, fold.pieces, fold.past), + ([65535, 64, 1], 2, false) + ); + assert_eq!(fold.bytes().len(), 36 + 2 * 12); + assert!(cmds.mesh_arguments.is_none()); + // Past what runs: 2^29 threadgroups or more, which Metal's GPU fails. + for counts in [[65535, 65535, 1], [1 << 29, 1, 1]] { + let cmds = instantiate(&t, &state, &groups(counts, [1; 3])).expect("past"); + assert_eq!(cmds.draw, tasks([0; 3]), "{counts:?}"); + assert!(cmds.object_fold.is_some_and(|f| f.past), "{counts:?}"); + } + // Threads per grid wrapped to 32 bits: a direct draw runs the threadgroups they fill, rounded + // up (Metal's), none where they wrap to 0, and the record reports them. + let cmds = instantiate(&t, &state, &groups([33_554_433, 1, 1], [128, 1, 1])).expect("wraps"); + assert_eq!(cmds.draw, tasks([1, 1, 1])); + let fold = cmds.object_fold.expect("a fold"); + assert_eq!(fold.record[..3], [1, 1, 1]); + assert_eq!(fold.record[4..7], [128, 1, 1]); + // Nothing Metal draws: no fold past anything. + for (counts, lo) in [([3, 0, 1], [4, 1, 1]), ([1 << 26, 1, 1], [128, 1, 1])] { + let cmds = instantiate(&t, &state, &groups(counts, lo)).expect("nothing"); + assert_eq!(cmds.draw, tasks([0; 3]), "{counts:?}"); + assert!( + cmds.object_fold.is_some_and(|f| !f.past && f.pieces == 0), + "{counts:?}" + ); + } + // Indirect: the folded arguments pass's pieces. + let indirect = DrawCall::MeshThreadgroupsIndirect { + indirect: IndirectRef::new(1, 12), + threads_per_object_group: [4, 1, 1], + threads_per_mesh_group: [32, 1, 1], + }; + let cmds = instantiate(&t, &state, &indirect).expect("indirect"); + assert_eq!( + cmds.draw, + vk::DrawCommand::DrawMeshTasksIndirectCount { + offset: u64::from(MeshArguments::OBJECT_COMMANDS), + count_offset: u64::from(MeshArguments::OBJECT_COUNT), + max_draw_count: MeshArguments::OBJECT_PIECES, + stride: 12, + } + ); + assert_eq!(cmds.mesh_arguments, Some(MeshArgumentsForm::FoldedObject)); + assert!(cmds.object_fold.is_none() && cmds.push_holes.contains(&hole)); + assert!(!cmds.indirect_needs_arguments && cmds.uses.len() == 1); +} + /// A mesh draw is `vkCmdDrawMeshTasksEXT` of its threadgroups, made with its threadgroup's size as /// its specialization (`MultiRegion` 0 beside the plan's constants) and writing its grid in /// `DispatchRegion`; `drawMeshThreads` launches the whole threadgroups its threads fill, and writes diff --git a/crates/metal2vulkan/src/bind/instantiate.rs b/crates/metal2vulkan/src/bind/instantiate.rs index a67ad872b..c402632f1 100644 --- a/crates/metal2vulkan/src/bind/instantiate.rs +++ b/crates/metal2vulkan/src/bind/instantiate.rs @@ -75,7 +75,9 @@ pub enum PushHole { /// `ReplayLayout::region_offset` of the dispatch's command and region in the replay's scratch, /// as a `u64` at `offset` of the variant's push bytes. A flat variant's dispatch outside a /// replay (`BindingPlan::instantiate_dispatch`) reads the record its preprocess wrote beside - /// the group counts. + /// the group counts. A mesh draw of a folded object function (`TASK_EXT`) reads its scratch's + /// region record: the arguments pass's (`DrawCommands::mesh_arguments`) or the uploaded fold's + /// (`DrawCommands::object_fold`), at [`MeshArguments::OBJECT_RECORD`](crate::bind::MeshArguments::OBJECT_RECORD), a multiple of 16. ReplayRegionAddress { stages: vk::ShaderStageFlags, offset: u32, diff --git a/crates/metal2vulkan/src/bind/mesh_arguments.rs b/crates/metal2vulkan/src/bind/mesh_arguments.rs index 57954a176..530caf1f2 100644 --- a/crates/metal2vulkan/src/bind/mesh_arguments.rs +++ b/crates/metal2vulkan/src/bind/mesh_arguments.rs @@ -4,9 +4,8 @@ //! `MTLDispatchThreadgroupsIndirectArguments`) as it runs. `vkCmdDrawMeshTasksIndirectEXT` requires //! every count within the device's task or mesh limits, so the draw cannot read Metal's arguments //! in place: the consumer records [`MeshArguments`] first, one invocation of the crate-owned -//! module [`mesh_arguments_module`] that reads Metal's three words and writes the -//! `VkDrawMeshTasksIndirectCommandEXT` the draw reads into a consumer-provided scratch of -//! [`MeshArguments::SCRATCH_BYTES`]. +//! module [`mesh_arguments_module`] that reads Metal's three words and writes what the draw reads +//! into a consumer-provided scratch of [`MeshArguments::scratch_bytes`]. //! //! **What Metal draws**, measured by our probe on an M3 Max (macOS 27.0.1), direct and indirect //! draws alike, with and without API validation, which stops none of them: @@ -17,19 +16,52 @@ //! of up to [`METAL_MESH_GRID_TOTAL`] (1,048,575, Apple's limit for the family) draw whole. Past //! that Metal is erratic (17 by 61,681 and 65,535 by 24 drew, 1025 by 1025 and 33 by 32,768 did //! not), and the module draws nothing, Metal's answer at 2^20 and above 2^21. -//! - With an object function the counts are the object grid, which Metal draws at every count -//! measured (16,777,216 along `x`). The mesh grid an object threadgroup sets follows the rule -//! above (65,536 along `x` or `y`, 1024 by 1024 and 2048 by 1024 launch nothing from it; 1023 by -//! 1025 and 65,535 by 16 launch whole), which the object function's lowering holds it to -//! (`lower::mesh`). +//! - With an object function the counts are the object grid, which Metal runs at every count +//! that its GPU finishes in time: 16,777,216 along `x` in 0.14 s and 2^28 threadgroups in 2.5 s +//! complete; 2^29 and 2^32 fail the command buffer after 5 s (`MTLCommandBufferErrorInternal`, +//! the GPU's watchdog), none of its writes landing. Metal's threads per grid along an axis are +//! the axis's threadgroups times its threads per threadgroup wrapped to 32 bits, which its grid +//! builtins report (`threads_per_grid`, and `threadgroups_per_grid` those threads over the +//! threadgroup's, rounded up): an indirect draw runs every threadgroup of its arguments +//! (4,294,970 by 1000 threads ran 4,294,970 threadgroups that each read a grid of 2704 threads, +//! 3 threadgroups), a direct draw only the threadgroups the wrapped threads fill, rounded up +//! (that draw ran 3, 4,194,304 by 1024 none) ([`metal_object_grid`]). The mesh grid an object +//! threadgroup sets follows the rule above (65,536 along `x` or `y`, 1024 by 1024 and 2048 by +//! 1024 launch nothing from it; 1023 by 1025 and 65,535 by 16 launch whole), which the object +//! function's lowering holds it to (`lower::mesh`). //! -//! **The module's rule** ([`MeshGridRule`], its constants): where Metal draws nothing, it writes -//! zero counts, which draw nothing. Where Metal draws and the counts lie within the device's -//! limits for the first stage (`maxMeshWorkGroupCount` and `maxMeshWorkGroupTotalCount`, or the -//! task stage's), it copies them. Where Metal draws and they do not (an object grid past the task -//! stage's limits), it writes zero counts and sets `MESH_GRID_PAST_LIMITS` in the command buffer's -//! `ExecutionStatus`, which the consumer reports as a command-buffer error: Metal draws them. -//! Every committed profile with the extension holds Metal's mesh grids within its mesh limits. +//! **The mesh form's rule** ([`MeshGridRule`], its constants): where Metal draws nothing, it +//! writes zero counts, which draw nothing. Where Metal draws and the counts lie within the +//! device's `maxMeshWorkGroupCount` and `maxMeshWorkGroupTotalCount`, it copies them; every +//! committed profile with the extension holds Metal's mesh grids so. Where they do not, it writes +//! zero counts and sets `MESH_GRID_PAST_LIMITS` in the command buffer's `ExecutionStatus`, which the +//! consumer reports as a command-buffer error. +//! +//! **The folded object form** ([`MeshArgumentsForm::FoldedObject`]) runs any object grid in +//! pieces within the task stage's limits ([`fold_object_grid`], which a direct draw's binder +//! computes on the CPU): on a device that folds object grids (`lower::mesh::folds_object_grids`) +//! the object function is compiled folded (`LoweringInputs::folded_groups`), so a task workgroup +//! counts its Metal threadgroup from its workgroup's position, the dispatch's size and its +//! `DrawIndex`, reads the threadgroups Metal runs and its threads per grid from the 32-byte region +//! record at its `PushField::ReplayRegionAddress`, and launches nothing past Metal's last +//! threadgroup. The module writes, into the scratch ([`MeshArguments::OBJECT_RECORD`] and after): +//! +//! - the region record: the threadgroups Metal runs along each axis in the base's words (which a +//! folded variant reads in their place, `lower::dispatch`), the packed threads per object +//! threadgroup, and Metal's threads per grid ([`metal_object_grid`]); +//! - the draw count `P` ([`MeshArguments::OBJECT_COUNT`]) and [`MeshArguments::OBJECT_PIECES`] +//! commands of one piece's dispatch ([`MeshArguments::OBJECT_COMMANDS`]), which +//! `vkCmdDrawMeshTasksIndirectCountEXT` reads. +//! +//! A grid with a zero count draws nothing. One of more than [`METAL_OBJECT_GRID_TOTAL`] +//! threadgroups (which Metal's GPU fails), or which more pieces than +//! [`MeshArguments::OBJECT_PIECES`] would take (none on a device of the task limits Vulkan +//! requires), draws nothing and sets `MESH_GRID_PAST_LIMITS`. +//! +//! **The unfolded object form** ([`MeshArgumentsForm::Object`], a device that does not fold +//! object grids) is the mesh form's rule with no Metal limit: Metal's counts where they lie within +//! the device's `maxTaskWorkGroupCount` and `maxTaskWorkGroupTotalCount`, else zero counts and +//! `MESH_GRID_PAST_LIMITS`. //! //! **The module** (fixed per device and form): one `GLCompute` entry `main` with local size //! `(1, 1, 1)`, no loops, three storage buffers in set 0 and one push constant: @@ -37,22 +69,24 @@ //! | Binding | Buffer | Range | //! |---|---|---| //! | [`MeshArgumentsModule::SOURCE_BINDING`] | the Metal indirect buffer | [`MeshArguments::source_range`] | -//! | [`MeshArgumentsModule::SCRATCH_BINDING`] | the consumer's scratch | [`MeshArguments::SCRATCH_BYTES`] | +//! | [`MeshArgumentsModule::SCRATCH_BINDING`] | the consumer's scratch | [`MeshArguments::scratch_bytes`] | //! | [`MeshArgumentsModule::STATUS_BINDING`] | the `ExecutionStatus` buffer | `ExecutionStatus::BYTES` | //! -//! The push constant ([`MeshArguments::push_constants`], `COMPUTE`, offset 0) is the byte distance +//! The push constants ([`MeshArguments::push_constants`], `COMPUTE`, offset 0) are the byte distance //! from the bound source range's start to the arguments (a multiple of 4), since a storage //! descriptor's offset must be a multiple of `minStorageBufferOffsetAlignment` where Metal's -//! argument offset is only 4-aligned. Reads of the source are contained (an index past the bound -//! range reads 0). +//! argument offset is only 4-aligned, and the folded object form's threads per object threadgroup, +//! packed as a region record packs them. Reads of the source are contained (an index past the +//! bound range reads 0). //! //! **Synchronization** (consumer): the source write → `SHADER_READ` in `COMPUTE_SHADER` before -//! the pass; the scratch `SHADER_WRITE` → `INDIRECT_COMMAND_READ` in `DRAW_INDIRECT` between the -//! pass and the draw. +//! the pass; the scratch `SHADER_WRITE` → `INDIRECT_COMMAND_READ` in `DRAW_INDIRECT`, and for the +//! folded object form `SHADER_READ` in `TASK_SHADER`, between the pass and the draw. use std::sync::Arc; use crate::bind::instantiate::{BufferRange, IndirectRef}; +use crate::bind::mesh_scan::{div_ceil, for_range}; use crate::bind::replay::checked_mul; use crate::bind::status::{StatusBits, StatusWord}; use crate::budget::{Budget, Meter}; @@ -67,7 +101,7 @@ use crate::spirv::builder::{FunctionBuilder, ModuleBuilder}; use crate::spirv::error::BResult; use crate::spirv::ids::{GlobalId, TypeId, Value}; use crate::spirv::ir::{ - natural_layout, AtomicOp, BinOp, ConstBits, Constant, ExecMode, ExecModel, LayoutRule, + natural_layout, AtomicOp, BinOp, ConstBits, Constant, ExecMode, ExecModel, GlslOp, LayoutRule, MemAccess, Scope, Semantics, StorageClass, Type, TypedModule, UnOp, }; @@ -79,6 +113,11 @@ pub const METAL_MESH_GRID_AXIS: u32 = 65_535; /// docs). pub const METAL_MESH_GRID_TOTAL: u32 = 1_048_575; +/// The most object threadgroups of a draw the runtime runs: Metal's GPU fails a draw of 2^29 or +/// more after its watchdog's 5 seconds even where each threadgroup does nothing (the module docs), +/// so a larger grid draws nothing and fails the command buffer. +pub const METAL_OBJECT_GRID_TOTAL: u32 = (1 << 29) - 1; + /// Whether Metal draws nothing for a mesh grid of `groups` without an object function: an axis /// past [`METAL_MESH_GRID_AXIS`], or more than [`METAL_MESH_GRID_TOTAL`] threadgroups. pub(crate) fn metal_mesh_grid_draws_nothing(groups: [u32; 3]) -> bool { @@ -92,8 +131,13 @@ pub(crate) fn metal_mesh_grid_draws_nothing(groups: [u32; 3]) -> bool { pub enum MeshArgumentsForm { /// The mesh function's, of a pipeline without an object function. Mesh, - /// The object function's. + /// The object function's, on a device that does not fold object grids + /// (`lower::mesh::folds_object_grids`): Metal's counts where the device's task stage launches + /// them. Object, + /// The object function's, compiled folded on a device that folds object grids: the fold of + /// Metal's counts ([`fold_object_grid`]). + FoldedObject, } /// A grid's limits: the largest count along each axis, and the largest product. @@ -131,7 +175,7 @@ impl MeshGridRule { total: limits.max_mesh_work_group_total_count, }, }, - MeshArgumentsForm::Object => MeshGridRule { + MeshArgumentsForm::Object | MeshArgumentsForm::FoldedObject => MeshGridRule { metal: None, device: MeshGridLimits { axes: limits.max_task_work_group_count, @@ -142,11 +186,120 @@ impl MeshGridRule { } } +/// How a draw of an object grid runs on a device that folds object grids (the module docs): the +/// region record its object function reads, one piece's dispatch, and the pieces. +#[non_exhaustive] +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct ObjectFold { + /// The 32-byte region record: the threadgroups Metal runs along each axis (in the base's + /// words), the packed threads per object threadgroup, Metal's threads per grid, and 0 + /// ([`metal_object_grid`]). + pub record: [u32; 8], + /// The group counts of each piece's `VkDrawMeshTasksIndirectCommandEXT`, within the task + /// stage's limits. + pub dispatch: [u32; 3], + /// The pieces, each a draw whose `DrawIndex` is its number: 0 for a grid that draws nothing. + pub pieces: u32, + /// The grid is past what the runtime runs ([`METAL_OBJECT_GRID_TOTAL`], or more than + /// [`MeshArguments::OBJECT_PIECES`] pieces): it draws nothing, and the command buffer fails as + /// Metal's does. + pub past: bool, +} + +impl ObjectFold { + /// The fold's scratch as a direct draw uploads it (the pass's layout, through its pieces' + /// commands): the region record at [`MeshArguments::OBJECT_RECORD`], the pieces at + /// [`MeshArguments::OBJECT_COUNT`], and each piece's command from + /// [`MeshArguments::OBJECT_COMMANDS`]. + pub fn bytes(&self) -> Vec { + let mut words = self.record.to_vec(); + words.push(self.pieces); + for _ in 0..self.pieces { + words.extend(self.dispatch); + } + words.iter().flat_map(|w| w.to_le_bytes()).collect() + } +} + +/// Metal's grid of an object draw of `groups` threadgroups of `threads` threads each (the module +/// docs): the threadgroups it runs along each axis, and the threads per grid its builtins report, +/// `groups · threads` wrapped to 32 bits. An indirect draw (`direct` false) runs every threadgroup; +/// a direct one those the wrapped threads fill, rounded up (measured on the M3 Max). `None` where +/// an axis has no thread. +pub fn metal_object_grid( + groups: [u32; 3], + threads: [u32; 3], + direct: bool, +) -> Option<([u32; 3], [u32; 3])> { + if threads.contains(&0) { + return None; + } + let reported: [u32; 3] = std::array::from_fn(|i| groups[i].wrapping_mul(threads[i])); + let runs = match direct { + true => std::array::from_fn(|i| reported[i].div_ceil(threads[i])), + false => groups, + }; + Some((runs, reported)) +} + +/// The fold of an object draw of `groups` threadgroups of `threads` threads each (1 to 1024 an +/// axis), direct or indirect, on a task stage of `task`'s limits (the module docs); `None` when +/// `threads` does not pack. Each piece runs `nx` by `ny` workgroups of the threadgroups Metal runs +/// ([`metal_object_grid`]): `nx` the fewer of those and the axis and total limits, `ny` the +/// fewest rows that cover them within the `y` limit and the total. +pub fn fold_object_grid( + groups: [u32; 3], + threads: [u32; 3], + task: MeshGridLimits, + direct: bool, +) -> Option { + let packed = crate::lower::dispatch::pack_nominal(threads)?; + let (runs, reported) = metal_object_grid(groups, threads, direct)?; + let none = |past| ObjectFold { + record: [0, 0, 0, packed, 0, 0, 0, 0], + dispatch: [0; 3], + pieces: 0, + past, + }; + if runs.contains(&0) { + return Some(none(false)); + } + let n = runs.iter().map(|&c| u64::from(c)).product::(); + if n > u64::from(METAL_OBJECT_GRID_TOTAL) { + return Some(none(true)); + } + let n = n as u32; + let total = object_total(task); + let nx = n.min(task.axes[0]).min(total).max(1); + let ny = n.div_ceil(nx).min(task.axes[1]).min(total / nx).max(1); + let pieces = n.div_ceil(nx * ny); + if pieces > MeshArguments::OBJECT_PIECES { + return Some(none(true)); + } + let [rx, ry, rz] = runs; + let [tx, ty, tz] = reported; + Some(ObjectFold { + record: [rx, ry, rz, packed, tx, ty, tz, 0], + dispatch: [nx, ny, 1], + pieces, + past: false, + }) +} + +/// The task stage's total for a fold, at most 2^31 so that no division by it is the all-ones +/// integer's (`tests::owned_divisions`); a fold needs at most [`METAL_OBJECT_GRID_TOTAL`]. +fn object_total(task: MeshGridLimits) -> u32 { + task.total.min(1 << 31) +} + /// An arguments pass the consumer records before an indirect mesh draw on a device with /// `VK_EXT_mesh_shader`: one invocation of [`mesh_arguments_module`] of the draw's form reads -/// Metal's arguments at `source` and writes the draw's `VkDrawMeshTasksIndirectCommandEXT` into a -/// consumer-provided scratch of [`MeshArguments::SCRATCH_BYTES`], from which the draw -/// (`DrawCommand::DrawMeshTasksIndirect` at offset 0) reads. +/// Metal's arguments at `source` and writes, into a consumer-provided scratch of +/// [`MeshArguments::scratch_bytes`], the mesh form's `VkDrawMeshTasksIndirectCommandEXT` +/// (`DrawCommand::DrawMeshTasksIndirect` at offset 0 reads it; the unfolded object form's too) or +/// the folded object form's region record, draw count and commands +/// (`DrawCommand::DrawMeshTasksIndirectCount` reads them). #[non_exhaustive] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] @@ -159,27 +312,59 @@ pub struct MeshArguments { /// 12 argument bytes. pub source_range: BufferRange, /// The push constant bytes (`COMPUTE`, offset 0): the arguments' byte offset inside - /// `source_range`. - pub push_constants: [u8; 4], + /// `source_range`, then the packed threads per object threadgroup (0 but for the folded + /// object form). + pub push_constants: [u8; 8], } impl MeshArguments { - /// Bytes of the scratch the draw's arguments are written to - /// (`VkDrawMeshTasksIndirectCommandEXT`). - pub const SCRATCH_BYTES: u32 = 12; + /// Bytes of Metal's arguments (`MTLDispatchThreadgroupsIndirectArguments`). + pub const ARGUMENT_BYTES: u32 = 12; + /// The folded object form's region record's byte offset in the scratch (16-aligned). + pub const OBJECT_RECORD: u32 = 0; + /// The folded object form's draw count's byte offset in the scratch. + pub const OBJECT_COUNT: u32 = 32; + /// The folded object form's first command's byte offset in the scratch. + pub const OBJECT_COMMANDS: u32 = 36; + /// The folded object form's commands, the most pieces a draw takes: 128 of the 2^22 + /// threadgroups every task stage launches per draw (`maxTaskWorkGroupTotalCount`'s required + /// least) cover [`METAL_OBJECT_GRID_TOTAL`]. + pub const OBJECT_PIECES: u32 = 128; + + /// Bytes of the scratch the pass of `form` writes: the mesh and unfolded object forms' + /// command, or the folded object form's region record, draw count and commands. + pub const fn scratch_bytes(form: MeshArgumentsForm) -> u32 { + match form { + MeshArgumentsForm::Mesh | MeshArgumentsForm::Object => 12, + MeshArgumentsForm::FoldedObject => Self::OBJECT_COMMANDS + 12 * Self::OBJECT_PIECES, + } + } /// The pass for Metal arguments at `source` of a draw whose first stage is `form`, with the - /// source bound at an offset aligned to `alignment` (`minStorageBufferOffsetAlignment`). - /// `None` when `source.offset` is not a multiple of 4 (such a draw draws nothing) or the range - /// overflows. - pub fn new(source: IndirectRef, form: MeshArgumentsForm, alignment: u64) -> Option { + /// source bound at an offset aligned to `alignment` (`minStorageBufferOffsetAlignment`) and, + /// for the folded object form, `threads` threads per object threadgroup. `None` when + /// `source.offset` is not a multiple of 4 (such a draw draws nothing), the range overflows, + /// or the threads do not pack. + pub fn new( + source: IndirectRef, + form: MeshArgumentsForm, + alignment: u64, + threads: [u32; 3], + ) -> Option { if !source.offset.is_multiple_of(4) { return None; } let a = alignment.max(4); let start = source.offset - source.offset % a; let residual = u32::try_from(source.offset - start).ok()?; - let end = source.offset.checked_add(u64::from(Self::SCRATCH_BYTES))?; + let end = source.offset.checked_add(u64::from(Self::ARGUMENT_BYTES))?; + let packed = match form { + MeshArgumentsForm::Mesh | MeshArgumentsForm::Object => 0, + MeshArgumentsForm::FoldedObject => crate::lower::dispatch::pack_nominal(threads)?, + }; + let mut push_constants = [0u8; 8]; + push_constants[..4].copy_from_slice(&residual.to_le_bytes()); + push_constants[4..].copy_from_slice(&packed.to_le_bytes()); Some(MeshArguments { source, form, @@ -187,7 +372,7 @@ impl MeshArguments { offset: start, range: end - start, }, - push_constants: residual.to_le_bytes(), + push_constants, }) } } @@ -209,12 +394,12 @@ impl MeshArgumentsModule { pub const SET: u32 = 0; /// The Metal indirect buffer, a storage buffer. pub const SOURCE_BINDING: u32 = 0; - /// The consumer's scratch (`VkDrawMeshTasksIndirectCommandEXT`), a storage buffer. + /// The consumer's scratch ([`MeshArguments::scratch_bytes`]), a storage buffer. pub const SCRATCH_BINDING: u32 = 1; /// The command buffer's `ExecutionStatus` buffer, a storage buffer. pub const STATUS_BINDING: u32 = 2; /// Bytes of the `COMPUTE` push-constant range at offset 0. - pub const PUSH_BYTES: u32 = 4; + pub const PUSH_BYTES: u32 = 8; } /// The binding symbol of the source buffer ([`MeshArgumentsModule::SOURCE_BINDING`]). @@ -241,6 +426,12 @@ const RESIDUAL: PushField = PushField::SlotBindOffset(SlotRef { class: SlotClass::Buffer, index: 0, }); +/// The push field of the folded object form's packed threads per object threadgroup, at offset 4. +const PACKED_THREADS: PushField = PushField::SlotBindOffset(SlotRef { + stage: Stage::Kernel, + class: SlotClass::Buffer, + index: 1, +}); /// A `Block { u32 words[]; }` storage buffer bound at `sym`. fn words_buffer(b: &mut ModuleBuilder, sym: ResourceSlot, u32_: TypeId) -> BResult { @@ -296,21 +487,144 @@ fn grid_within( Ok(within) } -/// The `bool` constant `true`. -fn truth(f: &mut FunctionBuilder<'_>) -> BResult { +/// The `bool` constant `v`. +fn boolean(f: &mut FunctionBuilder<'_>, v: bool) -> BResult { let ty = f.module().ty(Type::Bool)?; let c = f.module().constant(Constant::Scalar { ty, - bits: ConstBits(1), + bits: ConstBits(u64::from(v)), })?; f.module().const_value(c) } -/// The arguments module for `rule` as a typed module, before serialization: the module +/// The mesh and unfolded object forms (the module docs): Metal's counts `v` into the scratch's +/// command where Metal draws them and the device launches them, else zero. Whether Metal draws +/// them and the device cannot. +fn mesh_counts( + f: &mut FunctionBuilder<'_>, + rule: MeshGridRule, + v: [Value; 3], + scratch: Value, +) -> BResult { + let zero = u32_value(f, 0)?; + let metal = match rule.metal { + Some(limits) => grid_within(f, v, limits)?, + None => boolean(f, true)?, + }; + let device = grid_within(f, v, rule.device)?; + let drawn = f.binary(BinOp::LogicalAnd, metal, device)?; + for (axis, c) in v.into_iter().enumerate() { + let i = u32_value(f, axis as u32)?; + let count = f.select(drawn, c, zero)?; + let out = f.access_chain(scratch, &[zero, i])?; + f.store(out, count, MemAccess::default())?; + } + f.binary(BinOp::LogicalNotEqual, metal, drawn) +} + +/// The folded object form ([`fold_object_grid`] of an indirect draw, step for step): Metal's counts +/// `v` of threadgroups of the `packed` threads fold into the scratch's region record, draw count +/// and commands. Whether the grid is past what the runtime runs. +fn object_fold( + f: &mut FunctionBuilder<'_>, + u32_: TypeId, + task: MeshGridLimits, + (v, packed): ([Value; 3], Value), + scratch: Value, +) -> BResult { + let zero = u32_value(f, 0)?; + let one = u32_value(f, 1)?; + let mut any_zero = f.binary(BinOp::IEqual, v[0], zero)?; + for &c in &v[1..] { + let z = f.binary(BinOp::IEqual, c, zero)?; + any_zero = f.binary(BinOp::LogicalOr, any_zero, z)?; + } + // Metal's threads per grid, each wrapped to a `u32` (`metal_object_grid`: an indirect draw + // runs every threadgroup). + let mask = u32_value(f, (1 << crate::lower::dispatch::NOMINAL_AXIS_BITS) - 1)?; + let mut per_grid = [zero; 3]; + for (axis, out) in per_grid.iter_mut().enumerate() { + let shift = u32_value(f, crate::lower::dispatch::NOMINAL_AXIS_BITS * axis as u32)?; + let t = f.binary(BinOp::ShiftRightLogical, packed, shift)?; + let t = f.binary(BinOp::BitwiseAnd, t, mask)?; + let t = f.binary(BinOp::IAdd, t, one)?; + *out = f.binary(BinOp::IMul, v[axis], t)?; + } + // The threadgroups, at most `METAL_OBJECT_GRID_TOTAL`. + let (xy, wraps_xy) = checked_mul(f, v[0], v[1], zero)?; + let (n, wraps_n) = checked_mul(f, xy, v[2], zero)?; + let mut over = f.binary(BinOp::LogicalOr, wraps_xy, wraps_n)?; + let most = u32_value(f, METAL_OBJECT_GRID_TOTAL)?; + let many = f.binary(BinOp::UGreaterThan, n, most)?; + over = f.binary(BinOp::LogicalOr, over, many)?; + // One piece's dispatch and the pieces, of at least one threadgroup (a zero count or a grid + // past what runs draws nothing whatever they are). + let n = f.glsl(GlslOp::UMax, &[n, one])?; + let total = object_total(task); + let axis_x = u32_value(f, task.axes[0].min(total).max(1))?; + let nx = f.glsl(GlslOp::UMin, &[n, axis_x])?; + let rows = div_ceil(f, n, nx)?; + let axis_y = u32_value(f, task.axes[1].max(1))?; + let total = u32_value(f, total)?; + let room = f.binary(BinOp::UDiv, total, nx)?; + let ny = f.glsl(GlslOp::UMin, &[rows, axis_y])?; + let ny = f.glsl(GlslOp::UMin, &[ny, room])?; + let ny = f.glsl(GlslOp::UMax, &[ny, one])?; + let piece = f.binary(BinOp::IMul, nx, ny)?; + let pieces = div_ceil(f, n, piece)?; + let most = u32_value(f, MeshArguments::OBJECT_PIECES)?; + let many = f.binary(BinOp::UGreaterThan, pieces, most)?; + over = f.binary(BinOp::LogicalOr, over, many)?; + let none = f.binary(BinOp::LogicalOr, any_zero, over)?; + let runs = f.unary(UnOp::LogicalNot, none)?; + let past = f.unary(UnOp::LogicalNot, any_zero)?; + let past = f.binary(BinOp::LogicalAnd, past, over)?; + // The region record, the count and the commands. + let word = |f: &mut FunctionBuilder<'_>, at: u32, value: Value| -> BResult<()> { + let i = u32_value(f, at)?; + let p = f.access_chain(scratch, &[zero, i])?; + f.store(p, value, MemAccess::default()) + }; + let record = MeshArguments::OBJECT_RECORD / 4; + for (i, c) in v.into_iter().enumerate() { + let c = f.select(runs, c, zero)?; + word(f, record + i as u32, c)?; + } + word(f, record + 3, packed)?; + for (i, t) in per_grid.into_iter().enumerate() { + let t = f.select(runs, t, zero)?; + word(f, record + 4 + i as u32, t)?; + } + word(f, record + 7, zero)?; + let count = f.select(runs, pieces, zero)?; + word(f, MeshArguments::OBJECT_COUNT / 4, count)?; + let nx = f.select(runs, nx, zero)?; + let ny = f.select(runs, ny, zero)?; + let nz = f.select(runs, one, zero)?; + let first = u32_value(f, MeshArguments::OBJECT_COMMANDS / 4)?; + let end = u32_value(f, MeshArguments::OBJECT_PIECES)?; + for_range(f, u32_, (zero, end), move |f, i| { + let zero = u32_value(f, 0)?; + let three = u32_value(f, 3)?; + let at = f.binary(BinOp::IMul, i, three)?; + let at = f.binary(BinOp::IAdd, first, at)?; + for (k, value) in [nx, ny, nz].into_iter().enumerate() { + let k = u32_value(f, k as u32)?; + let w = f.binary(BinOp::IAdd, at, k)?; + let p = f.access_chain(scratch, &[zero, w])?; + f.store(p, value, MemAccess::default())?; + } + Ok(()) + })?; + Ok(past) +} + +/// The arguments module of `form` for `rule` as a typed module, before serialization: the module /// [`mesh_arguments_module`] serializes, which the CPU interpreter runs. Its bindings are the -/// symbols [`SOURCE`], [`SCRATCH`] and [`STATUS`]; its push field is the source residual at -/// offset 0. -pub fn typed_module(rule: MeshGridRule) -> BResult { +/// symbols [`SOURCE`], [`SCRATCH`] and [`STATUS`]; its push fields are the source residual at +/// offset 0 and, for the folded object form, the packed threads per object threadgroup at +/// offset 4. +pub fn typed_module(form: MeshArgumentsForm, rule: MeshGridRule) -> BResult { let mut b = ModuleBuilder::new(); let u32_ = b.ty(Type::Int { width: 32, @@ -320,6 +634,10 @@ pub fn typed_module(rule: MeshGridRule) -> BResult { let scratch = words_buffer(&mut b, SCRATCH, u32_)?; let status = words_buffer(&mut b, STATUS, u32_)?; let residual = b.push_member(RESIDUAL, u32_, 0)?; + let packed = match form { + MeshArgumentsForm::Mesh | MeshArgumentsForm::Object => None, + MeshArgumentsForm::FoldedObject => Some(b.push_member(PACKED_THREADS, u32_, 4)?), + }; let push = b.push_global()?; let void = b.ty(Type::Void)?; let mut f = b.function(void)?; @@ -343,21 +661,16 @@ pub fn typed_module(rule: MeshGridRule) -> BResult { let loaded = f.load(p, MemAccess::default())?; *out = f.select(inb, loaded, zero)?; } - let metal = match rule.metal { - Some(limits) => grid_within(&mut f, v, limits)?, - None => truth(&mut f)?, - }; - let device = grid_within(&mut f, v, rule.device)?; - let drawn = f.binary(BinOp::LogicalAnd, metal, device)?; let scratch_value = f.module().global_value(scratch)?; - for (axis, c) in v.into_iter().enumerate() { - let i = u32_value(&mut f, axis as u32)?; - let count = f.select(drawn, c, zero)?; - let out = f.access_chain(scratch_value, &[zero, i])?; - f.store(out, count, MemAccess::default())?; - } - // Metal draws the grid, and the device's first stage cannot launch it. - let past = f.binary(BinOp::LogicalNotEqual, metal, drawn)?; + let past = match packed { + None => mesh_counts(&mut f, rule, v, scratch_value)?, + Some(packed) => { + let member = u32_value(&mut f, packed.index)?; + let p = f.access_chain(push_value, &[member])?; + let packed = f.load(p, MemAccess::default())?; + object_fold(&mut f, u32_, rule.device, (v, packed), scratch_value)? + } + }; let status_value = f.module().global_value(status)?; let word = u32_value(&mut f, StatusWord::Status.index())?; let bit = u32_value(&mut f, StatusBits::MESH_GRID_PAST_LIMITS.0)?; @@ -397,7 +710,7 @@ pub fn mesh_arguments_module( ) -> Result { let profile = device.profile(); let rule = MeshGridRule::of(form, &profile.fields().limits.mesh); - let m = typed_module(rule)?; + let m = typed_module(form, rule)?; let mut meter = Meter::new(&Budget::default()); crate::spirv::verify::verify(&m, profile, &mut meter)?; let r = crate::spirv::serialize::serialize(m)?; diff --git a/crates/metal2vulkan/src/bind/mesh_arguments/tests.rs b/crates/metal2vulkan/src/bind/mesh_arguments/tests.rs index 07c32270c..9d9a172af 100644 --- a/crates/metal2vulkan/src/bind/mesh_arguments/tests.rs +++ b/crates/metal2vulkan/src/bind/mesh_arguments/tests.rs @@ -1,6 +1,7 @@ -//! The mesh arguments module: valid on every committed profile with `VK_EXT_mesh_shader`, and -//! Metal's rule on the CPU interpreter (copied, zeroed, and zeroed with `MESH_GRID_PAST_LIMITS`), -//! including the source residual and a short range. +//! The mesh arguments module: valid on every committed profile with `VK_EXT_mesh_shader`, Metal's +//! rule on the CPU interpreter (copied, zeroed, and zeroed with `MESH_GRID_PAST_LIMITS`), including +//! the source residual and a short range, the unfolded object form's, and the folded object form's +//! fold, word for word the CPU's (`fold_object_grid`). use super::*; use crate::bind::status::{ExecutionStatus, StatusReport}; @@ -8,6 +9,10 @@ use crate::device::VkExtension; use crate::spirv::interp::{run, Buffer, Config, Order, Resources}; use crate::spirv::testing::{assert_valid, committed_profiles}; +fn words_bytes(words: &[u32]) -> Vec { + words.iter().flat_map(|w| w.to_le_bytes()).collect() +} + fn words(bytes: &[u8]) -> Vec { bytes .as_chunks::<4>() @@ -17,10 +22,16 @@ fn words(bytes: &[u8]) -> Vec { .collect() } -/// Run the module of `rule` over `source` (bound whole) with push `residual`: the scratch's -/// counts and the status report. -fn pass(rule: MeshGridRule, source: &[u32], residual: u32) -> ([u32; 3], StatusReport) { - let m = typed_module(rule).expect("module"); +/// Run the module of `form` and `rule` over `source` (bound whole) with push `residual` and +/// `packed`: the scratch's words and the status report. +fn run_pass( + form: MeshArgumentsForm, + rule: MeshGridRule, + source: &[u32], + (residual, packed): (u32, u32), +) -> (Vec, StatusReport) { + let m = typed_module(form, rule).expect("module"); + let bytes = MeshArguments::scratch_bytes(form) as usize; let mut out = Vec::new(); for order in [Order::Forward, Order::Reverse] { let res = Resources { @@ -33,7 +44,7 @@ fn pass(rule: MeshGridRule, source: &[u32], residual: u32) -> ([u32; 3], StatusR Buffer { slot: Some(SCRATCH), address: None, - bytes: vec![0xEE; 16], + bytes: vec![0xEE; bytes + 4], }, Buffer { slot: Some(STATUS), @@ -41,7 +52,10 @@ fn pass(rule: MeshGridRule, source: &[u32], residual: u32) -> ([u32; 3], StatusR bytes: ExecutionStatus::initial().to_vec(), }, ], - push: residual.to_le_bytes().to_vec(), + push: [residual, packed] + .iter() + .flat_map(|w| w.to_le_bytes()) + .collect(), spec: Default::default(), }; let cfg = Config { @@ -53,14 +67,24 @@ fn pass(rule: MeshGridRule, source: &[u32], residual: u32) -> ([u32; 3], StatusR assert_eq!(out[0], out[1], "order independent"); let b = &out[0]; let scratch = words(&b[1]); - assert_eq!(scratch[3], 0xEEEE_EEEE, "the pass writes 12 bytes only"); + assert_eq!( + scratch[bytes / 4], + 0xEEEE_EEEE, + "the pass writes its scratch only" + ); let status: [u8; 32] = b[2].as_slice().try_into().expect("status"); ( - [scratch[0], scratch[1], scratch[2]], + scratch[..bytes / 4].to_vec(), ExecutionStatus::decode(&status), ) } +/// The mesh form's pass: the command and the status report. +fn pass(rule: MeshGridRule, source: &[u32], residual: u32) -> ([u32; 3], StatusReport) { + let (scratch, report) = run_pass(MeshArgumentsForm::Mesh, rule, source, (residual, 0)); + ([scratch[0], scratch[1], scratch[2]], report) +} + /// RADV's mesh and task limits on the Radeon 780M. fn radv() -> crate::device::MeshLimits { crate::device::MeshLimits { @@ -72,6 +96,15 @@ fn radv() -> crate::device::MeshLimits { } } +/// RADV's task limits on the Radeon 780M. +fn radv_task() -> MeshGridLimits { + let l = radv(); + MeshGridLimits { + axes: l.max_task_work_group_count, + total: l.max_task_work_group_total_count, + } +} + #[test] fn the_module_is_valid_on_every_committed_profile_with_mesh_shading() { for (name, p) in committed_profiles().expect("profiles") { @@ -83,7 +116,11 @@ fn the_module_is_valid_on_every_committed_profile_with_mesh_shading() { { continue; } - for form in [MeshArgumentsForm::Mesh, MeshArgumentsForm::Object] { + for form in [ + MeshArgumentsForm::Mesh, + MeshArgumentsForm::Object, + MeshArgumentsForm::FoldedObject, + ] { let rule = MeshGridRule::of(form, &p.fields().limits.mesh); // Every such profile launches each mesh grid Metal draws. if form == MeshArgumentsForm::Mesh { @@ -93,7 +130,7 @@ fn the_module_is_valid_on_every_committed_profile_with_mesh_shading() { "{name}: {rule:?}" ); } - assert_valid(typed_module(rule).expect("module"), &p); + assert_valid(typed_module(form, rule).expect("module"), &p); } } } @@ -128,10 +165,10 @@ fn a_mesh_grid_draws_as_metal_s() { } } -/// An object grid Metal draws at every count: copied within the task limits, else zeroed and -/// reported. +/// An object grid on a device that does not fold object grids: copied within the task limits, +/// else zeroed and reported. #[test] -fn an_object_grid_past_the_task_limits_is_reported() { +fn an_unfolded_object_grid_past_the_task_limits_is_reported() { let rule = MeshGridRule::of(MeshArgumentsForm::Object, &radv()); for (counts, within) in [ ([3, 1, 1], true), @@ -142,13 +179,196 @@ fn an_object_grid_past_the_task_limits_is_reported() { ([2048, 2049, 1], false), ([u32::MAX, 2, 1], false), ] { - let (out, report) = pass(rule, &counts, 0); + let (scratch, report) = run_pass(MeshArgumentsForm::Object, rule, &counts, (0, 0)); let want = if within { counts } else { [0; 3] }; - assert_eq!(out, want, "{counts:?}"); + assert_eq!(scratch, want, "{counts:?}"); assert_eq!(report.mesh_grid_past_limits, !within, "{counts:?}"); } } +/// The folded object form's scratch for the fold: the record, the count, and `OBJECT_PIECES` commands of +/// the piece's dispatch (zero where nothing runs). +fn object_scratch(fold: &ObjectFold) -> Vec { + let mut out = fold.record.to_vec(); + out.push(fold.pieces); + let command = if fold.pieces == 0 { + [0; 3] + } else { + fold.dispatch + }; + for _ in 0..MeshArguments::OBJECT_PIECES { + out.extend(command); + } + out +} + +/// Every piece's threadgroups are Metal's in order, each once: piece `p`'s workgroup `w` is Metal's +/// threadgroup `p · nx · ny + w`, and the pieces cover the grid. +fn covers(fold: &ObjectFold, counts: [u32; 3]) -> bool { + let n: u64 = counts.iter().map(|&c| u64::from(c)).product(); + let piece = u64::from(fold.dispatch[0]) * u64::from(fold.dispatch[1]); + u64::from(fold.pieces) * piece >= n && u64::from(fold.pieces.saturating_sub(1)) * piece < n +} + +/// Metal's object grids, as the M3 Max ran the owned fixture `mesh_object_grid` (macOS 27.0.1): +/// threads per grid wrap to 32 bits along each axis; an indirect draw runs every threadgroup, a +/// direct one those the wrapped threads fill, rounded up. +#[test] +fn metal_s_object_grid_wraps_its_threads_per_grid() { + for (groups, threads, direct, runs, reported) in [ + ( + [70_000, 1, 1], + [1, 1, 1], + true, + [70_000, 1, 1], + [70_000, 1, 1], + ), + ( + [300, 300, 2], + [4, 2, 1], + true, + [300, 300, 2], + [1200, 600, 2], + ), + ( + [4_194_303, 1, 1], + [1024, 1, 1], + true, + [4_194_303, 1, 1], + [4_294_966_272, 1, 1], + ), + ([4_194_304, 1, 1], [1024, 1, 1], true, [0, 1, 1], [0, 1, 1]), + ( + [4_194_304, 1, 1], + [1024, 1, 1], + false, + [4_194_304, 1, 1], + [0, 1, 1], + ), + ( + [4_194_305, 1, 1], + [1024, 1, 1], + true, + [1, 1, 1], + [1024, 1, 1], + ), + ( + [4_194_305, 1, 1], + [1024, 1, 1], + false, + [4_194_305, 1, 1], + [1024, 1, 1], + ), + ( + [4_294_968, 1, 1], + [1000, 1, 1], + true, + [1, 1, 1], + [704, 1, 1], + ), + ( + [4_294_970, 1, 1], + [1000, 1, 1], + true, + [3, 1, 1], + [2704, 1, 1], + ), + ( + [4_294_970, 1, 1], + [1000, 1, 1], + false, + [4_294_970, 1, 1], + [2704, 1, 1], + ), + ( + [2, 4_194_305, 1], + [1, 1024, 1], + true, + [2, 1, 1], + [2, 1024, 1], + ), + ( + [65536, 64, 1], + [1024, 1, 1], + true, + [65536, 64, 1], + [67_108_864, 64, 1], + ), + ] { + assert_eq!( + metal_object_grid(groups, threads, direct), + Some((runs, reported)), + "{groups:?} of {threads:?}, direct {direct}" + ); + } + assert_eq!(metal_object_grid([3, 1, 1], [0, 1, 1], true), None); +} + +/// The folded object form folds any grid it runs within the task stage's limits, in the pieces that +/// cover it, word for word as the CPU's fold of an indirect draw (and a direct draw's upload is +/// the scratch through its pieces), and draws nothing for a zero count or a grid past what it runs +/// (setting `MESH_GRID_PAST_LIMITS` for the latter). +#[test] +fn an_object_grid_folds_within_the_task_limits_as_the_cpu_does() { + let nvidia = MeshGridLimits { + axes: [4_194_304, 65535, 65535], + total: 4_194_304, + }; + let small = MeshGridLimits { + axes: [100, 100, 100], + total: 5000, + }; + for (task, counts, threads, runs) in [ + (radv_task(), [3, 1, 1], [1, 1, 1], true), + (radv_task(), [65535, 64, 1], [32, 1, 1], true), + (radv_task(), [70_000, 1, 1], [1, 1, 1], true), + (radv_task(), [2048, 2049, 1], [2, 2, 1], true), + (radv_task(), [1 << 24, 1, 1], [1, 1, 1], true), + (radv_task(), [65536, 4096, 1], [1, 1, 1], true), + (radv_task(), [7, 9, 11], [4, 4, 4], true), + (radv_task(), [1 << 23, 1, 1], [1024, 1, 1], true), + (radv_task(), [4_294_970, 1, 1], [1000, 1, 1], true), + (nvidia, [70_000, 3, 1], [1, 1, 1], true), + (nvidia, [1 << 24, 4, 1], [1, 1, 1], true), + (small, [600_000, 1, 1], [1, 1, 1], true), + (radv_task(), [0, 70_000, 1], [1, 1, 1], false), + (radv_task(), [65536, 8192, 1], [1, 1, 1], false), + (radv_task(), [u32::MAX, 2, 1], [1, 1, 1], false), + (radv_task(), [1 << 29, 1, 1], [1, 1, 1], false), + (small, [700_000, 1, 1], [1, 1, 1], false), + ] { + let rule = MeshGridRule { + metal: None, + device: task, + }; + let packed = crate::lower::dispatch::pack_nominal(threads).expect("packs"); + let fold = fold_object_grid(counts, threads, task, false).expect("fold"); + let what = format!("{counts:?} of {threads:?} on {task:?}: {fold:?}"); + assert_eq!(fold.pieces > 0, runs, "{what}"); + assert_eq!(fold.past, !runs && !counts.contains(&0), "{what}"); + if runs { + let [nx, ny, nz] = fold.dispatch; + assert!( + nx <= task.axes[0] && ny <= task.axes[1] && nz == 1, + "{what}" + ); + assert!(nx * ny <= task.total, "{what}"); + assert!(fold.pieces <= MeshArguments::OBJECT_PIECES, "{what}"); + assert!(covers(&fold, counts), "{what}"); + let per_grid: Vec = (0..3).map(|i| counts[i].wrapping_mul(threads[i])).collect(); + assert_eq!(fold.record[..3], counts[..], "{what}"); + assert_eq!(fold.record[4..7], per_grid[..], "{what}"); + } + assert_eq!(fold.record[3], packed, "{what}"); + let (scratch, report) = + run_pass(MeshArgumentsForm::FoldedObject, rule, &counts, (0, packed)); + assert_eq!(scratch, object_scratch(&fold), "{what}"); + let upload = 4 * (9 + 3 * fold.pieces as usize); + assert_eq!(fold.bytes(), words_bytes(&scratch)[..upload], "{what}"); + assert_eq!(report.mesh_grid_past_limits, fold.past, "{what}"); + } +} + #[test] fn the_residual_selects_the_arguments_and_a_short_range_reads_zero() { let rule = MeshGridRule::of(MeshArgumentsForm::Mesh, &radv()); @@ -162,10 +382,23 @@ fn the_residual_selects_the_arguments_and_a_short_range_reads_zero() { #[test] fn the_pass_binds_an_aligned_source_range() { let form = MeshArgumentsForm::Mesh; - let a = MeshArguments::new(IndirectRef::new(3, 300), form, 256).expect("pass"); + let a = MeshArguments::new(IndirectRef::new(3, 300), form, 256, [1; 3]).expect("pass"); assert_eq!((a.source_range.offset, a.source_range.range), (256, 56)); - assert_eq!(u32::from_le_bytes(a.push_constants), 44); - let a = MeshArguments::new(IndirectRef::new(3, 12), form, 1).expect("pass"); + assert_eq!(a.push_constants, [44, 0, 0, 0, 0, 0, 0, 0]); + let a = MeshArguments::new(IndirectRef::new(3, 12), form, 1, [1; 3]).expect("pass"); assert_eq!((a.source_range.offset, a.source_range.range), (12, 12)); - assert_eq!(MeshArguments::new(IndirectRef::new(3, 2), form, 4), None); + assert_eq!( + MeshArguments::new(IndirectRef::new(3, 2), form, 4, [1; 3]), + None + ); + let object = MeshArgumentsForm::Object; + let a = MeshArguments::new(IndirectRef::new(3, 8), object, 4, [32, 2, 1]).expect("pass"); + assert_eq!(a.push_constants, [0; 8]); + let folded = MeshArgumentsForm::FoldedObject; + let a = MeshArguments::new(IndirectRef::new(3, 8), folded, 4, [32, 2, 1]).expect("pass"); + assert_eq!(a.push_constants, [0, 0, 0, 0, 31, 4, 0, 0]); + assert_eq!( + MeshArguments::new(IndirectRef::new(3, 8), folded, 4, [0; 3]), + None + ); } diff --git a/crates/metal2vulkan/src/bind/mod.rs b/crates/metal2vulkan/src/bind/mod.rs index 56287cfc6..41d3d20a4 100644 --- a/crates/metal2vulkan/src/bind/mod.rs +++ b/crates/metal2vulkan/src/bind/mod.rs @@ -245,8 +245,9 @@ pub use instantiate::{ PushConstantWrite, PushHole, ResidentRange, ResidentSet, RootTable, }; pub use mesh_arguments::{ - mesh_arguments_module, MeshArguments, MeshArgumentsForm, MeshArgumentsModule, MeshGridLimits, - MeshGridRule, METAL_MESH_GRID_AXIS, METAL_MESH_GRID_TOTAL, + fold_object_grid, mesh_arguments_module, metal_object_grid, MeshArguments, MeshArgumentsForm, + MeshArgumentsModule, MeshGridLimits, MeshGridRule, ObjectFold, METAL_MESH_GRID_AXIS, + METAL_MESH_GRID_TOTAL, METAL_OBJECT_GRID_TOTAL, }; pub use mesh_scan::{mesh_scan_module, MeshScanModule}; pub use mipmap_filter::{ diff --git a/crates/metal2vulkan/src/bind/plan.rs b/crates/metal2vulkan/src/bind/plan.rs index f9e0836bb..d1a01425d 100644 --- a/crates/metal2vulkan/src/bind/plan.rs +++ b/crates/metal2vulkan/src/bind/plan.rs @@ -260,6 +260,11 @@ pub(crate) struct MeshTemplate { pub mesh: GroupLimits, /// The task stage's limits (`maxTaskWorkGroup*`), of a pipeline with an object function. pub object: Option, + /// The object function is compiled folded (`RuntimeFact::FoldedGroups`, + /// `lower::mesh::folds_object_grids`): each draw runs its object grid in pieces within the task + /// stage's limits (`bind::mesh_arguments`). + #[cfg_attr(feature = "serde", serde(default))] + pub folded: bool, /// An emulated mesh function's records: each draw dispatches its mesh threadgroups and /// draws their primitives (`DrawCommands::mesh_dispatch`). #[cfg_attr(feature = "serde", serde(default))] diff --git a/crates/metal2vulkan/src/bind/status.rs b/crates/metal2vulkan/src/bind/status.rs index c13436ba6..94f967e33 100644 --- a/crates/metal2vulkan/src/bind/status.rs +++ b/crates/metal2vulkan/src/bind/status.rs @@ -117,8 +117,8 @@ pub struct StatusReport { /// capture settle took every tile of the pass's mask (`bind::CaptureSettleModule`): the /// pass's reach is the announced fallback, not its draws' tiles. pub captured_reach_unmeasured: bool, - /// An indirect mesh draw's arguments pass met a grid Metal draws past the device's limits - /// for the draw's first stage (`bind::MeshArguments`): that draw drew nothing. + /// An indirect mesh draw's arguments pass met an object grid past what runs + /// (`StatusBits::MESH_GRID_PAST_LIMITS`): that draw drew nothing. pub mesh_grid_past_limits: bool, } @@ -243,8 +243,9 @@ impl StatusBits { /// nothing (`bind::TessellationScanModule`); the fault words name the command buffer's first /// records fault of either kind. pub const TESSELLATION_RECORDS_OVERFLOW: StatusBits = StatusBits(1 << 8); - /// An indirect mesh draw's arguments pass met an object grid Metal draws past the device's - /// task limits, and the draw drew nothing (`bind::MeshArguments`). + /// An indirect mesh draw's arguments pass met an object grid past what runs (2^29 or more + /// threadgroups, or, unfolded, past the device's task limits), and the draw drew nothing + /// (`bind::MeshArguments`). pub const MESH_GRID_PAST_LIMITS: StatusBits = StatusBits(1 << 9); /// Either records fault: the command buffer's first one of either kind writes the fault /// words. diff --git a/crates/metal2vulkan/src/cache/codec.rs b/crates/metal2vulkan/src/cache/codec.rs index e5d8608e7..845b4162f 100644 --- a/crates/metal2vulkan/src/cache/codec.rs +++ b/crates/metal2vulkan/src/cache/codec.rs @@ -930,7 +930,7 @@ codec_enum! { ShaderTessellationAndGeometryPointSize, MultiviewGeometryShader, AttachmentFeedbackLoopLayout, ExtendedDynamicState3ColorWriteMask, ShaderFmaFloat16, - ProvokingVertexLast, LogicOp, + ProvokingVertexLast, LogicOp, DrawIndirectCount, } VkExtension { ExtRobustness2, ExtImageRobustness, ExtShaderAtomicFloat, ExtShaderAtomicFloat2, diff --git a/crates/metal2vulkan/src/cache/mod.rs b/crates/metal2vulkan/src/cache/mod.rs index 751caf164..0eca00167 100644 --- a/crates/metal2vulkan/src/cache/mod.rs +++ b/crates/metal2vulkan/src/cache/mod.rs @@ -60,7 +60,7 @@ mod tests; /// unchanged version, and its bless records the version. Independent of the crate's version and of /// [`ARTIFACT_FORMAT_VERSION`]. The commit that bumps it says what changed; this comment keeps no /// history. -pub const SEMANTICS_VERSION: u32 = 1815; +pub const SEMANTICS_VERSION: u32 = 1816; /// The byte-layout version of encoded artifacts (`CompiledFunction::to_bytes` and the /// [`PipelineArtifact`] encodings). Every encoded artifact carries it, and a decode under another @@ -70,7 +70,7 @@ pub const SEMANTICS_VERSION: u32 = 1815; /// re-typed in an encoded type, its `codec` body or its `envelope`. A variant removed while its tag /// stays unused needs no bump: an entry holding it fails to decode, which is a miss. The commit that /// bumps it says what changed; this comment keeps no history. -pub const ARTIFACT_FORMAT_VERSION: u32 = 440; +pub const ARTIFACT_FORMAT_VERSION: u32 = 441; /// The version of what this crate's runtime does with a compiled pipeline: instantiating a binding /// plan (`BindingPlan::instantiate_*`: descriptor ranges, push bytes, root, argument, and handle @@ -93,7 +93,7 @@ pub const ARTIFACT_FORMAT_VERSION: u32 = 440; /// changes no behaviour, and then updates that hash alone with the commit saying why, or changes /// behaviour and also bumps this version. The commit that bumps it says what changed; this comment /// keeps no history. -pub const RUNTIME_VERSION: u32 = 1508; +pub const RUNTIME_VERSION: u32 = 1509; /// The digest of the sources this build of the crate was compiled from: SHA-256, as lowercase hex, /// of the manifest, the build script, and exactly the files the crate roots' module tree compiles diff --git a/crates/metal2vulkan/src/device/enables.rs b/crates/metal2vulkan/src/device/enables.rs index 80ce218be..bb6a307a9 100644 --- a/crates/metal2vulkan/src/device/enables.rs +++ b/crates/metal2vulkan/src/device/enables.rs @@ -226,7 +226,7 @@ exposures! { DescriptorBindingStorageBufferUpdateAfterBind, DescriptorBindingUniformTexelBufferUpdateAfterBind, DescriptorBindingStorageTexelBufferUpdateAfterBind, - DescriptorBindingUpdateUnusedWhilePending, + DescriptorBindingUpdateUnusedWhilePending, DrawIndirectCount, ShaderSampledImageArrayNonUniformIndexing, ShaderStorageImageArrayNonUniformIndexing, ShaderStorageBufferArrayNonUniformIndexing, ShaderUniformTexelBufferArrayNonUniformIndexing, diff --git a/crates/metal2vulkan/src/device/khronos.rs b/crates/metal2vulkan/src/device/khronos.rs index 08dc4b828..540ef501b 100644 --- a/crates/metal2vulkan/src/device/khronos.rs +++ b/crates/metal2vulkan/src/device/khronos.rs @@ -1444,6 +1444,7 @@ pub(super) const FEATURE_MEMBERS: &[(&str, VkFeature)] = { ("shaderResourceResidency", F::ShaderResourceResidency), ("samplerAnisotropy", F::SamplerAnisotropy), ("samplerFilterMinmax", F::SamplerFilterMinmax), + ("drawIndirectCount", F::DrawIndirectCount), ("samplerMirrorClampToEdge", F::SamplerMirrorClampToEdge), ( "shaderStorageImageMultisample", diff --git a/crates/metal2vulkan/src/device/requirements.rs b/crates/metal2vulkan/src/device/requirements.rs index c56133073..382d67624 100644 --- a/crates/metal2vulkan/src/device/requirements.rs +++ b/crates/metal2vulkan/src/device/requirements.rs @@ -91,6 +91,9 @@ pub enum VkFeature { VertexAttributeInstanceRateZeroDivisor, DrawIndirectFirstInstance, MultiDrawIndirect, + /// `drawIndirectCount` (Vulkan 1.2, or `VK_KHR_draw_indirect_count`): an indirect draw whose + /// draw count is GPU data (an indirect object mesh draw's pieces, `bind::mesh_arguments`). + DrawIndirectCount, DepthClamp, FillModeNonSolid, // Images and samplers. diff --git a/crates/metal2vulkan/src/lower/access/mod.rs b/crates/metal2vulkan/src/lower/access/mod.rs index 369a518b7..313c7d4c4 100644 --- a/crates/metal2vulkan/src/lower/access/mod.rs +++ b/crates/metal2vulkan/src/lower/access/mod.rs @@ -1520,8 +1520,9 @@ fn place_slots(cx: &mut SelectCx<'_>, m: &mut Meter) -> Result, sources: &[SlotRef]) -> Result<(), Error> // the slot table, which no fetch of a vertex descriptor reads. use crate::pipeline::sym::Stage; let drawn = cx.inputs.replay_bindings && matches!(cx.stage, Stage::Vertex | Stage::Fragment); + // A folded object function: its draw's pieces fold Metal's object grid + // (`bind::mesh_arguments`). + let pieces = cx.inputs.folded_groups && cx.stage == Stage::Object; let fetches = cx .inputs .vertex_fetch .as_ref() .is_some_and(|f| !f.attributes.is_empty()); - if (cx.stage != Stage::Kernel && !drawn) + if (cx.stage != Stage::Kernel && !drawn && !pieces) || fetches || !sources.is_empty() || cx.inputs.stage_input.is_some() diff --git a/crates/metal2vulkan/src/lower/dispatch.rs b/crates/metal2vulkan/src/lower/dispatch.rs index 64ecb6229..3193ba940 100644 --- a/crates/metal2vulkan/src/lower/dispatch.rs +++ b/crates/metal2vulkan/src/lower/dispatch.rs @@ -390,6 +390,10 @@ pub struct DispatchPlan { pub keys: DispatchKeys, /// The kernel folds Metal's group counts into its dispatch (`LoweringInputs::folded_groups`). pub folded_groups: bool, + /// A folded object function: its draw's pieces each run `nx · ny · nz` of Metal's + /// threadgroups, so its threadgroup's number adds `DrawIndex · nx · ny · nz` + /// ([`KernelDecl::folded`]). + pub draw_pieces: bool, /// The kernel's threadgroup position and grid are what its entry wrapper computes, not its /// dispatch's: an emulated mesh function under an object function, whose flat dispatch runs /// every object threadgroup's mesh grid ([`WrapperGroups`]). @@ -556,6 +560,7 @@ pub fn plan_kernel(cx: &mut SelectCx<'_>, tier: Tier) -> Result, uvec3: TypeId, /// `sx, sy, sz`. size: [ConstId; 3], @@ -959,6 +966,7 @@ impl KernelDecl { tile_sized: dp.tile_sized, flat_grid: dp.flat_grid, folded_groups: dp.folded_groups, + draw_index: var(dp.draw_pieces, B::DrawIndex, u32_)?, uvec3, size, multi_region, @@ -1288,9 +1296,13 @@ impl KernelDecl { /// A folded variant's threadgroup position in the Metal grid (a `uvec3`) and whether its /// workgroup is one of Metal's threadgroups: the workgroup's index `(wz · ny + wy) · nx + wx` - /// over the dispatch, counted over Metal's group counts `threads_per_grid / (sx, sy, sz)` - /// (`region[1].xyz`) `x` fastest, all in 64 bits. Every value it reads is the workgroup's, so - /// the whole workgroup is inside or past. Inside the grid each axis's position is below its + /// over the dispatch (plus `DrawIndex · nx · ny · nz` for a folded object function, whose + /// draw's pieces each run that many), counted over Metal's group counts `x` fastest, all in 64 + /// bits. A kernel's counts are `threads_per_grid / (sx, sy, sz)` (`region[1].xyz`); a folded + /// object function's are the record's base words (`region[0].xyz`, which no folded variant + /// reads as a base), since its threads per grid are Metal's, wrapped to 32 bits + /// (`bind::metal_object_grid`). Every value it reads is the workgroup's, so the whole workgroup + /// is inside or past. Inside the grid each axis's position is below its /// count, so it fits its `u32`; past it the position is unused. A count of zero runs no /// workgroup (the preprocess writes a zero dispatch), so no running invocation divides by it. fn folded( @@ -1313,12 +1325,30 @@ impl KernelDecl { let index = fb.binary(BinOp::IMul, wz, ny)?; let index = fb.binary(BinOp::IAdd, index, wy)?; let index = fb.binary(BinOp::IMul, index, nx)?; - let index = fb.binary(BinOp::IAdd, index, wx)?; + let mut index = fb.binary(BinOp::IAdd, index, wx)?; + if let Some(draw) = self.draw_index { + let piece = fb.module().global_value(draw)?; + let piece = fb.load(piece, MemAccess::default())?; + let piece = fb.convert(ConvOp::UConvert, piece, u64_)?; + let nz = wide(fb, dispatched, 2)?; + let size = fb.binary(BinOp::IMul, nx, ny)?; + let size = fb.binary(BinOp::IMul, size, nz)?; + let first = fb.binary(BinOp::IMul, piece, size)?; + index = fb.binary(BinOp::IAdd, index, first)?; + } let r = region(fb)?; - let threads = fb.composite_extract(r, &[1])?; - let threads = fb.vector_shuffle(threads, threads, &[0, 1, 2])?; - let s = self.size3(fb)?; - let counts = fb.binary(BinOp::UDiv, threads, s)?; + let counts = match self.draw_index { + Some(_) => { + let runs = fb.composite_extract(r, &[0])?; + fb.vector_shuffle(runs, runs, &[0, 1, 2])? + } + None => { + let threads = fb.composite_extract(r, &[1])?; + let threads = fb.vector_shuffle(threads, threads, &[0, 1, 2])?; + let s = self.size3(fb)?; + fb.binary(BinOp::UDiv, threads, s)? + } + }; let [cx, cy, cz] = [ wide(fb, counts, 0)?, wide(fb, counts, 1)?, diff --git a/crates/metal2vulkan/src/lower/dispatch/tests.rs b/crates/metal2vulkan/src/lower/dispatch/tests.rs index 18e7035f4..dcc2f57d1 100644 --- a/crates/metal2vulkan/src/lower/dispatch/tests.rs +++ b/crates/metal2vulkan/src/lower/dispatch/tests.rs @@ -33,6 +33,7 @@ fn plan(form: LocalSizeForm, multi_region: bool) -> DispatchPlan { flat_grid: false, keys: SpecKey::dispatch_keys(Stage::Kernel), folded_groups: false, + draw_pieces: false, wrapper_groups: false, } } diff --git a/crates/metal2vulkan/src/lower/mesh/mod.rs b/crates/metal2vulkan/src/lower/mesh/mod.rs index a3232a0f8..bbc6b8c0d 100644 --- a/crates/metal2vulkan/src/lower/mesh/mod.rs +++ b/crates/metal2vulkan/src/lower/mesh/mod.rs @@ -396,6 +396,21 @@ pub fn emulates(p: &DeviceProfile) -> bool { || !enabled.features.contains(&VkFeature::MeshShader) } +/// Whether profile `p` compiles an object function folded (`LoweringInputs::folded_groups`), so +/// that its draws run any object grid Metal runs in pieces within the task stage's limits +/// (`bind::mesh_arguments`): it runs mesh functions natively, and has device addresses (the +/// region record), 64-bit integers (the threadgroup's number), `multiDrawIndirect` (a direct draw's +/// pieces, and `maxDrawIndirectCount` at least 65,535) and `drawIndirectCount` (an indirect +/// draw's). +pub fn folds_object_grids(p: &DeviceProfile) -> bool { + let features = &p.enabled().features; + !emulates(p) + && p.fields().buffer_access == crate::device::profile::BufferAccess::Addressed + && features.contains(&VkFeature::ShaderInt64) + && features.contains(&VkFeature::MultiDrawIndirect) + && features.contains(&VkFeature::DrawIndirectCount) +} + /// The bytes of the entry's payload (`air.payload`'s `air.arg_type_size`), if it has one. pub fn payload_size(e: &Entry) -> Option { e.ep.params.iter().find_map(|b| match b.role { diff --git a/crates/metal2vulkan/src/pipeline/api_tests.rs b/crates/metal2vulkan/src/pipeline/api_tests.rs index 79ba28d09..8f2c2f979 100644 --- a/crates/metal2vulkan/src/pipeline/api_tests.rs +++ b/crates/metal2vulkan/src/pipeline/api_tests.rs @@ -1278,6 +1278,7 @@ mod bind_serde_round_trips { }, indirect_needs_arguments: false, mesh_arguments: None, + object_fold: None, index_bounds_pass: false, extents: Vec::new(), push_holes: Vec::new(), @@ -1347,5 +1348,11 @@ mod bind_serde_round_trips { draw_count: 1, stride: 12, }); + round_trip(&vk::DrawCommand::DrawMeshTasksIndirectCount { + offset: 36, + count_offset: 32, + max_draw_count: 128, + stride: 12, + }); } } diff --git a/crates/metal2vulkan/src/pipeline/compile/api.rs b/crates/metal2vulkan/src/pipeline/compile/api.rs index 726f09ae6..274ce6a92 100644 --- a/crates/metal2vulkan/src/pipeline/compile/api.rs +++ b/crates/metal2vulkan/src/pipeline/compile/api.rs @@ -500,7 +500,10 @@ impl Device { let p = self.profile(); let object = match &d.object { Some(o) => { - let inputs = v.lowering_inputs(Stage::Object); + // An object function on a device that folds its grids runs any object grid in + // pieces within the task stage's limits (`bind::mesh_arguments`). + let mut inputs = v.lowering_inputs(Stage::Object); + inputs.folded_groups = crate::lower::mesh::folds_object_grids(p); Some(self.stage(o, InputsFrom::Given(&inputs), m)?) } None => None, diff --git a/crates/metal2vulkan/src/spirv/requirements/mod.rs b/crates/metal2vulkan/src/spirv/requirements/mod.rs index 023141838..564b814f4 100644 --- a/crates/metal2vulkan/src/spirv/requirements/mod.rs +++ b/crates/metal2vulkan/src/spirv/requirements/mod.rs @@ -756,6 +756,11 @@ impl Deriver<'_> { _ => {} } } + // A task or mesh entry's `DrawIndex` is enabled by `MeshShadingEXT` (as the grammar lists + // it), which the entry declared: it needs no `DrawParameters`. + if b == B::DrawIndex && matches!(self.model, ExecModel::TaskEXT | ExecModel::MeshEXT) { + return Ok(()); + } // A geometry stage's point size, input or output, is `GeometryPointSize`'s. if b == B::PointSize && self.model == ExecModel::Geometry { self.cap(Cap::GeometryPointSize); diff --git a/crates/metal2vulkan/src/tests/engine_mesh.rs b/crates/metal2vulkan/src/tests/engine_mesh.rs index f2228f981..2def4b74a 100644 --- a/crates/metal2vulkan/src/tests/engine_mesh.rs +++ b/crates/metal2vulkan/src/tests/engine_mesh.rs @@ -1321,6 +1321,56 @@ fn object_draws(dev: &crate::device::Device, p: &crate::pipeline::RenderPipeline [Some(8), Some(1), Some(1)], "{what}" ); + // Where the device folds object grids, the object function reads its region record, and a + // grid past the task stage's limits runs in pieces (`bind::mesh_arguments`). + let folds = crate::lower::mesh::folds_object_grids(dev.profile()); + assert_eq!( + p.dependencies + .iter() + .any(|d| d.fact == crate::pipeline::facts::RuntimeFact::FoldedGroups), + folds, + "{what}" + ); + if !folds { + return; + } + let hole = |c: &crate::bind::DrawCommands| { + c.push_holes.iter().any(|h| { + matches!(h, crate::bind::PushHole::ReplayRegionAddress { stages, .. } + if *stages == vk::ShaderStageFlags::TASK_EXT) + }) + }; + assert!(hole(&cmds) && cmds.object_fold.is_some(), "{what}"); + let task = dev.profile().fields().limits.mesh.max_task_work_group_count; + let draw = DrawCall::MeshThreadgroups { + groups: [task[0].saturating_add(1), 100, 1], + threads_per_object_group: [4, 1, 1], + threads_per_mesh_group: [8, 1, 1], + }; + let cmds = plan + .instantiate_draw(&state, &draw) + .unwrap_or_else(|e| panic!("{what}: a folded object draw: {e}")); + let fold = cmds.object_fold.expect("a fold"); + assert!( + fold.pieces >= 1 && !fold.past && hole(&cmds), + "{what}: {fold:?}" + ); + let indirect = DrawCall::MeshThreadgroupsIndirect { + indirect: crate::bind::IndirectRef::new(1, 0), + threads_per_object_group: [4, 1, 1], + threads_per_mesh_group: [8, 1, 1], + }; + let cmds = plan + .instantiate_draw(&state, &indirect) + .unwrap_or_else(|e| panic!("{what}: a folded indirect object draw: {e}")); + assert!( + matches!( + cmds.draw, + vk::DrawCommand::DrawMeshTasksIndirectCount { .. } + ) && hole(&cmds), + "{what}: {:?}", + cmds.draw + ); } /// The binder's plan of mesh pipeline `p` on `dev` and its mesh draws: the plan leaves the mesh diff --git a/crates/metal2vulkan/src/vk/draw.rs b/crates/metal2vulkan/src/vk/draw.rs index c701c3f6f..8fc0af07a 100644 --- a/crates/metal2vulkan/src/vk/draw.rs +++ b/crates/metal2vulkan/src/vk/draw.rs @@ -57,4 +57,13 @@ pub enum DrawCommand { draw_count: u32, stride: u32, }, + /// `vkCmdDrawMeshTasksIndirectCountEXT` (`drawIndirectCount`): the draw count is the `u32` at + /// `count_offset`, at most `max_draw_count`, and the commands start at `offset`, both in the + /// buffer the draw names. + DrawMeshTasksIndirectCount { + offset: u64, + count_offset: u64, + max_draw_count: u32, + stride: u32, + }, } diff --git a/crates/metal2vulkan/tests/api_surface.rs b/crates/metal2vulkan/tests/api_surface.rs index f241bd4e6..e28c22a49 100644 --- a/crates/metal2vulkan/tests/api_surface.rs +++ b/crates/metal2vulkan/tests/api_surface.rs @@ -678,6 +678,18 @@ surface! { enum ChromaDecode N; fn mesh_scan_module; struct MeshScanModule N; + fn mesh_arguments_module; + fn fold_object_grid; + fn metal_object_grid; + struct MeshArguments N; + enum MeshArgumentsForm E; + struct MeshArgumentsModule N; + struct MeshGridLimits N; + struct MeshGridRule N; + struct ObjectFold N; + const METAL_MESH_GRID_AXIS; + const METAL_MESH_GRID_TOTAL; + const METAL_OBJECT_GRID_TOTAL; fn tessellation_scan_module; struct TessellationScanKernel N; struct TessellationScanModule N; diff --git a/crates/metal2vulkan/tests/golden_hashes.tsv b/crates/metal2vulkan/tests/golden_hashes.tsv index 88518dc5c..c366afd88 100644 --- a/crates/metal2vulkan/tests/golden_hashes.tsv +++ b/crates/metal2vulkan/tests/golden_hashes.tsv @@ -4,23 +4,23 @@ # A cell is the first 64 bits of SHA-256 over the final SPIR-V of its subject, or its # refusal class. A cell that changes under an unchanged fixture source and profile # fingerprint needs cache::SEMANTICS_VERSION above its value at the last bless. -profile amd-780m-hawkpoint-radv eb7f00b2124f323f -profile amd-780m-radv eb7f00b2124f323f -profile amd-rdna2-apu-radv b5e63d7136d426b4 -profile amd-rdna3-radv 9207aba1ab4bb64b -profile gate-lavapipe fde43fe9fb86d746 -profile gate-lavapipe-x86_64 ae8cc703b7803b19 -profile intel-arl-anv 6abc6b10f2e1f4f2 -profile intel-irisxe-anv a1aaa58cd6c3949e -profile intel-irisxe-rplp-anv bf8d73538abf2ae8 -profile intel-uhd770-rpls-anv bf8d73538abf2ae8 -profile lavapipe 0d932cb2fe16687b +profile amd-780m-hawkpoint-radv 920b7fdaedc8f69f +profile amd-780m-radv 920b7fdaedc8f69f +profile amd-rdna2-apu-radv fc1561d7aa1141f7 +profile amd-rdna3-radv f135572fc356ea1e +profile gate-lavapipe fccdaf8c9e734652 +profile gate-lavapipe-x86_64 d7d0386732bb2328 +profile intel-arl-anv 29d7a19b6a3e4634 +profile intel-irisxe-anv 9058b8b1526ebc68 +profile intel-irisxe-rplp-anv 65a358a805c78409 +profile intel-uhd770-rpls-anv 65a358a805c78409 +profile lavapipe 6198891e231207f3 profile lunarg-desktop-baseline-2023 b37d1d640379db97 profile moltenvk-m3 91696fe993570e70 profile moltenvk-m4 91696fe993570e70 -profile nvidia-pascal-linux afcfd32ddfb9bf55 -profile nvidia-rtx50-linux 072ab14efaacd31d -profile nvidia-rtx5080-laptop 1a3bef5554dbd6f3 +profile nvidia-pascal-linux 19e857f74fd404c7 +profile nvidia-rtx50-linux 106d8169beba8b97 +profile nvidia-rtx5080-laptop 17bc8444081081a3 profile roadmap-2022 12cdcb05db4ae1d0 profile swiftshader bc00a9775e6882b9 profile vk12-floor cb98a973eb06eedb @@ -1124,6 +1124,8 @@ engine/icb_render_replay_template.air.ll 29317c185ddd928f icb_render_replay_temp engine/icb_render_replay_template.ll ca8990a1c89d4a62 icb_render_replay_template d50e118848512d7a d50e118848512d7a d50e118848512d7a d50e118848512d7a d50e118848512d7a d50e118848512d7a 2d4f956fccefabe6 2d4f956fccefabe6 2d4f956fccefabe6 2d4f956fccefabe6 d50e118848512d7a c82fbb3617cd5be1 d50e118848512d7a d50e118848512d7a c82fbb3617cd5be1 2d4f956fccefabe6 2d4f956fccefabe6 Unsupported{StageStoresAndAtomics; AnyOf[[Feature(VertexPipelineStoresAndAtomics)]]} c82fbb3617cd5be1 Unsupported{StageStoresAndAtomics; AnyOf[[Feature(VertexPipelineStoresAndAtomics)]]} engine/icb_render_stride_template.air.ll db4c8dcf8925e454 icb_render_stride_template b684009d608774b8 b684009d608774b8 b684009d608774b8 b684009d608774b8 b684009d608774b8 b684009d608774b8 b684009d608774b8 b684009d608774b8 b684009d608774b8 b684009d608774b8 b684009d608774b8 b684009d608774b8 b684009d608774b8 b684009d608774b8 b684009d608774b8 b684009d608774b8 b684009d608774b8 Unsupported{StageStoresAndAtomics; AnyOf[[Feature(VertexPipelineStoresAndAtomics)]]} b684009d608774b8 Unsupported{StageStoresAndAtomics; AnyOf[[Feature(VertexPipelineStoresAndAtomics)]]} engine/icb_render_stride_template.ll 1b6def77f2d7875e icb_render_stride_template b684009d608774b8 b684009d608774b8 b684009d608774b8 b684009d608774b8 b684009d608774b8 b684009d608774b8 b684009d608774b8 b684009d608774b8 b684009d608774b8 b684009d608774b8 b684009d608774b8 b684009d608774b8 b684009d608774b8 b684009d608774b8 b684009d608774b8 b684009d608774b8 b684009d608774b8 Unsupported{StageStoresAndAtomics; AnyOf[[Feature(VertexPipelineStoresAndAtomics)]]} b684009d608774b8 Unsupported{StageStoresAndAtomics; AnyOf[[Feature(VertexPipelineStoresAndAtomics)]]} +engine/icb_render_typed_encode.air.ll 07adcc4db60fb727 icb_render_typed_encode 5359e33f320e4407 5359e33f320e4407 5359e33f320e4407 5359e33f320e4407 5359e33f320e4407 5359e33f320e4407 5359e33f320e4407 5359e33f320e4407 5359e33f320e4407 5359e33f320e4407 5359e33f320e4407 Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(BufferDeviceAddress), Feature(ShaderInt64)]]} 5359e33f320e4407 5359e33f320e4407 5359e33f320e4407 5359e33f320e4407 5359e33f320e4407 Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(ShaderInt64)]]} Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(ShaderInt64)]]} Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(BufferDeviceAddress), Feature(ShaderInt64)]]} +engine/icb_render_typed_encode.ll 7f604baa4070d8fa icb_render_typed_encode 5359e33f320e4407 5359e33f320e4407 5359e33f320e4407 5359e33f320e4407 5359e33f320e4407 5359e33f320e4407 5359e33f320e4407 5359e33f320e4407 5359e33f320e4407 5359e33f320e4407 5359e33f320e4407 Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(BufferDeviceAddress), Feature(ShaderInt64)]]} 5359e33f320e4407 5359e33f320e4407 5359e33f320e4407 5359e33f320e4407 5359e33f320e4407 Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(ShaderInt64)]]} Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(ShaderInt64)]]} Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(BufferDeviceAddress), Feature(ShaderInt64)]]} engine/icb_replay_encode.air.ll cab14deef136bb51 icb_replay_encode b2380f329bd800b2 b2380f329bd800b2 b2380f329bd800b2 b2380f329bd800b2 b2380f329bd800b2 b2380f329bd800b2 b2380f329bd800b2 b2380f329bd800b2 b2380f329bd800b2 b2380f329bd800b2 b2380f329bd800b2 Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(BufferDeviceAddress), Feature(ShaderInt64)]]} b2380f329bd800b2 b2380f329bd800b2 b2380f329bd800b2 b2380f329bd800b2 b2380f329bd800b2 Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(ShaderInt64)]]} Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(ShaderInt64)]]} Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(BufferDeviceAddress), Feature(ShaderInt64)]]} engine/icb_replay_encode.ll 8af816c1ad2b48e2 icb_replay_encode b2380f329bd800b2 b2380f329bd800b2 b2380f329bd800b2 b2380f329bd800b2 b2380f329bd800b2 b2380f329bd800b2 b2380f329bd800b2 b2380f329bd800b2 b2380f329bd800b2 b2380f329bd800b2 b2380f329bd800b2 Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(BufferDeviceAddress), Feature(ShaderInt64)]]} b2380f329bd800b2 b2380f329bd800b2 b2380f329bd800b2 b2380f329bd800b2 b2380f329bd800b2 Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(ShaderInt64)]]} Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(ShaderInt64)]]} Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(BufferDeviceAddress), Feature(ShaderInt64)]]} engine/icb_replay_encode_buffers.air.ll a17225ba2473d71e icb_replay_encode_buffers 5d67f7546dd48a86 5d67f7546dd48a86 5d67f7546dd48a86 5d67f7546dd48a86 5d67f7546dd48a86 5d67f7546dd48a86 5d67f7546dd48a86 5d67f7546dd48a86 5d67f7546dd48a86 5d67f7546dd48a86 5d67f7546dd48a86 Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(BufferDeviceAddress), Feature(ShaderInt64)]]} 5d67f7546dd48a86 5d67f7546dd48a86 5d67f7546dd48a86 5d67f7546dd48a86 5d67f7546dd48a86 Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(ShaderInt64)]]} Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(ShaderInt64)]]} Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(BufferDeviceAddress), Feature(ShaderInt64)]]} @@ -1261,6 +1263,12 @@ engine/mesh_draws.ll 3d3689026db57166 mesh_draws_mesh a0a2b51c149451d8 a0a2b51c1 engine/mesh_draws.ll 3d3689026db57166 mesh_draws_object aded24542e796b26 aded24542e796b26 aded24542e796b26 aded24542e796b26 aded24542e796b26 aded24542e796b26 3d240b7ad3647629 bf3a91ae00ee09d8 bf3a91ae00ee09d8 bf3a91ae00ee09d8 aded24542e796b26 efcc8269be5a4f0a 5249be454a1a3389 5249be454a1a3389 efcc8269be5a4f0a 3d240b7ad3647629 3d240b7ad3647629 efcc8269be5a4f0a efcc8269be5a4f0a efcc8269be5a4f0a engine/mesh_gated.air.ll 03506d41ca56d7ce mesh_gated f1bd2f41932ad4e0 f1bd2f41932ad4e0 f1bd2f41932ad4e0 f1bd2f41932ad4e0 3f2902c3ebd08ac5 3f2902c3ebd08ac5 f1bd2f41932ad4e0 ba4155410e91e850 ba4155410e91e850 ba4155410e91e850 3f2902c3ebd08ac5 ba4155410e91e850 065e2fa825837752 065e2fa825837752 ba4155410e91e850 f1bd2f41932ad4e0 f1bd2f41932ad4e0 ba4155410e91e850 ba4155410e91e850 ba4155410e91e850 engine/mesh_gated.ll cf1e7b355ff45ba0 mesh_gated f1bd2f41932ad4e0 f1bd2f41932ad4e0 f1bd2f41932ad4e0 f1bd2f41932ad4e0 3f2902c3ebd08ac5 3f2902c3ebd08ac5 f1bd2f41932ad4e0 ba4155410e91e850 ba4155410e91e850 ba4155410e91e850 3f2902c3ebd08ac5 ba4155410e91e850 065e2fa825837752 065e2fa825837752 ba4155410e91e850 f1bd2f41932ad4e0 f1bd2f41932ad4e0 ba4155410e91e850 ba4155410e91e850 ba4155410e91e850 +engine/mesh_object_grid.air.ll d39f8193ec4a0cf9 mesh_object_grid_fragment 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 +engine/mesh_object_grid.air.ll d39f8193ec4a0cf9 mesh_object_grid_mesh e79d596f779397f8 e79d596f779397f8 e79d596f779397f8 e79d596f779397f8 c03b19c30090f3c6 c03b19c30090f3c6 e79d596f779397f8 c5328e12abda800c c5328e12abda800c c5328e12abda800c c03b19c30090f3c6 c5328e12abda800c 8d4fcd29a2cf547e 8d4fcd29a2cf547e c5328e12abda800c e79d596f779397f8 e79d596f779397f8 c5328e12abda800c c5328e12abda800c c5328e12abda800c +engine/mesh_object_grid.air.ll d39f8193ec4a0cf9 mesh_object_grid_object d3105f2a528b8473 d3105f2a528b8473 d3105f2a528b8473 d3105f2a528b8473 d3105f2a528b8473 d3105f2a528b8473 d3105f2a528b8473 b96ec816d5f90b1b b96ec816d5f90b1b b96ec816d5f90b1b d3105f2a528b8473 b96ec816d5f90b1b bf1ac2dd0844ac9a bf1ac2dd0844ac9a b96ec816d5f90b1b d3105f2a528b8473 d3105f2a528b8473 b96ec816d5f90b1b b2ffd783cea50a4e b96ec816d5f90b1b +engine/mesh_object_grid.ll 2d322f1d452ccc47 mesh_object_grid_fragment 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 495ef6c1043bf074 +engine/mesh_object_grid.ll 2d322f1d452ccc47 mesh_object_grid_mesh e79d596f779397f8 e79d596f779397f8 e79d596f779397f8 e79d596f779397f8 c03b19c30090f3c6 c03b19c30090f3c6 e79d596f779397f8 c5328e12abda800c c5328e12abda800c c5328e12abda800c c03b19c30090f3c6 c5328e12abda800c 8d4fcd29a2cf547e 8d4fcd29a2cf547e c5328e12abda800c e79d596f779397f8 e79d596f779397f8 c5328e12abda800c c5328e12abda800c c5328e12abda800c +engine/mesh_object_grid.ll 2d322f1d452ccc47 mesh_object_grid_object d3105f2a528b8473 d3105f2a528b8473 d3105f2a528b8473 d3105f2a528b8473 d3105f2a528b8473 d3105f2a528b8473 d3105f2a528b8473 b96ec816d5f90b1b b96ec816d5f90b1b b96ec816d5f90b1b d3105f2a528b8473 b96ec816d5f90b1b bf1ac2dd0844ac9a bf1ac2dd0844ac9a b96ec816d5f90b1b d3105f2a528b8473 d3105f2a528b8473 b96ec816d5f90b1b b2ffd783cea50a4e b96ec816d5f90b1b engine/mesh_object_memory.air.ll 2ab36bf45ae2fe43 mesh_object_memory_sums c23eb3e984fb4c72 c23eb3e984fb4c72 c23eb3e984fb4c72 c23eb3e984fb4c72 c23eb3e984fb4c72 c23eb3e984fb4c72 c23eb3e984fb4c72 070c80ab37d3a06d 070c80ab37d3a06d 070c80ab37d3a06d c23eb3e984fb4c72 837eae35699c22de 0507f7082574ef84 0507f7082574ef84 837eae35699c22de c23eb3e984fb4c72 c23eb3e984fb4c72 837eae35699c22de 837eae35699c22de 837eae35699c22de engine/mesh_object_memory.ll 0eea367f7f9940e8 mesh_object_memory_sums c23eb3e984fb4c72 c23eb3e984fb4c72 c23eb3e984fb4c72 c23eb3e984fb4c72 c23eb3e984fb4c72 c23eb3e984fb4c72 c23eb3e984fb4c72 070c80ab37d3a06d 070c80ab37d3a06d 070c80ab37d3a06d c23eb3e984fb4c72 837eae35699c22de 0507f7082574ef84 0507f7082574ef84 837eae35699c22de c23eb3e984fb4c72 c23eb3e984fb4c72 837eae35699c22de 837eae35699c22de 837eae35699c22de engine/mesh_order.air.ll e50bed9ed7da1bdd mesh_order_fragment NeedsInput{FramebufferFetch} NeedsInput{FramebufferFetch} NeedsInput{FramebufferFetch} NeedsInput{FramebufferFetch} ea6272adc9a10fe9 ea6272adc9a10fe9 NeedsInput{FramebufferFetch} NeedsInput{FramebufferFetch} NeedsInput{FramebufferFetch} NeedsInput{FramebufferFetch} ea6272adc9a10fe9 Unsupported{FramebufferFetch; AnyOf[[Feature(RasterizationOrderColorAttachmentAccess)], [Feature(FragmentShaderPixelInterlock)]]} NeedsInput{FramebufferFetch} NeedsInput{FramebufferFetch} NeedsInput{FramebufferFetch} NeedsInput{FramebufferFetch} NeedsInput{FramebufferFetch} Unsupported{FramebufferFetch; AnyOf[[Feature(RasterizationOrderColorAttachmentAccess)], [Feature(FragmentShaderPixelInterlock)]]} 4b3663cb0ba2519a Unsupported{FramebufferFetch; AnyOf[[Feature(RasterizationOrderColorAttachmentAccess)], [Feature(FragmentShaderPixelInterlock), Feature(FragmentStoresAndAtomics)]]} @@ -2564,7 +2572,7 @@ kernel_icb_declared_handle_is_inert.ll 7563618aa4063832 kernel_icb_declared_hand kernel_icb_encode_compute_commands.ll 823f95e2840591f3 kernel_icb_encode_compute_commands e9b81b240dafd435 e9b81b240dafd435 e9b81b240dafd435 e9b81b240dafd435 e9b81b240dafd435 e9b81b240dafd435 e9b81b240dafd435 e9b81b240dafd435 e9b81b240dafd435 e9b81b240dafd435 e9b81b240dafd435 Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(BufferDeviceAddress), Feature(ShaderInt64)]]} e9b81b240dafd435 e9b81b240dafd435 e9b81b240dafd435 e9b81b240dafd435 e9b81b240dafd435 Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(ShaderInt64)]]} Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(ShaderInt64)]]} Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(BufferDeviceAddress), Feature(ShaderInt64)]]} kernel_icb_encode_plain_setters_air_2_5.ll 6befc80ec9562e20 encode_plain_compute_commands e44b4b33ace1d807 e44b4b33ace1d807 e44b4b33ace1d807 e44b4b33ace1d807 e44b4b33ace1d807 e44b4b33ace1d807 e44b4b33ace1d807 e44b4b33ace1d807 e44b4b33ace1d807 e44b4b33ace1d807 e44b4b33ace1d807 Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(BufferDeviceAddress), Feature(ShaderInt64)]]} e44b4b33ace1d807 e44b4b33ace1d807 e44b4b33ace1d807 e44b4b33ace1d807 e44b4b33ace1d807 Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(ShaderInt64)]]} Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(ShaderInt64)]]} Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(BufferDeviceAddress), Feature(ShaderInt64)]]} kernel_icb_encode_plain_setters_air_2_5.ll 6befc80ec9562e20 encode_plain_render_commands ce8df481d9fe2d8c ce8df481d9fe2d8c ce8df481d9fe2d8c ce8df481d9fe2d8c ce8df481d9fe2d8c ce8df481d9fe2d8c ce8df481d9fe2d8c ce8df481d9fe2d8c ce8df481d9fe2d8c ce8df481d9fe2d8c ce8df481d9fe2d8c Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(BufferDeviceAddress), Feature(ShaderInt64)]]} ce8df481d9fe2d8c ce8df481d9fe2d8c ce8df481d9fe2d8c ce8df481d9fe2d8c ce8df481d9fe2d8c Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(ShaderInt64)]]} Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(ShaderInt64)]]} Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(BufferDeviceAddress), Feature(ShaderInt64)]]} -kernel_icb_encode_render_commands.ll 21d7b2a7dff58031 kernel_icb_encode_render_commands 4da12d7fc24f08db 4da12d7fc24f08db 4da12d7fc24f08db 4da12d7fc24f08db 4da12d7fc24f08db 4da12d7fc24f08db 4da12d7fc24f08db 4da12d7fc24f08db 4da12d7fc24f08db 4da12d7fc24f08db 4da12d7fc24f08db Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(BufferDeviceAddress), Feature(ShaderInt64)]]} 4da12d7fc24f08db 4da12d7fc24f08db 4da12d7fc24f08db 4da12d7fc24f08db 4da12d7fc24f08db Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(ShaderInt64)]]} Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(ShaderInt64)]]} Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(BufferDeviceAddress), Feature(ShaderInt64)]]} +kernel_icb_encode_render_commands.ll 21d7b2a7dff58031 kernel_icb_encode_render_commands de7b580f44480624 de7b580f44480624 de7b580f44480624 de7b580f44480624 de7b580f44480624 de7b580f44480624 de7b580f44480624 de7b580f44480624 de7b580f44480624 de7b580f44480624 de7b580f44480624 Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(BufferDeviceAddress), Feature(ShaderInt64)]]} de7b580f44480624 de7b580f44480624 de7b580f44480624 de7b580f44480624 de7b580f44480624 Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(ShaderInt64)]]} Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(ShaderInt64)]]} Unsupported{GpuEncodedIndirectCommands; AnyOf[[Feature(BufferDeviceAddress), Feature(ShaderInt64)]]} kernel_imageblock_extent.ll 98ff1876439eab54 kernel_imageblock_extent NeedsInput{TileAttachments} NeedsInput{TileAttachments} NeedsInput{TileAttachments} NeedsInput{TileAttachments} NeedsInput{TileAttachments} NeedsInput{TileAttachments} NeedsInput{TileAttachments} NeedsInput{TileAttachments} NeedsInput{TileAttachments} NeedsInput{TileAttachments} NeedsInput{TileAttachments} NeedsInput{TileAttachments} NeedsInput{TileAttachments} NeedsInput{TileAttachments} NeedsInput{TileAttachments} NeedsInput{TileAttachments} NeedsInput{TileAttachments} NeedsInput{TileAttachments} NeedsInput{TileAttachments} NeedsInput{TileAttachments} kernel_imageblock_float_tile_to_array.ll 69a7ef9c694c96f4 kernel_imageblock_float_tile_to_array 567c8257a2115bc7 567c8257a2115bc7 dfe5b00fb65f9be4 dfe5b00fb65f9be4 f2e907043d875eff f2e907043d875eff dfe5b00fb65f9be4 dfe5b00fb65f9be4 567c8257a2115bc7 567c8257a2115bc7 f2e907043d875eff 9b778a6aa4b278b3 567c8257a2115bc7 567c8257a2115bc7 9b778a6aa4b278b3 dfe5b00fb65f9be4 567c8257a2115bc7 NeedsInput{StorageTextureFormat { slot: SlotRef { stage: Kernel, class: Texture, index: 0 } }} 9b778a6aa4b278b3 NeedsInput{StorageTextureFormat { slot: SlotRef { stage: Kernel, class: Texture, index: 0 } }} kernel_imageblock_full_tile_planes.ll f5c4709339653c21 kernel_imageblock_full_tile_planes b08798e7f90b15b2 b08798e7f90b15b2 b08798e7f90b15b2 b08798e7f90b15b2 fb3e51d25659ca45 fb3e51d25659ca45 4aa719902bf029e6 4aa719902bf029e6 4aa719902bf029e6 4aa719902bf029e6 fb3e51d25659ca45 2f99fad17684c611 7a0efdc0fcc5c2d1 7a0efdc0fcc5c2d1 2f99fad17684c611 fb3e51d25659ca45 fb3e51d25659ca45 NeedsInput{StorageTextureFormat { slot: SlotRef { stage: Kernel, class: Texture, index: 0 } }} 2f99fad17684c611 NeedsInput{StorageTextureFormat { slot: SlotRef { stage: Kernel, class: Texture, index: 0 } }} diff --git a/crates/metal2vulkan/tests/golden_hashes_exact.tsv b/crates/metal2vulkan/tests/golden_hashes_exact.tsv index 4cb1c24b1..d736df708 100644 --- a/crates/metal2vulkan/tests/golden_hashes_exact.tsv +++ b/crates/metal2vulkan/tests/golden_hashes_exact.tsv @@ -5,23 +5,23 @@ # A cell is the first 64 bits of SHA-256 over the final SPIR-V of its subject, or its # refusal class. A cell that changes under an unchanged fixture source and profile # fingerprint needs cache::SEMANTICS_VERSION above its value at the last bless. -profile amd-780m-hawkpoint-radv 42ce94e948a31110 -profile amd-780m-radv 42ce94e948a31110 -profile amd-rdna2-apu-radv ee6f01a79fcc13a1 -profile amd-rdna3-radv c2fe8c2410373921 -profile gate-lavapipe d2748b6186077841 -profile gate-lavapipe-x86_64 4ee055836cf4dae8 -profile intel-arl-anv a9250a5fc404db0f -profile intel-irisxe-anv 75c889530922f2eb -profile intel-irisxe-rplp-anv efadf1d160238c4f -profile intel-uhd770-rpls-anv efadf1d160238c4f -profile lavapipe 7ae2fd8e66b85165 +profile amd-780m-hawkpoint-radv 9ca26cb90b66a66c +profile amd-780m-radv 9ca26cb90b66a66c +profile amd-rdna2-apu-radv 9a3a2271b816c1fd +profile amd-rdna3-radv fe29349094cff520 +profile gate-lavapipe f70c24a9173758ef +profile gate-lavapipe-x86_64 83a7b134dc157793 +profile intel-arl-anv 521ccfda99ec3ad4 +profile intel-irisxe-anv 3d0544e0c87158be +profile intel-irisxe-rplp-anv c8b62c0f2e94de31 +profile intel-uhd770-rpls-anv c8b62c0f2e94de31 +profile lavapipe 79d4e8daf0654c1c profile lunarg-desktop-baseline-2023 714c60d7048b6d6b profile moltenvk-m3 a2c321db7978d21e profile moltenvk-m4 a2c321db7978d21e -profile nvidia-pascal-linux 471bcdd4a96e7b30 -profile nvidia-rtx50-linux ffcd0b32b473b2be -profile nvidia-rtx5080-laptop fa8a389a4ce95b17 +profile nvidia-pascal-linux 560c796d2cfc5e95 +profile nvidia-rtx50-linux 64a79c56e3f408f3 +profile nvidia-rtx5080-laptop 44726246eec8e8b7 profile roadmap-2022 71e877c60c7a7ba1 profile swiftshader 5a325debe7c7eab3 profile vk12-floor 0498dfefb8a2686c diff --git a/docs/API.md b/docs/API.md index 965927d26..805039cf4 100644 --- a/docs/API.md +++ b/docs/API.md @@ -570,10 +570,24 @@ A grid Metal draws nothing for (an axis past `bind::METAL_MESH_GRID_AXIS`, or mo a direct draw's command is zeroed, an object function's wrapper launches nothing for such a grid, and an indirect draw reads its counts on the GPU. With the extension, an indirect draw's `DrawCommands::mesh_arguments` is a pass to record before the render pass -(`bind::mesh_arguments_module`, one invocation): it writes the draw's counts into 12 bytes of the -consumer's scratch, which the draw reads in place of Metal's arguments; an object grid past the -device's task limits, which Metal draws, is zeroed there and sets -`StatusBits::MESH_GRID_PAST_LIMITS` in the command buffer's `ExecutionStatus`. +(`bind::mesh_arguments_module`, one invocation): it writes the draw's counts into the consumer's +scratch (`MeshArguments::scratch_bytes`), which the draw reads in place of Metal's arguments. + +An object grid runs at any count Metal runs, past the task stage's limits too, on a device with +device addresses, `shaderInt64`, `multiDrawIndirect` and `drawIndirectCount` (every committed +profile with the extension): the object function is compiled folded, and each draw runs its grid +in pieces within the task limits (`bind::fold_object_grid`), its object stage reading the +threadgroups Metal runs and its grid from a 32-byte region record at its +`PushHole::ReplayRegionAddress`. A direct draw's fold is `DrawCommands::object_fold`, whose bytes +the consumer uploads (the record, and its pieces' commands where `draw` is indirect); an indirect +draw's arguments pass (`MeshArgumentsForm::FoldedObject`) writes the record, the pieces and their +commands, which `draw` (`DrawMeshTasksIndirectCount`) reads. Metal's threads per grid wrap to 32 +bits along each axis, as its builtins report them; a direct draw runs only the threadgroups those +threads fill, rounded up, an indirect one every threadgroup (`bind::metal_object_grid`). A grid of +`bind::METAL_OBJECT_GRID_TOTAL` threadgroups or more draws nothing and fails its command buffer +(Metal's GPU fails it), through `StatusBits::MESH_GRID_PAST_LIMITS` in the command buffer's +`ExecutionStatus` or the fold's `past`. Elsewhere an indirect draw's object grid past the device's +task limits does the same, and a direct one is refused naming the limit. ### Tile pipelines @@ -2887,6 +2901,10 @@ each item named states the rule in full. to 4 bytes, and every later position draws index 0 plus the base vertex. - **An indexed draw from an index offset at or past the length draws index 0** plus the base vertex at each position, where Metal reads whatever memory follows (`zeroed-index-fetch`). +- **An object grid of 2^29 threadgroups or more fails its command buffer at once** + (`MeshGridPastLimits`, Metal's code), drawing nothing of that draw while the command buffer's + other work runs. Metal's GPU runs it for its watchdog's 5 seconds, then fails the command buffer + with none of its writes landing (`bind::METAL_OBJECT_GRID_TOTAL`). - **A mesh grid of 1,048,577 to 2,097,151 threadgroups draws nothing**, direct, indirect or set by an object threadgroup. Metal on the M3 Max draws whole up to 1,048,575 and nothing at exactly 2^20 or from 2^21 on, and between them is erratic (17 by 61,681 and 65,535 by 24 drew, 1025 by diff --git a/docs/FAST-PATHS.md b/docs/FAST-PATHS.md index a3dbf659b..1755ba804 100644 --- a/docs/FAST-PATHS.md +++ b/docs/FAST-PATHS.md @@ -437,12 +437,14 @@ driver's. Each is open work. Xe, the UHD 770 and the RTX 5080 Laptop GPU, 128 KiB on the RTX 3090, 192 KiB on the M3 Max and M4 under MoltenVK, 48 KiB on lavapipe; 16 KiB elsewhere. An exact form for compute, private memory in a runtime buffer with a slot per resident threadgroup, is not built. -- **An indirect mesh draw's object grid past the device's task limits fails its command buffer** - (`CommandBufferError::MeshGridPastLimits`, drawing nothing): Metal draws every object grid - measured (16,777,216 along `x`), where RADV launches at most 65,535 task workgroups along an - axis and 4,194,304 in all, lavapipe 65,536. A fold of the grid into the task stage's limits is - not built. The emulation (MoltenVK, ANV on the Iris Xe) refuses an indirect draw with an object - function (`NotImplemented(MeshShading)`). +- **An object grid past the device's limits where the device does not fold it.** With + `VK_EXT_mesh_shader` but without device addresses, `shaderInt64`, `multiDrawIndirect` or + `drawIndirectCount` (no committed profile), an indirect draw's object grid past the task stage's + limits fails its command buffer (`CommandBufferError::MeshGridPastLimits`, drawing nothing) and + a direct one is refused (`Unsupported{MeshShading}` naming the limit). The emulation (MoltenVK, + ANV on the Iris Xe) refuses an indirect draw with an object function + (`NotImplemented(MeshShading)`) and a direct object grid past the compute stage's limits + (`Unsupported{MeshShading}` naming `maxComputeWorkGroupCount`). - **An object threadgroup that sets a mesh grid Metal launches nothing for keeps its own writes.** On the M3 Max such a threadgroup's device writes (an atomic add before the set) do not land either, while the draw's other threadgroups run; the runtime runs the threadgroup and launches diff --git a/docs/METAL-COVERAGE.md b/docs/METAL-COVERAGE.md index efec90356..f011fd028 100644 --- a/docs/METAL-COVERAGE.md +++ b/docs/METAL-COVERAGE.md @@ -2073,7 +2073,7 @@ Cheap items a plain app calls first, then medium pieces by how often a plain app | `MTLRenderCommandEncoder.setMeshSamplerStates:lodMinClamps:lodMaxClamps:withRange:` | method | implemented | `RenderCommandEncoder::set_mesh_sampler_states` (runtime) | | `MTLRenderCommandEncoder.drawMeshThreadgroups:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup:` | method | implemented | `RenderCommandEncoder::draw_mesh_threadgroups` (runtime) | | `MTLRenderCommandEncoder.drawMeshThreads:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup:` | method | implemented | `RenderCommandEncoder::draw_mesh_threads` (runtime) | -| `MTLRenderCommandEncoder.drawMeshThreadgroupsWithIndirectBuffer:indirectBufferOffset:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup:` | method | implemented | `RenderCommandEncoder::draw_mesh_threadgroups_indirect` (runtime): an object grid past the device's task limits fails the command buffer (`MeshGridPastLimits`); refused `NotImplemented(MeshShading)` with an object function where mesh draws are emulated | +| `MTLRenderCommandEncoder.drawMeshThreadgroupsWithIndirectBuffer:indirectBufferOffset:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup:` | method | implemented | `RenderCommandEncoder::draw_mesh_threadgroups_indirect` (runtime): an object grid of 2^29 threadgroups or more fails the command buffer (`MeshGridPastLimits`, as Metal's GPU fails it), and so does one past the task limits where the device does not fold object grids; refused `NotImplemented(MeshShading)` with an object function where mesh draws are emulated | | `MTLRenderCommandEncoder.drawPrimitives:vertexStart:vertexCount:instanceCount:` | method | implemented | `RenderCommandEncoder::draw_primitives` (runtime) | | `MTLRenderCommandEncoder.drawPrimitives:vertexStart:vertexCount:` | method | implemented | `RenderCommandEncoder::draw_primitives` (runtime) | | `MTLRenderCommandEncoder.drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferOffset:instanceCount:` | method | implemented | `RenderCommandEncoder::draw_indexed_primitives` (runtime) | diff --git a/docs/REFUSALS.md b/docs/REFUSALS.md index 7a71000fc..b05972f90 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 `13d45141f`. +Generated at `8efdde594`. ## Totals @@ -48,7 +48,7 @@ Generated at `13d45141f`. | `SimdWidth` | Simdgroup width 32 is not achievable for this usage, stage, and device | devices without VkProperty::MetalFragmentSimdgroups; devices without a capability the site computes (`width_needs(stage, st)`) | 2: `crates/metal2vulkan/src/device/subgroup.rs:377`, `crates/metal2vulkan/src/lower/simd/mod.rs:382` | `app`: simdgroup functions on a device whose subgroups cannot run 32 wide for the use | | `LocalSize` | A local size beyond a device limit on this axis (`None` | every device (no Vulkan mechanism) | 1: `crates/metal2vulkan/src/bind/dispatch.rs:475` | `app`: a threadgroup size past a smaller device's limit | | `IrreducibleConvergent` | An irreducible region containing a convergent instruction | every device (no Vulkan mechanism) | 1: `crates/metal2vulkan/src/structurize/irreducible.rs:108` | `rare`: irreducible loops around barriers or simd operations | -| `ComputeDerivativesWithSimd` | Compute derivatives in a flattened simd tier | every device (no Vulkan mechanism) | 1: `crates/metal2vulkan/src/lower/dispatch.rs:472` | `rare`: derivatives in a kernel | +| `ComputeDerivativesWithSimd` | Compute derivatives in a flattened simd tier | every device (no Vulkan mechanism) | 1: `crates/metal2vulkan/src/lower/dispatch.rs:476` | `rare`: derivatives in a kernel | | `ComputeDerivatives` | Derivatives outside fragment without compute-derivative support | devices without VkFeature::ComputeDerivativeGroupLinear; every device (no Vulkan mechanism); every device (not implemented) | 4: `crates/metal2vulkan/src/bind/dispatch.rs:320`, `crates/metal2vulkan/src/lower/sync/barrier.rs:486` (+2) | `rare`: derivatives in a kernel | | `QuadOperations` | Quad operations in a stage without quad support | devices without VkLimit::MinSubgroupSize; devices without VkProperty::SubgroupQuadOperationsInAllStages | 2: `crates/metal2vulkan/src/device/subgroup.rs:371`, `crates/metal2vulkan/src/device/subgroup.rs:405` | `app`: quad shuffles in kernels on devices without quad operations there | | `SimdgroupMatrix` | Simdgroup matrix operations | every device (not implemented) | 1: `crates/metal2vulkan/src/lower/simd/matrix.rs:83` | `rare`: simdgroup matrix kernels | @@ -64,8 +64,8 @@ Generated at `13d45141f`. | `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: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:3658` (+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:1688`, `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:3772` (+5) | `app`: a buffer window past a device's descriptor range | | `Int64Arithmetic` | 64-bit integer arithmetic | devices without VkFeature::ShaderInt64 | 2: `crates/metal2vulkan/src/lower/arith/legal.rs:582`, `crates/metal2vulkan/src/lower/select.rs:1133` | `rare`: 64-bit integers on a device without shaderInt64 | | `Float64Arithmetic` | 64-bit float arithmetic | devices without VkFeature::ShaderFloat64 | 2: `crates/metal2vulkan/src/device/metal.rs:230`, `crates/metal2vulkan/src/lower/arith/legal.rs:587` | `rare`: doubles (MSL has none outside Apple's own code) | | `Format` | A pixel format not supported for the required use | devices without VkFeature::ShaderStorageImageExtendedFormats; devices without a capability the site computes; devices without a capability the site computes (`alternatives`); devices without a capability the site computes (`c`); devices without a capability the site computes (`missing`); devices without a capability the site computes (`routes`); devices without a format's usage; every device (no Vulkan mechanism); every device (not implemented) | 121: `crates/metal2vulkan-runtime/src/binding_view.rs:146`, `crates/metal2vulkan-runtime/src/blit_plan.rs:523` (+119) | `system`: pixel formats a device lacks for a use (CoreVideo's 4:2:x and 10-bit formats among them) | @@ -82,31 +82,31 @@ Generated at `13d45141f`. | `SamplerLodBias` | Sampler LOD bias | devices short of a Vulkan feature the site names; devices without VkLimit::MaxSamplerLodBias; every device (no Vulkan mechanism) | 3: `crates/metal2vulkan/src/lower/sampler/constexpr.rs:258`, `crates/metal2vulkan/src/lower/sampler/constexpr.rs:265` (+1) | `app`: constexpr samplers with an LOD bias | | `SamplerCompare` | Sampler compare functions outside what Vulkan allows for the image | devices short of a Vulkan feature the site names | 1: `crates/metal2vulkan/src/metal/sampler.rs:260` | `app`: compare samplers a device cannot apply to the image | | `PixelSamplerCompare` | A constexpr sampler with pixel coordinates and a compare function, which Apple's compiler rejects ("invalid values combination in sampler... | every device (no Vulkan mechanism) | 1: `crates/metal2vulkan/src/lower/sampler/constexpr.rs:115` | `none`: Apple's compiler rejects it | -| `TexelBuffer` | Texture buffers beyond the device's texel-buffer limits | devices without a format's usage; every device (no Vulkan mechanism) | 3: `crates/metal2vulkan/src/bind/instantiate.rs:880`, `crates/metal2vulkan/src/bind/instantiate.rs:886` (+1) | `app`: texture buffers past a device's texel-buffer limits | +| `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:882`, `crates/metal2vulkan/src/bind/instantiate.rs:888` (+1) | `app`: texture buffers past a device's texel-buffer limits | | `RasterOrderGroups` | Raster order groups without fragment shader interlock | devices without VkFeature::FragmentShaderPixelInterlock; devices without VkFeature::FragmentShaderSampleInterlock; devices without a capability the site computes (`alternatives`); every device (not implemented) | 4: `crates/metal2vulkan/src/device/metal.rs:242`, `crates/metal2vulkan/src/lower/fragment/rog.rs:151` (+2) | `rare`: raster order groups | | `FramebufferFetch` | Framebuffer fetch without an ordered form on the device (rasterization-order attachment access, or the pixel interlock's storage form where the... | devices short of a Vulkan property the site names; devices without VkFeature::FragmentShaderPixelInterlock; devices without VkFeature::RasterizationOrderColorAttachmentAccess; devices without VkFeature::SampleRateShading; devices without a capability the site computes; devices without a capability the site computes (`alternatives`); devices without a capability the site computes (`c`); devices without a capability the site computes (`capability`); devices without a capability the site computes (`missing`); devices without a format's usage; drivers with a defect; every device (not implemented) | 23: `crates/metal2vulkan-runtime/src/families/features.rs:1018`, `crates/metal2vulkan-runtime/src/render.rs:5894` (+21) | `system`: programmable blending (framebuffer fetch); macOS 26.6.2's login reaches it (two WindowServer and RenderBox pipelines fetch RGB10A8_2P_XR10 attachments, the consumer's boots) | | `PrimitiveId` | `[[primitive_id]]` in a fragment function | devices without a capability the site computes; every device (not implemented) | 3: `crates/metal2vulkan-runtime/src/families/features.rs:1127`, `crates/metal2vulkan/src/lower/stage_io/plan.rs:3211` (+1) | `rare`: primitive_id on a device without geometry or tessellation shaders, in an indexed draw or behind a mesh function | | `PrivatePrimitives` | One of Metal's private primitive types (a line loop, a triangle fan, quads, a quad strip) drawn in the pulled list form... | - | via a helper: 1: `crates/metal2vulkan/src/lower/stage_io/plan.rs:2601` | `rare`: a private primitive type drawn in the pulled list form (a vertex function that writes memory or the primitive_id varying, a vertex start past 2^31) on a device without device addresses | -| `VertexAmplification` | Vertex amplification | devices without VkFeature::Multiview; devices without VkFeature::MultiviewTessellationShader; devices without VkLimit::MaxMultiviewInstanceIndex; devices without a capability the site computes (`needs`); every device (not implemented) | 5: `crates/metal2vulkan/src/bind/graphics.rs:3999`, `crates/metal2vulkan/src/lower/stage_io/plan.rs:1312` (+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:4113`, `crates/metal2vulkan/src/lower/stage_io/plan.rs:1312` (+3) | `rare`: vertex amplification | | `LayeredRendering` | Layered rendering (`render_target_array_index`, `viewport_array_index`) | devices without VkFeature::ImageView2DOn3DImage; devices without VkFeature::MultiViewport; devices without VkFeature::ShaderOutputLayer; devices without VkFeature::ShaderOutputViewportIndex; devices without a capability the site computes (`needs`); every device (not implemented) | 7: `crates/metal2vulkan-runtime/src/render_pass.rs:1669`, `crates/metal2vulkan-runtime/src/render_state.rs:1107` (+5) | `rare`: layered rendering on a device without its features | -| `ClipDistance` | Clip or cull distances | devices without VkFeature::ShaderClipDistance; devices without VkLimit::MaxClipDistances | 2: `crates/metal2vulkan/src/lower/mesh/mod.rs:941`, `crates/metal2vulkan/src/lower/mesh/mod.rs:949` | `rare`: clip distances on a device without them | +| `ClipDistance` | Clip or cull distances | devices without VkFeature::ShaderClipDistance; devices without VkLimit::MaxClipDistances | 2: `crates/metal2vulkan/src/lower/mesh/mod.rs:956`, `crates/metal2vulkan/src/lower/mesh/mod.rs:964` | `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:1924` (+3) | `rare`: barycentric coordinates | -| `StencilExport` | Stencil export | devices without VkExtension::ExtShaderStencilExport; every device (not implemented) | 6: `crates/metal2vulkan-runtime/src/families/features.rs:1114`, `crates/metal2vulkan/src/bind/graphics.rs:2685` (+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:1114`, `crates/metal2vulkan/src/bind/graphics.rs:2719` (+4) | `rare`: stencil from the shader | | `SampleRateShading` | Per-sample shading | devices without VkFeature::SampleRateShading; devices without a capability the site computes (`needs`); every device (not implemented) | 3: `crates/metal2vulkan/src/pipeline/link/graphics.rs:844`, `crates/metal2vulkan/src/pipeline/link/graphics.rs:846` (+1) | `rare`: per-sample shading | | `PixelCoverageAtSampleRate` | The pixel's coverage (`[[sample_mask]]` read) in a fragment function that runs once per sample | drivers with a defect; every device (no Vulkan mechanism); every device (not implemented) | 3: `crates/metal2vulkan/src/lower/fragment/coverage.rs:296`, `crates/metal2vulkan/src/lower/simd/mod.rs:754` (+1) | `rare`: coverage read at sample rate | | `InterfaceComponents` | Too many interface components or locations | devices short of a device limit the site names; devices without VkLimit::MaxColorAttachments; devices without VkLimit::MaxVertexInputAttributes | 4: `crates/metal2vulkan/src/pipeline/compile/color_group.rs:202`, `crates/metal2vulkan/src/pipeline/link/graphics.rs:301` (+2) | `rare`: too many varyings or attachments for a device | | `UnmatchedVarying` | A fragment input without a vertex producer (a Metal link error) | every device (no Vulkan mechanism) | 3: `crates/metal2vulkan/src/pipeline/link/varyings.rs:318`, `crates/metal2vulkan/src/pipeline/link/varyings.rs:537` (+1) | `none`: a Metal link error | | `KernelStageIn` | Kernel `[[stage_in]]` | every device (not implemented) | 3: `crates/metal2vulkan-runtime/src/indirect_execute.rs:376`, `crates/metal2vulkan/src/bind/dispatch.rs:871` (+1) | `rare`: kernel stage-in combinations Metal leaves unestablished | | `Tessellation` | Tessellation | devices without VkLimit::MaxPushConstantsSize; devices without VkLimit::MaxStorageBufferRange; devices without VkLimit::MaxTessellationGenerationLevel; every device (not implemented) | 13: `crates/metal2vulkan-air/src/canon/mod.rs:1256`, `crates/metal2vulkan-air/src/canon/mod.rs:1347` (+11) | `rare`: tessellation | -| `MeshShading` | | devices short of a device limit the site names; devices without VkLimit::MaxMeshOutputLayers; devices without VkLimit::MaxTaskPayloadSize; devices without a capability the site computes (`missing`); every device (not implemented) | 7: `crates/metal2vulkan/src/bind/graphics.rs:1604`, `crates/metal2vulkan/src/bind/graphics.rs:3058` (+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:1630`, `crates/metal2vulkan/src/bind/graphics.rs:3095` (+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:520`, `crates/metal2vulkan/src/bind/plan/compute.rs:237` (+3) | `rare`: tile shaders (Apple GPU families) | | `Imageblocks` | An imageblock outside the forms implemented | devices without VkFeature::SampleRateShading; devices without a capability the site computes (`missing`); drivers with a defect; every device (not implemented) | 10: `crates/metal2vulkan/src/lower/access/imageblock.rs:98`, `crates/metal2vulkan/src/lower/access/mod.rs:908` (+8) | `rare`: imageblocks (Apple GPU families) | | `RayTracing` | | devices without a capability the site computes (`missing`); every device (no Vulkan mechanism); every device (not implemented) | 12: `crates/metal2vulkan/src/bind/acceleration.rs:202`, `crates/metal2vulkan/src/bind/acceleration.rs:216` (+10) | `rare`: ray tracing (out of scope by ruling) | | `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:930` | `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) | 17: `crates/metal2vulkan/src/bind/replay.rs:556`, `crates/metal2vulkan/src/bind/replay.rs:796` (+15) | `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:926`, `crates/metal2vulkan/src/device/derive.rs:105` | `none`: a device below Vulkan 1.2 | +| `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:927`, `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 | | `BitcodeRecord` | A bitcode record LLVM defines in `block` that the typed model does not cover and that has no more specific variant (legacy spellings predating... | - | via a helper: 7: `crates/metal2vulkan-air/src/bitcode/attrs.rs:337`, `crates/metal2vulkan-air/src/bitcode/function.rs:572` (+5) | `none`: bitcode records AIR does not emit | @@ -131,11 +131,11 @@ Generated at `13d45141f`. | `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:1196` | `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:1244`, `crates/metal2vulkan-runtime/src/image_plan.rs:598` (+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:5136` (+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:996` (+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:5150` (+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:998` (+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:1890`, `crates/metal2vulkan-runtime/src/mipmap_pick.rs:37` (+5) | `app`: generateMipmapsForTexture: where the device's filter is not Metal's | | `HostMemory` | A buffer over the caller's host memory without a copy (`newBufferWithBytesNoCopy:`) | devices without VkExtension::ExtExternalMemoryHost; every device (no Vulkan mechanism); every device (not implemented) | 5: `crates/metal2vulkan-runtime/src/host_memory.rs:430`, `crates/metal2vulkan-runtime/src/host_memory.rs:470` (+3) | `system`: newBufferWithBytesNoCopy: where the device cannot import the memory | -| `GpuTimes` | A command buffer's GPU times (`GPUStartTime`, `GPUEndTime`) on a device whose queue family writes no timestamps (`timestampValidBits` 0) | every device (no Vulkan mechanism) | 1: `crates/metal2vulkan-runtime/src/command_buffer/mod.rs:2840` | `rare`: GPU times on a queue without timestamps | +| `GpuTimes` | A command buffer's GPU times (`GPUStartTime`, `GPUEndTime`) on a device whose queue family writes no timestamps (`timestampValidBits` 0) | every device (no Vulkan mechanism) | 1: `crates/metal2vulkan-runtime/src/command_buffer/mod.rs:2850` | `rare`: GPU times on a queue without timestamps | | `CountingVisibility` | A `Counting` visibility result (`MTLVisibilityResultModeCounting`) on a device without `occlusionQueryPrecise` | devices without VkFeature::OcclusionQueryPrecise | 1: `crates/metal2vulkan-runtime/src/visibility.rs:452` | `rare`: counting occlusion queries on a device without precise queries | | `ViewFormatReinterpretation` | A texture view whose format has other components, or components of other widths, than its texture's (`RGBA8Unorm` as `R32Uint`), on a device whose... | every device (no Vulkan mechanism) | 1: `crates/metal2vulkan-runtime/src/view_plan.rs:570` | `app`: a view of another component layout on a portability subset (MoltenVK) | | `SeparateMultisampledDepthStencil` | A render pass whose depth and stencil attachments are separate multisampled textures that it loads or may store, on a device without maintenance8,... | - | via a helper: 7: `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:188`, `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:294` (+5) | `rare`: separate multisampled depth and stencil textures | @@ -165,20 +165,20 @@ Generated at `13d45141f`. |---|---|---|---|---| | `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:1563` (+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:1982` | `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:465`, `crates/metal2vulkan-runtime/src/texture.rs:1674` (+1) | `rare`: sparse heaps | +| `SparseHeaps` | Sparse heaps and their textures | every device (runtime piece not built) | 3: `crates/metal2vulkan-runtime/src/sparse/encoder.rs:465`, `crates/metal2vulkan-runtime/src/texture.rs:1683` (+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:562`, `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:714` | `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:1071` | `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:1510`, `crates/metal2vulkan-runtime/src/texture/heap.rs:1517` (+3) | `app`: a heap texture the heap's memory type does not take | | `FunctionTablePastMaxBufferLength` | A visible-function table of more entries than one buffer of the device's `max_buffer_length` holds words for, or than its size word holds | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/function_table.rs:622` | `none`: a function table past one buffer | -| `IndirectCommandBufferPastMaxBufferLength` | An indirect command buffer of more commands than one buffer of the device's `max_buffer_length` holds the records of | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/indirect_command_buffer.rs:522` | `none`: an ICB past one buffer | +| `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:523` | `none`: an ICB past one buffer | | `IndirectRenderCommands` | What indirect command buffers lack of their render commands | every device (runtime piece not built) | 15: `crates/metal2vulkan-runtime/src/compute.rs:1291`, `crates/metal2vulkan-runtime/src/compute.rs:1376` (+13) | `rare`: indirect render commands' remaining pieces | -| `IndirectImageblockSize` | An indirect compute command's imageblock side past 65535, which Metal keeps | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/indirect_command_buffer.rs:3363` | `none`: an imageblock side past 65535 | +| `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:3397` | `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:723`, `crates/metal2vulkan-runtime/src/binding.rs:726` | `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:1794` | `rare`: render attachment forms not built | | `AccelerationStructures` | Acceleration structures | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/binding.rs:1797` | `rare`: ray tracing (out of scope by ruling) | -| `FeatureEnable` | A feature a created device would enable that the runtime's feature chain has no member for, or whose structure no enabled extension exposes | devices without the feature or extension it names | 1: `crates/metal2vulkan-runtime/src/enables.rs:1165` | `none`: device creation with a feature the runtime's chain lacks | -| `ExtensionEnable` | An extension a created device would enable that the device lists under none of the names the runtime knows for it | devices without the feature or extension it names | 1: `crates/metal2vulkan-runtime/src/enables.rs:1156` | `none`: device creation with an extension under an unknown name | +| `FeatureEnable` | A feature a created device would enable that the runtime's feature chain has no member for, or whose structure no enabled extension exposes | devices without the feature or extension it names | 1: `crates/metal2vulkan-runtime/src/enables.rs:1166` | `none`: device creation with a feature the runtime's chain lacks | +| `ExtensionEnable` | An extension a created device would enable that the device lists under none of the names the runtime knows for it | devices without the feature or extension it names | 1: `crates/metal2vulkan-runtime/src/enables.rs:1157` | `none`: device creation with an extension under an unknown name | | `Render` | Render pipelines, passes and draws | every device (runtime piece not built) | 23: `crates/metal2vulkan-runtime/src/attachment_stand_in.rs:404`, `crates/metal2vulkan-runtime/src/attachment_stand_in.rs:460` (+21) | `system`: render pass, resolve and attachment forms not built (20 sites: see the appendix) | | `TexelsPastBufferLength` | A 2D array over a buffer whose texels run past the buffer's length, which Metal makes over bytes its buffer's allocation has past the length | every device (runtime piece not built) | 2: `crates/metal2vulkan-runtime/src/buffer_texture.rs:261`, `crates/metal2vulkan-runtime/src/texture/surface_depth.rs:105` | `rare`: a 2D array over a buffer past its length | | `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 | @@ -208,33 +208,33 @@ Generated at `13d45141f`. | `LayeredPass` | A layered render pass (`renderTargetArrayLength` 2 or more) that needs a step of one layer | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/color_resolve.rs:890` | `rare`: layered passes needing a per-layer color resolve | | `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:1340` | `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:637`, `crates/metal2vulkan-runtime/src/texture/heap.rs:2726` (+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:5775` | `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:1682`, `crates/metal2vulkan-runtime/src/texture/heap.rs:1373` | `app`: an ASTC texture in a heap on a device without ASTC | +| `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:637`, `crates/metal2vulkan-runtime/src/texture/heap.rs:2739` (+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:5789` | `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:1691`, `crates/metal2vulkan-runtime/src/texture/heap.rs:1373` | `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) | 1: `crates/metal2vulkan-runtime/src/render/restart.rs:71` | `none`: a strip after the Apple-private setPrimitiveRestartEnabled:index: whose rewrite pass cannot run as Metal draws | -| `PrivatePrimitives` | A draw of one of Metal's private primitive types (`DrawPrimitiveType` | every device (runtime piece not built) | 2: `crates/metal2vulkan-runtime/src/render.rs:7937`, `crates/metal2vulkan-runtime/src/render/restart.rs:72` | `none`: a draw of an Apple-private primitive type (OpenGL on Metal's quads and kin) whose list cannot draw as Metal draws: a list past a u32 or one storage range, indices or arguments an unordered earlier draw wrote | +| `PrivatePrimitives` | A draw of one of Metal's private primitive types (`DrawPrimitiveType` | every device (runtime piece not built) | 2: `crates/metal2vulkan-runtime/src/render.rs:8026`, `crates/metal2vulkan-runtime/src/render/restart.rs:72` | `none`: a draw of an Apple-private primitive type (OpenGL on Metal's quads and kin) whose list cannot draw as Metal draws: a list past a u32 or one storage range, indices or arguments an unordered earlier draw wrote | | `ProvokingVertex` | A draw under Apple's last provoking vertex (`setProvokingVertexMode:` 1) on a device without `VK_EXT_provoking_vertex`'s last vertex, which the... | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/render/restart.rs:73` | `none`: a draw after the Apple-private setProvokingVertexMode: 1, on a device without the last provoking vertex, whose rotated list cannot draw as Metal draws | -| `PrimitiveIdIndices` | An indexed draw (`drawIndexedPrimitives:`) of a pipeline whose fragment function reads `[[primitive_id]]` on a device whose fragment stage cannot... | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/render.rs:7947` | `rare`: an indexed draw of a primitive_id pipeline, on a device without geometry or tessellation shaders, whose indices the encoder wrote since its last barrier | +| `PrimitiveIdIndices` | An indexed draw (`drawIndexedPrimitives:`) of a pipeline whose fragment function reads `[[primitive_id]]` on a device whose fragment stage cannot... | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/render.rs:8036` | `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:1669`, `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:641`, `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:4924` | `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:4938` | `none`: CPU texel access while a runtime extension detached the bytes | | `SurfaceDepthStencil` | A use of a texture of a depth or stencil format (`Depth16Unorm`, `Depth32Float`, `Depth32Float_Stencil8`, `Stencil8`, `X32_Stencil8`) over a plane... | every device (runtime piece not built) | 2: `crates/metal2vulkan-runtime/src/blit_texture.rs:269`, `crates/metal2vulkan-runtime/src/texture/surface_depth.rs:57` | `rare`: a blit of the stencil of a Depth32Float_Stencil8 texture over a plane of an IOSurface with planes, or a pass on an X32_Stencil8 one's view as Depth32Float_Stencil8 | | `ExtendedRangeResolve` | The multisample resolve (`MultisampleResolve`, `StoreAndMultisampleResolve`) of a color attachment of an extended-range format (`BGRA10_XR`,... | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/resolve.rs:604` | `rare`: a multisample resolve of a BGRA10_XR, BGR10_XR or sRGB twin attachment (EDR content drawn multisampled) | | `MultisampledBufferCopy` | A blit copy between a buffer and a multisampled texture (`copyFromBuffer:...toTexture:` into, or `copyFromTexture:...toBuffer:` out of, a texture... | every device (runtime piece not built) | 2: `crates/metal2vulkan-runtime/src/blit_texture.rs:536`, `crates/metal2vulkan-runtime/src/blit_texture.rs:693` | `rare`: a buffer<->multisampled-texture copy on a device without sample-rate shading, an integer multisample attachment at the count, or the copy format's storage; and, where maintenance8's depth/colour copies are missing or wrong, what the sample-rate draws cannot move: a 16-bit depth, or a depth or stencil texture they cannot sample or render to (emulated elsewhere; the consumer's Maps pans and screensaver make the copy) | -| `MultisampledBufferLayout` | A blit copy between a buffer and a multisampled texture (as for `MultisampledBufferCopy`) in one of two buffer layouts that plain Metal copies by... | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/sample_interleave.rs:1020` | `rare`: a buffer<->multisampled-texture copy at a bytesPerRow of 0 from an offset that is a multiple of 16, or of pixels of 32 bytes or more at a pitch below a row or off the pixel: Metal copies these by rules not yet reduced, and its API validation rejects them | +| `MultisampledBufferLayout` | A blit copy between a buffer and a multisampled texture (as for `MultisampledBufferCopy`) in one of two buffer layouts that plain Metal copies by... | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/sample_interleave.rs:1029` | `rare`: a buffer<->multisampled-texture copy at a bytesPerRow of 0 from an offset that is a multiple of 16, or of pixels of 32 bytes or more at a pitch below a row or off the pixel: Metal copies these by rules not yet reduced, and its API validation rejects them | | `ColorAttachmentGroups` | What a render pass the device draws in color groups does not build | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/render/color_groups.rs:106` | `app`: in a render pass of more color attachments than the device draws at once (five or more on a device of four), or one at an index past them: a pipeline state of other colors, a tile state, an execution of render commands, a draw reading another group's attachment | ## 3. Apple-only calls (`Error::AppleOnly`) | Variant | What it blocks | Where | Sites | Reach | |---|---|---|---|---| -| `ProtectedContent` | Protection options whose answer on Metal is not measured (`command_buffer/protection.rs`) | every device (Apple-private, Metal's answer not measured) | 3: `crates/metal2vulkan-runtime/src/command_buffer/mod.rs:2398`, `crates/metal2vulkan-runtime/src/command_buffer/protection.rs:126` (+1) | `none`: Apple-private (no public header) | +| `ProtectedContent` | Protection options whose answer on Metal is not measured (`command_buffer/protection.rs`) | every device (Apple-private, Metal's answer not measured) | 3: `crates/metal2vulkan-runtime/src/command_buffer/mod.rs:2408`, `crates/metal2vulkan-runtime/src/command_buffer/protection.rs:126` (+1) | `none`: Apple-private (no public header) | | `LineWidth` | A line width other than 1 (`setLineWidth:`) | every device (Apple-private, Metal's answer not measured) | 1: `crates/metal2vulkan-runtime/src/apple_only.rs:189` | `none`: Apple-private (no public header) | | `ViewportTransformDisabled` | The viewport transform turned off (`setViewportTransformEnabled:NO`) | every device (Apple-private, Metal's answer not measured) | 1: `crates/metal2vulkan-runtime/src/apple_only.rs:191` | `none`: Apple-private (no public header) | | `VertexAmplificationMode` | `setVertexAmplificationMode:value:` of a count (the value's set bits in mode 1, else the value) of 0, whose copies change from run to run on... | every device (Apple-private, Metal's answer not measured) | 2: `crates/metal2vulkan-runtime/src/apple_only.rs:195`, `crates/metal2vulkan-runtime/src/apple_only.rs:320` | `none`: Apple-private (no public header) | @@ -244,14 +244,14 @@ Generated at `13d45141f`. | Variant | What it blocks | Where | Sites | Reach | |---|---|---|---|---| -| `DescriptorRangeExceeded` | A descriptor-form slot's window exceeds the descriptor range limit (Profile F) | at the device's limit | 1: `crates/metal2vulkan/src/bind/instantiate.rs:653` | `app`: a buffer window past a device's descriptor range | -| `TexelBufferTooLarge` | A texel buffer exceeds `maxTexelBufferElements` | at the device's limit | 1: `crates/metal2vulkan/src/bind/instantiate.rs:892` | `rare`: a texture buffer past maxTexelBufferElements | +| `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:655` | `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:894` | `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:3653` | `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:3697` | `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:3735` | `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:3767` | `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:3811` | `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:3849` | `rare`: control-point indices past one storage descriptor | | `MissingStageInRegion` | The kernel reads the compute encoder's stage-in region (a `[[stage_in]]` attribute stepping by thread position, or `[[grid_origin]]` or... | at the device's limit | 1: `crates/metal2vulkan/src/bind/dispatch.rs:796` | `none`: a stage-in region never set, which Metal leaves undefined | -| `UniformViewAliased` | A `device` buffer slot the pipeline reads through a uniform view (Profile F's per-stage storage-buffer fallback,... | at the device's limit | 1: `crates/metal2vulkan/src/bind/instantiate.rs:607` | `rare`: Profile F's uniform-view fallback aliased by a write | +| `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:609` | `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 | ## 5. Translation caps (`Error::LimitExceeded(Limit)`) @@ -309,7 +309,7 @@ Each refusal's sites, with the function that builds it. - `feature::SimdWidth`: `crates/metal2vulkan/src/device/subgroup.rs:377 (subgroup_tier)`; `crates/metal2vulkan/src/lower/simd/mod.rs:382 (finish)` - `feature::LocalSize`: `crates/metal2vulkan/src/bind/dispatch.rs:475 (regions)` - `feature::IrreducibleConvergent`: `crates/metal2vulkan/src/structurize/irreducible.rs:108 (refuse_tangled)` -- `feature::ComputeDerivativesWithSimd`: `crates/metal2vulkan/src/lower/dispatch.rs:472 (plan_kernel)` +- `feature::ComputeDerivativesWithSimd`: `crates/metal2vulkan/src/lower/dispatch.rs:476 (plan_kernel)` - `feature::ComputeDerivatives`: `crates/metal2vulkan/src/bind/dispatch.rs:320 (check_local)`; `crates/metal2vulkan/src/lower/sync/barrier.rs:486 (select_derivative)`; `crates/metal2vulkan/src/lower/sync/barrier.rs:495 (select_derivative)`; `crates/metal2vulkan/src/lower/sync/barrier.rs:499 (select_derivative)` - `feature::QuadOperations`: `crates/metal2vulkan/src/device/subgroup.rs:371 (subgroup_tier)`; `crates/metal2vulkan/src/device/subgroup.rs:405 (subgroup_tier)` - `feature::SimdgroupMatrix`: `crates/metal2vulkan/src/lower/simd/matrix.rs:83 (not_implemented)` @@ -325,11 +325,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:1684 (accept_placement)`; `crates/metal2vulkan/src/lower/select.rs:1641 (finish)`; `crates/metal2vulkan/src/pipeline/link.rs:1135 (limit_error)` -- `feature::BufferRange`: `crates/metal2vulkan-runtime/src/function_table.rs:569 (past_storage_buffer_range)`; `crates/metal2vulkan/src/bind/graphics.rs:3658 (patch_binding)`; `crates/metal2vulkan/src/bind/graphics.rs:3702 (patch_binding)`; `crates/metal2vulkan/src/bind/graphics.rs:3740 (patch_binding)`; `crates/metal2vulkan/src/bind/instantiate.rs:659 (bind_buffers)`; `crates/metal2vulkan/src/lower/access/function_table.rs:226 (select)`; `crates/metal2vulkan/src/lower/access/mod.rs:1184 (place_slots)` +- `feature::DescriptorCount`: `crates/metal2vulkan/src/lower/access/mod.rs:1688 (accept_placement)`; `crates/metal2vulkan/src/lower/select.rs:1641 (finish)`; `crates/metal2vulkan/src/pipeline/link.rs:1135 (limit_error)` +- `feature::BufferRange`: `crates/metal2vulkan-runtime/src/function_table.rs:569 (past_storage_buffer_range)`; `crates/metal2vulkan/src/bind/graphics.rs:3772 (patch_binding)`; `crates/metal2vulkan/src/bind/graphics.rs:3816 (patch_binding)`; `crates/metal2vulkan/src/bind/graphics.rs:3854 (patch_binding)`; `crates/metal2vulkan/src/bind/instantiate.rs:661 (bind_buffers)`; `crates/metal2vulkan/src/lower/access/function_table.rs:226 (select)`; `crates/metal2vulkan/src/lower/access/mod.rs:1184 (place_slots)` - `feature::Int64Arithmetic`: `crates/metal2vulkan/src/lower/arith/legal.rs:582 (check_scalar)`; `crates/metal2vulkan/src/lower/select.rs:1133 (selector_form)` - `feature::Float64Arithmetic`: `crates/metal2vulkan/src/device/metal.rs:230 (unsupported_features)`; `crates/metal2vulkan/src/lower/arith/legal.rs:587 (check_scalar)` -- `feature::Format`: `crates/metal2vulkan-runtime/src/binding_view.rs:146 (binding_view)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:523 (check_formats)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:530 (check_formats)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:545 (check_formats)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:602 (pair_unit)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:694 (plan_levels_copy)`; `crates/metal2vulkan-runtime/src/blit_texture.rs:2206 (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:270 (colour_unit)`; `crates/metal2vulkan-runtime/src/copy_plan.rs:298 (copy_unit)`; `crates/metal2vulkan-runtime/src/copy_plan.rs:344 (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:1625 (read_write_tier)`; `crates/metal2vulkan-runtime/src/families/formats.rs:1628 (sparse_missing)`; `crates/metal2vulkan-runtime/src/families/formats.rs:227 (none)`; `crates/metal2vulkan-runtime/src/families/formats.rs:271 (answers)`; `crates/metal2vulkan-runtime/src/families/formats.rs:291 (answers)`; `crates/metal2vulkan-runtime/src/families/formats.rs:306 (answers)`; `crates/metal2vulkan-runtime/src/families/formats.rs:353 (answers)`; `crates/metal2vulkan-runtime/src/families/formats.rs:392 (answers)`; `crates/metal2vulkan-runtime/src/families/formats.rs:474 (atomic_gap)`; `crates/metal2vulkan-runtime/src/families/formats.rs:508 (lacking)`; `crates/metal2vulkan-runtime/src/families/formats.rs:522 (unsupported)`; `crates/metal2vulkan-runtime/src/image_plan.rs:544 (check_own_memory)`; `crates/metal2vulkan-runtime/src/image_plan.rs:670 (plan_held)`; `crates/metal2vulkan-runtime/src/image_plan.rs:787 (plan_held)`; `crates/metal2vulkan-runtime/src/image_plan.rs:907 (plan_held)`; `crates/metal2vulkan-runtime/src/render.rs:2292 (viewing)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1031 (check_target)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1369 (layout)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1709 (target)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1802 (attachment_format)`; `crates/metal2vulkan-runtime/src/resolve.rs:409 (unmodelled_resolve)`; `crates/metal2vulkan-runtime/src/resolve.rs:616 (color)`; `crates/metal2vulkan-runtime/src/sample_copy.rs:176 (checked_twin)`; `crates/metal2vulkan-runtime/src/sample_copy.rs:204 (plan)`; `crates/metal2vulkan-runtime/src/sample_interleave.rs:301 (interleave_merge)`; `crates/metal2vulkan-runtime/src/shadow.rs:648 (unmerged)`; `crates/metal2vulkan-runtime/src/shadow.rs:655 (unmerged)`; `crates/metal2vulkan-runtime/src/texture.rs:2047 (texture_as)`; `crates/metal2vulkan-runtime/src/texture.rs:3588 (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:1949 (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:150 (unmeasured)`; `crates/metal2vulkan-runtime/src/view_plan.rs:380 (check_format)`; `crates/metal2vulkan-runtime/src/view_plan.rs:393 (check_format)`; `crates/metal2vulkan-runtime/src/view_plan.rs:400 (check_format)`; `crates/metal2vulkan-runtime/src/view_plan.rs:412 (check_format)`; `crates/metal2vulkan-runtime/src/view_plan.rs:422 (check_format)`; `crates/metal2vulkan-runtime/src/ycbcr.rs:285 (refused)`; `crates/metal2vulkan/src/bind/extended_shadow.rs:184 (extended_shadow_module)`; `crates/metal2vulkan/src/bind/plan/resources.rs:1134 (plain_texture)`; `crates/metal2vulkan/src/bind/plan/resources.rs:1814 (extended_sampler)`; `crates/metal2vulkan/src/bind/plan/resources.rs:193 (require_filter_features)`; `crates/metal2vulkan/src/bind/plan/resources.rs:959 (plain_texture)`; `crates/metal2vulkan/src/bind/sample_interleave.rs:304 (finish)`; `crates/metal2vulkan/src/bind/sample_interleave.rs:328 (interleave_split_module)`; `crates/metal2vulkan/src/bind/shadow_copy_in.rs:259 (shadow_copy_in_module)`; `crates/metal2vulkan/src/bind/unused_bits.rs:687 (unused_bits_module)`; `crates/metal2vulkan/src/lower/access/tile.rs:1029 (storage_format)`; `crates/metal2vulkan/src/lower/fragment/color.rs:160 (select_param)`; `crates/metal2vulkan/src/lower/fragment/color.rs:166 (select_param)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1202 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1223 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1229 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1235 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1260 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1437 (plan)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1873 (select_read)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1979 (select_output)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:2006 (select_output)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:2025 (select_output)`; `crates/metal2vulkan/src/lower/sampler/select.rs:1093 (select_extended)`; `crates/metal2vulkan/src/lower/sampler/select.rs:691 (texel_in)`; `crates/metal2vulkan/src/lower/stage_io/extended_color.rs:77 (plan)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:2355 (entry)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:896 (zeroed_output)`; `crates/metal2vulkan/src/lower/stage_io/word_color.rs:83 (plan)`; `crates/metal2vulkan/src/lower/texture/mod.rs:2360 (select)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3002 (cross_class)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3174 (select_image)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3344 (select_read_as)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3381 (select_read_as)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3714 (select_write)`; `crates/metal2vulkan/src/lower/texture/slot.rs:1035 (declare_slot)`; `crates/metal2vulkan/src/lower/texture/slot.rs:1048 (declare_slot)`; `crates/metal2vulkan/src/lower/texture/slot.rs:1054 (declare_slot)`; `crates/metal2vulkan/src/lower/texture/slot.rs:739 (storage_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:742 (storage_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:753 (storage_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:771 (storage_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:791 (storage_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:815 (ulong_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:826 (ulong_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:873 (ulong_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:908 (atomic_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:917 (atomic_format)`; `crates/metal2vulkan/src/metal/format/mod.rs:1693 (vk_format)`; `crates/metal2vulkan/src/metal/format/mod.rs:1695 (vk_format)`; `crates/metal2vulkan/src/metal/format/mod.rs:1825 (candidates)`; `crates/metal2vulkan/src/metal/format/mod.rs:2783 (storage_choice_viewed)`; `crates/metal2vulkan/src/metal/format/mod.rs:2801 (held_storage_choice)`; `crates/metal2vulkan/src/metal/format/mod.rs:2809 (held_storage_choice)`; `crates/metal2vulkan/src/metal/format/mod.rs:2906 (held_storage_choice)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:1100 (extended_write_mask)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:428 (graphics_state)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:474 (graphics_state)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:546 (graphics_state)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:969 (reads_alpha_to_coverage)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:990 (reads_alpha_to_coverage)`; `crates/metal2vulkan/src/pipeline/rotated_blend.rs:449 (rotated_blend)`; `crates/metal2vulkan/src/pipeline/rotated_blend.rs:593 (alpha_in_red_blend)` +- `feature::Format`: `crates/metal2vulkan-runtime/src/binding_view.rs:146 (binding_view)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:523 (check_formats)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:530 (check_formats)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:545 (check_formats)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:602 (pair_unit)`; `crates/metal2vulkan-runtime/src/blit_plan.rs:694 (plan_levels_copy)`; `crates/metal2vulkan-runtime/src/blit_texture.rs:2206 (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:270 (colour_unit)`; `crates/metal2vulkan-runtime/src/copy_plan.rs:298 (copy_unit)`; `crates/metal2vulkan-runtime/src/copy_plan.rs:344 (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:1625 (read_write_tier)`; `crates/metal2vulkan-runtime/src/families/formats.rs:1628 (sparse_missing)`; `crates/metal2vulkan-runtime/src/families/formats.rs:227 (none)`; `crates/metal2vulkan-runtime/src/families/formats.rs:271 (answers)`; `crates/metal2vulkan-runtime/src/families/formats.rs:291 (answers)`; `crates/metal2vulkan-runtime/src/families/formats.rs:306 (answers)`; `crates/metal2vulkan-runtime/src/families/formats.rs:353 (answers)`; `crates/metal2vulkan-runtime/src/families/formats.rs:392 (answers)`; `crates/metal2vulkan-runtime/src/families/formats.rs:474 (atomic_gap)`; `crates/metal2vulkan-runtime/src/families/formats.rs:508 (lacking)`; `crates/metal2vulkan-runtime/src/families/formats.rs:522 (unsupported)`; `crates/metal2vulkan-runtime/src/image_plan.rs:544 (check_own_memory)`; `crates/metal2vulkan-runtime/src/image_plan.rs:670 (plan_held)`; `crates/metal2vulkan-runtime/src/image_plan.rs:787 (plan_held)`; `crates/metal2vulkan-runtime/src/image_plan.rs:907 (plan_held)`; `crates/metal2vulkan-runtime/src/render.rs:2292 (viewing)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1031 (check_target)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1369 (layout)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1709 (target)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1802 (attachment_format)`; `crates/metal2vulkan-runtime/src/resolve.rs:409 (unmodelled_resolve)`; `crates/metal2vulkan-runtime/src/resolve.rs:616 (color)`; `crates/metal2vulkan-runtime/src/sample_copy.rs:176 (checked_twin)`; `crates/metal2vulkan-runtime/src/sample_copy.rs:204 (plan)`; `crates/metal2vulkan-runtime/src/sample_interleave.rs:303 (interleave_merge)`; `crates/metal2vulkan-runtime/src/shadow.rs:649 (unmerged)`; `crates/metal2vulkan-runtime/src/shadow.rs:656 (unmerged)`; `crates/metal2vulkan-runtime/src/texture.rs:2056 (texture_as)`; `crates/metal2vulkan-runtime/src/texture.rs:3602 (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:1949 (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:150 (unmeasured)`; `crates/metal2vulkan-runtime/src/view_plan.rs:380 (check_format)`; `crates/metal2vulkan-runtime/src/view_plan.rs:393 (check_format)`; `crates/metal2vulkan-runtime/src/view_plan.rs:400 (check_format)`; `crates/metal2vulkan-runtime/src/view_plan.rs:412 (check_format)`; `crates/metal2vulkan-runtime/src/view_plan.rs:422 (check_format)`; `crates/metal2vulkan-runtime/src/ycbcr.rs:285 (refused)`; `crates/metal2vulkan/src/bind/extended_shadow.rs:184 (extended_shadow_module)`; `crates/metal2vulkan/src/bind/plan/resources.rs:1134 (plain_texture)`; `crates/metal2vulkan/src/bind/plan/resources.rs:1814 (extended_sampler)`; `crates/metal2vulkan/src/bind/plan/resources.rs:193 (require_filter_features)`; `crates/metal2vulkan/src/bind/plan/resources.rs:959 (plain_texture)`; `crates/metal2vulkan/src/bind/sample_interleave.rs:304 (finish)`; `crates/metal2vulkan/src/bind/sample_interleave.rs:328 (interleave_split_module)`; `crates/metal2vulkan/src/bind/shadow_copy_in.rs:259 (shadow_copy_in_module)`; `crates/metal2vulkan/src/bind/unused_bits.rs:687 (unused_bits_module)`; `crates/metal2vulkan/src/lower/access/tile.rs:1029 (storage_format)`; `crates/metal2vulkan/src/lower/fragment/color.rs:160 (select_param)`; `crates/metal2vulkan/src/lower/fragment/color.rs:166 (select_param)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1202 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1223 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1229 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1235 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1260 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1437 (plan)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1873 (select_read)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1979 (select_output)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:2006 (select_output)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:2025 (select_output)`; `crates/metal2vulkan/src/lower/sampler/select.rs:1093 (select_extended)`; `crates/metal2vulkan/src/lower/sampler/select.rs:691 (texel_in)`; `crates/metal2vulkan/src/lower/stage_io/extended_color.rs:77 (plan)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:2355 (entry)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:896 (zeroed_output)`; `crates/metal2vulkan/src/lower/stage_io/word_color.rs:83 (plan)`; `crates/metal2vulkan/src/lower/texture/mod.rs:2360 (select)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3002 (cross_class)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3174 (select_image)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3344 (select_read_as)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3381 (select_read_as)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3714 (select_write)`; `crates/metal2vulkan/src/lower/texture/slot.rs:1035 (declare_slot)`; `crates/metal2vulkan/src/lower/texture/slot.rs:1048 (declare_slot)`; `crates/metal2vulkan/src/lower/texture/slot.rs:1054 (declare_slot)`; `crates/metal2vulkan/src/lower/texture/slot.rs:739 (storage_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:742 (storage_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:753 (storage_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:771 (storage_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:791 (storage_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:815 (ulong_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:826 (ulong_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:873 (ulong_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:908 (atomic_format)`; `crates/metal2vulkan/src/lower/texture/slot.rs:917 (atomic_format)`; `crates/metal2vulkan/src/metal/format/mod.rs:1693 (vk_format)`; `crates/metal2vulkan/src/metal/format/mod.rs:1695 (vk_format)`; `crates/metal2vulkan/src/metal/format/mod.rs:1825 (candidates)`; `crates/metal2vulkan/src/metal/format/mod.rs:2783 (storage_choice_viewed)`; `crates/metal2vulkan/src/metal/format/mod.rs:2801 (held_storage_choice)`; `crates/metal2vulkan/src/metal/format/mod.rs:2809 (held_storage_choice)`; `crates/metal2vulkan/src/metal/format/mod.rs:2906 (held_storage_choice)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:1100 (extended_write_mask)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:428 (graphics_state)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:474 (graphics_state)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:546 (graphics_state)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:969 (reads_alpha_to_coverage)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:990 (reads_alpha_to_coverage)`; `crates/metal2vulkan/src/pipeline/rotated_blend.rs:449 (rotated_blend)`; `crates/metal2vulkan/src/pipeline/rotated_blend.rs:593 (alpha_in_red_blend)` - `feature::DivergentImplicitLod`: `crates/metal2vulkan/src/lower/sampler/select.rs:352 (select_sampling)` - `feature::ImplicitLodOutsideFragment`: `crates/metal2vulkan/src/lower/sampler/constexpr.rs:136 (query_min_level)`; `crates/metal2vulkan/src/lower/sampler/select.rs:229 (query_level_measured)`; `crates/metal2vulkan/src/lower/sampler/select.rs:255 (query_min_level)` - `feature::MinLodClamp`: `crates/metal2vulkan/src/lower/sampler/select.rs:1572 (select_one)`; `crates/metal2vulkan/src/lower/sampler/select.rs:973 (min_lod)` @@ -343,31 +343,31 @@ Each refusal's sites, with the function that builds it. - `feature::SamplerLodBias`: `crates/metal2vulkan/src/lower/sampler/constexpr.rs:258 (constexpr_desc)`; `crates/metal2vulkan/src/lower/sampler/constexpr.rs:265 (constexpr_desc)`; `crates/metal2vulkan/src/lower/sampler/constexpr.rs:271 (constexpr_desc)` - `feature::SamplerCompare`: `crates/metal2vulkan/src/metal/sampler.rs:260 (check_sampler)` - `feature::PixelSamplerCompare`: `crates/metal2vulkan/src/lower/sampler/constexpr.rs:115 (lowered)` -- `feature::TexelBuffer`: `crates/metal2vulkan/src/bind/instantiate.rs:880 (texel_ranges)`; `crates/metal2vulkan/src/bind/instantiate.rs:886 (texel_ranges)`; `crates/metal2vulkan/src/bind/plan/resources.rs:1147 (plain_texture)` +- `feature::TexelBuffer`: `crates/metal2vulkan/src/bind/instantiate.rs:882 (texel_ranges)`; `crates/metal2vulkan/src/bind/instantiate.rs:888 (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:1018 (state)`; `crates/metal2vulkan-runtime/src/render.rs:5894 (next_instance)`; `crates/metal2vulkan-runtime/src/sample_planes.rs:120 (lacks)`; `crates/metal2vulkan-runtime/src/sample_planes.rs:147 (new)`; `crates/metal2vulkan-runtime/src/sample_planes.rs:518 (planes_merge)`; `crates/metal2vulkan/src/bind/extended_shadow.rs:190 (extended_shadow_module)`; `crates/metal2vulkan/src/bind/sample_planes.rs:477 (finish)`; `crates/metal2vulkan/src/device/metal.rs:252 (unsupported_features)`; `crates/metal2vulkan/src/lower/arith/extended_range/blend.rs:1218 (unorm8)`; `crates/metal2vulkan/src/lower/arith/extended_range/blend.rs:1236 (unorm8)`; `crates/metal2vulkan/src/lower/arith/extended_range/blend.rs:1250 (unorm8)`; `crates/metal2vulkan/src/lower/arith/extended_range/blend.rs:1293 (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:1087 (storage_form)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1178 (storage_form)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1215 (extended_range_blend)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1827 (plan_sample)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:789 (not_implemented)`; `crates/metal2vulkan/src/pipeline/link/fetch.rs:164 (storage_attachments)` - `feature::PrimitiveId`: `crates/metal2vulkan-runtime/src/families/features.rs:1127 (state)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:3211 (finish)`; `crates/metal2vulkan/src/pipeline/link/varyings.rs:240 (check_primitive_id)` - `feature::PrivatePrimitives`: `crates/metal2vulkan/src/lower/stage_io/plan.rs:2601 (indices_feature)` -- `feature::VertexAmplification`: `crates/metal2vulkan/src/bind/graphics.rs:3999 (multiview_instances)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:1312 (own_index_store)`; `crates/metal2vulkan/src/lower/tessellation/mod.rs:718 (select_param)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:258 (vertex_amplification)`; `crates/metal2vulkan/src/pipeline/link/tessellation/mod.rs:228 (control_plan)` -- `feature::LayeredRendering`: `crates/metal2vulkan-runtime/src/render_pass.rs:1669 (target)`; `crates/metal2vulkan-runtime/src/render_state.rs:1107 (needs_viewports)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:781 (target_index)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:800 (target_index)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:1313 (own_index_store)`; `crates/metal2vulkan/src/pipeline/link/geometry.rs:150 (not_implemented)`; `crates/metal2vulkan/src/pipeline/link/geometry.rs:172 (refused)` -- `feature::ClipDistance`: `crates/metal2vulkan/src/lower/mesh/mod.rs:941 (select)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:949 (select)` +- `feature::VertexAmplification`: `crates/metal2vulkan/src/bind/graphics.rs:4113 (multiview_instances)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:1312 (own_index_store)`; `crates/metal2vulkan/src/lower/tessellation/mod.rs:718 (select_param)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:258 (vertex_amplification)`; `crates/metal2vulkan/src/pipeline/link/tessellation/mod.rs:228 (control_plan)` +- `feature::LayeredRendering`: `crates/metal2vulkan-runtime/src/render_pass.rs:1669 (target)`; `crates/metal2vulkan-runtime/src/render_state.rs:1107 (needs_viewports)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:796 (target_index)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:815 (target_index)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:1313 (own_index_store)`; `crates/metal2vulkan/src/pipeline/link/geometry.rs:150 (not_implemented)`; `crates/metal2vulkan/src/pipeline/link/geometry.rs:172 (refused)` +- `feature::ClipDistance`: `crates/metal2vulkan/src/lower/mesh/mod.rs:956 (select)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:964 (select)` - `feature::DualSourceBlending`: `crates/metal2vulkan-runtime/src/families/formats.rs:386 (answers)`; `crates/metal2vulkan/src/metal/state.rs:37 (blend_factor)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:1157 (check_outputs)`; `crates/metal2vulkan/src/pipeline/rotated_blend.rs:463 (rotated_blend)`; `crates/metal2vulkan/src/pipeline/rotated_blend.rs:538 (rotated_blend)` - `feature::Barycentrics`: `crates/metal2vulkan/src/device/metal.rs:263 (unsupported_features)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:1924 (input_builtin)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:745 (param)`; `crates/metal2vulkan/src/pipeline/link/geometry.rs:148 (not_implemented)`; `crates/metal2vulkan/src/pipeline/link/geometry.rs:170 (refused)` -- `feature::StencilExport`: `crates/metal2vulkan-runtime/src/families/features.rs:1114 (state)`; `crates/metal2vulkan/src/bind/graphics.rs:2685 (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:1114 (state)`; `crates/metal2vulkan/src/bind/graphics.rs:2719 (shadow_stencil_words)`; `crates/metal2vulkan/src/lower/fragment/stencil.rs:157 (device_form)`; `crates/metal2vulkan/src/lower/fragment/stencil.rs:168 (not_implemented)`; `crates/metal2vulkan/src/pipeline/link/stencil.rs:55 (shadow_stencil)`; `crates/metal2vulkan/src/pipeline/link/stencil.rs:73 (shadow_stencil)` - `feature::SampleRateShading`: `crates/metal2vulkan/src/pipeline/link/graphics.rs:844 (sample_invocations)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:846 (sample_invocations)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:928 (sample_invocations)` - `feature::PixelCoverageAtSampleRate`: `crates/metal2vulkan/src/lower/fragment/coverage.rs:296 (finish)`; `crates/metal2vulkan/src/lower/simd/mod.rs:754 (select_param)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:879 (sample_invocations)` - `feature::InterfaceComponents`: `crates/metal2vulkan/src/pipeline/compile/color_group.rs:202 (refusal)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:301 (graphics_state)`; `crates/metal2vulkan/src/pipeline/link/varyings.rs:409 (assign)`; `crates/metal2vulkan/src/pipeline/link/varyings.rs:90 (limit_error)` - `feature::UnmatchedVarying`: `crates/metal2vulkan/src/pipeline/link/varyings.rs:318 (mesh_fragment)`; `crates/metal2vulkan/src/pipeline/link/varyings.rs:537 (varyings)`; `crates/metal2vulkan/src/pipeline/link/varyings.rs:548 (varyings)` - `feature::KernelStageIn`: `crates/metal2vulkan-runtime/src/indirect_execute.rs:376 (record)`; `crates/metal2vulkan/src/bind/dispatch.rs:871 (instantiate)`; `crates/metal2vulkan/src/lower/stage_io/stage_in.rs:133 (select)` -- `feature::Tessellation`: `crates/metal2vulkan-air/src/canon/mod.rs:1256 (post_check)`; `crates/metal2vulkan-air/src/canon/mod.rs:1347 (post_check)`; `crates/metal2vulkan/src/bind/graphics.rs:3856 (tessellation_dispatch)`; `crates/metal2vulkan/src/lower/stage_io/fetch.rs:519 (select)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:1508 (primitive_id_output)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:1794 (input_builtin)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:828 (param)`; `crates/metal2vulkan/src/lower/tessellation/mod.rs:150 (not_implemented)`; `crates/metal2vulkan/src/lower/tessellation/mod.rs:489 (plan_entry)`; `crates/metal2vulkan/src/metal/vertex.rs:219 (fetch_as)`; `crates/metal2vulkan/src/pipeline/link/tessellation/mod.rs:212 (control_plan)`; `crates/metal2vulkan/src/pipeline/link/tessellation/mod.rs:292 (check_fragment)`; `crates/metal2vulkan/src/pipeline/link/tessellation/mod.rs:316 (push_offset)` -- `feature::MeshShading`: `crates/metal2vulkan/src/bind/graphics.rs:1604 (plan)`; `crates/metal2vulkan/src/bind/graphics.rs:3058 (mesh_limit)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:502 (check_payload)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:541 (plan_entry)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:575 (plan_entry)`; `crates/metal2vulkan/src/memory/plan.rs:2056 (reprs)`; `crates/metal2vulkan/src/pipeline/link/mesh.rs:102 (records)` -- `feature::TileShading`: `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:520 (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:699 (tile_pipeline)` +- `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:3970 (tessellation_dispatch)`; `crates/metal2vulkan/src/lower/stage_io/fetch.rs:519 (select)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:1508 (primitive_id_output)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:1794 (input_builtin)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:828 (param)`; `crates/metal2vulkan/src/lower/tessellation/mod.rs:150 (not_implemented)`; `crates/metal2vulkan/src/lower/tessellation/mod.rs:489 (plan_entry)`; `crates/metal2vulkan/src/metal/vertex.rs:219 (fetch_as)`; `crates/metal2vulkan/src/pipeline/link/tessellation/mod.rs:212 (control_plan)`; `crates/metal2vulkan/src/pipeline/link/tessellation/mod.rs:292 (check_fragment)`; `crates/metal2vulkan/src/pipeline/link/tessellation/mod.rs:316 (push_offset)` +- `feature::MeshShading`: `crates/metal2vulkan/src/bind/graphics.rs:1630 (plan)`; `crates/metal2vulkan/src/bind/graphics.rs:3095 (mesh_limit)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:517 (check_payload)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:556 (plan_entry)`; `crates/metal2vulkan/src/lower/mesh/mod.rs:590 (plan_entry)`; `crates/metal2vulkan/src/memory/plan.rs:2056 (reprs)`; `crates/metal2vulkan/src/pipeline/link/mesh.rs:102 (records)` +- `feature::TileShading`: `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:520 (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:702 (tile_pipeline)` - `feature::Imageblocks`: `crates/metal2vulkan/src/lower/access/imageblock.rs:98 (imageblocks)`; `crates/metal2vulkan/src/lower/access/mod.rs:908 (select_param)`; `crates/metal2vulkan/src/lower/fragment/imageblock.rs:104 (require)`; `crates/metal2vulkan/src/lower/fragment/imageblock.rs:412 (reach)`; `crates/metal2vulkan/src/lower/fragment/imageblock.rs:554 (plan_tests)`; `crates/metal2vulkan/src/lower/fragment/imageblock.rs:578 (plan_tests)`; `crates/metal2vulkan/src/lower/fragment/imageblock.rs:86 (not_implemented)`; `crates/metal2vulkan/src/lower/texture/mod.rs:2370 (select)`; `crates/metal2vulkan/src/lower/texture/slice.rs:139 (imageblocks)`; `crates/metal2vulkan/src/pipeline/link/imageblock.rs:50 (fragment_imageblock)` - `feature::RayTracing`: `crates/metal2vulkan/src/bind/acceleration.rs:202 (instance_record)`; `crates/metal2vulkan/src/bind/acceleration.rs:216 (instance_record)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:1087 (primitive_data_read)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:1202 (instance_count)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:1245 (intersect)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:1257 (intersect)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:1282 (intersect)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:1297 (intersect)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:1312 (intersect)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:344 (slot_of)`; `crates/metal2vulkan/src/lower/raytracing/mod.rs:385 (select_param)`; `crates/metal2vulkan/src/lower/select.rs:899 (route_air)` - `feature::Tensors`: `crates/metal2vulkan-air/src/canon/matmul2d/synth.rs:32 (refuse)`; `crates/metal2vulkan/src/lower/select.rs:903 (route_air)` - `feature::RasterizationRateMap`: `crates/metal2vulkan/src/lower/fragment/mod.rs:930 (select)` -- `feature::GpuEncodedIndirectCommands`: `crates/metal2vulkan/src/bind/replay.rs:556 (preprocess)`; `crates/metal2vulkan/src/bind/replay.rs:796 (replay_preprocess_module)`; `crates/metal2vulkan/src/bind/replay/draws.rs:280 (draw_replay_preprocess)`; `crates/metal2vulkan/src/bind/replay/draws.rs:482 (draw_replay_module)`; `crates/metal2vulkan/src/bind/replay/flat.rs:247 (flat_dispatch_module)`; `crates/metal2vulkan/src/bind/replay/merged.rs:242 (draw_merge_module)`; `crates/metal2vulkan/src/lower/access/encode.rs:394 (needs)`; `crates/metal2vulkan/src/lower/access/encode.rs:410 (needs)`; `crates/metal2vulkan/src/lower/access/encode.rs:527 (select_command)`; `crates/metal2vulkan/src/lower/access/mod.rs:1539 (plan_replay)`; `crates/metal2vulkan/src/lower/access/mod.rs:1562 (plan_replay)`; `crates/metal2vulkan/src/lower/access/mod.rs:1565 (plan_replay)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:2707 (merged)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:2763 (finish_merged)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:458 (param)`; `crates/metal2vulkan/src/pipeline/compile.rs:2126 (plan_one)`; `crates/metal2vulkan/src/pipeline/compile.rs:2131 (plan_one)` -- `feature::VulkanVersion`: `crates/metal2vulkan/src/ash_interop/query.rs:926 (query)`; `crates/metal2vulkan/src/device/derive.rs:105 (with_deviations)` +- `feature::GpuEncodedIndirectCommands`: `crates/metal2vulkan/src/bind/replay.rs:556 (preprocess)`; `crates/metal2vulkan/src/bind/replay.rs:796 (replay_preprocess_module)`; `crates/metal2vulkan/src/bind/replay/draws.rs:280 (draw_replay_preprocess)`; `crates/metal2vulkan/src/bind/replay/draws.rs:482 (draw_replay_module)`; `crates/metal2vulkan/src/bind/replay/flat.rs:247 (flat_dispatch_module)`; `crates/metal2vulkan/src/bind/replay/merged.rs:242 (draw_merge_module)`; `crates/metal2vulkan/src/lower/access/encode.rs:394 (needs)`; `crates/metal2vulkan/src/lower/access/encode.rs:410 (needs)`; `crates/metal2vulkan/src/lower/access/encode.rs:527 (select_command)`; `crates/metal2vulkan/src/lower/access/mod.rs:1540 (plan_replay)`; `crates/metal2vulkan/src/lower/access/mod.rs:1566 (plan_replay)`; `crates/metal2vulkan/src/lower/access/mod.rs:1569 (plan_replay)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:2707 (merged)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:2763 (finish_merged)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:458 (param)`; `crates/metal2vulkan/src/pipeline/compile.rs:2126 (plan_one)`; `crates/metal2vulkan/src/pipeline/compile.rs:2131 (plan_one)` +- `feature::VulkanVersion`: `crates/metal2vulkan/src/ash_interop/query.rs:927 (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)` - `feature::BitcodeRecord`: `crates/metal2vulkan-air/src/bitcode/attrs.rs:337 (decode_lists)`; `crates/metal2vulkan-air/src/bitcode/function.rs:572 (symtab)`; `crates/metal2vulkan-air/src/bitcode/metadata.rs:130 (decode)`; `crates/metal2vulkan-air/src/bitcode/metadata.rs:157 (decode)`; `crates/metal2vulkan-air/src/bitcode/module.rs:727 (check_bodies)`; `crates/metal2vulkan-air/src/bitcode/module.rs:872 (symtab)`; `crates/metal2vulkan/src/error/mod.rs:257 (from)` @@ -381,7 +381,7 @@ 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:455`; `crates/metal2vulkan/src/bind/dispatch.rs:953 (instantiate)`; `crates/metal2vulkan/src/bind/graphics.rs:3272 (mesh_draw)`; `crates/metal2vulkan/src/bind/graphics.rs:3323 (emulated_draw)` +- `feature::GroupCount`: `crates/metal2vulkan/src/bind/dispatch.rs:379 (product)`; `crates/metal2vulkan/src/bind/dispatch.rs:455`; `crates/metal2vulkan/src/bind/dispatch.rs:953 (instantiate)`; `crates/metal2vulkan/src/bind/graphics.rs:3384 (mesh_draw)`; `crates/metal2vulkan/src/bind/graphics.rs:3437 (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:2173 (check_pipeline)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:1017 (uniform_blend)` - `feature::RasterSampleCount`: `crates/metal2vulkan-runtime/src/families/limits.rs:1063 (sample_count)`; `crates/metal2vulkan/src/pipeline/graphics.rs:563 (sample_count_properties)` @@ -392,11 +392,11 @@ 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:1196 (check_image_limits)` - `feature::TextureSampleCount`: `crates/metal2vulkan-runtime/src/image_plan.rs:1244 (check_image_limits)`; `crates/metal2vulkan-runtime/src/image_plan.rs:598 (plan_held)`; `crates/metal2vulkan-runtime/src/image_plan.rs:608 (plan_held)` -- `feature::TextureView`: `crates/metal2vulkan-runtime/src/binding_view.rs:156 (binding_view)`; `crates/metal2vulkan-runtime/src/texture.rs:5136 (view)`; `crates/metal2vulkan-runtime/src/texture/decoded_twin.rs:1427 (make_second_twin)`; `crates/metal2vulkan-runtime/src/texture/view_shadow.rs:298 (apart_refusal)`; `crates/metal2vulkan-runtime/src/view_plan.rs:433 (check_format)`; `crates/metal2vulkan-runtime/src/view_plan.rs:483 (check_view)`; `crates/metal2vulkan-runtime/src/view_plan.rs:505 (check_view)` -- `feature::TextureSwizzle`: `crates/metal2vulkan-runtime/src/binding_view.rs:167 (binding_view)`; `crates/metal2vulkan-runtime/src/texture.rs:996 (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:3409 (select_read_as)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3756 (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:5150 (view)`; `crates/metal2vulkan-runtime/src/texture/decoded_twin.rs:1427 (make_second_twin)`; `crates/metal2vulkan-runtime/src/texture/view_shadow.rs:298 (apart_refusal)`; `crates/metal2vulkan-runtime/src/view_plan.rs:433 (check_format)`; `crates/metal2vulkan-runtime/src/view_plan.rs:483 (check_view)`; `crates/metal2vulkan-runtime/src/view_plan.rs:505 (check_view)` +- `feature::TextureSwizzle`: `crates/metal2vulkan-runtime/src/binding_view.rs:167 (binding_view)`; `crates/metal2vulkan-runtime/src/texture.rs:998 (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:3409 (select_read_as)`; `crates/metal2vulkan/src/lower/texture/mod.rs:3756 (select_write)`; `crates/metal2vulkan/src/lower/texture/slice.rs:307 (select)` - `feature::MipmapGeneration`: `crates/metal2vulkan-runtime/src/blit_texture.rs:1890 (mipmaps)`; `crates/metal2vulkan-runtime/src/mipmap_pick.rs:37 (pick_mipmaps)`; `crates/metal2vulkan-runtime/src/mipmap_plan.rs:262 (plan_mipmaps)`; `crates/metal2vulkan-runtime/src/mipmap_plan.rs:270 (plan_mipmaps)`; `crates/metal2vulkan-runtime/src/mipmap_plan.rs:275 (plan_mipmaps)`; `crates/metal2vulkan-runtime/src/mipmap_plan.rs:304 (plan_mipmaps)`; `crates/metal2vulkan/src/bind/mipmap_filter.rs:973 (mipmap_filter_module)` - `feature::HostMemory`: `crates/metal2vulkan-runtime/src/host_memory.rs:430 (not_importable)`; `crates/metal2vulkan-runtime/src/host_memory.rs:470 (refuse_unwritable)`; `crates/metal2vulkan-runtime/src/host_memory.rs:689 (new)`; `crates/metal2vulkan-runtime/src/host_memory.rs:694 (new)`; `crates/metal2vulkan-runtime/src/host_memory.rs:712 (new)` -- `feature::GpuTimes`: `crates/metal2vulkan-runtime/src/command_buffer/mod.rs:2840 (gpu_times)` +- `feature::GpuTimes`: `crates/metal2vulkan-runtime/src/command_buffer/mod.rs:2850 (gpu_times)` - `feature::CountingVisibility`: `crates/metal2vulkan-runtime/src/visibility.rs:452 (check_mode)` - `feature::ViewFormatReinterpretation`: `crates/metal2vulkan-runtime/src/view_plan.rs:570 (reinterpretation_refused)` - `feature::SeparateMultisampledDepthStencil`: `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:188 (sampled_candidate)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:294 (by_draws)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:336 (scratch)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:376 (scratch)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:777 (plan)`; `crates/metal2vulkan-runtime/src/nan_clear.rs:658 (nan_write)`; `crates/metal2vulkan-runtime/src/texture/signed_depth.rs:191 (sample_strip)` @@ -419,23 +419,23 @@ Each refusal's sites, with the function that builds it. - `feature::ProgramScopeBinding`: `crates/metal2vulkan-air/src/abi/module.rs:77 (decode)`; `crates/metal2vulkan/src/error/mod.rs:267 (from)` - `feature::SeqCstFence`: `crates/metal2vulkan/src/lower/sync/barrier.rs:443 (require_seq_cst)` - `feature::PostDepthCoverage`: `crates/metal2vulkan-runtime/src/families/features.rs:1219 (state)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:783 (param)` -- `gap::Textures`: `crates/metal2vulkan-runtime/src/blit_texture.rs:163 (check_depth_view)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:1563 (view_usage)`; `crates/metal2vulkan-runtime/src/pipeline/mod.rs:1625 (compile_error)`; `crates/metal2vulkan-runtime/src/texture.rs:1461 (image_error)`; `crates/metal2vulkan-runtime/src/texture.rs:2221 (storage_over_buffer)`; `crates/metal2vulkan-runtime/src/texture.rs:3036 (new_image_starting)`; `crates/metal2vulkan-runtime/src/texture.rs:4078 (image)`; `crates/metal2vulkan-runtime/src/texture.rs:5703 (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:1563 (view_usage)`; `crates/metal2vulkan-runtime/src/pipeline/mod.rs:1625 (compile_error)`; `crates/metal2vulkan-runtime/src/texture.rs:1463 (image_error)`; `crates/metal2vulkan-runtime/src/texture.rs:2230 (storage_over_buffer)`; `crates/metal2vulkan-runtime/src/texture.rs:3050 (new_image_starting)`; `crates/metal2vulkan-runtime/src/texture.rs:4092 (image)`; `crates/metal2vulkan-runtime/src/texture.rs:5717 (host_copy)`; `crates/metal2vulkan-runtime/src/texture/surface_two_planes.rs:207 (new_surface_planes_texture)` - `gap::ResourceHeap`: `crates/metal2vulkan-runtime/src/binding.rs:1982 (descriptor)` -- `gap::SparseHeaps`: `crates/metal2vulkan-runtime/src/sparse/encoder.rs:465 (first_slice)`; `crates/metal2vulkan-runtime/src/texture.rs:1674 (plan_sparse_texture)`; `crates/metal2vulkan-runtime/src/texture.rs:4826 (make_aliasable)` -- `gap::SparseTileMaps`: `crates/metal2vulkan-runtime/src/binding.rs:562 (slot_tile_map)`; `crates/metal2vulkan-runtime/src/sparse/texture.rs:30 (sparse_refusal)`; `crates/metal2vulkan-runtime/src/texture.rs:1707 (plan_sparse_texture)` +- `gap::SparseHeaps`: `crates/metal2vulkan-runtime/src/sparse/encoder.rs:465 (first_slice)`; `crates/metal2vulkan-runtime/src/texture.rs:1683 (plan_sparse_texture)`; `crates/metal2vulkan-runtime/src/texture.rs:4840 (make_aliasable)` +- `gap::SparseTileMaps`: `crates/metal2vulkan-runtime/src/binding.rs:562 (slot_tile_map)`; `crates/metal2vulkan-runtime/src/sparse/texture.rs:30 (sparse_refusal)`; `crates/metal2vulkan-runtime/src/texture.rs:1716 (plan_sparse_texture)` - `gap::HeapPastMaxBufferSize`: `crates/metal2vulkan-runtime/src/heap.rs:714 (heap_size)` - `gap::HeapTextureAlignment`: `crates/metal2vulkan-runtime/src/texture/heap.rs:1071 (check_heap_base)` - `gap::HeapTextureMemory`: `crates/metal2vulkan-runtime/src/texture/heap.rs:1510 (heap_plan)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:1517 (heap_plan)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2059 (host_heap_plan)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2291 (memory_shadow)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:554 (memory_refusal)` - `gap::FunctionTablePastMaxBufferLength`: `crates/metal2vulkan-runtime/src/function_table.rs:622 (past_limit)` -- `gap::IndirectCommandBufferPastMaxBufferLength`: `crates/metal2vulkan-runtime/src/indirect_command_buffer.rs:522 (new_indirect_command_buffer)` -- `gap::IndirectRenderCommands`: `crates/metal2vulkan-runtime/src/compute.rs:1291 (execute_range)`; `crates/metal2vulkan-runtime/src/compute.rs:1376 (execute_indirect_range)`; `crates/metal2vulkan-runtime/src/depth_stencil.rs:85 (gpu_resource_id)`; `crates/metal2vulkan-runtime/src/indirect_command_buffer.rs:4368 (render_state)`; `crates/metal2vulkan-runtime/src/indirect_command_buffer.rs:517 (new_indirect_command_buffer)`; `crates/metal2vulkan-runtime/src/pipeline/mod.rs:1632 (compile_error)`; `crates/metal2vulkan-runtime/src/render.rs:7196 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:7681 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:8098 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:8605 (draw_resident)`; `crates/metal2vulkan-runtime/src/render/executions.rs:1106 (back_memoryless)`; `crates/metal2vulkan-runtime/src/render/executions.rs:2916 (record_forms)`; `crates/metal2vulkan-runtime/src/render/executions.rs:382 (execute_range)`; `crates/metal2vulkan-runtime/src/render/executions.rs:441 (execute_indirect_range)`; `crates/metal2vulkan-runtime/src/render/executions.rs:456 (execute_indirect_range)` -- `gap::IndirectImageblockSize`: `crates/metal2vulkan-runtime/src/indirect_command_buffer.rs:3363 (set_imageblock_size)` +- `gap::IndirectCommandBufferPastMaxBufferLength`: `crates/metal2vulkan-runtime/src/indirect_command_buffer.rs:523 (new_indirect_command_buffer)` +- `gap::IndirectRenderCommands`: `crates/metal2vulkan-runtime/src/compute.rs:1291 (execute_range)`; `crates/metal2vulkan-runtime/src/compute.rs:1376 (execute_indirect_range)`; `crates/metal2vulkan-runtime/src/depth_stencil.rs:85 (gpu_resource_id)`; `crates/metal2vulkan-runtime/src/indirect_command_buffer.rs:4422 (render_state)`; `crates/metal2vulkan-runtime/src/indirect_command_buffer.rs:518 (new_indirect_command_buffer)`; `crates/metal2vulkan-runtime/src/pipeline/mod.rs:1632 (compile_error)`; `crates/metal2vulkan-runtime/src/render.rs:7196 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:7731 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:8188 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:8738 (draw_resident)`; `crates/metal2vulkan-runtime/src/render/executions.rs:1126 (back_memoryless)`; `crates/metal2vulkan-runtime/src/render/executions.rs:2941 (record_forms)`; `crates/metal2vulkan-runtime/src/render/executions.rs:393 (execute_range)`; `crates/metal2vulkan-runtime/src/render/executions.rs:461 (execute_indirect_range)`; `crates/metal2vulkan-runtime/src/render/executions.rs:476 (execute_indirect_range)` +- `gap::IndirectImageblockSize`: `crates/metal2vulkan-runtime/src/indirect_command_buffer.rs:3397 (set_imageblock_size)` - `gap::CommandReplay`: `crates/metal2vulkan-runtime/src/binding.rs:723 (bind_into)`; `crates/metal2vulkan-runtime/src/binding.rs:726 (bind_into)` - `gap::RenderAttachments`: `crates/metal2vulkan-runtime/src/binding.rs:1794 (unexpected)` - `gap::AccelerationStructures`: `crates/metal2vulkan-runtime/src/binding.rs:1797 (unexpected)` -- `gap::FeatureEnable`: `crates/metal2vulkan-runtime/src/enables.rs:1165 (of)` -- `gap::ExtensionEnable`: `crates/metal2vulkan-runtime/src/enables.rs:1156 (of)` -- `gap::Render`: `crates/metal2vulkan-runtime/src/attachment_stand_in.rs:404 (stand_in_as)`; `crates/metal2vulkan-runtime/src/attachment_stand_in.rs:460 (stand_in_as)`; `crates/metal2vulkan-runtime/src/attachment_stand_in.rs:684 (check_copies)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:796 (attachment_twin)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:283 (check_sizes)`; `crates/metal2vulkan-runtime/src/kept_bytes.rs:138 (settle)`; `crates/metal2vulkan-runtime/src/linear_attachment.rs:293 (settle)`; `crates/metal2vulkan-runtime/src/nan_clear.rs:204 (plan)`; `crates/metal2vulkan-runtime/src/pipeline/render.rs:1169 (imageblock_sample_length)`; `crates/metal2vulkan-runtime/src/render.rs:2223 (check_pipeline)`; `crates/metal2vulkan-runtime/src/render.rs:5940 (next_instance)`; `crates/metal2vulkan-runtime/src/render.rs:7775 (draw_resident)`; `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:516 (scratch)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1313 (layout)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1676 (target)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1730 (target)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1791 (attachment_format)`; `crates/metal2vulkan-runtime/src/render_pass.rs:2024 (depth_stencil)`; `crates/metal2vulkan-runtime/src/resolve.rs:1035 (attach)`; `crates/metal2vulkan-runtime/src/resolve.rs:1103 (color_copy)`; `crates/metal2vulkan-runtime/src/resolve.rs:1150 (destination)`; `crates/metal2vulkan-runtime/src/resolve.rs:1167 (destination)`; `crates/metal2vulkan-runtime/src/resolve.rs:1232 (destination)` +- `gap::FeatureEnable`: `crates/metal2vulkan-runtime/src/enables.rs:1166 (of)` +- `gap::ExtensionEnable`: `crates/metal2vulkan-runtime/src/enables.rs:1157 (of)` +- `gap::Render`: `crates/metal2vulkan-runtime/src/attachment_stand_in.rs:404 (stand_in_as)`; `crates/metal2vulkan-runtime/src/attachment_stand_in.rs:460 (stand_in_as)`; `crates/metal2vulkan-runtime/src/attachment_stand_in.rs:684 (check_copies)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:796 (attachment_twin)`; `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:283 (check_sizes)`; `crates/metal2vulkan-runtime/src/kept_bytes.rs:138 (settle)`; `crates/metal2vulkan-runtime/src/linear_attachment.rs:293 (settle)`; `crates/metal2vulkan-runtime/src/nan_clear.rs:204 (plan)`; `crates/metal2vulkan-runtime/src/pipeline/render.rs:1169 (imageblock_sample_length)`; `crates/metal2vulkan-runtime/src/render.rs:2223 (check_pipeline)`; `crates/metal2vulkan-runtime/src/render.rs:5940 (next_instance)`; `crates/metal2vulkan-runtime/src/render.rs:7825 (draw_resident)`; `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:516 (scratch)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1313 (layout)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1676 (target)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1730 (target)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1791 (attachment_format)`; `crates/metal2vulkan-runtime/src/render_pass.rs:2024 (depth_stencil)`; `crates/metal2vulkan-runtime/src/resolve.rs:1035 (attach)`; `crates/metal2vulkan-runtime/src/resolve.rs:1103 (color_copy)`; `crates/metal2vulkan-runtime/src/resolve.rs:1150 (destination)`; `crates/metal2vulkan-runtime/src/resolve.rs:1167 (destination)`; `crates/metal2vulkan-runtime/src/resolve.rs:1232 (destination)` - `gap::TexelsPastBufferLength`: `crates/metal2vulkan-runtime/src/buffer_texture.rs:261 (refusal_error)`; `crates/metal2vulkan-runtime/src/texture/surface_depth.rs:105 (surface_depth_twin)` - `gap::OverlappingSurfaceRows`: `crates/metal2vulkan-runtime/src/buffer_texture.rs:263 (refusal_error)` - `gap::SamplePositionsAtBegin`: `crates/metal2vulkan-runtime/src/depth_stencil_scratch.rs:145 (stencil_scratch)`; `crates/metal2vulkan-runtime/src/render_pass.rs:1861 (positioned_stand_in)`; `crates/metal2vulkan-runtime/src/sample_positions.rs:185 (grid)` @@ -444,7 +444,7 @@ Each refusal's sites, with the function that builds it. - `gap::NonFiniteDepthBias`: `crates/metal2vulkan-runtime/src/render_state.rs:1603 (collapses)`; `crates/metal2vulkan-runtime/src/render_state.rs:1606 (collapses)`; `crates/metal2vulkan-runtime/src/render_state.rs:365 (set_depth_bias)`; `crates/metal2vulkan-runtime/src/render_state.rs:463 (draw_viewports)`; `crates/metal2vulkan-runtime/src/render_state.rs:605 (compensation)` - `gap::DepthNeverWithoutAttachment`: `crates/metal2vulkan-runtime/src/depth_stencil.rs:147 (failing_draw)` - `gap::HiddenDepthStencil`: `crates/metal2vulkan-runtime/src/attachment_stand_in.rs:563 (hidden)`; `crates/metal2vulkan-runtime/src/render.rs:6617 (hidden_depth_stencil)` -- `gap::IndirectDrawArguments`: `crates/metal2vulkan-runtime/src/index_bounds.rs:91 (new)`; `crates/metal2vulkan-runtime/src/render.rs:3302 (draw_indexed_primitives_indirect)`; `crates/metal2vulkan-runtime/src/render.rs:7516 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:7585 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:7616 (draw_resident)` +- `gap::IndirectDrawArguments`: `crates/metal2vulkan-runtime/src/index_bounds.rs:91 (new)`; `crates/metal2vulkan-runtime/src/render.rs:3302 (draw_indexed_primitives_indirect)`; `crates/metal2vulkan-runtime/src/render.rs:7521 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:7635 (draw_resident)`; `crates/metal2vulkan-runtime/src/render.rs:7666 (draw_resident)` - `gap::DepthStencilResolve`: `crates/metal2vulkan-runtime/src/depth_stencil_resolve.rs:441 (draws_run)`; `crates/metal2vulkan-runtime/src/resolve.rs:1388 (plan)`; `crates/metal2vulkan-runtime/src/resolve.rs:787 (depth_stencil)`; `crates/metal2vulkan-runtime/src/resolve.rs:885 (steps)`; `crates/metal2vulkan-runtime/src/resolve.rs:905 (steps)`; `crates/metal2vulkan-runtime/src/resolve.rs:946 (split_steps)`; `crates/metal2vulkan-runtime/src/resolve.rs:958 (split_steps)` - `gap::TileAtSampleCount`: `crates/metal2vulkan-runtime/src/render_pass.rs:1611 (layout)`; `crates/metal2vulkan-runtime/src/render_pass.rs:937` - `gap::ImageblockMasters`: `crates/metal2vulkan-runtime/src/render.rs:7350 (draw_resident)`; `crates/metal2vulkan-runtime/src/render/tile_dispatch.rs:929 (dispatch_tiles_resident)` @@ -464,40 +464,40 @@ Each refusal's sites, with the function that builds it. - `gap::LayeredPass`: `crates/metal2vulkan-runtime/src/color_resolve.rs:890 (plan)` - `gap::FunctionOptions`: `crates/metal2vulkan-runtime/src/library.rs:215 (new_function_with_descriptor)` - `gap::OverlappingTextureCopies`: `crates/metal2vulkan-runtime/src/blit_texture.rs:1340 (texture_copies_of_bytes)` -- `gap::RebindTextures`: `crates/metal2vulkan-runtime/src/buffer_descriptor.rs:637 (rebind_host_pages)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2726 (rebound_heap_images)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2741 (rebound_heap_images)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2752 (rebound_heap_images)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2795 (dma_buf_heap_images_again)` -- `gap::PvrtcBlockOrder`: `crates/metal2vulkan-runtime/src/texture.rs:5775 (host_copy)` -- `gap::DecodedHeapTexture`: `crates/metal2vulkan-runtime/src/texture.rs:1682 (plan_sparse_texture)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:1373 (heap_plan)` +- `gap::RebindTextures`: `crates/metal2vulkan-runtime/src/buffer_descriptor.rs:637 (rebind_host_pages)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2739 (rebound_heap_images)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2754 (rebound_heap_images)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2765 (rebound_heap_images)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2808 (dma_buf_heap_images_again)` +- `gap::PvrtcBlockOrder`: `crates/metal2vulkan-runtime/src/texture.rs:5789 (host_copy)` +- `gap::DecodedHeapTexture`: `crates/metal2vulkan-runtime/src/texture.rs:1691 (plan_sparse_texture)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:1373 (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/render/restart.rs:71 (gap)` -- `gap::PrivatePrimitives`: `crates/metal2vulkan-runtime/src/render.rs:7937 (draw_resident)`; `crates/metal2vulkan-runtime/src/render/restart.rs:72 (gap)` +- `gap::PrivatePrimitives`: `crates/metal2vulkan-runtime/src/render.rs:8026 (draw_resident)`; `crates/metal2vulkan-runtime/src/render/restart.rs:72 (gap)` - `gap::ProvokingVertex`: `crates/metal2vulkan-runtime/src/render/restart.rs:73 (gap)` -- `gap::PrimitiveIdIndices`: `crates/metal2vulkan-runtime/src/render.rs:7947 (draw_resident)` -- `gap::RotatedTexture`: `crates/metal2vulkan-runtime/src/blit_texture.rs:1669 (texel_copies)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:715 (turned_plane)`; `crates/metal2vulkan-runtime/src/rotated.rs:185 (new)`; `crates/metal2vulkan-runtime/src/rotated.rs:201 (new)`; `crates/metal2vulkan-runtime/src/shadow.rs:642 (unmerged)`; `crates/metal2vulkan-runtime/src/texture.rs:5094 (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:641 (rebind_host_pages)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:622 (make_texture_over)`; `crates/metal2vulkan-runtime/src/detach.rs:172 (detach_host_pages)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2935 (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::PrimitiveIdIndices`: `crates/metal2vulkan-runtime/src/render.rs:8036 (draw_resident)` +- `gap::RotatedTexture`: `crates/metal2vulkan-runtime/src/blit_texture.rs:1669 (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:643 (unmerged)`; `crates/metal2vulkan-runtime/src/texture.rs:5108 (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:641 (rebind_host_pages)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:622 (make_texture_over)`; `crates/metal2vulkan-runtime/src/detach.rs:172 (detach_host_pages)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2948 (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:4924 (refuse_detached_texels)` +- `gap::DetachedTexelAccess`: `crates/metal2vulkan-runtime/src/texture.rs:4938 (refuse_detached_texels)` - `gap::SurfaceDepthStencil`: `crates/metal2vulkan-runtime/src/blit_texture.rs:269 (unit)`; `crates/metal2vulkan-runtime/src/texture/surface_depth.rs:57 (surface_depth_twin)` - `gap::ExtendedRangeResolve`: `crates/metal2vulkan-runtime/src/resolve.rs:604 (color)` - `gap::MultisampledBufferCopy`: `crates/metal2vulkan-runtime/src/blit_texture.rs:536 (copy_from_buffer_to_texture)`; `crates/metal2vulkan-runtime/src/blit_texture.rs:693 (copy_from_texture_to_buffer)` -- `gap::MultisampledBufferLayout`: `crates/metal2vulkan-runtime/src/sample_interleave.rs:1020 (plan)` +- `gap::MultisampledBufferLayout`: `crates/metal2vulkan-runtime/src/sample_interleave.rs:1029 (plan)` - `gap::ColorAttachmentGroups`: `crates/metal2vulkan-runtime/src/render/color_groups.rs:106 (gap)` -- `apple::ProtectedContent`: `crates/metal2vulkan-runtime/src/command_buffer/mod.rs:2398 (commit_now)`; `crates/metal2vulkan-runtime/src/command_buffer/protection.rs:126 (refuse_protected_state_encoder)`; `crates/metal2vulkan-runtime/src/command_buffer/protection.rs:52 (set)` +- `apple::ProtectedContent`: `crates/metal2vulkan-runtime/src/command_buffer/mod.rs:2408 (commit_now)`; `crates/metal2vulkan-runtime/src/command_buffer/protection.rs:126 (refuse_protected_state_encoder)`; `crates/metal2vulkan-runtime/src/command_buffer/protection.rs:52 (set)` - `apple::LineWidth`: `crates/metal2vulkan-runtime/src/apple_only.rs:189 (check)` - `apple::ViewportTransformDisabled`: `crates/metal2vulkan-runtime/src/apple_only.rs:191 (check)` - `apple::VertexAmplificationMode`: `crates/metal2vulkan-runtime/src/apple_only.rs:195 (check)`; `crates/metal2vulkan-runtime/src/apple_only.rs:320 (set_vertex_amplification_mode)` - `apple::SurfaceClientDirection`: `crates/metal2vulkan-runtime/src/buffer_texture.rs:417 (new_texture_with_iosurface_plane)` -- `bind::DescriptorRangeExceeded`: `crates/metal2vulkan/src/bind/instantiate.rs:653 (bind_buffers)` -- `bind::TexelBufferTooLarge`: `crates/metal2vulkan/src/bind/instantiate.rs:892 (texel_ranges)` +- `bind::DescriptorRangeExceeded`: `crates/metal2vulkan/src/bind/instantiate.rs:655 (bind_buffers)` +- `bind::TexelBufferTooLarge`: `crates/metal2vulkan/src/bind/instantiate.rs:894 (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:3653 (patch_binding)` -- `bind::PatchIndexRange`: `crates/metal2vulkan/src/bind/graphics.rs:3697 (patch_binding)` -- `bind::ControlPointIndexRange`: `crates/metal2vulkan/src/bind/graphics.rs:3735 (patch_binding)` +- `bind::TessellationFactorRange`: `crates/metal2vulkan/src/bind/graphics.rs:3767 (patch_binding)` +- `bind::PatchIndexRange`: `crates/metal2vulkan/src/bind/graphics.rs:3811 (patch_binding)` +- `bind::ControlPointIndexRange`: `crates/metal2vulkan/src/bind/graphics.rs:3849 (patch_binding)` - `bind::MissingStageInRegion`: `crates/metal2vulkan/src/bind/dispatch.rs:796 (instantiate)` -- `bind::UniformViewAliased`: `crates/metal2vulkan/src/bind/instantiate.rs:607 (check_uniform_aliasing)` +- `bind::UniformViewAliased`: `crates/metal2vulkan/src/bind/instantiate.rs:609 (check_uniform_aliasing)` - `bind::MissingDeviceAddress`: `crates/metal2vulkan/src/bind/plan/slots.rs:133 (plan_buffer)` - `limit::InlinedInstructions`: `crates/metal2vulkan-air/src/canon/inline.rs:330 (u32_of)`; `crates/metal2vulkan-air/src/canon/inline.rs:334 (usize_of)`; `crates/metal2vulkan-air/src/canon/inline.rs:61 (inline)` - `limit::OutputBlocks`: `crates/metal2vulkan/src/structurize/irreducible.rs:90 (round)`; `crates/metal2vulkan/src/structurize/mod.rs:187 (structure_prepared)`; `crates/metal2vulkan/src/structurize/structurizer_properties/mod.rs:423 (output_cap_is_checked_before_allocating)`; `crates/metal2vulkan/src/structurize/structurizer_properties/trees.rs:232 (the_output_cap_is_checked_before_emission)` diff --git a/scripts/metal-coverage/coverage.tsv b/scripts/metal-coverage/coverage.tsv index edb5ce05f..d07527a53 100644 --- a/scripts/metal-coverage/coverage.tsv +++ b/scripts/metal-coverage/coverage.tsv @@ -1629,7 +1629,7 @@ MTLRenderCommandEncoder.h MTLRenderCommandEncoder method setMeshSamplerState:lod MTLRenderCommandEncoder.h MTLRenderCommandEncoder method setMeshSamplerStates:lodMinClamps:lodMaxClamps:withRange: I runtime RenderCommandEncoder::set_mesh_sampler_states MTLRenderCommandEncoder.h MTLRenderCommandEncoder method drawMeshThreadgroups:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup: I runtime RenderCommandEncoder::draw_mesh_threadgroups MTLRenderCommandEncoder.h MTLRenderCommandEncoder method drawMeshThreads:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup: I runtime RenderCommandEncoder::draw_mesh_threads -MTLRenderCommandEncoder.h MTLRenderCommandEncoder method drawMeshThreadgroupsWithIndirectBuffer:indirectBufferOffset:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup: I runtime RenderCommandEncoder::draw_mesh_threadgroups_indirect an object grid past the device's task limits fails the command buffer (`MeshGridPastLimits`); refused `NotImplemented(MeshShading)` with an object function where mesh draws are emulated +MTLRenderCommandEncoder.h MTLRenderCommandEncoder method drawMeshThreadgroupsWithIndirectBuffer:indirectBufferOffset:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup: I runtime RenderCommandEncoder::draw_mesh_threadgroups_indirect an object grid of 2^29 threadgroups or more fails the command buffer (`MeshGridPastLimits`, as Metal's GPU fails it), and so does one past the task limits where the device does not fold object grids; refused `NotImplemented(MeshShading)` with an object function where mesh draws are emulated MTLRenderCommandEncoder.h MTLRenderCommandEncoder method drawPrimitives:vertexStart:vertexCount:instanceCount: I runtime RenderCommandEncoder::draw_primitives MTLRenderCommandEncoder.h MTLRenderCommandEncoder method drawPrimitives:vertexStart:vertexCount: I runtime RenderCommandEncoder::draw_primitives MTLRenderCommandEncoder.h MTLRenderCommandEncoder method drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferOffset:instanceCount: I runtime RenderCommandEncoder::draw_indexed_primitives