Skip to main content

tessera_ui/renderer/
drawer.rs

1//! Graphics rendering pipeline management.
2
3pub mod command;
4pub mod pipeline;
5
6use crate::render_graph::DrawGeometry;
7
8pub use command::DrawCommand;
9pub use pipeline::{DrawablePipeline, ErasedDrawContext, PipelineRegistry};
10
11/// Drawer manages graphics pipelines and processes draw commands.
12#[derive(Default)]
13pub struct Drawer {
14    /// Registry containing all registered graphics pipelines
15    pub pipeline_registry: PipelineRegistry,
16}
17
18impl Drawer {
19    /// Create a new drawer
20    pub fn new() -> Self {
21        Self::default()
22    }
23
24    /// Submit a draw command to the appropriate pipeline for rendering.
25    ///
26    /// # Arguments
27    ///
28    /// * `context` - Render-pass resources and the active clipping rectangle.
29    /// * `commands` - Commands with local dimensions and precise target
30    ///   mappings.
31    pub fn submit(
32        &mut self,
33        context: ErasedDrawContext<'_, '_>,
34        commands: &[(&dyn DrawCommand, DrawGeometry)],
35    ) {
36        self.pipeline_registry.dispatch(context, commands);
37    }
38}