pub struct AdapterContext {
glow: Mutex<RawMutex, Context>,
egl: Option<EglContext>,
}
Expand description
A wrapper around a [glow::Context
] and the required EGL context that uses locking to guarantee
exclusive access when shared with multiple threads.
Fields§
§glow: Mutex<RawMutex, Context>
§egl: Option<EglContext>
Implementations§
§impl AdapterContext
impl AdapterContext
pub fn is_owned(&self) -> bool
pub fn egl_instance(&self) -> Option<&Instance<Dynamic<Library, EGL1_4>>>
pub fn egl_instance(&self) -> Option<&Instance<Dynamic<Library, EGL1_4>>>
Returns the EGL instance.
This provides access to EGL functions and the ability to load GL and EGL extension functions.
pub fn raw_display(&self) -> Option<&Display>
pub fn raw_display(&self) -> Option<&Display>
Returns the EGLDisplay corresponding to the adapter context.
Returns None
if the adapter was externally created.
pub fn egl_version(&self) -> Option<(i32, i32)>
pub fn egl_version(&self) -> Option<(i32, i32)>
Returns the EGL version the adapter context was created with.
Returns None
if the adapter was externally created.
pub fn raw_context(&self) -> *mut c_void
§impl AdapterContext
impl AdapterContext
pub unsafe fn get_without_egl_lock(&self) -> MutexGuard<'_, RawMutex, Context>
pub unsafe fn get_without_egl_lock(&self) -> MutexGuard<'_, RawMutex, Context>
Get’s the [glow::Context
] without waiting for a lock
§Safety
This should only be called when you have manually made sure that the current thread has made
the EGL context current and that no other thread also has the EGL context current.
Additionally, you must manually make the EGL context not current after you are done with
it, so that future calls to lock()
will not fail.
Note: Calling this function will still lock the [
glow::Context
] which adds an extra safe-guard against accidental concurrent access to the context.
pub fn lock<'a>(&'a self) -> AdapterContextLock<'a>
pub fn lock<'a>(&'a self) -> AdapterContextLock<'a>
Obtain a lock to the EGL context and get handle to the [glow::Context
] that can be used to
do rendering.
Trait Implementations§
impl Send for AdapterContext
impl Sync for AdapterContext
Auto Trait Implementations§
impl !Freeze for AdapterContext
impl !RefUnwindSafe for AdapterContext
impl Unpin for AdapterContext
impl UnwindSafe for AdapterContext
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
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
§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> DowncastSync for T
impl<T> DowncastSync for T
§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 moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request