diff --git a/wgpu-hal/src/metal/surface.rs b/wgpu-hal/src/metal/surface.rs index f1e215e04..ef54f5dc7 100644 --- a/wgpu-hal/src/metal/surface.rs +++ b/wgpu-hal/src/metal/surface.rs @@ -48,8 +48,9 @@ impl super::Surface { } #[cfg(target_os = "ios")] + #[allow(clippy::transmute_ptr_to_ref)] pub unsafe fn from_uiview(uiview: *mut c_void) -> Self { - let view: cocoa_foundation::base::id = mem::transmute(uiview); + let view = uiview as *mut Object; if view.is_null() { panic!("window does not have a valid contentView"); } @@ -58,7 +59,7 @@ impl super::Surface { let class = class!(CAMetalLayer); let is_valid_layer: BOOL = msg_send![main_layer, isKindOfClass: class]; let render_layer = if is_valid_layer == YES { - mem::transmute::<_, &MetalLayerRef>(main_layer).to_owned() + mem::transmute::<_, &mtl::MetalLayerRef>(main_layer).to_owned() } else { // If the main layer is not a CAMetalLayer, we create a CAMetalLayer sublayer and use it instead. // Unlike on macOS, we cannot replace the main view as UIView does not allow it (when NSView does). @@ -74,7 +75,7 @@ impl super::Surface { let screen: *mut Object = msg_send![window, screen]; assert!(!screen.is_null(), "window is not attached to a screen"); - let scale_factor: CGFloat = msg_send![screen, nativeScale]; + let scale_factor: mtl::CGFloat = msg_send![screen, nativeScale]; let () = msg_send![view, setContentScaleFactor: scale_factor]; } diff --git a/wgpu-types/src/lib.rs b/wgpu-types/src/lib.rs index 3cccf262e..b8162269a 100644 --- a/wgpu-types/src/lib.rs +++ b/wgpu-types/src/lib.rs @@ -2490,9 +2490,7 @@ impl Extent3d { /// ``` pub fn max_mips(&self) -> u32 { let max_dim = self.width.max(self.height.max(self.depth_or_array_layers)); - let max_levels = 32 - max_dim.leading_zeros(); - - max_levels + 32 - max_dim.leading_zeros() } }