fix for android surface acquiring (#1868)

This commit is contained in:
Dimkar3000 2022-04-05 18:39:29 +03:00 committed by GitHub
parent d1ab3f6726
commit c79437191a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View File

@ -121,9 +121,13 @@ unsafe fn winit_to_surface<W: SafeBorrow<Window>>(
instance: Arc<Instance>,
win: W,
) -> Result<Arc<Surface<W>>, 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")))]

View File

@ -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::{