Skip to main content

RenderEffects

Struct RenderEffects 

Source
pub struct RenderEffects(/* private fields */);
Expand description

The render effects, one bit each.

One bit per effect and not one per pass: the occlusion pass and its blur are one switch because the blur is not optional (crate::ssao says why), and the reflection march and its blur are one switch because the blur is the composite.

Implementations§

Source§

impl RenderEffects

Source

pub const SHADOWS: Self

The shadow atlas: the sun’s cascades and every shadowed light’s tiles, their culls, and the depth-only pass that fills them.

Source

pub const AMBIENT_OCCLUSION: Self

Screen-space ambient occlusion — the occlusion pass and its depth-weighted blur, whose result scales the ambient term.

Source

pub const REFLECTIONS: Self

Screen-space reflections — the march and the blur that composites it into the scene colour.

Source

pub const BLOOM: Self

The bloom chain — the threshold-free downsample pyramid, the tent upsample that walks it back down, and the composite that adds it to the scene colour.

One bit for a variable number of passes, because the chain’s length is a function of the target’s extent rather than a choice — see crate::bloom. It is also the first bit here that is not in RenderEffects::DEFAULT_STACK; that constant says why.

Source

pub const ANTIALIASING: Self

FXAA — the fullscreen edge filter that resolves the tonemapped frame into the target. Antialiasing::Fxaa is the rung a settings file names it by.

Not in RenderEffects::DEFAULT_STACK, and not on BLOOM’s grounds: this one is not a lens, it is a resolve, and what keeps it out is that the slot holds one filter and CMAA2 is the tier the default carries — Antialiasing::from_effects of the default stack answers Antialiasing::Cmaa2. So this is the cheap tier rather than the absent one: a view’s own stack, or a player writing antialiasing = "fxaa", asks for the one pass instead of the three. docs/notes/rendering.md is where the ladder’s rules are written down.

Source

pub const VOLUMETRIC_FOG: Self

Volumetric fog — the froxel scatter, the column scan that turns it into a prefix, and the fullscreen composite over the frame.

The froxel ladder in docs/notes/rendering.md. The second bit not in RenderEffects::DEFAULT_STACK, and for a reason neither of the other two has: this one does not add a term, it moves one. The medium it integrates is the same exponential height fog mesh.slang composites analytically, so a frame that ran both would charge the air twice — ForwardRenderer::add_passes zeroes the frame block’s density when this is on, and the froxel path owns the medium instead.

A view with Fog::NONE draws the same frame either way, exactly: a zero density gives every froxel a transmittance of one and no radiance, and the composite multiplies by that one and adds those zeroes.

Source

pub const AUTO_EXPOSURE: Self

Auto-exposure — the luminance histogram of the finished frame, the reduce that turns it into one number, and the tonemap reading that number instead of the one a caller set.

Topic 43 §6’s rung, and the third bit not in RenderEffects::DEFAULT_STACK. The reason is VOLUMETRIC_FOG’s rather than BLOOM’s: it does not add a term to the picture, it takes the exposure away from the caller and computes it from the frame. A view that set an exposure and then found the engine overriding it would have been given a control that does nothing, so handing the control over is something a view asks for.

It also has no additive-zero form to land behind — an exposure measured from the frame is not the exposure a caller happened to set — so switching it on moves every frame it is on for, which is the re-bless each tier of the resolve slot has already spent in turn.

A view that hands ForwardRenderer::set_exposure_adaptation its rates and frame delta gets an exposure that steps toward each frame’s measurement, so a cut between two differently-lit shots rolls over a few tenths of a second; a view that sets none lands on the measurement in one frame.

Source

pub const CMAA2: Self

CMAA2 — the edge detect that writes one edge word per pixel, the shape classification with its bounded long-edge search, adding its fixed-point shares straight into the accumulation, and the deferred colour apply. Antialiasing::Cmaa2 is the rung a settings file names it by.

The antialiasing ladder’s second rung and the higher of the two antialiasing tiers. When it is set it takes the resolve slot instead of ANTIALIASING: three passes where FXAA is one, over-blurring far less of the thin geometry and text that is FXAA’s known weakness, and costing what a frame’s edges cost rather than what its pixels do.

The two are never both run, and that is what “a tier that is off is a frame with fewer passes” means here — the FXAA bit may stay set beside this one and is simply not recorded, because there is one resolve slot and this fills it. ForwardRenderer::add_passes is where the choice is made, once, and crate::cmaa2 is the pass group.

In RenderEffects::DEFAULT_STACK, on ANTIALIASING’s terms and in its place: a resolve is not a lens, so the slot belongs in the default, and the tier the engine reaches for is the honest thing to put in it. Swapping the slot moved every golden the bit is on for at once, which is the re-bless the antialiasing ladder priced and which was taken as a change of its own.

The bit is numbered after the tiers it postdates rather than beside the one it replaces, so no existing flag’s value moves. It kept the slot the retired SMAA tier had, for the same reason.

Source

pub const CONTACT_SHADOWS: Self

Screen-space contact shadows — the short march along the sun’s direction through the depth prepass, whose R8Unorm channel scales the sun’s shadow term.

Topic 45’s 2026-08-30 decision, and the rung the shadow ladder reached after the rotated disc: the sliver where a foot meets the floor or a book meets a shelf is finer than any atlas texel, so no bias and no filter can close it — a bias large enough to stop acne is large enough to detach the contact. crate::shadow is what the atlas answers for and crate::contact_shadows is the pass.

A screen-space term, so it leaves no trace on a tile and stacks with every rung above it: it neither reads the atlas nor writes it, and a frame that switches it off records one fewer full-screen pass and binds the renderer’s 1×1 white in its place.

Not in RenderEffects::DEFAULT_STACK, and parked there rather than argued out of it. The decision puts it in the default stack, with the low quality preset clearing it; what holds it out today is that switching it on moves every golden the workspace has. That flip and its re-bless is its own change — see the constant, which lists it with the three bits that are out on the merits.

The bit is numbered after the tiers it postdates rather than beside the shadow bit it completes, so no existing flag’s value moves — CMAA2’s rule.

Source§

impl RenderEffects

Source

pub const fn empty() -> Self

Get a flags value with all bits unset.

Source

pub const fn all() -> Self

Get a flags value with all known bits set.

Source

pub const fn bits(&self) -> u32

Get the underlying bits value.

The returned value is exactly the bits set in this flags value.

Source

pub const fn from_bits(bits: u32) -> Option<Self>

Convert from a bits value.

This method will return None if any unknown bits are set.

Source

pub const fn from_bits_truncate(bits: u32) -> Self

Convert from a bits value, unsetting any unknown bits.

Source

pub const fn from_bits_retain(bits: u32) -> Self

Convert from a bits value exactly.

Source

pub fn from_name(name: &str) -> Option<Self>

Get a flags value with the bits of a flag with the given name set.

This method will return None if name is empty or doesn’t correspond to any named flag.

Source

pub const fn is_empty(&self) -> bool

Whether all bits in self are unset.

Source

pub const fn is_all(&self) -> bool

Whether all known bits in this flags value are set.

Source

pub const fn intersects(&self, other: Self) -> bool

Whether any set bits in other are also set in self.

Source

pub const fn contains(&self, other: Self) -> bool

Whether all set bits in other are also set in self.

Source

pub fn insert(&mut self, other: Self)

The bitwise or (|) of the bits in self and other.

Source

pub fn remove(&mut self, other: Self)

The intersection of self with the complement of other (&!).

This method is not equivalent to self & !other when other has unknown bits set. remove won’t truncate other, but the ! operator will.

Source

pub fn toggle(&mut self, other: Self)

The bitwise exclusive-or (^) of the bits in self and other.

Source

pub fn set(&mut self, other: Self, value: bool)

Call insert when value is true or remove when value is false.

Source

pub const fn intersection(self, other: Self) -> Self

The bitwise and (&) of the bits in self and other.

Source

pub const fn union(self, other: Self) -> Self

The bitwise or (|) of the bits in self and other.

Source

pub const fn difference(self, other: Self) -> Self

The intersection of self with the complement of other (&!).

This method is not equivalent to self & !other when other has unknown bits set. difference won’t truncate other, but the ! operator will.

Source

pub const fn symmetric_difference(self, other: Self) -> Self

The bitwise exclusive-or (^) of the bits in self and other.

Source

pub const fn complement(self) -> Self

The bitwise negation (!) of the bits in self, truncating the result.

Source§

impl RenderEffects

Source

pub const fn iter(&self) -> Iter<RenderEffects> ⓘ

Yield a set of contained flags values.

Each yielded flags value will correspond to a defined named flag. Any unknown bits will be yielded together as a final flags value.

Source

pub const fn iter_names(&self) -> IterNames<RenderEffects> ⓘ

Yield a set of contained named flags values.

This method is like iter, except only yields bits in contained named flags. Any unknown bits, or bits not corresponding to a contained flag will not be yielded.

Source§

impl RenderEffects

Source

pub const DEFAULT_STACK: Self

What a view that has declared no render stack asks for.

The three light-transport effects, and neither of the two post passes. The line is not arbitrary: shadows, ambient occlusion and reflections each approximate light transport that is physically present in the scene, so a view that says nothing about them is a view asking for the most correct picture the device can draw. Bloom is a property of a lens — topic 18 files it under the post stack, whose contents that document says are “data-driven per camera (RON: which passes, parameters)” — and a camera that has been given no stack has been given no lens.

VOLUMETRIC_FOG is out for a second reason: it does not add a term to the picture, it takes one away from the fragment stage and computes it somewhere else, and which of the two a view wants is a cost question rather than a correctness one. AUTO_EXPOSURE is out for a third, written on the bit: it takes a control away from the caller, and a view that set an exposure has said what it wants done with it. ANTIALIASING is out for a fourth that is not a refusal: the resolve slot holds one filter and CMAA2 — which is in here — fills it, so the cheap tier is what a view or a player asks for by name when it wants the one pass instead of the three. CONTACT_SHADOWS is out for a fifth reason that is not a reason at all: topic 45 decided it belongs here, with the low preset clearing it, and it is parked outside only until the re-bless its first frame forces is taken on its own. It is the one member of this list that is expected to leave it.

So the default is the most correct picture, no lens and the higher antialiasing tier, and a view that wants otherwise asks for it: through its own stack, or through EffectOverride, which is the layer that may move a decision upward.

This is what EffectRequest::default’s camera holds, and it is why adding the bloom bit — and each antialiasing tier’s bit in turn — did not change a single frame the engine already drew on the change that added it.

Source

pub fn row(self) -> String

This set as a debug panel row and a headless summary line spell it: shadows ao ssr, with a switched-off effect dropped, and none where they all are.

One spelling for every sample, because every sample reports this and a second copy of the table is where one of them comes to disagree about what a frame drew.

Trait Implementations§

Source§

impl Binary for RenderEffects

Source§

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

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

impl BitAnd for RenderEffects

Source§

fn bitand(self, other: Self) -> Self

The bitwise and (&) of the bits in self and other.

Source§

type Output = RenderEffects

The resulting type after applying the & operator.
Source§

impl BitAndAssign for RenderEffects

Source§

fn bitand_assign(&mut self, other: Self)

The bitwise and (&) of the bits in self and other.

Source§

impl BitOr for RenderEffects

Source§

fn bitor(self, other: RenderEffects) -> Self

The bitwise or (|) of the bits in self and other.

Source§

type Output = RenderEffects

The resulting type after applying the | operator.
Source§

impl BitOrAssign for RenderEffects

Source§

fn bitor_assign(&mut self, other: Self)

The bitwise or (|) of the bits in self and other.

Source§

impl BitXor for RenderEffects

Source§

fn bitxor(self, other: Self) -> Self

The bitwise exclusive-or (^) of the bits in self and other.

Source§

type Output = RenderEffects

The resulting type after applying the ^ operator.
Source§

impl BitXorAssign for RenderEffects

Source§

fn bitxor_assign(&mut self, other: Self)

The bitwise exclusive-or (^) of the bits in self and other.

Source§

impl Clone for RenderEffects

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 Copy for RenderEffects

Source§

impl Debug for RenderEffects

Source§

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

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

impl Eq for RenderEffects

Source§

impl Extend<RenderEffects> for RenderEffects

Source§

fn extend<T: IntoIterator<Item = Self>>(&mut self, iterator: T)

The bitwise or (|) of the bits in each flags value.

Source§

fn extend_one(&mut self, item: T)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl Flags for RenderEffects

Source§

const FLAGS: &'static [Flag<RenderEffects>]

The set of defined flags.
Source§

type Bits = u32

The underlying bits type.
Source§

fn bits(&self) -> u32

Get the underlying bits value. Read more
Source§

fn from_bits_retain(bits: u32) -> RenderEffects

Convert from a bits value exactly.
Source§

fn all_named() -> RenderEffects

Get a flags value with all bits from named flags set. Read more
Source§

fn empty() -> Self

Get a flags value with all bits unset.
Source§

fn all() -> Self

Get a flags value with all known bits set.
Source§

fn known_bits(&self) -> Self::Bits

Get the known bits from a flags value.
Source§

fn unknown_bits(&self) -> Self::Bits

Get the unknown bits from a flags value.
Source§

fn contains_unknown_bits(&self) -> bool

This method will return true if any unknown bits are set.
Source§

fn from_bits(bits: Self::Bits) -> Option<Self>

Convert from a bits value. Read more
Source§

fn from_bits_truncate(bits: Self::Bits) -> Self

Convert from a bits value, unsetting any unknown bits.
Source§

fn from_name(name: &str) -> Option<Self>

Get a flags value with the bits of a flag with the given name set. Read more
Source§

fn iter(&self) -> Iter<Self> ⓘ

Yield a set of contained flags values. Read more
Source§

fn iter_names(&self) -> IterNames<Self> ⓘ

Yield a set of contained named flags values. Read more
Source§

fn iter_defined_names() -> IterDefinedNames<Self> ⓘ

Yield a set of all named flags defined by Self::FLAGS.
Source§

fn iter_equal_names(&self) -> IterEqualNames<Self> ⓘ

Get an iterator over all defined names for this flags value. Read more
Source§

fn is_empty(&self) -> bool

Whether all bits in this flags value are unset.
Source§

fn is_all(&self) -> bool

Whether all known bits in this flags value are set.
Source§

fn intersects(&self, other: Self) -> bool
where Self: Sized,

Whether any set bits in other are also set in self.
Source§

fn contains(&self, other: Self) -> bool
where Self: Sized,

Whether all set bits in other are also set in self.
Source§

fn truncate(&mut self)
where Self: Sized,

Remove any unknown bits from the flags.
Source§

fn insert(&mut self, other: Self)
where Self: Sized,

The bitwise or (|) of the bits in self and other.
Source§

fn remove(&mut self, other: Self)
where Self: Sized,

The intersection of self with the complement of other (&!). Read more
Source§

fn toggle(&mut self, other: Self)
where Self: Sized,

The bitwise exclusive-or (^) of the bits in self and other.
Source§

fn set(&mut self, other: Self, value: bool)
where Self: Sized,

Call Flags::insert when value is true or Flags::remove when value is false.
Source§

fn clear(&mut self)
where Self: Sized,

Unsets all bits in the flags.
Source§

fn intersection(self, other: Self) -> Self

The bitwise and (&) of the bits in self and other.
Source§

fn union(self, other: Self) -> Self

The bitwise or (|) of the bits in self and other.
Source§

fn difference(self, other: Self) -> Self

The intersection of self with the complement of other (&!). Read more
Source§

fn symmetric_difference(self, other: Self) -> Self

The bitwise exclusive-or (^) of the bits in self and other.
Source§

fn complement(self) -> Self

The bitwise negation (!) of the bits in self, truncating the result.
Source§

impl FromIterator<RenderEffects> for RenderEffects

Source§

fn from_iter<T: IntoIterator<Item = Self>>(iterator: T) -> Self

The bitwise or (|) of the bits in each flags value.

Source§

impl Hash for RenderEffects

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 IntoIterator for RenderEffects

Source§

type Item = RenderEffects

The type of the elements being iterated over.
Source§

type IntoIter = Iter<RenderEffects>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl LowerHex for RenderEffects

Source§

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

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

impl Not for RenderEffects

Source§

fn not(self) -> Self

The bitwise negation (!) of the bits in self, truncating the result.

Source§

type Output = RenderEffects

The resulting type after applying the ! operator.
Source§

impl Octal for RenderEffects

Source§

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

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

impl PartialEq for RenderEffects

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 PublicFlags for RenderEffects

Source§

type Primitive = u32

The type of the underlying storage.
Source§

type Internal = InternalBitFlags

The type of the internal field on the generated flags type.
Source§

impl StructuralPartialEq for RenderEffects

Source§

impl Sub for RenderEffects

Source§

fn sub(self, other: Self) -> Self

The intersection of self with the complement of other (&!).

This method is not equivalent to self & !other when other has unknown bits set. difference won’t truncate other, but the ! operator will.

Source§

type Output = RenderEffects

The resulting type after applying the - operator.
Source§

impl SubAssign for RenderEffects

Source§

fn sub_assign(&mut self, other: Self)

The intersection of self with the complement of other (&!).

This method is not equivalent to self & !other when other has unknown bits set. difference won’t truncate other, but the ! operator will.

Source§

impl UpperHex for RenderEffects

Source§

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

Formats the value using the given formatter. Read more

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
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
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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> HalThreadSafe for T
where T: Send + Sync,

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> 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.