Struct smithay::backend::egl::context::EGLContext

source ·
pub struct EGLContext { /* private fields */ }
Available on crate feature backend_egl only.
Expand description

EGL context for rendering

Implementations§

source§

impl EGLContext

source

pub unsafe fn from_raw( display: *const c_void, config_id: *const c_void, context: *const c_void, ) -> Result<EGLContext, Error>

Creates a new EGLContext from raw handles.

§Safety
  • The context must be created from the system default EGL library (dlopen("libEGL.so"))
  • The display, config, and context must be valid for the lifetime of the returned context.
source

pub fn new(display: &EGLDisplay) -> Result<EGLContext, Error>

Creates a new configless EGLContext from a given EGLDisplay

source

pub fn new_with_priority( display: &EGLDisplay, priority: ContextPriority, ) -> Result<EGLContext, Error>

Creates a new configless EGLContext with the specified priority from a given EGLDisplay

Note: The priority is a hint that might be ignored by the underlying platform. It also requires EGL_IMG_context_priority to be available, otherwise the priority will be ignored.

source

pub fn new_with_config( display: &EGLDisplay, attributes: GlAttributes, reqs: PixelFormatRequirements, ) -> Result<EGLContext, Error>

Create a new EGLContext from a given EGLDisplay and configuration requirements

source

pub fn new_with_config_and_priority( display: &EGLDisplay, attributes: GlAttributes, reqs: PixelFormatRequirements, priority: ContextPriority, ) -> Result<EGLContext, Error>

Create a new EGLContext from a given EGLDisplay, configuration requirements and priority

Note: The priority is a hint that might be ignored by the underlying platform. It also requires EGL_IMG_context_priority to be available, otherwise the priority will be ignored.

source

pub fn new_shared( display: &EGLDisplay, share: &EGLContext, ) -> Result<EGLContext, Error>

Create a new configless EGLContext from a given EGLDisplay sharing resources with another context

source

pub fn new_shared_with_priority( display: &EGLDisplay, share: &EGLContext, priority: ContextPriority, ) -> Result<EGLContext, Error>

Create a new configless EGLContext with the specified priority from a given EGLDisplay sharing resources with another context

Note: The priority is a hint that might be ignored by the underlying platform. It also requires EGL_IMG_context_priority to be available, otherwise the priority will be ignored.

source

pub fn new_shared_with_config( display: &EGLDisplay, share: &EGLContext, attributes: GlAttributes, reqs: PixelFormatRequirements, ) -> Result<EGLContext, Error>

Create a new EGLContext from a given EGLDisplay and configuration requirements sharing resources with another context

source

pub fn new_shared_with_config_and_priority( display: &EGLDisplay, share: &EGLContext, attributes: GlAttributes, reqs: PixelFormatRequirements, priority: ContextPriority, ) -> Result<EGLContext, Error>

Create a new EGLContext with the specified priority from a given EGLDisplay and configuration requirements sharing resources with another context

Note: The priority is a hint that might be ignored by the underlying platform. It also requires EGL_IMG_context_priority to be available, otherwise the priority will be ignored.

source

pub unsafe fn make_current(&self) -> Result<(), MakeCurrentError>

Makes the OpenGL context the current context in the current thread with no surface bound.

§Safety

This function is marked unsafe, because the context cannot be made current on another thread without being unbound again (see EGLContext::unbind).

source

pub unsafe fn make_current_with_surface( &self, surface: &EGLSurface, ) -> Result<(), MakeCurrentError>

Makes the OpenGL context the current context in the current thread with a surface to read/draw to.

§Safety

This function is marked unsafe, because the context cannot be made current on another thread without being unbound again (see EGLContext::unbind).

source

pub unsafe fn make_current_with_draw_and_read_surface( &self, draw_surface: &EGLSurface, read_surface: &EGLSurface, ) -> Result<(), MakeCurrentError>

Makes the OpenGL context the current context in the current thread with surfaces to read/draw to.

§Safety

This function is marked unsafe, because the context cannot be made current on another thread without being unbound again (see EGLContext::unbind).

source

pub fn is_current(&self) -> bool

Returns true if the OpenGL context is the current one in the thread.

source

pub fn config_id(&self) -> EGLConfig

Returns the egl config for this context

source

pub fn pixel_format(&self) -> Option<PixelFormat>

Returns the pixel format of the main framebuffer of the context.

source

pub fn unbind(&self) -> Result<(), MakeCurrentError>

Unbinds this context from the current thread, if set.

This does nothing if this context is not the current context.

source

pub fn display(&self) -> &EGLDisplay

Returns the display which created this context.

source

pub fn dmabuf_render_formats(&self) -> &FormatSet

Returns a list of formats for dmabufs that can be rendered to.

source

pub fn dmabuf_texture_formats(&self) -> &FormatSet

Returns a list of formats for dmabufs that can be used as textures.

source

pub fn user_data(&self) -> &UserDataMap

Retrieve user_data associated with this context

Note: UserData is shared between shared context, if constructed with new_shared or new_shared_with_config.

source

pub fn get_context_handle(&self) -> EGLContext

Get a raw handle to the underlying context.

The pointer will become invalid, when this struct is destroyed.

Trait Implementations§

source§

impl Debug for EGLContext

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for EGLContext

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl Send for EGLContext

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 for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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>,

source§

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>,

source§

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<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more