tessera_ui/
pipeline_context.rs1use crate::{
4 CompositeCommand, ComputablePipeline, ComputeCommand, DrawCommand, DrawablePipeline,
5 renderer::{RenderCore, RenderResources, composite::CompositePipeline},
6};
7
8pub struct PipelineContext<'a> {
10 core: &'a mut RenderCore,
11}
12
13impl<'a> PipelineContext<'a> {
14 pub(crate) fn new(core: &'a mut RenderCore) -> Self {
16 Self { core }
17 }
18
19 pub fn resources(&self) -> RenderResources<'_> {
21 self.core.resources()
22 }
23
24 pub fn register_draw_pipeline<T, P>(&mut self, pipeline: P)
26 where
27 T: DrawCommand + 'static,
28 P: DrawablePipeline<T> + 'static,
29 {
30 self.core.register_draw_pipeline(pipeline);
31 }
32
33 pub fn register_compute_pipeline<T, P>(&mut self, pipeline: P)
35 where
36 T: ComputeCommand + 'static,
37 P: ComputablePipeline<T> + 'static,
38 {
39 self.core.register_compute_pipeline(pipeline);
40 }
41
42 pub fn register_composite_pipeline<T, P>(&mut self, pipeline: P)
44 where
45 T: CompositeCommand + 'static,
46 P: CompositePipeline<T> + 'static,
47 {
48 self.core.register_composite_pipeline(pipeline);
49 }
50}