From 60e30f5196df12899bc7fab3db3fe401395ea2ca Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Thu, 3 Dec 2026 15:04:32 -0800 Subject: [PATCH] Runtime: a mesh state keeps nothing of its descriptor, and the group counts fill by fixed chunks Clippy in job m3-max-85712 (c6bd918103, plain, m2v_gpu and m2v_cpu_icd alike) stopped the runtime's lib on two errors: - dead_code: Made::Mesh held the MeshPipelineDescriptor, which only a test helper read. A vertex state keeps its descriptor because a pass makes its content again from it (for_pass); no pass does that for a mesh state. Made::Mesh is now a unit variant, and the test helper says a mesh state keeps no vertex or fragment function (rule 4: nothing unused is kept). - clippy::chunks_exact_to_as_chunks in mesh_draw::count_bytes: the three counts now go through as_chunks_mut::<4>(), the same bytes. Verified by the error text of 85712 only; the next job runs the three clippy configurations. --- crates/metal2vulkan-runtime/src/mesh_draw.rs | 4 ++-- crates/metal2vulkan-runtime/src/render.rs | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/crates/metal2vulkan-runtime/src/mesh_draw.rs b/crates/metal2vulkan-runtime/src/mesh_draw.rs index 66216d748..a58b13732 100644 --- a/crates/metal2vulkan-runtime/src/mesh_draw.rs +++ b/crates/metal2vulkan-runtime/src/mesh_draw.rs @@ -218,8 +218,8 @@ pub(crate) fn records(piece: [u32; 3], pieces: u32) -> Vec { /// The group counts' bytes, as the object function or the launcher reads them. pub(crate) fn count_bytes(counts: [u32; 3]) -> [u8; 12] { let mut out = [0; 12]; - for (at, axis) in out.chunks_exact_mut(4).zip(counts) { - at.copy_from_slice(&axis.to_le_bytes()); + for (at, axis) in out.as_chunks_mut::<4>().0.iter_mut().zip(counts) { + *at = axis.to_le_bytes(); } out } diff --git a/crates/metal2vulkan-runtime/src/render.rs b/crates/metal2vulkan-runtime/src/render.rs index 8a227ba47..b64a0b41a 100644 --- a/crates/metal2vulkan-runtime/src/render.rs +++ b/crates/metal2vulkan-runtime/src/render.rs @@ -149,7 +149,7 @@ impl RenderPipelineState { function(Some(&descriptor.vertex)), function(descriptor.fragment.as_ref()), ], - Made::Mesh(descriptor) => [None, function(descriptor.fragment.as_ref())], + Made::Mesh => [None, None], } } @@ -183,8 +183,9 @@ pub(crate) struct RenderInner { enum Made { /// `newRenderPipelineStateWithDescriptor:error:`'s. Vertex(RenderPipelineDescriptor), - /// `newRenderPipelineStateWithMeshDescriptor:options:reflection:error:`'s. - Mesh(MeshPipelineDescriptor), + /// `newRenderPipelineStateWithMeshDescriptor:options:reflection:error:`'s, of which the state + /// keeps nothing: no pass makes its content again. + Mesh, } /// The vertex function's index in a draw's tables, and the fragment function's. @@ -1020,7 +1021,7 @@ impl crate::Device { inner: Arc::new(RenderInner { compiled, numbered, - descriptor: Made::Mesh(descriptor.clone()), + descriptor: Made::Mesh, folded: OnceLock::new(), }), }) @@ -2714,7 +2715,7 @@ impl RenderPipelineState { false, false, ], - Made::Mesh(_) => [false; TABLES], + Made::Mesh => [false; TABLES], } }