From cd01c9df20a2c72a0061b717921953532d82d88a Mon Sep 17 00:00:00 2001 From: Lattice 0 Date: Sat, 21 May 2022 20:29:42 +0000 Subject: [PATCH 1/3] fixed missing stuff --- glutin/src/api/android/mod.rs | 5 +++++ glutin/src/api/egl/mod.rs | 14 ++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/glutin/src/api/android/mod.rs b/glutin/src/api/android/mod.rs index 09d1036df3..a623060062 100644 --- a/glutin/src/api/android/mod.rs +++ b/glutin/src/api/android/mod.rs @@ -142,6 +142,11 @@ impl Context { #[inline] pub fn resize(&self, _: u32, _: u32) {} + #[inline] + pub fn buffer_age(&self) -> u32 { + self.0.egl_context.buffer_age() + } + #[inline] pub fn is_current(&self) -> bool { self.0.egl_context.is_current() diff --git a/glutin/src/api/egl/mod.rs b/glutin/src/api/egl/mod.rs index ed14a6f868..15e02bb236 100644 --- a/glutin/src/api/egl/mod.rs +++ b/glutin/src/api/egl/mod.rs @@ -617,11 +617,7 @@ impl Context { #[cfg(not(target_os = "windows"))] pub fn swap_buffers_with_damage(&self, rects: &[Rect]) -> Result<(), ContextError> { let egl = EGL.as_ref().unwrap(); - - if !egl.SwapBuffersWithDamageKHR.is_loaded() { - return Err(ContextError::FunctionUnavailable); - } - + let surface = self.surface.as_ref().unwrap().lock(); if *surface == ffi::egl::NO_SURFACE { return Err(ContextError::ContextLost); @@ -658,12 +654,18 @@ impl Context { } #[inline] - #[cfg(not(target_os = "windows"))] + #[cfg(all(not(target_os = "windows"), not(target_os = "android")))] pub fn swap_buffers_with_damage_supported(&self) -> bool { let egl = EGL.as_ref().unwrap(); egl.SwapBuffersWithDamageKHR.is_loaded() } + #[inline] + #[cfg(target_os = "android")] + pub fn swap_buffers_with_damage_supported(&self) -> bool { + true + } + #[inline] pub fn get_pixel_format(&self) -> PixelFormat { self.pixel_format.clone() From e69d9f08b7e322a79918a6e00e34328e8c77a5fe Mon Sep 17 00:00:00 2001 From: Lattice 0 Date: Sat, 21 May 2022 20:40:19 +0000 Subject: [PATCH 2/3] fix --- glutin/Cargo.toml | 2 +- glutin/src/api/android/mod.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/glutin/Cargo.toml b/glutin/Cargo.toml index ddd23eec90..9e3dae1d30 100644 --- a/glutin/Cargo.toml +++ b/glutin/Cargo.toml @@ -22,7 +22,7 @@ default = ["x11", "wayland", "wayland-dlopen"] [dependencies] lazy_static = "1.3" -winit = { version = "0.26", default-features = false } +winit = { version = "0.26", default-features = false, path="../../winit" } [target.'cfg(target_os = "android")'.dependencies] android_glue = "0.2" diff --git a/glutin/src/api/android/mod.rs b/glutin/src/api/android/mod.rs index a623060062..18ef90b1ba 100644 --- a/glutin/src/api/android/mod.rs +++ b/glutin/src/api/android/mod.rs @@ -4,7 +4,7 @@ use crate::api::egl::{Context as EglContext, NativeDisplay, SurfaceType as EglSu use crate::CreationError::{self, OsError}; use crate::{Api, ContextError, GlAttributes, PixelFormat, PixelFormatRequirements, Rect}; -use crate::platform::android::EventLoopExtAndroid; +use crate::platform::android::EventLoopWindowTargetExtAndroid; use glutin_egl_sys as ffi; use parking_lot::Mutex; use winit; From db72349282ff9c601951c595dce682f0cc23c244 Mon Sep 17 00:00:00 2001 From: Lattice 0 Date: Sat, 21 May 2022 21:51:26 +0000 Subject: [PATCH 3/3] fix --- glutin/src/api/egl/mod.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/glutin/src/api/egl/mod.rs b/glutin/src/api/egl/mod.rs index 15e02bb236..e9635fa777 100644 --- a/glutin/src/api/egl/mod.rs +++ b/glutin/src/api/egl/mod.rs @@ -617,7 +617,11 @@ impl Context { #[cfg(not(target_os = "windows"))] pub fn swap_buffers_with_damage(&self, rects: &[Rect]) -> Result<(), ContextError> { let egl = EGL.as_ref().unwrap(); - + + if !self.swap_buffers_with_damage_supported() { + return Err(ContextError::FunctionUnavailable); + } + let surface = self.surface.as_ref().unwrap().lock(); if *surface == ffi::egl::NO_SURFACE { return Err(ContextError::ContextLost); @@ -654,7 +658,7 @@ impl Context { } #[inline] - #[cfg(all(not(target_os = "windows"), not(target_os = "android")))] + #[cfg(not(any(target_os = "windows", target_os = "android")))] pub fn swap_buffers_with_damage_supported(&self) -> bool { let egl = EGL.as_ref().unwrap(); egl.SwapBuffersWithDamageKHR.is_loaded()