JSPM

  • Created
  • Published
  • Downloads 922153
  • Score
    100M100P100Q189688F
  • License MIT

Classify GPU's based on their benchmark score in order to provide an adaptive experience.

Package Exports

  • detect-gpu

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (detect-gpu) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Detect GPU

npm version dependencies devDependencies

Classify GPU's based on their benchmark score in order to provide an adaptive experience.

Demo

Live demo

Installation

Make sure you have Node.js installed.

 $ npm install detect-gpu

Usage

detect-gpu uses benchmarking scores in order to determine what tier should be assigned to the user's GPU. If no WebGLContext can be created or the GPU is blacklisted TIER 0 is assigned. One should provide a HTML fallback page that a user should be redirected to.

By default are all GPU's that have met these preconditions classified as TIER 1.

In order to keep up to date with new GPU's coming out detect-gpu splits the benchmarking scores in 4 tiers based on rough estimates of the market share.

By default detect-gpu assumes 15% of the lowest scores to be insufficient to run the experience and is assigned TIER 0. 35% of the GPU's are considered good enough to run the experience and are assigned TIER 1. 30% of the GPU's are considered powerful and are classified as TIER 2. The last 20% of the GPU's are considered to be very powerful and can run the experience with all bells and whistles.

You can tweak these percentages when registering the application as shown below:

DetectGPU.register({
  // [TIER_0, TIER_1, TIER_2, TIER_3]
  BENCHMARK_TIER_PERCENTAGES_MOBILE: [15, 35, 30, 20],
  BENCHMARK_TIER_PERCENTAGES_DESKTOP: [15, 35, 30, 20]
});

Development

$ npm start

$ npm run serve

$ npm run lint

$ npm run dist

$ npm run deploy

$ npm run update-benchmarks

Licence

My work is released under the MIT license.

detect-gpu uses both mobile and desktop benchmarking scores from https://www.notebookcheck.net/.