pub struct ComputePipelineRegistry { /* private fields */ }
Expand description
Registry for managing and dispatching compute pipelines.
The ComputePipelineRegistry
serves as the central hub for all compute pipelines
in the Tessera framework. It maintains a collection of registered pipelines and
handles the dispatch of compute commands to their appropriate pipelines.
§Architecture
The registry uses type erasure to store pipelines of different types in a single collection. When a compute command needs to be processed, the registry attempts to dispatch it to all registered pipelines until one handles it successfully.
§Usage Pattern
- Create a new registry
- Register all required compute pipelines during application initialization
- The renderer uses the registry to dispatch commands during frame rendering
§Example
use tessera_ui::renderer::compute::ComputePipelineRegistry;
// Create registry and register pipelines
let mut registry = ComputePipelineRegistry::new();
registry.register(blur_pipeline);
registry.register(contrast_pipeline);
registry.register(brightness_pipeline);
// Registry is now ready for use by the renderer
§Performance Considerations
- All registered pipelines are called for each command until one handles it
- Register more commonly used pipelines first for better average performance
- Consider the frequency of different compute operations when ordering registrations
§Thread Safety
The registry and all registered pipelines must be Send + Sync
to support
parallel execution in the rendering system.
Implementations§
Source§impl ComputePipelineRegistry
impl ComputePipelineRegistry
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new empty compute pipeline registry.
§Example
use tessera_ui::renderer::compute::ComputePipelineRegistry;
let registry = ComputePipelineRegistry::new();
Sourcepub fn register<C: ComputeCommand + 'static>(
&mut self,
pipeline: impl ComputablePipeline<C> + 'static,
)
pub fn register<C: ComputeCommand + 'static>( &mut self, pipeline: impl ComputablePipeline<C> + 'static, )
Registers a new compute pipeline for a specific command type.
This method takes ownership of the pipeline and wraps it in a type-erased container that can be stored alongside other pipelines of different types.
§Type Parameters
C
- TheComputeCommand
type this pipeline handles
§Parameters
pipeline
- The pipeline instance to register
§Example
use tessera_ui::renderer::compute::ComputePipelineRegistry;
let mut registry = ComputePipelineRegistry::new();
// Register custom compute pipelines
let blur_pipeline = BlurPipeline::new(&device);
registry.register(blur_pipeline);
let contrast_pipeline = ContrastPipeline::new(&device);
registry.register(contrast_pipeline);
// Register multiple pipelines for different effects
registry.register(BrightnessAdjustmentPipeline::new(&device));
registry.register(ColorGradingPipeline::new(&device));
§Registration Order
Unlike drawable pipelines, compute pipelines are dispatched to all registered pipelines until one handles the command. Consider registering more frequently used pipelines first for better performance.
§Thread Safety
The pipeline must implement Send + Sync
to be compatible with Tessera’s
parallel rendering architecture.
Trait Implementations§
Source§impl Default for ComputePipelineRegistry
impl Default for ComputePipelineRegistry
Source§fn default() -> ComputePipelineRegistry
fn default() -> ComputePipelineRegistry
Auto Trait Implementations§
impl Freeze for ComputePipelineRegistry
impl !RefUnwindSafe for ComputePipelineRegistry
impl Send for ComputePipelineRegistry
impl Sync for ComputePipelineRegistry
impl Unpin for ComputePipelineRegistry
impl !UnwindSafe for ComputePipelineRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian()
.