tessera_ui/renderer/compute.rs
1//! A unified system for GPU-based computation.
2//!
3//! This module provides a structured way to define and dispatch compute shaders as part
4//! of a sequential rendering and computation workflow. It integrates seamlessly with the
5//! unified command system to enable mixed graphics and compute workloads.
6//!
7//! # Key Components
8//!
9//! * [`ComputeCommand`]: A trait marking a command as a compute operation with optional barrier support.
10//! * [`ComputablePipeline`]: A trait for a specific compute task that processes a command
11//! within a `wgpu::ComputePass`.
12//! * [`ComputePipelineRegistry`]: The central dispatcher that manages all registered pipelines.
13//!
14//! # Workflow
15//!
16//! 1. **Define a Command:** Create a struct that implements `ComputeCommand`.
17//! 2. **Implement a Pipeline:** Create a struct that implements `ComputablePipeline<YourCommand>`.
18//! This involves setting up the `wgpu::ComputePipeline` and defining the `dispatch` method.
19//! 3. **Register the Pipeline:** During application startup, register an instance of your
20//! pipeline with the `ComputePipelineRegistry`.
21//! 4. **Submit Commands:** Components submit `ComputeCommand`s, which are then dispatched
22//! by the renderer to the appropriate pipeline through the unified command system.
23//!
24//! # Barrier Support
25//!
26//! Compute commands can specify barrier requirements to ensure proper synchronization
27//! with previous rendering operations, enabling post-processing effects and multi-pass algorithms.
28
29pub mod command;
30pub mod pipeline;
31pub mod resource;
32
33pub use command::ComputeCommand;
34pub use pipeline::{ComputablePipeline, ComputePipelineRegistry};
35pub use resource::{ComputeResource, ComputeResourceManager, ComputeResourceRef};