Struct wgpu::hal::gles::AdapterContext

source ·
pub struct AdapterContext { /* private fields */ }
Available on wgpu_core and gles only.
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.

Implementations§

source§

impl AdapterContext

source

pub fn is_owned(&self) -> bool

source

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.

source

pub fn raw_display(&self) -> Option<&Display>

Returns the EGLDisplay corresponding to the adapter context.

Returns None if the adapter was externally created.

source

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.

source

pub fn raw_context(&self) -> *mut c_void

source§

impl AdapterContext

source

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.

source

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§

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

source§

impl<T> WasmNotSend for T
where T: Send,

source§

impl<T> WasmNotSendSync for T

source§

impl<T> WasmNotSync for T
where T: Sync,