Native
| Kind | class |
| Package | backend |
| Full name | backend.Native |
| Source | source/backend/Native.hx |
GPU / CPU / driver detection.
The GPU sniffing is ported from the Psych Plus Engine
(source/backend/Native.hx, https://github.com/Psych-Plus-Team/FNF-PlusEngine)
— big thanks to the Psych Plus Team for the original implementation! The CPU
and operating system part is native (see backend.NativeHardware).
The engine itself uses this to enrich crash reports: when something goes
wrong the log says which GPU, driver and CPU the player was running, which
turns "it is slow on my machine" into an actionable bug report. Mods can
read the same values through the scripting API (getGPUName() and friends).
Every query degrades gracefully: on a target without a usable render context (or without native CPU queries) the value is reported as "Unknown" instead of throwing.
Public fields
| Name | Type | Static | Default | Notes |
|---|---|---|---|---|
UNKNOWN | String | yes | "Unknown" | Reported whenever a value could not be determined. |
Public methods
getSystemInfo
static function getSystemInfo():HardwareInfo
The hardware information of this machine.
The values are queried once and then cached, so calling this from a script every frame is cheap.
getGPUName
static function getGPUName():String
The GPU model, e.g. "NVIDIA GeForce RTX 3060".
getGPUVendor
static function getGPUVendor():String
The GPU vendor, e.g. "NVIDIA".
getGPUDriverVersion
static function getGPUDriverVersion():String
The GPU driver version, e.g. "535.104.05".
getCPUName
static function getCPUName():String
The CPU model, e.g. "Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz".
getCPUVendor
static function getCPUVendor():String
The CPU vendor, e.g. "Intel".
getOSName
static function getOSName():String
The operating system, e.g. "Windows".
getOSVersion
static function getOSVersion():String
The operating system version, e.g. "10.0.19045".
getGraphicsApi
static function getGraphicsApi():String
The graphics API version, e.g. "OpenGL 4.6".
buildSystemInfo
static function buildSystemInfo():String
A short human readable report of the machine the game runs on.
This is what ends up in the crash log, so a bug report carries the hardware details without the user having to look them up.
getOpenGLVersion
static function getOpenGLVersion():String
The OpenGL version exactly as reported by the active driver.
getOpenGLLabel
static function getOpenGLLabel():String
Short runtime label used by debug overlays, e.g. "OpenGL ES 3.2".
getOpenALSoftVersion
static function getOpenALSoftVersion():String
Reports the active OpenAL implementation and its exact runtime version.
getGPUEnhancements
static function getGPUEnhancements():String
Gets a hint about which features the detected GPU can handle.
Ported from the Psych Plus Engine.
Internals
Private / internal members
| Field | Type | Static |
|---|---|---|
API_PREFIX_REGEX | — | yes |
GPU_KEYWORDS | Array<String> | yes |
RENDERER_NOISE | Array<String> | yes |
VERSION_TOKEN_REGEX | — | yes |
CPU_VENDOR_NAMES | Map<String, String> | yes |
resolved | Bool | yes |
cached | HardwareInfo | yes |
| Method |
|---|
static function detect():HardwareInfo |
static function readGLString(parameter:Int):String |
static function hasRenderContext():Bool |
static function parseGPUModel(renderer:String):String |
static function parseGPUVendor(renderer:String, glVendor:String):String |
static function parseGPUDriver(glVersion:String):String |
static function parseGraphicsApi(glVersion:String):String |
static function cleanRenderer(renderer:String):String |
static function cutRendererNoise(text:String):String |
static function findGPUKeyword(info:String):Int |
static function cleanVendorName(vendor:String):String |
static function cleanCPUVendor(vendor:String):String |
static function cleanOSName(name:String):String |
static function cleanText(value:Null<String>):String |
static function valueOrUnknown(value:Null<String>):String |
static function trimPatchVersion(version:String):String |