Detect GPU

Detect and rate GPUs based on their 3D rendering benchmark score allowing the developer to provide sensible default settings for graphically intensive applications. Think of it like a user-agent detection for the GPU but more powerful.
This project is a maintained fork of detect-gpu project rewritten in JavaScript.
Demo
Live demo
Installation
Make sure you have Node.js installed, then:
$ npm install detect-gpu-js
By default we use the UNPKG CDN to host the benchmark data. If you would like to serve the benchmark data yourself, download the required benchmarking data from benchmarks.tar.gz and serve it from a public directory.
Alternatively, there is the detect-gpu.bundle.js
build that comes with benchmark data embedded. This however requires 300KB+ more data downloaded over the network.
Usage
import { getGPUTier } from 'detect-gpu';
(async () => {
const gpuTier = await getGPUTier();
})();
detect-gpu-js
uses rendering benchmark scores (framerate, normalized by resolution) in order to determine what tier should be assigned to the user's GPU. If no WebGLContext
can be created, the GPU is blocklisted or the GPU has reported to render on less than 15 fps
tier: 0
is assigned. One should provide a fallback to a non-WebGL experience.
Based on the reported fps
the GPU is then classified into either tier: 1 (>= 15 fps)
, tier: 2 (>= 30 fps)
or tier: 3 (>= 60 fps)
. The higher the tier the more graphically intensive workload you can offer to the user.
API
getGPUTier({
benchmarksURL,
glContext,
failIfMajorPerformanceCaveat,
mobileTiers,
desktopTiers,
hidpiScreenSize,
override: {
renderer,
isIpad,
isMobile,
screenSize: { width, height },
loadBenchmarks
};
})
Support
Requires JavaScript modules to be supported, e.g. works on Chrome 61+, Firefox 60+, Safari 11+ (most versions dated back to 2017).
Changelog
Changelog
Licence
The project is released under the MIT license.
detect-gpu-js
uses both mobile and desktop benchmarking scores from https://gfxbench.com.