Skip to main content

LayerRaster

Trait LayerRaster 

pub trait LayerRaster {
    type Error;

    // Required methods
    fn device(&self) -> &Device;
    fn queue(&self) -> &Queue;
    fn size(&self) -> (u32, u32);
    fn sparse(&self) -> bool;
    fn base_color(&self) -> AlphaColor<Srgb>;
    fn render(
        &mut self,
        layer: &mut LayerTexture,
        scene: &Scene,
        regions: Option<Vec<FineDamageRect>>,
        base: AlphaColor<Srgb>,
    ) -> Result<(), Self::Error>;
    fn composite(
        &mut self,
        encode: impl FnOnce(&Device, &Queue, &mut CommandEncoder, &TextureView),
    ) -> Result<(), Self::Error>;
}
Expand description

What a LayerPresenter rasterises with and composites through.

Required Associated Types§

type Error

Required Methods§

fn device(&self) -> &Device

fn queue(&self) -> &Queue

fn size(&self) -> (u32, u32)

The output’s size, which every layer texture has too.

fn sparse(&self) -> bool

Whether Self::render can rasterise only some regions of a layer.

fn base_color(&self) -> AlphaColor<Srgb>

What the backdrop layer is rasterised over.

fn render( &mut self, layer: &mut LayerTexture, scene: &Scene, regions: Option<Vec<FineDamageRect>>, base: AlphaColor<Srgb>, ) -> Result<(), Self::Error>

Rasterise scene over base into layer: within regions only, when given, keeping the rest of the texture.

§Errors

When the render fails or misses the host’s completion policy.

fn composite( &mut self, encode: impl FnOnce(&Device, &Queue, &mut CommandEncoder, &TextureView), ) -> Result<(), Self::Error>

Encode with encode what writes the output (the composite, writing the output view it is given), and submit it under the host’s completion policy.

§Errors

When the submission fails or misses the host’s completion policy.

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§