Skip to main content

Module display

Module display 

Source
Expand description

Presentation settings and HDR output (see sg_abi::display and sg_abi::hdr).

Present mode and frame latency can also be set the usual wgpu way, in SurfaceConfiguration; set_present changes them later without the game reconfiguring (the host re-applies the game’s configuration). The user’s launch settings always take precedence (status::LOCKED).

Modules§

fullscreen_mode
Fullscreen codes.
mode
Present-mode codes (the repr of wgpu::PresentMode).
status
Return codes of the display functions.

Structs§

HdrMetadata
Static HDR metadata (SMPTE ST 2086 mastering display + CTA-861.3 content light levels), as 12 little-endian f32s in this order.
Output
The negotiated output: what to put in SurfaceConfiguration and the shader uniform.

Enums§

OutputMode

Constants§

HDR_WGSL
WGSL for guests: paste (or concat!) into a shader module and bind an SgOutput uniform built by Output::uniform.

Functions§

info
Present modes, the active mode and latency, frame cap, refresh rate, fullscreen state, HDR formats and which settings the user locked.
negotiate
Picks the output for a surface offering formats (format, color spaces), in order of preference: PQ on a 10-bit format, scRGB, PQ on fp16, then SDR (an *Srgb format first). allow_hdr = false forces SDR. Returns None only if no format is usable at all.
negotiate_output
Picks format, color space and encoding for caps (HDR if offered and allow_hdr).
set_frame_cap
Frames per second; 0 removes the cap.
set_frame_latency
set_fullscreen
Needs a recent user gesture (key or click) and is rate limited.
set_hdr_metadata
set_present
latency 1..=3, or 0 to keep it.
stats
Rolling timing statistics (present interval, acquire/present blocking, display latency where the platform reports present times).