Struct wgpu_hal::gles::AdapterContext
source · pub struct AdapterContext { /* private fields */ }
webgl
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
impl AdapterContext
pub fn is_owned(&self) -> bool
sourcepub fn egl_instance(&self) -> Option<&DynamicInstance<EGL1_4>>
pub fn egl_instance(&self) -> Option<&DynamicInstance<EGL1_4>>
Returns the EGL instance.
This provides access to EGL functions and the ability to load GL and EGL extension functions.
sourcepub 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.
sourcepub 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
source§impl AdapterContext
impl AdapterContext
sourcepub unsafe fn get_without_egl_lock(&self) -> MappedMutexGuard<'_, Context>
pub unsafe fn get_without_egl_lock(&self) -> MappedMutexGuard<'_, 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.
sourcepub 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.