smithay::backend::renderer::gles2

Struct Gles2Renderer

Source
pub struct Gles2Renderer { /* private fields */ }
Expand description

A renderer utilizing OpenGL ES 2

Implementations§

Source§

impl Gles2Renderer

Source

pub unsafe fn new<L>( context: EGLContext, logger: L, ) -> Result<Gles2Renderer, Gles2Error>
where L: Into<Option<Logger>>,

Creates a new OpenGL ES 2 renderer from a given EGLContext.

§Safety

This operation will cause undefined behavior if the given EGLContext is active in another thread.

§Implementation details
  • Texture handles created by the resulting renderer are valid for every rendered created with an EGLContext shared with the given one (see EGLContext::new_shared) and can be used on any of these renderers.
  • This renderer has no default framebuffer, use Bind::bind before rendering.
  • Binding a new target, while another one is already bound, will replace the current target.
  • Shm buffers can be released after a successful import, without the texture handle becoming invalid.
Source§

impl Gles2Renderer

Source

pub fn with_context<F, R>(&mut self, func: F) -> Result<R, Gles2Error>
where F: FnOnce(&mut Self, &Gles2) -> R,

Run custom code in the GL context owned by this renderer.

Note: Any changes to the GL state should be restored at the end of this function. Otherwise this can lead to rendering errors while using functions of this renderer. Relying on any state set by the renderer may break on any smithay update as the details about how this renderer works are considered an implementation detail.

Trait Implementations§

Source§

impl Bind<Dmabuf> for Gles2Renderer

Source§

fn bind(&mut self, dmabuf: Dmabuf) -> Result<(), Gles2Error>

Bind a given rendering target, which will contain the rendering results until unbind is called. Read more
Source§

fn supported_formats(&self) -> Option<HashSet<Format>>

Supported pixel formats for given targets, if applicable.
Source§

impl Bind<Rc<EGLSurface>> for Gles2Renderer

Source§

fn bind(&mut self, surface: Rc<EGLSurface>) -> Result<(), Gles2Error>

Bind a given rendering target, which will contain the rendering results until unbind is called. Read more
Source§

fn supported_formats(&self) -> Option<HashSet<Format>>

Supported pixel formats for given targets, if applicable.
Source§

impl Debug for Gles2Renderer

Source§

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

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

impl Drop for Gles2Renderer

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl ImportDma for Gles2Renderer

Source§

fn import_dmabuf(&mut self, buffer: &Dmabuf) -> Result<Gles2Texture, Gles2Error>

Import a given raw dmabuf into the renderer. Read more
Source§

fn dmabuf_formats<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Format> + 'a>

Returns supported formats for dmabufs.
Source§

fn import_dma_buffer( &mut self, buffer: &WlBuffer, ) -> Result<<Self as Renderer>::TextureId, <Self as Renderer>::Error>

Import a given dmabuf-based buffer into the renderer (see buffer_type). Read more
Source§

impl ImportEgl for Gles2Renderer

Source§

fn bind_wl_display(&mut self, display: &Display) -> Result<(), Error>

Binds the underlying EGL display to the given Wayland display. Read more
Source§

fn unbind_wl_display(&mut self)

Unbinds a previously bound egl display, if existing. Read more
Source§

fn egl_reader(&self) -> Option<&EGLBufferReader>

Returns the underlying EGLBufferReader. Read more
Source§

fn import_egl_buffer( &mut self, buffer: &WlBuffer, ) -> Result<Gles2Texture, Gles2Error>

Import a given wl_drm-based buffer into the renderer (see buffer_type). Read more
Source§

impl ImportShm for Gles2Renderer

Source§

fn import_shm_buffer( &mut self, buffer: &WlBuffer, surface: Option<&SurfaceData>, damage: &[Rectangle<i32, Buffer>], ) -> Result<Gles2Texture, Gles2Error>

Import a given shm-based buffer into the renderer (see buffer_type). Read more
Source§

fn shm_formats(&self) -> &[Format]

Returns supported formats for shared memory buffers. Read more
Source§

impl Renderer for Gles2Renderer

Source§

type Error = Gles2Error

Error type returned by the rendering operations of this renderer.
Source§

type TextureId = Gles2Texture

Texture Handle type used by this renderer.
Source§

type Frame = Gles2Frame

Type representing a currently in-progress frame during the Renderer::render-call
Source§

fn render<F, R>( &mut self, size: Size<i32, Physical>, transform: Transform, rendering: F, ) -> Result<R, Self::Error>
where F: FnOnce(&mut Self, &mut Self::Frame) -> R,

Initialize a rendering context on the current rendering target with given dimensions and transformation. Read more
Source§

impl Unbind for Gles2Renderer

Source§

fn unbind(&mut self) -> Result<(), <Self as Renderer>::Error>

Unbind the current rendering target. Read more

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
Source§

impl<T> Downcast for T
where T: Any,

Source§

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.
Source§

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.
Source§

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.
Source§

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<R> ImportAll for R

Source§

fn import_buffer( &mut self, buffer: &WlBuffer, surface: Option<&SurfaceData>, damage: &[Rectangle<i32, Buffer>], ) -> Option<Result<<R as Renderer>::TextureId, <R as Renderer>::Error>>

Import a given buffer into the renderer. 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> Pointable for T

Source§

const ALIGN: usize = _

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V