Skip to main content

EffectRequest

Struct EffectRequest 

Source
pub struct EffectRequest {
    pub camera: RenderEffects,
    pub video: RenderEffects,
    pub antialiasing: Option<Antialiasing>,
    pub programmatic: EffectOverride,
}
Expand description

The layers a caller supplies, in the order they are applied.

A struct rather than positional arguments, for the reason this crate’s SsrImages is one: two of these fields are the same type, so positional arguments could be swapped at a call site and the frame would still compile and still draw a picture.

Default is RenderEffects::DEFAULT_STACK wanted by the view, no quality clamp, no antialiasing choice and no override — which resolves to whatever the device permits, and is what every frame the engine drew before this type existed did.

Fields§

§camera: RenderEffects

What this view needs, from its render stack.

Per camera because it is genuinely per view: topic 18’s render-to-texture security monitor and its planar reflection do not want reflections of their own, and that is a property of the camera rather than of the player’s hardware.

A crate::stack::CameraStack is what a view writes it from, which is the render-stack RON topic 18 describes; ForwardRenderer::set_camera_stack is the one-layer setter. A renderer per view is what makes the layer real either way — see this module’s table — and apps/lantern’s monitor camera is the consumer whose stack is still a constant rather than a file.

§video: RenderEffects

What the player allows, from [engine.video].

A quality setting, so it only ever clamps downward: a player who turned reflections off gets none, and a player who turned them on gets them where the view asked for them.

crcbl’s start-up is what sets it: crcbl::settings::VIDEO_KEYS is the one place a key is spelled, crcbl::engine::GpuContext reads the namespace through crcbl_store::settings::SettingsStack while it opens, and GpuContext::effect_request is what a renderer built on that context is handed. See this module’s table.

RenderEffects::all is “the player has said nothing”, which is what a missing key, a missing file and a missing settings directory all produce — a clamp that removes nothing rather than a frame with no effects in it.

§antialiasing: Option<Antialiasing>

Which antialiasing tier the player picked, from [engine.video] antialiasing.

None is “the player has not picked one”, and is what a missing key, a missing file and a missing settings directory all produce — the view’s own stack keeps the slot it asked for.

The one layer that replaces rather than clamps, and Antialiasing’s docs carry the argument: the slot holds one filter, so a player choosing CMAA2 where the camera asked for FXAA is asking for a different filter and not for less of one. It is applied after video and before programmatic, so game code still has the last word before the device — see resolve.

§programmatic: EffectOverride

What this moment calls for, from game code.

Implementations§

Source§

impl EffectRequest

Source

pub fn resolve(&self, device: RenderEffects) -> RenderEffects

Applies the whole order and returns what the frame draws.

camera → clamped by video → the AA slot replaced by the player's tier
       → moved either way by the override
       → clamped by device, last and absolutely

The antialiasing tier sits inside the order rather than beside it, and both of its neighbours matter. It is after the video clamp because a clamp can only take the resolve away, and the player picking a different filter is not a smaller ask; it is before the programmatic override because game code is the layer that may move a decision either way, and a tier applied after it would silently undo an override that had just forced a resolve on or off.

device is what the hardware can run. It cannot be overridden upward: asking for an effect a device has no way to draw is what DeviceDesc::required_features is for, and it is not something a toggle can force.

Trait Implementations§

Source§

impl Clone for EffectRequest

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 EffectRequest

Source§

impl Debug for EffectRequest

Source§

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

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

impl Default for EffectRequest

Source§

fn default() -> Self

RenderEffects::DEFAULT_STACK for the view, no quality clamp, no antialiasing choice and no override.

The camera field is the default stack rather than RenderEffects::all, and that constant carries the argument: the effects that model the scene’s own light transport are what a view asks for by saying nothing, and the lens effects are what it has to ask for.

Source§

impl Eq for EffectRequest

Source§

impl PartialEq for EffectRequest

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 EffectRequest

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.