pub struct Renderer { /* private fields */ }Expand description
The wgpu renderer. Consumes scene deltas; owns only derived GPU/CPU caches.
Implementations§
Source§impl Renderer
impl Renderer
Sourcepub fn new(
device: Device,
queue: Queue,
format: TextureFormat,
options: RendererOptions,
) -> Result<Self, RenderError>
pub fn new( device: Device, queue: Queue, format: TextureFormat, options: RendererOptions, ) -> Result<Self, RenderError>
Create a renderer drawing into targets of format.
The device should be created with limits no larger than
[wgpu::Limits::downlevel_webgl2_defaults] needs; the renderer uses only
WebGL2-compatible features on every backend.
§Errors
RenderError::Font if the bundled font fails to load (never expected).
Sourcepub fn sample_count(&self) -> u32
pub fn sample_count(&self) -> u32
MSAA sample count in use.
Sourcepub fn apply_delta_bytes(&mut self, bytes: &[u8]) -> Result<(), RenderError>
pub fn apply_delta_bytes(&mut self, bytes: &[u8]) -> Result<(), RenderError>
Apply a binary scene delta (dotloom-scene format).
§Errors
RenderError::Scene for malformed input; the scene is left unchanged.
Sourcepub fn apply_delta(&mut self, delta: SceneDelta)
pub fn apply_delta(&mut self, delta: SceneDelta)
Apply a decoded scene delta.
Sourcepub fn scene(&self) -> &SceneCache
pub fn scene(&self) -> &SceneCache
The scene cache.
Sourcepub fn set_overlay(&mut self, overlay: Overlay)
pub fn set_overlay(&mut self, overlay: Overlay)
Set the interaction overlay.
Sourcepub fn set_hover(&mut self, id: Option<u64>)
pub fn set_hover(&mut self, id: Option<u64>)
Highlight one item as hovered (drawn on top as feedback).
Sourcepub fn last_stats(&self) -> FrameStats
pub fn last_stats(&self) -> FrameStats
Statistics of the last frame.
Sourcepub fn render(&mut self, target: &Texture) -> Result<FrameStats, RenderError>
pub fn render(&mut self, target: &Texture) -> Result<FrameStats, RenderError>
Draw one frame into target (its size defines the viewport in device pixels).
§Errors
Sourcepub fn dispose(&mut self)
pub fn dispose(&mut self)
Release all GPU resources now (buffers, textures). The renderer cannot draw afterwards. Dropping the renderer also releases them.
Sourcepub fn is_disposed(&self) -> bool
pub fn is_disposed(&self) -> bool
Whether Renderer::dispose was called.