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§
Sourcefn context_id(&self) -> ContextId<Self::TextureId>
fn context_id(&self) -> ContextId<Self::TextureId>
Sourcefn downscale_filter(&mut self, filter: TextureFilter) -> Result<(), Self::Error>
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
Sourcefn upscale_filter(&mut self, filter: TextureFilter) -> Result<(), Self::Error>
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
Sourcefn set_debug_flags(&mut self, flags: DebugFlags)
fn set_debug_flags(&mut self, flags: DebugFlags)
Set the enabled DebugFlags
Sourcefn debug_flags(&self) -> DebugFlags
fn debug_flags(&self) -> DebugFlags
Returns the current enabled DebugFlags
Sourcefn 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 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.
Provided Methods§
Sourcefn cleanup_texture_cache(&mut self) -> Result<(), Self::Error>
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§
impl Renderer for GlesRenderer
renderer_gl
only.impl Renderer for GlowRenderer
renderer_glow
only.impl Renderer for PixmanRenderer
renderer_pixman
only.impl Renderer for DummyRenderer
renderer_test
only.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,
renderer_multi
only.