Trait Renderer

Source
pub trait Renderer: RendererSuper {
    // Required methods
    fn context_id(&self) -> ContextId<Self::TextureId>;
    fn downscale_filter(
        &mut self,
        filter: TextureFilter,
    ) -> Result<(), Self::Error>;
    fn upscale_filter(
        &mut self,
        filter: TextureFilter,
    ) -> Result<(), Self::Error>;
    fn set_debug_flags(&mut self, flags: DebugFlags);
    fn debug_flags(&self) -> DebugFlags;
    fn render<'frame, 'buffer>(
        &'frame mut self,
        framebuffer: &'frame mut Self::Framebuffer<'buffer>,
        output_size: Size<i32, Physical>,
        dst_transform: Transform,
    ) -> Result<Self::Frame<'frame, 'buffer>, Self::Error>
       where 'buffer: 'frame;
    fn wait(&mut self, sync: &SyncPoint) -> Result<(), Self::Error>;

    // Provided method
    fn cleanup_texture_cache(&mut self) -> Result<(), Self::Error> { ... }
}
Expand description

Abstraction of commonly used rendering operations for compositors.

Note: Associated types are defined in RendererSuper.

Required Methods§

Source

fn context_id(&self) -> ContextId<Self::TextureId>

Returns the ContextId of this renderer

See ContextId for more details.

Source

fn downscale_filter(&mut self, filter: TextureFilter) -> Result<(), Self::Error>

Set the filter method to be used when rendering a texture into a smaller area than its size

Source

fn upscale_filter(&mut self, filter: TextureFilter) -> Result<(), Self::Error>

Set the filter method to be used when rendering a texture into a larger area than its size

Source

fn set_debug_flags(&mut self, flags: DebugFlags)

Set the enabled DebugFlags

Source

fn debug_flags(&self) -> DebugFlags

Returns the current enabled DebugFlags

Source

fn render<'frame, 'buffer>( &'frame mut self, framebuffer: &'frame mut Self::Framebuffer<'buffer>, output_size: Size<i32, Physical>, dst_transform: Transform, ) -> Result<Self::Frame<'frame, 'buffer>, Self::Error>
where 'buffer: 'frame,

Initialize a rendering context on the provided framebuffer with given dimensions and transformation.

The output_size specifies the dimensions of the display before the dst_transform is applied.

This function may error, if:

  • The given dimensions are unsupported (too large) for this renderer
  • The given Transformation is not supported by the renderer (Transform::Normal is always supported).
  • The underlying object of the given framebuffer is incompatible with this particular render instance.
Source

fn wait(&mut self, sync: &SyncPoint) -> Result<(), Self::Error>

Wait for a SyncPoint to be signaled

Provided Methods§

Source

fn cleanup_texture_cache(&mut self) -> Result<(), Self::Error>

Forcibly clean up the renderer internal texture cache

Note: Resources used by the renderer will be implicitly cleaned-up after finishing a Frame by either dropping the Frame or explicitly calling Frame::finish. This call can be used to clean-up resources in cases where either no Frame is used at all to prevent resource pile-up or in case of only infrequent access to lower system resource usage.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Renderer for GlesRenderer

Available on crate feature renderer_gl only.
Source§

impl Renderer for GlowRenderer

Available on crate feature renderer_glow only.
Source§

impl Renderer for PixmanRenderer

Available on crate feature renderer_pixman only.
Source§

impl Renderer for DummyRenderer

Available on crate feature renderer_test only.
Source§

impl<'render, 'target, R, T: GraphicsApi> Renderer for MultiRenderer<'render, 'target, R, T>
where R: 'static + GraphicsApi, R::Error: 'static, T::Error: 'static, <R::Device as ApiDevice>::Renderer: Bind<Dmabuf> + ExportMem + ImportDma + ImportMem, <T::Device as ApiDevice>::Renderer: ImportDma + ImportMem, <<R::Device as ApiDevice>::Renderer as RendererSuper>::TextureId: Clone + Send, <<R::Device as ApiDevice>::Renderer as RendererSuper>::Error: 'static, <<T::Device as ApiDevice>::Renderer as RendererSuper>::Error: 'static,

Available on crate feature renderer_multi only.