From 0bed413d7c718489f75e8e80411fac4082ce7780 Mon Sep 17 00:00:00 2001 From: Raphael Amorim Date: Sat, 2 May 2026 16:20:14 +0200 Subject: [PATCH] small fixes --- sugarloaf/src/renderer/batch.rs | 19 ------------------- sugarloaf/src/renderer/mod.rs | 9 ++++++++- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/sugarloaf/src/renderer/batch.rs b/sugarloaf/src/renderer/batch.rs index 23122c0b..24cfa0d8 100644 --- a/sugarloaf/src/renderer/batch.rs +++ b/sugarloaf/src/renderer/batch.rs @@ -54,25 +54,6 @@ pub struct Vertex { pub clip_rect: [f32; 4], } -impl Vertex { - /// Vertex size in bytes: - /// pos[3] + color[4] + uv[2] + layers[2] + corner_radii[4] + rect_size[2] + underline_style + clip_rect[4] - /// = 12 + 16 + 8 + 8 + 16 + 8 + 4 + 16 = 88 bytes - pub const SIZE: usize = 88; - - /// Convert vertex to bytes for caching - #[inline] - pub fn to_bytes(self) -> [u8; Self::SIZE] { - bytemuck::cast(self) - } - - /// Create vertex from bytes - #[inline] - pub fn from_bytes(bytes: &[u8; Self::SIZE]) -> Self { - bytemuck::cast(*bytes) - } -} - /// Rectangle with floating point coordinates. #[derive(Copy, Clone, Default, Debug)] pub struct Rect { diff --git a/sugarloaf/src/renderer/mod.rs b/sugarloaf/src/renderer/mod.rs index 05ffbf00..f0371699 100644 --- a/sugarloaf/src/renderer/mod.rs +++ b/sugarloaf/src/renderer/mod.rs @@ -1369,8 +1369,13 @@ impl Renderer { None => continue, }; let tex = match &img.gpu { - #[cfg(target_os = "macos")] ImageTexture::Metal(tex) => tex, + // The Wgpu variant only exists when the `wgpu` feature + // is enabled — without it, this match is exhaustive + // and the wildcard would be a clippy + // `unreachable_patterns`. Vulkan is gated to Linux, + // so it never reaches this Metal-only function. + #[cfg(feature = "wgpu")] _ => continue, }; @@ -1425,6 +1430,8 @@ impl Renderer { }; let tex = match &entry.gpu { ImageTexture::Metal(tex) => tex, + // See `draw_images_metal` for why the Wgpu arm is feature-gated. + #[cfg(feature = "wgpu")] _ => return true, }; -- 2.51.2