Skip to main content

Native

Kindclass
Packagebackend
Full namebackend.Native
Sourcesource/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​

NameTypeStaticDefaultNotes
UNKNOWNStringyes"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.

View source

getGPUName​

static function getGPUName():String

The GPU model, e.g. "NVIDIA GeForce RTX 3060".

View source

getGPUVendor​

static function getGPUVendor():String

The GPU vendor, e.g. "NVIDIA".

View source

getGPUDriverVersion​

static function getGPUDriverVersion():String

The GPU driver version, e.g. "535.104.05".

View source

getCPUName​

static function getCPUName():String

The CPU model, e.g. "Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz".

View source

getCPUVendor​

static function getCPUVendor():String

The CPU vendor, e.g. "Intel".

View source

getOSName​

static function getOSName():String

The operating system, e.g. "Windows".

View source

getOSVersion​

static function getOSVersion():String

The operating system version, e.g. "10.0.19045".

View source

getGraphicsApi​

static function getGraphicsApi():String

The graphics API version, e.g. "OpenGL 4.6".

View source

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.

View source

getOpenGLVersion​

static function getOpenGLVersion():String

The OpenGL version exactly as reported by the active driver.

View source

getOpenGLLabel​

static function getOpenGLLabel():String

Short runtime label used by debug overlays, e.g. "OpenGL ES 3.2".

View source

getOpenALSoftVersion​

static function getOpenALSoftVersion():String

Reports the active OpenAL implementation and its exact runtime version.

View source

getGPUEnhancements​

static function getGPUEnhancements():String

Gets a hint about which features the detected GPU can handle.

Ported from the Psych Plus Engine.

View source

Internals​

Private / internal members
FieldTypeStatic
API_PREFIX_REGEX—yes
GPU_KEYWORDSArray<String>yes
RENDERER_NOISEArray<String>yes
VERSION_TOKEN_REGEX—yes
CPU_VENDOR_NAMESMap<String, String>yes
resolvedBoolyes
cachedHardwareInfoyes
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