Trait MewPipeline

Source
pub trait MewPipeline {
    type BindGroupSet;
    type BindGroupArray<T>;
    type VertexArray<T>;
    type FragmentArray<T>;

    // Required methods
    fn new(pipeline: RenderPipeline) -> Self;
    fn bind_group_layout_types_array(    ) -> Self::BindGroupArray<(TypeId, BindGroupLayoutDescriptor<'static>)>;
    fn map_bind_group_array<A, B, F: FnMut(A) -> B>(
        array: Self::BindGroupArray<A>,
        f: F,
    ) -> Self::BindGroupArray<B>;
    fn bind_group_ref_array(
        layout_array: &Self::BindGroupArray<BindGroupLayout>,
    ) -> Self::BindGroupArray<&BindGroupLayout>;
    fn layout_desc<'a, 'b>(
        bind_group_layouts: &'a Self::BindGroupArray<&'b BindGroupLayout>,
    ) -> PipelineLayoutDescriptor<'a>;
    fn fragment_targets<'a>(
        surface_fmt: Option<TextureFormat>,
    ) -> Self::FragmentArray<Option<ColorTargetState>>;
    fn pipeline_desc<'a>(
        layout: &'a MewPipelineLayout<Self>,
        shader: &'a ShaderModule,
        vertex_entry: Option<&'a str>,
        fragment_entry: Option<&'a str>,
        fragment_targets: &'a Self::FragmentArray<Option<ColorTargetState>>,
    ) -> RenderPipelineDescriptor<'a>;
}
Expand description

Trait for pipeline wrapper types, to get layouts and descriptors about the inner pipeline.

The number of internal bind groups must be defined in the generic parameter, because associated consts are “uNsTAbLe”, apparently.

Ideally, avoid using this directly - it’s horribly designed, so just look away and use the pipeline macro.

Required Associated Types§

Source

type BindGroupSet

A tuple of the pipeline’s internal bind groups (max of 4).

Source

type BindGroupArray<T>

A generic array the length of the number of bind groups (literally [T; N]).

Source

type VertexArray<T>

A generic array the length of the number of vertex types (literally [T; N]).

Source

type FragmentArray<T>

A generic array the length of the number of fragment targets (literally [T; N]).

Required Methods§

Source

fn new(pipeline: RenderPipeline) -> Self

Wrap a pipeline in this struct.

Source

fn bind_group_layout_types_array() -> Self::BindGroupArray<(TypeId, BindGroupLayoutDescriptor<'static>)>

Get an array of internal bind group layouts.

Source

fn map_bind_group_array<A, B, F: FnMut(A) -> B>( array: Self::BindGroupArray<A>, f: F, ) -> Self::BindGroupArray<B>

Source

fn bind_group_ref_array( layout_array: &Self::BindGroupArray<BindGroupLayout>, ) -> Self::BindGroupArray<&BindGroupLayout>

Source

fn layout_desc<'a, 'b>( bind_group_layouts: &'a Self::BindGroupArray<&'b BindGroupLayout>, ) -> PipelineLayoutDescriptor<'a>

Get the layout descriptor for the pipeline. Requires the output from Self::bind_group_layout_types_array because const fns in traits are “uNsTAbLe”, apparently, and lifetimes exist.

Source

fn fragment_targets<'a>( surface_fmt: Option<TextureFormat>, ) -> Self::FragmentArray<Option<ColorTargetState>>

Source

fn pipeline_desc<'a>( layout: &'a MewPipelineLayout<Self>, shader: &'a ShaderModule, vertex_entry: Option<&'a str>, fragment_entry: Option<&'a str>, fragment_targets: &'a Self::FragmentArray<Option<ColorTargetState>>, ) -> RenderPipelineDescriptor<'a>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§