Skip to main content

HdrOutputMode

Enum HdrOutputMode 

Source
pub enum HdrOutputMode {
    Sdr,
    Hdr {
        max_edr: f32,
        encoding: HdrEncoding,
    },
}
Expand description

Resolved swapchain colour-output mode. Threaded into Metal + DirectX at init (both honour Hdr end-to-end, including the PQ-encoded branch); Vulkan honours the ExtendedLinear Hdr arm but ignores the PQ encoding flag and falls back to SDR on a panel that reports no EDR headroom.

Variants§

§

Sdr

Tone-map + gamma-encode the HDR scene into the standard BGRA8Unorm swapchain. FXAA + ColorLut run.

§

Hdr

Drive an EDR-capable swapchain (RGBA16Float, Display P3 family colour space, wantsExtendedDynamicRangeContent = true). The composite shader’s hdr_output branch skips the tonemap, gamma encode, FXAA, and LUT. encoding picks between scRGB-linear passthrough and PQ-encoded output. max_edr is the panel-reported headroom (e.g. 2.0 on an HDR400 panel, 8.0+ on HDR1000), surfaced via the StatHud EDR chip.

Fields

§max_edr: f32

Reported maximum extended-range colour-component multiplier; SDR reference white is 1.0, so values above that drive HDR.

§encoding: HdrEncoding

Whether the composite shader emits PQ-encoded values or linear extended-range values. Drives both the colour-space tag and the shader branch.

Implementations§

Source§

impl HdrOutputMode

Source

pub fn resolve( hdr_display_requested: bool, pq_requested: bool, max_edr: f32, ) -> Self

Build the mode from the world’s authored request and the platform’s measured EDR multiplier. The asset toggle is the gate: even on a capable display, no HDR unless hdr_display = true. The reverse (hdr_display = true on an SDR panel) falls back to Self::Sdr and is logged once by the backend. pq_requested is honoured only when HDR resolves to on; off-by-default keeps the existing extended-linear path as the safer fallback.

Source

pub fn shader_flag(&self) -> f32

Value to push into PostProcessParams.hdr_output so the composite shader’s > 0.5 branch lights up on the HDR path and stays inert on the SDR path.

Source

pub fn pq_flag(&self) -> f32

PQ branch value pushed into PostProcessParams.pq_output. The shader reads it inside its hdr_output > 0.5 branch and switches between linear-passthrough and PQ-encode. Always 0.0 on the SDR path.

Source

pub fn is_hdr(&self) -> bool

True when the renderer is on the HDR path. Cheap predicate for log messages + the runtime’s hdr_display=on/off summary line.

Source

pub fn post_process_params( &self, tunables: PostProcessTunables, ) -> PostProcessParams

Compose the GPU-facing composite uniform from the authored tunables and this negotiated mode. The backends call it once at init; afterwards a live tunable push goes through PostProcessParams::set_tunables, which leaves the two flags stamped here alone.

Trait Implementations§

Source§

impl Clone for HdrOutputMode

Source§

fn clone(&self) -> HdrOutputMode

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 HdrOutputMode

Source§

impl Debug for HdrOutputMode

Source§

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

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

impl PartialEq for HdrOutputMode

Source§

fn eq(&self, other: &HdrOutputMode) -> 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 HdrOutputMode

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, 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, <T as TryFrom<U>>::Error>

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.