diff --git a/CHANGELOG.md b/CHANGELOG.md index 16aaf43cec..aa1e2aeb15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ - Fix crash when creating OpenGLES context without explicit version - Add `buffer_age` method on `WindowedContext` +- On Android, switched from `StaticStructGenerator` to `StructGenerator`, fixing some compilation errors. # Version 0.28.0 (2021-12-02) diff --git a/glutin/Cargo.toml b/glutin/Cargo.toml index ddd23eec90..5daaf41839 100644 --- a/glutin/Cargo.toml +++ b/glutin/Cargo.toml @@ -27,6 +27,7 @@ winit = { version = "0.26", default-features = false } [target.'cfg(target_os = "android")'.dependencies] android_glue = "0.2" glutin_egl_sys = { version = "0.1.5", path = "../glutin_egl_sys" } +libloading = "0.7" parking_lot = "0.11" [target.'cfg(target_os = "emscripten")'.dependencies] diff --git a/glutin/src/api/dlloader.rs b/glutin/src/api/dlloader.rs index 9cfba937d5..fa35b03412 100644 --- a/glutin/src/api/dlloader.rs +++ b/glutin/src/api/dlloader.rs @@ -5,6 +5,7 @@ target_os = "freebsd", target_os = "netbsd", target_os = "openbsd", + target_os = "android", ))] use libloading::Library; diff --git a/glutin/src/api/egl/mod.rs b/glutin/src/api/egl/mod.rs index ed14a6f868..1b9134c7d8 100644 --- a/glutin/src/api/egl/mod.rs +++ b/glutin/src/api/egl/mod.rs @@ -9,7 +9,6 @@ ))] #![allow(unused_variables)] -#[cfg(not(target_os = "android"))] mod egl { use super::ffi; use crate::api::dlloader::{SymTrait, SymWrapper}; @@ -90,20 +89,6 @@ mod egl { } } -#[cfg(target_os = "android")] -mod egl { - use super::ffi; - - #[derive(Clone)] - pub struct Egl(pub ffi::egl::Egl); - - impl Egl { - pub fn new() -> Result { - Ok(Egl(ffi::egl::Egl)) - } - } -} - mod make_current_guard; pub use self::egl::Egl; @@ -180,13 +165,6 @@ pub struct Context { config_id: ffi::egl::types::EGLConfig, } -#[cfg(target_os = "android")] -#[inline] -fn get_native_display(native_display: &NativeDisplay) -> *const raw::c_void { - let egl = EGL.as_ref().unwrap(); - unsafe { egl.GetDisplay(ffi::egl::DEFAULT_DISPLAY as *mut _) } -} - fn get_egl_version( display: ffi::egl::types::EGLDisplay, ) -> Result<(ffi::egl::types::EGLint, ffi::egl::types::EGLint), CreationError> { @@ -256,7 +234,6 @@ unsafe fn bind_and_get_api<'a>( } } -#[cfg(not(target_os = "android"))] fn get_native_display(native_display: &NativeDisplay) -> *const raw::c_void { let egl = EGL.as_ref().unwrap(); // the first step is to query the list of extensions without any display, if @@ -352,9 +329,6 @@ fn get_native_display(native_display: &NativeDisplay) -> *const raw::c_void { } } - // TODO: This will never be reached right now, as the android egl - // bindings use the static generator, so can't rely on - // GetPlatformDisplay(EXT). NativeDisplay::Android if has_dp_extension("EGL_KHR_platform_android") && egl.GetPlatformDisplay.is_loaded() => diff --git a/glutin_egl_sys/build.rs b/glutin_egl_sys/build.rs index 88edab42ff..7b222aaa87 100644 --- a/glutin_egl_sys/build.rs +++ b/glutin_egl_sys/build.rs @@ -42,7 +42,7 @@ fn main() { ], ); - if target.contains("android") || target.contains("ios") { + if target.contains("ios") { reg.write_bindings(gl_generator::StaticStructGenerator, &mut file) } else { reg.write_bindings(gl_generator::StructGenerator, &mut file)