Skip to content

Supporting custom draw pipelines in imaging? #65

Description

@dwuggh

I would like to discuss whether imaging should support drawing through user-defined/custom pipelines, similar in spirit to custom shaders in wgpu or skia's sksL.

the design in my mind right now would be like a generalized version of bevy's SpecializedRenderPipeline:

trait PipelineDesc {
    /// the data type for this pipeline
    type State;
    fn draw(&self, state: &State);
    // ...
}
// pipeline with data, store as draw commands
struct PipeLine<P: PipelineDesc> {
    desc: P,
    data: P::State,
}

trait PipelineSpecializer {
    type Key: Clone + Hash + PartialEq + Eq;

    type Desc: PipelineDesc;
    /// Construct a new render pipeline based on the provided key.
    fn specialize(&self, key: Self::Key) -> Desc;
}

pub struct PipelineRef<'a> {
    pub transform: Affine,
    pipeline: &'a dyn Pipeline,
    // ...
}

I believe we can do runtime type checking, to match the type of Pipeline and its caller, though I don't have a clear thought now.

Will custom pipeline draw command be supported, or it is not in plan? If so, I'd be happy to contribute.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions