From c79437191acbf97b701433e4babe163efb555e7b Mon Sep 17 00:00:00 2001 From: Dimkar3000 Date: Tue, 5 Apr 2022 18:39:29 +0300 Subject: [PATCH] fix for android surface acquiring (#1868) --- vulkano-win/src/winit.rs | 10 +++++++--- vulkano/src/command_buffer/mod.rs | 6 +++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/vulkano-win/src/winit.rs b/vulkano-win/src/winit.rs index 0fc905a3..6aa6aaad 100644 --- a/vulkano-win/src/winit.rs +++ b/vulkano-win/src/winit.rs @@ -121,9 +121,13 @@ unsafe fn winit_to_surface>( instance: Arc, win: W, ) -> Result>, SurfaceCreationError> { - use winit::platform::android::WindowExtAndroid; - - Surface::from_android(instance, win.borrow().native_window(), win) + use raw_window_handle::HasRawWindowHandle; + use raw_window_handle::RawWindowHandle::AndroidNdk; + if let AndroidNdk(handle) = win.borrow().raw_window_handle() { + Surface::from_android(instance, handle.a_native_window, win) + } else { + unreachable!("This should be unreachable if the target is android"); + } } #[cfg(all(unix, not(target_os = "android"), not(target_os = "macos")))] diff --git a/vulkano/src/command_buffer/mod.rs b/vulkano/src/command_buffer/mod.rs index 215b29fd..ba4fe929 100644 --- a/vulkano/src/command_buffer/mod.rs +++ b/vulkano/src/command_buffer/mod.rs @@ -78,7 +78,7 @@ pub use self::commands::{ debug::CheckColorError, - image::{CheckClearColorImageError, CheckClearDepthStencilImageError, CheckBlitImageError}, + image::{CheckBlitImageError, CheckClearColorImageError, CheckClearDepthStencilImageError}, pipeline::{ CheckDescriptorSetsValidityError, CheckDispatchError, CheckDynamicStateValidityError, CheckIndexBufferError, CheckIndirectBufferError, CheckPipelineError, @@ -89,8 +89,8 @@ pub use self::commands::{ CheckResetQueryPoolError, CheckWriteTimestampError, }, transfer::{ - CheckCopyBufferError, CheckCopyBufferImageError, CheckCopyImageError, - CheckFillBufferError, CheckUpdateBufferError, + CheckCopyBufferError, CheckCopyBufferImageError, CheckCopyImageError, CheckFillBufferError, + CheckUpdateBufferError, }, }; pub use self::{