Skip to main content

tessera_ui/
render_module.rs

1//! Custom GPU pipelines.
2//!
3//! Implement [`crate::DrawCommand`] and [`crate::DrawablePipeline`] for drawing,
4//! or [`crate::ComputeCommand`] and [`crate::ComputablePipeline`] for compute.
5//! Register the pipeline through [`PipelineContext::register_draw_pipeline`] or
6//! [`PipelineContext::register_compute_pipeline`] in a [`RenderModule`]. Install
7//! the module with [`crate::EntryPoint::module`], or share it through a
8//! [`crate::TesseraPackage`] using [`crate::EntryRegistry::add_module`].
9//!
10//! Emit commands from a render policy through [`crate::RenderInput`], or attach
11//! a draw policy to a layout. Reuse GPU resources across frames and upload through
12//! [`crate::GraphicsDevice`]. Pipeline creation resources specify the surface
13//! format and sample count; use both when constructing WGPU pipelines.
14//!
15//! UI render pipelines require [`crate::ui_stencil_state`]. Honor the supplied
16//! clip rectangle, draw geometry and local-to-window transform. Keep measurements
17//! local and apply the transform once. Declare background reads with
18//! [`crate::DrawCommand::sample_region`]; [`crate::SampleRegion`] describes the
19//! sampled scene, while [`crate::DrawRegion`] describes the command's output.
20//! Prefer bounded sampling regions when an effect does not need the whole scene.
21//!
22//! [`crate::DrawablePipeline`] provides frame and pass hooks for batched uploads
23//! and drawing. The renderer owns pass boundaries, clipping and submission.
24
25use crate::PipelineContext;
26
27/// A render module that registers pipelines.
28pub trait RenderModule: Send + Sync {
29    /// Registers pipelines using the provided context.
30    fn register_pipelines(&self, context: &mut PipelineContext<'_>);
31}