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: boolWhether 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: DepthStencilPolicyHow 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: ColorWritesWhich color channels the pipeline writes to the target.
a2c_hint: boolWhether 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
impl LineOptions
Sourcepub const fn opaque() -> Self
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.
Trait Implementations§
Source§impl Clone for LineOptions
impl Clone for LineOptions
Source§impl Debug for LineOptions
impl Debug for LineOptions
Source§impl Default for LineOptions
impl Default for LineOptions
impl Eq for LineOptions
Source§impl Hash for LineOptions
impl Hash for LineOptions
Source§impl PartialEq for LineOptions
impl PartialEq for LineOptions
impl StructuralPartialEq for LineOptions
Auto Trait Implementations§
impl Forget for LineOptions
impl Freeze for LineOptions
impl RefUnwindSafe for LineOptions
impl Send for LineOptions
impl Sync for LineOptions
impl Unpin for LineOptions
impl UnsafeUnpin for LineOptions
impl UnwindSafe for LineOptions
Blanket Implementations§
impl<T> AsId for T
impl<T> AsIdSalt for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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