Skip to main content

LineOptions

Struct LineOptions 

Source
pub struct LineOptions {
    pub shader: Option<LineShader>,
    pub hard_edge: bool,
    pub depth_stencil: DepthStencilPolicy,
    pub blend: Option<BlendState>,
    pub write_mask: ColorWrites,
    pub a2c_hint: bool,
}
Expand description

The policy a caller decides about a built-in line pipeline.

Everything a draw resolves is absent: the instance record, the render target and the device’s storage-buffer answer are facts a draw folds into an LineVariant when it composes a pipeline, not choices a caller can make. The target owns the color format, the sample count and whether there is a depth attachment at all; what is left is what a caller actually picks.

The zero value is the usual stroke: an antialiased edge blended over the frame, testing against the depth the pass holds without writing its own.

Fields§

§shader: Option<LineShader>

The entry shader this policy draws with, or None for the built-in line.wesl.

A caller’s snippets extend the built-in source and nothing else: the layouts, the instance record and the entry-point names stay the variant’s. See LineShader.

The shader takes part in equality and hashing whole, label included: two options whose shaders differ at all — a name among the differences — build two pipelines, which is the observable difference.

§hard_edge: bool

Whether the fragment stage cuts a pixel whose coverage falls below one half instead of blending its partial colour.

An antialiased edge is a veil of partial pixels; a stroke that covers the frame, as an opaque one does, has no colour to veil the background with, so it cuts cleanly at the pixel it covers instead. The cut is a whole-pixel decision, so it works at any sample count — but on a multisampled target the pipeline drops the cut and leaves the edge to the samples: state a2c_hint to have the alpha turned into the sample mask, which smooths the edge the cut would jag. See LineVariant.

§depth_stencil: DepthStencilPolicy

How the pipeline tests and writes the depth attachment, for a target that has one.

A target without a depth attachment runs the pipeline without a depth-stencil state at all, whatever this field says. The format is the attachment’s own, which the options cannot know: it is the target’s word, and the variant carries the target.

The default states the stroke convention: the comparison is the renderer’s reverse-z one, and a stroke writes its own depth, which is what lets strokes cover one another. A stroke that blends over the frame instead states the default with the write cleared, so it hides nothing behind it.

§blend: Option<BlendState>

The blend state the fragment output composites with, or None to write it unblended.

The common stroke composites with the target’s alpha: the fragment’s coverage rides its alpha, so ALPHA_BLENDING is what makes an edge antialiased rather than jagged. A stroke under a caller’s own policy — an additive energy line, say — states its own.

§write_mask: ColorWrites

Which color channels the pipeline writes to the target.

§a2c_hint: bool

Whether the fragment’s alpha states coverage, on a multisampled target.

Alpha-to-coverage turns the fragment’s alpha into the sample mask, so an antialiased edge lands as partially covered samples instead of a blend. That is only honest when the alpha is coverage: a wash whose alpha is transparency, blended over the frame, would have its contribution squared — masked to a fraction of the samples and then blended by the same fraction again — so the hint defaults to off and a stroke states it when its alpha means coverage. Nothing happens on a single-sampled target, where there are no samples to spread over.

Implementations§

Source§

impl LineOptions

Source

pub const fn opaque() -> Self

A stroke that covers the frame: no blend, the depth written.

The cut at half coverage is what keeps its edge from veiling the background with a colour it does not own; see hard_edge. On a multisampled target the cut yields to alpha-to-coverage, which keeps the edge smooth there.

Source

pub const fn blended() -> Self

A stroke blended over the frame, testing depth without writing it.

Trait Implementations§

Source§

impl Clone for LineOptions

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LineOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for LineOptions

Source§

fn default() -> Self

A stroke blended over the frame, testing depth without writing it.

Source§

impl Eq for LineOptions

Source§

impl Hash for LineOptions

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for LineOptions

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for LineOptions

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> AsId for T
where T: Hash + Debug,

§

impl<T> AsIdSalt for T
where T: Hash + Debug,

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,

§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more