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
impl RenderEffects
Sourcepub const SHADOWS: Self
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.
Sourcepub const AMBIENT_OCCLUSION: Self
pub const AMBIENT_OCCLUSION: Self
Screen-space ambient occlusion — the occlusion pass and its depth-weighted blur, whose result scales the ambient term.
Sourcepub const REFLECTIONS: Self
pub const REFLECTIONS: Self
Screen-space reflections — the march and the blur that composites it into the scene colour.
Sourcepub const BLOOM: Self
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.
Sourcepub const ANTIALIASING: Self
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.
Sourcepub const VOLUMETRIC_FOG: Self
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.
Sourcepub const AUTO_EXPOSURE: Self
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.
Sourcepub const CMAA2: Self
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.
Sourcepub const CONTACT_SHADOWS: Self
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
impl RenderEffects
Sourcepub const fn bits(&self) -> u32
pub const fn bits(&self) -> u32
Get the underlying bits value.
The returned value is exactly the bits set in this flags value.
Sourcepub const fn from_bits(bits: u32) -> Option<Self>
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.
Sourcepub const fn from_bits_truncate(bits: u32) -> Self
pub const fn from_bits_truncate(bits: u32) -> Self
Convert from a bits value, unsetting any unknown bits.
Sourcepub const fn from_bits_retain(bits: u32) -> Self
pub const fn from_bits_retain(bits: u32) -> Self
Convert from a bits value exactly.
Sourcepub fn from_name(name: &str) -> Option<Self>
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.
Sourcepub const fn intersects(&self, other: Self) -> bool
pub const fn intersects(&self, other: Self) -> bool
Whether any set bits in other are also set in self.
Sourcepub const fn contains(&self, other: Self) -> bool
pub const fn contains(&self, other: Self) -> bool
Whether all set bits in other are also set in self.
Sourcepub fn remove(&mut self, other: Self)
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.
Sourcepub fn toggle(&mut self, other: Self)
pub fn toggle(&mut self, other: Self)
The bitwise exclusive-or (^) of the bits in self and other.
Sourcepub fn set(&mut self, other: Self, value: bool)
pub fn set(&mut self, other: Self, value: bool)
Call insert when value is true or remove when value is false.
Sourcepub const fn intersection(self, other: Self) -> Self
pub const fn intersection(self, other: Self) -> Self
The bitwise and (&) of the bits in self and other.
Sourcepub const fn union(self, other: Self) -> Self
pub const fn union(self, other: Self) -> Self
The bitwise or (|) of the bits in self and other.
Sourcepub const fn difference(self, other: Self) -> Self
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.
Sourcepub const fn symmetric_difference(self, other: Self) -> Self
pub const fn symmetric_difference(self, other: Self) -> Self
The bitwise exclusive-or (^) of the bits in self and other.
Sourcepub const fn complement(self) -> Self
pub const fn complement(self) -> Self
The bitwise negation (!) of the bits in self, truncating the result.
Source§impl RenderEffects
impl RenderEffects
Sourcepub const fn iter(&self) -> Iter<RenderEffects> ⓘ
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.
Sourcepub const fn iter_names(&self) -> IterNames<RenderEffects> ⓘ
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
impl RenderEffects
Sourcepub const DEFAULT_STACK: Self
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.
Sourcepub fn row(self) -> String
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
impl Binary for RenderEffects
Source§impl BitAnd for RenderEffects
impl BitAnd for RenderEffects
Source§impl BitAndAssign for RenderEffects
impl BitAndAssign for RenderEffects
Source§fn bitand_assign(&mut self, other: Self)
fn bitand_assign(&mut self, other: Self)
The bitwise and (&) of the bits in self and other.
Source§impl BitOr for RenderEffects
impl BitOr for RenderEffects
Source§fn bitor(self, other: RenderEffects) -> Self
fn bitor(self, other: RenderEffects) -> Self
The bitwise or (|) of the bits in self and other.
Source§type Output = RenderEffects
type Output = RenderEffects
| operator.Source§impl BitOrAssign for RenderEffects
impl BitOrAssign for RenderEffects
Source§fn bitor_assign(&mut self, other: Self)
fn bitor_assign(&mut self, other: Self)
The bitwise or (|) of the bits in self and other.
Source§impl BitXor for RenderEffects
impl BitXor for RenderEffects
Source§impl BitXorAssign for RenderEffects
impl BitXorAssign for RenderEffects
Source§fn bitxor_assign(&mut self, other: Self)
fn bitxor_assign(&mut self, other: Self)
The bitwise exclusive-or (^) of the bits in self and other.
Source§impl Clone for RenderEffects
impl Clone for RenderEffects
impl Copy for RenderEffects
Source§impl Debug for RenderEffects
impl Debug for RenderEffects
impl Eq for RenderEffects
Source§impl Extend<RenderEffects> for RenderEffects
impl Extend<RenderEffects> for RenderEffects
Source§fn extend<T: IntoIterator<Item = Self>>(&mut self, iterator: T)
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)
fn extend_one(&mut self, item: T)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl Flags for RenderEffects
impl Flags for RenderEffects
Source§const FLAGS: &'static [Flag<RenderEffects>]
const FLAGS: &'static [Flag<RenderEffects>]
Source§fn from_bits_retain(bits: u32) -> RenderEffects
fn from_bits_retain(bits: u32) -> RenderEffects
Source§fn all_named() -> RenderEffects
fn all_named() -> RenderEffects
Source§fn known_bits(&self) -> Self::Bits
fn known_bits(&self) -> Self::Bits
Source§fn unknown_bits(&self) -> Self::Bits
fn unknown_bits(&self) -> Self::Bits
Source§fn contains_unknown_bits(&self) -> bool
fn contains_unknown_bits(&self) -> bool
true if any unknown bits are set.Source§fn from_bits_truncate(bits: Self::Bits) -> Self
fn from_bits_truncate(bits: Self::Bits) -> Self
Source§fn from_name(name: &str) -> Option<Self>
fn from_name(name: &str) -> Option<Self>
Source§fn iter_names(&self) -> IterNames<Self> ⓘ
fn iter_names(&self) -> IterNames<Self> ⓘ
Source§fn iter_defined_names() -> IterDefinedNames<Self> ⓘ
fn iter_defined_names() -> IterDefinedNames<Self> ⓘ
Self::FLAGS.Source§fn iter_equal_names(&self) -> IterEqualNames<Self> ⓘ
fn iter_equal_names(&self) -> IterEqualNames<Self> ⓘ
Source§fn intersects(&self, other: Self) -> boolwhere
Self: Sized,
fn intersects(&self, other: Self) -> boolwhere
Self: Sized,
other are also set in self.Source§fn contains(&self, other: Self) -> boolwhere
Self: Sized,
fn contains(&self, other: Self) -> boolwhere
Self: Sized,
other are also set in self.Source§fn insert(&mut self, other: Self)where
Self: Sized,
fn insert(&mut self, other: Self)where
Self: Sized,
|) of the bits in self and other.Source§fn toggle(&mut self, other: Self)where
Self: Sized,
fn toggle(&mut self, other: Self)where
Self: Sized,
^) of the bits in self and other.Source§fn intersection(self, other: Self) -> Self
fn intersection(self, other: Self) -> Self
&) of the bits in self and other.Source§fn difference(self, other: Self) -> Self
fn difference(self, other: Self) -> Self
Source§fn symmetric_difference(self, other: Self) -> Self
fn symmetric_difference(self, other: Self) -> Self
^) of the bits in self and other.Source§fn complement(self) -> Self
fn complement(self) -> Self
!) of the bits in self, truncating the result.Source§impl FromIterator<RenderEffects> for RenderEffects
impl FromIterator<RenderEffects> for RenderEffects
Source§fn from_iter<T: IntoIterator<Item = Self>>(iterator: T) -> Self
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
impl Hash for RenderEffects
Source§impl IntoIterator for RenderEffects
impl IntoIterator for RenderEffects
Source§impl LowerHex for RenderEffects
impl LowerHex for RenderEffects
Source§impl Not for RenderEffects
impl Not for RenderEffects
Source§impl Octal for RenderEffects
impl Octal for RenderEffects
Source§impl PartialEq for RenderEffects
impl PartialEq for RenderEffects
Source§impl PublicFlags for RenderEffects
impl PublicFlags for RenderEffects
impl StructuralPartialEq for RenderEffects
Source§impl Sub for RenderEffects
impl Sub for RenderEffects
Source§fn sub(self, other: Self) -> Self
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
type Output = RenderEffects
- operator.Source§impl SubAssign for RenderEffects
impl SubAssign for RenderEffects
Source§fn sub_assign(&mut self, other: Self)
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.