pub struct EglContext {
pub egl: Arc<DynamicInstance<EGL1_4>>,
pub display: Display,
pub config: Config,
pub context: Context,
pub version: GlesVersion,
/* private fields */
}Expand description
Process-wide EGL display + GLES context. Cheap to clone because the heavy
state (Arc<EglInstance>, Arc<glow::Context>) is reference-counted; the
raw EGL handles are POD.
Fields§
§egl: Arc<DynamicInstance<EGL1_4>>§display: Display§config: Config§context: Context§version: GlesVersionImplementations§
Source§impl EglContext
impl EglContext
Sourcepub fn new(conn: &Connection) -> Result<Self, String>
pub fn new(conn: &Connection) -> Result<Self, String>
Initialise EGL on conn. Returns Err( reason ) if EGL cannot be
used (forced software, library missing, no compatible config, ES2/3
context creation failed). The caller falls back to SHM and is
expected to log via log_software_fallback.
Sourcepub fn gl(&self) -> &Arc<Context>
pub fn gl(&self) -> &Arc<Context>
Access the lazily-constructed glow::Context. Must be called only after
the first successful make_current; panics otherwise.
Sourcepub fn create_surface(
&self,
wl_surface: &WlSurface,
width: i32,
height: i32,
) -> Result<EglSurface, String>
pub fn create_surface( &self, wl_surface: &WlSurface, width: i32, height: i32, ) -> Result<EglSurface, String>
Create an EGLSurface pinned to wl_surface at the given pixel size.
Sourcepub fn make_current(&self, surface: &EglSurface) -> Result<(), String>
pub fn make_current(&self, surface: &EglSurface) -> Result<(), String>
Make surface current for subsequent GL calls. The first successful
call lazily constructs the shared glow::Context (glow needs a live
current context to read GL_VERSION during initialisation).
pub fn swap_buffers(&self, surface: &EglSurface) -> Result<(), String>
Sourcepub fn swap_buffers_with_damage(
&self,
surface: &EglSurface,
rects: &[(i32, i32, i32, i32)],
) -> Result<(), String>
pub fn swap_buffers_with_damage( &self, surface: &EglSurface, rects: &[(i32, i32, i32, i32)], ) -> Result<(), String>
Like Self::swap_buffers but submits explicit damage rects so Mesa
emits proper wl_surface.damage_buffer requests instead of its
INT32_MAX-everywhere sentinel. Falls back to plain swap_buffers
when the extension is unavailable — that path still works on
cooperative compositors but trips over the sentinel on others (see the
crate-private SwapBuffersWithDamageFn type alias above for the
underlying rationale).
Each rect is (x, y, width, height) in EGL window coordinates
(origin at the bottom-left, in physical pixels). Callers that work in
top-left screen coords must flip Y before passing them in. For
full-surface damage, (0, 0, w, h) is correct in either convention.
Auto Trait Implementations§
impl !Freeze for EglContext
impl RefUnwindSafe for EglContext
impl !Send for EglContext
impl !Sync for EglContext
impl Unpin for EglContext
impl UnwindSafe for EglContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more