Display
What the game shows: its camera’s view, output encoding, frame captures and frame times.
Display
Section titled “Display”Get it with Api.display().
claimView(changed: Wraith.Lease.Changed | null): Wraith.LeasegameView(): Wraith.Display.ViewsetColorSpace(space: Wraith.ColorSpace | Wraith.ColorSpaceName): voidcapture(point: Wraith.Capture.Point | Wraith.Capture.PointName): Promise<Wraith.Capture>frameStats(): Wraith.Display.Statstimes(): Array<number>claimView(changed: Wraith.Lease.Changed|nil): Wraith.LeasegameView(): Wraith.Display.ViewsetColorSpace(space: Wraith.ColorSpace|Wraith.ColorSpaceName)capture(point: Wraith.Capture.Point|Wraith.Capture.PointName): salamander.PromiseframeStats(): Wraith.Display.Statstimes(): (number)[]Wraith.Lease? ClaimView(Wraith.Lease.Changed? changed)Wraith.Display.View GameView()void SetColorSpace(Wraith.ColorSpace space)System.Threading.Tasks.Task<Wraith.Capture> CaptureAsync(Wraith.Capture.Point point, System.Threading.CancellationToken cancel = default)Wraith.Display.Stats FrameStats()float[] Times()sal::Result<Wraith::Lease, Wraith::LeaseError> claimView(Wraith::Lease_Changed changed) constWraith::Display_View gameView() constvoid setColorSpace(Wraith::ColorSpace space) constsal::Future<Wraith::Capture, Wraith::CaptureError> capture(Wraith::Capture_Point point) constWraith::Display_Stats frameStats() conststd::span<const float> times() constpub fn claim_view(&self, changed: wraith::LeaseChanged) -> Result<wraith::Lease, wraith::LeaseError>pub fn game_view(&self) -> wraith::DisplayViewpub fn set_color_space(&self, space: wraith::ColorSpace)pub fn capture(&self, point: wraith::CapturePoint) -> salamander::Future<wraith::Capture, wraith::CaptureError>pub fn frame_stats(&self) -> wraith::DisplayStatspub fn times(&self) -> &[f32]fn claimView(self: Wraith.Display, changed: ?Wraith.Lease.Changed) (Wraith.LeaseError || rt.Failure)!Wraith.Leasefn gameView(self: Wraith.Display) Wraith.Display.Viewfn setColorSpace(self: Wraith.Display, space: Wraith.ColorSpace) voidfn capture(self: Wraith.Display, point: Wraith.Capture.Point) rt.Promise((Wraith.CaptureError || rt.Failure)!Wraith.Capture, Wraith.CaptureErrorCode)fn frameStats(self: Wraith.Display) Wraith.Display.Statsfn times(self: Wraith.Display) []const f32uint32_t Wraith_Display_claimView(Wraith_Display self, Wraith_Lease_Changed changed, Wraith_Lease *out)Wraith_Display_View Wraith_Display_gameView(Wraith_Display self)void Wraith_Display_setColorSpace(Wraith_Display self, Wraith_ColorSpace space)sal_Promise Wraith_Display_capture(Wraith_Display self, Wraith_Capture_Point point)Wraith_Display_Stats Wraith_Display_frameStats(Wraith_Display self)Slice_f32 Wraith_Display_times(Wraith_Display self)claimView
Section titled “claimView”A lease on the output color space, see Lease. Only the holder’s setColorSpace counts.
Fails with LeaseError. Uses Lease.Changed, Lease.
gameView
Section titled “gameView”The last view set. Any thread.
Uses Display.View.
setColorSpace
Section titled “setColorSpace”How the game’s output is encoded, for where the swap chain can’t say. The swap chain’s own setting wins. Kept till it gets the lease, and gone with it. Any thread.
Uses ColorSpace.
capture
Section titled “capture”The next frame drawn at point. Any thread.
Async. Fails with CaptureError. Uses Capture.Point, Capture.
frameStats
Section titled “frameStats”Updated a few times a second, so cheap every frame. Any thread.
Uses Display.Stats.
Newest frame times in ms, oldest first. Good till the thread’s next call into Wraith. Any thread.
PixelFormat
Section titled “PixelFormat”4 bytes a pixel except rgba16f’s 8.
An enum of u8.
| Value | Name | |
|---|---|---|
| 0 | unknown |
|
| 1 | rgba8 |
|
| 2 | bgra8 |
|
| 3 | bgrx8 |
Alpha is junk |
| 4 | rgb10a2 |
32 bits from the low bits up: 10 red, 10 green, 10 blue, 2 alpha |
| 5 | bgr10a2 |
Same with red and blue swapped |
| 6 | rgba16f |
Half floats, usually scRGB |
ColorSpace
Section titled “ColorSpace”An enum of u8.
| Value | Name | |
|---|---|---|
| 0 | srgb |
SDR, sRGB-encoded |
| 1 | scrgb |
Linear Rec.709, 1.0 is 80 nits, can go past 0..1 |
| 2 | hdr10 |
Rec.2020 with PQ, 1.0 is 10000 nits |
GraphicsApi
Section titled “GraphicsApi”An enum of u8.
| Value | Name | |
|---|---|---|
| 0 | unknown |
|
| 1 | d3d9 |
|
| 2 | d3d10 |
|
| 3 | d3d11 |
|
| 4 | d3d12 |
|
| 5 | vulkan |
|
| 6 | opengl |
Capture.Point
Section titled “Capture.Point”An enum of u8.
| Value | Name | |
|---|---|---|
| 0 | before_overlay |
Before the overlay draws |
| 1 | after_overlay |
With the overlay, as presented |
Capture
Section titled “Capture”A copy of a frame, owned by whoever takes it.
A struct, 0x30 bytes, aligned to 8.
| Offset | Field | Type | |
|---|---|---|---|
| 0x0 | width |
u32 |
|
| 0x4 | height |
u32 |
|
| 0x8 | pitch |
u32 |
Bytes per row, top row first. Can be more than the pixels need. |
| 0xc | format |
PixelFormat |
|
| 0x10 | native_format |
u32 |
The API’s own format: DXGI_FORMAT, VkFormat, D3DFORMAT or a GL internal format |
| 0x14 | graphics_api |
GraphicsApi |
|
| 0x15 | color_space |
ColorSpace |
|
| 0x18 | sdr_white_nits |
f32 |
SDR white on the game’s display, in nits |
| 0x20 | pixels |
blob |
width: numberheight: numberpitch: numberformat: Wraith.PixelFormat | Wraith.PixelFormatNamenative_format: numbergraphics_api: Wraith.GraphicsApi | Wraith.GraphicsApiNamecolor_space: Wraith.ColorSpace | Wraith.ColorSpaceNamesdr_white_nits: numberpixels: Uint8Array | nullwidth: integerheight: integerpitch: integerformat: Wraith.PixelFormat|Wraith.PixelFormatNamenative_format: integergraphics_api: Wraith.GraphicsApi|Wraith.GraphicsApiNamecolor_space: Wraith.ColorSpace|Wraith.ColorSpaceNamesdr_white_nits: numberpixels: stringuint Widthuint Heightuint PitchWraith.PixelFormat Formatuint NativeFormatWraith.GraphicsApi GraphicsApiWraith.ColorSpace ColorSpacefloat SdrWhiteNitsSalamander.Blob? Pixelsuint32_t widthuint32_t heightuint32_t pitchWraith::PixelFormat formatuint32_t native_formatWraith::GraphicsApi graphics_apiWraith::ColorSpace color_spacefloat sdr_white_nitssal::Blob pixelspub width: u32pub height: u32pub pitch: u32pub format: wraith::PixelFormatpub native_format: u32pub graphics_api: wraith::GraphicsApipub color_space: wraith::ColorSpacepub sdr_white_nits: f32pub pixels: salamander::Blobwidth: u32height: u32pitch: u32format: Wraith.PixelFormatnative_format: u32graphics_api: Wraith.GraphicsApicolor_space: Wraith.ColorSpacesdr_white_nits: f32pixels: rt.Blobuint32_t widthuint32_t heightuint32_t pitchWraith_PixelFormat formatuint32_t native_formatWraith_GraphicsApi graphics_apiWraith_ColorSpace color_spacefloat sdr_white_nitssal_object pixelsCaptureError
Section titled “CaptureError”What can go wrong, besides Cancelled, Unsupported and Gone.
| Code | Error | |
|---|---|---|
| 1 | NoFrames |
|
| 2 | Failed |
This game’s graphics can’t be copied, or the overlay can’t draw |
| 3 | NotDeclared |
Its wraith.json doesn’t list “capture” in “permissions” |
Display.View
Section titled “Display.View”The game camera’s view, for drawing over the world. Row vectors, D3D style: clip = [x y z 1] * view * projection, looking down +z, depth 0 near to 1 far, clip y up.
A struct, 0x84 bytes, aligned to 4.
| Offset | Field | Type | |
|---|---|---|---|
| 0x0 | viewMatrix |
Mat4 |
|
| 0x40 | projection |
Mat4 |
|
| 0x80 | known |
bool |
False till the camera’s plugin puts its camera in the scene, or once it’s gone |
viewMatrix: Wraith.Mat4projection: Wraith.Mat4known: booleanviewMatrix: Wraith.Mat4projection: Wraith.Mat4known: booleanWraith.Mat4 ViewMatrixWraith.Mat4 ProjectionSalamander.Bool KnownWraith::Mat4 viewMatrixWraith::Mat4 projectionbool knownpub view_matrix: wraith::Mat4pub projection: wraith::Mat4pub known: boolviewMatrix: Wraith.Mat4projection: Wraith.Mat4known: boolWraith_Mat4 viewMatrixWraith_Mat4 projectionbool knownDisplay.Stats
Section titled “Display.Stats”A struct, 0x50 bytes, aligned to 8.
| Offset | Field | Type | |
|---|---|---|---|
| 0x0 | window_seconds |
f32 |
What these cover. Less than the window early on or after a reset. |
| 0x4 | frames |
u32 |
|
| 0x8 | fps |
f32 |
From the average frame time |
| 0xc | avg_ms |
f32 |
|
| 0x10 | min_ms |
f32 |
|
| 0x14 | max_ms |
f32 |
|
| 0x18 | p50_ms |
f32 |
|
| 0x1c | p95_ms |
f32 |
|
| 0x20 | p99_ms |
f32 |
|
| 0x24 | low_1_fps |
f32 |
The fps at the 99th and 99.9th percentile frame times |
| 0x28 | low_01_fps |
f32 |
|
| 0x2c | hitches |
u32 |
Frames over hitch_factor times the median |
| 0x30 | hitch_factor |
f32 |
|
| 0x38 | total_frames |
u64 |
Since the game started or the stats were reset |
| 0x40 | total_avg_ms |
f32 |
|
| 0x44 | total_min_ms |
f32 |
|
| 0x48 | total_max_ms |
f32 |
window_seconds: numberframes: numberfps: numberavg_ms: numbermin_ms: numbermax_ms: numberp50_ms: numberp95_ms: numberp99_ms: numberlow_1_fps: numberlow_01_fps: numberhitches: numberhitch_factor: numbertotal_frames: biginttotal_avg_ms: numbertotal_min_ms: numbertotal_max_ms: numberwindow_seconds: numberframes: integerfps: numberavg_ms: numbermin_ms: numbermax_ms: numberp50_ms: numberp95_ms: numberp99_ms: numberlow_1_fps: numberlow_01_fps: numberhitches: integerhitch_factor: numbertotal_frames: integertotal_avg_ms: numbertotal_min_ms: numbertotal_max_ms: numberfloat WindowSecondsuint Framesfloat Fpsfloat AvgMsfloat MinMsfloat MaxMsfloat P50Msfloat P95Msfloat P99Msfloat Low1Fpsfloat Low01Fpsuint Hitchesfloat HitchFactorulong TotalFramesfloat TotalAvgMsfloat TotalMinMsfloat TotalMaxMsfloat window_secondsuint32_t framesfloat fpsfloat avg_msfloat min_msfloat max_msfloat p50_msfloat p95_msfloat p99_msfloat low_1_fpsfloat low_01_fpsuint32_t hitchesfloat hitch_factoruint64_t total_framesfloat total_avg_msfloat total_min_msfloat total_max_mspub window_seconds: f32pub frames: u32pub fps: f32pub avg_ms: f32pub min_ms: f32pub max_ms: f32pub p50_ms: f32pub p95_ms: f32pub p99_ms: f32pub low_1_fps: f32pub low_01_fps: f32pub hitches: u32pub hitch_factor: f32pub total_frames: u64pub total_avg_ms: f32pub total_min_ms: f32pub total_max_ms: f32window_seconds: f32frames: u32fps: f32avg_ms: f32min_ms: f32max_ms: f32p50_ms: f32p95_ms: f32p99_ms: f32low_1_fps: f32low_01_fps: f32hitches: u32hitch_factor: f32total_frames: u64total_avg_ms: f32total_min_ms: f32total_max_ms: f32float window_secondsuint32_t framesfloat fpsfloat avg_msfloat min_msfloat max_msfloat p50_msfloat p95_msfloat p99_msfloat low_1_fpsfloat low_01_fpsuint32_t hitchesfloat hitch_factoruint64_t total_framesfloat total_avg_msfloat total_min_msfloat total_max_mswraith.io · Mods on the Hub · Get Wraith
Made with ♥ by Asgard
