pub trait SceneRenderer: 'static {
// Required methods
fn draw(&mut self, scene: &Scene) -> bool;
fn sprite_atlas(&self) -> Arc<dyn PlatformAtlas> ⓘ;
}Expand description
A renderer that presents a Scene to some target.
OS backends and alternative engines implement this; gpui produces the
Scene and submits it through the window’s platform implementation.
Image capture and offscreen rendering are capabilities of the renderer
rather than of the OS window, so onscreen GPU renderers only need to
implement SceneRenderer::draw and SceneRenderer::sprite_atlas.
Required Methods§
Sourcefn draw(&mut self, scene: &Scene) -> bool
fn draw(&mut self, scene: &Scene) -> bool
Encodes and submits scene, returning whether it was presented.
Renderers that cannot observe presentation (or that render offscreen)
return true; window backends that pace themselves on compositor
callbacks use false to retry the frame later.
Sourcefn sprite_atlas(&self) -> Arc<dyn PlatformAtlas> ⓘ
fn sprite_atlas(&self) -> Arc<dyn PlatformAtlas> ⓘ
Returns the sprite atlas used by this renderer.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".