Skip to content

Commit

Permalink
expose egl display in gles
Browse files Browse the repository at this point in the history
  • Loading branch information
i509VCB committed May 18, 2022
1 parent f5c2ff1 commit f3671e8
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion wgpu-hal/src/gles/egl.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use glow::HasContext;
use parking_lot::{Mutex, MutexGuard};
use parking_lot::{MappedMutexGuard, Mutex, MutexGuard};
use raw_window_handle::{HasRawWindowHandle, RawWindowHandle};

use std::{ffi, os::raw, ptr, sync::Arc, time::Duration};
Expand Down Expand Up @@ -580,6 +580,25 @@ pub struct Instance {
inner: Mutex<Inner>,
}

impl Instance {
pub fn raw_display(&self) -> MappedMutexGuard<'_, egl::Display> {
MutexGuard::map(
self.inner
.try_lock()
.expect("Could not lock instance. This is most-likely a deadlock."),
|inner| &mut inner.egl.display,
)
}

/// Returns the version of the EGL display.
pub fn egl_version(&self) -> (i32, i32) {
self.inner
.try_lock()
.expect("Could not lock instance. This is most-likely a deadlock.")
.version
}
}

unsafe impl Send for Instance {}
unsafe impl Sync for Instance {}

Expand Down

0 comments on commit f3671e8

Please sign in to comment.