How to use getGPUTier()
masterUse getGPUTier() to classify a user's GPU based on 3D rendering benchmarks. This allows you to provide appropriate graphical settings for different hardware capabilities.
getGPUTier() returns a promise that resolves to a result object containing the assigned tier, whether the device is mobile, the detection type, the measured fps (if applicable), and the GPU name.
Tier Logic:
tier: 0: WebGL is unsupported, the GPU is blocklisted, or performance is < 15 fps.tier: 1: $\ge$ 15 fpstier: 2: $\ge$ 30 fpstier: 3: $\ge$ 60 fps
Note: Always provide a fallback for tier: 0 to ensure a non-WebGL experience is available.
import { getGPUTier } from '@pmndrs/detect-gpu';
const gpuTier = await getGPUTier();
// Example output:
// {
// "tier": 1,
// "isMobile": false,
// "type": "BENCHMARK",
// "fps": 21,
// "gpu": "intel iris graphics 6100"
// }