Skip to main content

PipelineVariant

Trait PipelineVariant 

Source
pub trait PipelineVariant<P>:
    Clone
    + Hash
    + Eq
    + 'static {
    type Descriptor: PipelineDescriptor<P>;

    // Required method
    fn descriptor(&self, device: &Device) -> Self::Descriptor;
}
Expand description

The complete, hashable identity of one compiled pipeline, and the recipe for its blueprint.

This is the cache key, so it carries exactly the information the descriptor depends on – no more, no less – and must be injective: equal variants build equal descriptors, and draws whose descriptors differ resolve to different variants. Equal keys then share one compiled pipeline, which is why Variants needs only a single map.

A variant may be its own descriptor (type Descriptor = Self), as the built-in lit family does, or describe a larger one it does not own.

Required Associated Types§

Source

type Descriptor: PipelineDescriptor<P>

The blueprint this variant compiles.

Required Methods§

Source

fn descriptor(&self, device: &Device) -> Self::Descriptor

Build this variant’s blueprint. Called only on a cache miss.

device is there for variants whose blueprint depends on device capabilities; the cache itself is built for one device.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§