Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion glutin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 6 additions & 1 deletion glutin/src/api/android/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()
Expand Down
14 changes: 8 additions & 6 deletions glutin/src/api/egl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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()
Expand Down