Expand description
Display ABI: present modes, frame pacing, fullscreen and HDR metadata.
Host functions (module sg):
| Function | Returns |
|---|---|
display_info(ptr, cap) -> i64 | JSON document (see DisplayInfo); its length, copied only if it fits |
present_config(mode, latency) -> i32 | a status code; mode is a mode code or mode::KEEP, latency is 1..=3 or 0 to keep |
frame_cap(fps: f64) -> i32 | a status code; 0.0 removes the cap, otherwise FPS_CAP_MIN..=FPS_CAP_MAX |
fullscreen(mode) -> i32 | a status code; mode is a fullscreen code |
hdr_metadata(ptr, len) -> i32 | a status code; len must be HDR_METADATA_SIZE |
frame_stats(ptr, cap) -> i64 | JSON document (see FrameStats) |
Requests are validated by the host; out-of-range values return
status::INVALID, never trap. Only malformed calls (pointers outside
guest memory, a wrong hdr_metadata length) trap. The user’s launch
settings take precedence over every game request (status::LOCKED).
Modules§
- fullscreen
- Fullscreen codes.
- mode
- Present-mode codes (the
reprofwgpu::PresentMode). - status
- Return codes of the display functions.
Structs§
- Display
Info - Field names of the
display_infoJSON document (for reference; the guest parses it with any JSON library): - Frame
Stats - Field names of the
frame_statsJSON document: rolling statistics over the last 120 presented frames, in milliseconds. - HdrMetadata
- Static HDR metadata (SMPTE ST 2086 mastering display + CTA-861.3 content
light levels), as 12 little-endian
f32s in this order.