Skip to content

Instantly share code, notes, and snippets.

@kenjiSpecial
Forked from cvan/webgl-detect-gpu.js
Created August 16, 2018 13:20
Show Gist options
  • Save kenjiSpecial/92c8962471328a328d8495ae2908c5a2 to your computer and use it in GitHub Desktop.
Save kenjiSpecial/92c8962471328a328d8495ae2908c5a2 to your computer and use it in GitHub Desktop.
use JavaScript to detect GPU used from within your browser
var canvas = document.createElement('canvas');
var gl;
var debugInfo;
var vendor;
var renderer;
try {
gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
} catch (e) {
}
if (gl) {
debugInfo = gl.getExtension('WEBGL_debug_renderer_info');
vendor = gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL);
renderer = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
}
// Sample output:
//
// » console.log(renderer);
// ATI Technologies Inc. AMD Radeon R9 M370X OpenGL Engine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment