egl: Expose raw types for downstream integrations

This commit is contained in:
Victor Brekenfeld 2022-01-10 17:38:57 +01:00
parent 20d95c80c6
commit 74162a73b6
3 changed files with 20 additions and 1 deletions

View File

@ -264,6 +264,13 @@ impl EGLContext {
pub fn user_data(&self) -> &UserDataMap { pub fn user_data(&self) -> &UserDataMap {
&*self.user_data &*self.user_data
} }
/// Get a raw handle to the underlying context.
///
/// The pointer will become invalid, when this struct is destroyed.
pub fn get_context_handle(&self) -> ffi::egl::types::EGLContext {
self.context
}
} }
impl Drop for EGLContext { impl Drop for EGLContext {

View File

@ -173,7 +173,9 @@ impl EGLDevice {
} }
/// Returns the pointer to the raw [`EGLDevice`]. /// Returns the pointer to the raw [`EGLDevice`].
pub fn inner(&self) -> *const c_void { ///
/// The pointer will become invalid, when this struct is destroyed.
pub fn get_device_handle(&self) -> *const c_void {
self.inner self.inner
} }
} }

View File

@ -172,6 +172,16 @@ impl EGLSurface {
pub fn resize(&self, width: i32, height: i32, dx: i32, dy: i32) -> bool { pub fn resize(&self, width: i32, height: i32, dx: i32, dy: i32) -> bool {
self.native.resize(width, height, dx, dy) self.native.resize(width, height, dx, dy)
} }
/// Get a raw handle to the underlying surface
///
/// *Note*: The surface might get dynamically recreated during swap-buffers
/// causing the pointer to become invalid.
///
/// The pointer will become invalid, when this struct is destroyed.
pub fn get_surface_handle(&self) -> ffi::egl::types::EGLSurface {
self.surface.load(Ordering::SeqCst)
}
} }
impl Drop for EGLSurface { impl Drop for EGLSurface {