pub struct Gles2Renderer { /* private fields */ }
Expand description
A renderer utilizing OpenGL ES 2
Implementations§
Source§impl Gles2Renderer
impl Gles2Renderer
Sourcepub unsafe fn new<L>(
context: EGLContext,
logger: L,
) -> Result<Gles2Renderer, Gles2Error>
pub unsafe fn new<L>( context: EGLContext, logger: L, ) -> Result<Gles2Renderer, Gles2Error>
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 (seeEGLContext::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
impl Gles2Renderer
Sourcepub fn with_context<F, R>(&mut self, func: F) -> Result<R, Gles2Error>
pub fn with_context<F, R>(&mut self, func: F) -> Result<R, Gles2Error>
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
impl Bind<Dmabuf> for Gles2Renderer
Source§impl Bind<Rc<EGLSurface>> for Gles2Renderer
impl Bind<Rc<EGLSurface>> for Gles2Renderer
Source§fn bind(&mut self, surface: Rc<EGLSurface>) -> Result<(), Gles2Error>
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 moreSource§impl Debug for Gles2Renderer
impl Debug for Gles2Renderer
Source§impl Drop for Gles2Renderer
impl Drop for Gles2Renderer
Source§impl ImportDma for Gles2Renderer
impl ImportDma for Gles2Renderer
Source§fn import_dmabuf(&mut self, buffer: &Dmabuf) -> Result<Gles2Texture, Gles2Error>
fn import_dmabuf(&mut self, buffer: &Dmabuf) -> Result<Gles2Texture, Gles2Error>
Import a given raw dmabuf into the renderer. Read more
Source§impl ImportEgl for Gles2Renderer
impl ImportEgl for Gles2Renderer
Source§fn bind_wl_display(&mut self, display: &Display) -> Result<(), Error>
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)
fn unbind_wl_display(&mut self)
Unbinds a previously bound egl display, if existing. Read more
Source§fn egl_reader(&self) -> Option<&EGLBufferReader>
fn egl_reader(&self) -> Option<&EGLBufferReader>
Returns the underlying
EGLBufferReader
. Read moreSource§fn import_egl_buffer(
&mut self,
buffer: &WlBuffer,
) -> Result<Gles2Texture, Gles2Error>
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 moreSource§impl ImportShm for Gles2Renderer
impl ImportShm for Gles2Renderer
Source§fn import_shm_buffer(
&mut self,
buffer: &WlBuffer,
surface: Option<&SurfaceData>,
damage: &[Rectangle<i32, Buffer>],
) -> Result<Gles2Texture, Gles2Error>
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 moreSource§fn shm_formats(&self) -> &[Format]
fn shm_formats(&self) -> &[Format]
Returns supported formats for shared memory buffers. Read more
Source§impl Renderer for Gles2Renderer
impl Renderer for Gles2Renderer
Source§type Error = Gles2Error
type Error = Gles2Error
Error type returned by the rendering operations of this renderer.
Source§type TextureId = Gles2Texture
type TextureId = Gles2Texture
Texture Handle type used by this renderer.
Source§type Frame = Gles2Frame
type Frame = Gles2Frame
Type representing a currently in-progress frame during the
Renderer::render
-callAuto Trait Implementations§
impl Freeze for Gles2Renderer
impl !RefUnwindSafe for Gles2Renderer
impl !Send for Gles2Renderer
impl !Sync for Gles2Renderer
impl Unpin for Gles2Renderer
impl !UnwindSafe for Gles2Renderer
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
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn 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
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
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)
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.