Skip to main content

PipelineSystem

Trait PipelineSystem 

pub trait PipelineSystem: Send + Sync {
    // Required methods
    fn layout(
        &self,
        device: &(dyn GraphicsDevice + 'static),
        key: LayoutKey,
        variant: &ShaderVariantKey,
    ) -> Result<BindGroupLayoutId, RenderError>;
    fn inline_layout(
        &self,
        device: &(dyn GraphicsDevice + 'static),
        label: &'static str,
        entries: &[BindGroupLayoutEntry],
    ) -> Result<BindGroupLayoutId, RenderError>;
    fn pipeline(
        &self,
        device: &(dyn GraphicsDevice + 'static),
        spec: &PipelineSpec,
    ) -> Result<RenderPipelineId, RenderError>;
    fn compute_pipeline(
        &self,
        device: &(dyn GraphicsDevice + 'static),
        spec: &ComputePipelineSpec,
    ) -> Result<ComputePipelineId, RenderError>;

    // Provided methods
    fn set_overlay_source(&self, _logical_path: &str, _source: String) { ... }
    fn recompose_dirty(
        &self,
        _device: &(dyn GraphicsDevice + 'static),
    ) -> Result<(), RenderError> { ... }
}
Expand description

Backend that compiles shaders and builds/caches bind-group layouts and render pipelines on demand. See the module docs.

Required Methods§

fn layout( &self, device: &(dyn GraphicsDevice + 'static), key: LayoutKey, variant: &ShaderVariantKey, ) -> Result<BindGroupLayoutId, RenderError>

Returns the canonical bind-group layout for key under variant, creating + caching it on first request. Both lit lanes (pipeline slot) and the material projection (group-2 bind group) obtain layouts here, so they share the same id.

fn inline_layout( &self, device: &(dyn GraphicsDevice + 'static), label: &'static str, entries: &[BindGroupLayoutEntry], ) -> Result<BindGroupLayoutId, RenderError>

Returns a bespoke (inline) bind-group layout, identified + cached by its stable label, creating it on first request. Lanes with non-canonical layouts (shadow / UI / overlay / unlit) obtain their layout ids here so they can build ring buffers / bind groups against the same id the pipeline was built with.

fn pipeline( &self, device: &(dyn GraphicsDevice + 'static), spec: &PipelineSpec, ) -> Result<RenderPipelineId, RenderError>

Returns the render pipeline for spec, creating + caching it on first request (keyed by (shader, variant, color_format)). Resolves the spec’s bind-group layouts, compiles the shader for the variant, and builds the pipeline. Lanes call this every frame; it is a cache hit after the first.

fn compute_pipeline( &self, device: &(dyn GraphicsDevice + 'static), spec: &ComputePipelineSpec, ) -> Result<ComputePipelineId, RenderError>

Returns the compute pipeline for spec, creating + caching it on first request (keyed by (shader, variant)). Resolves the spec’s bind-group layouts, compiles the shader for the variant, and builds the pipeline. Used by Forward+ light culling.

Provided Methods§

fn set_overlay_source(&self, _logical_path: &str, _source: String)

Hot-reload: override a logical shader source (lib or pipeline) with new text, marking it (and dependent pipelines) for recompose. Default no-op until the hot-reload phase wires it.

fn recompose_dirty( &self, _device: &(dyn GraphicsDevice + 'static), ) -> Result<(), RenderError>

Hot-reload: recompose any modules marked dirty by set_overlay_source and rebuild the affected cached pipelines in place. Default no-op.

Implementors§