Skip to content

Instantly share code, notes, and snippets.

@ugreek85
Forked from cvan/webgl-detect-gpu.js
Created November 14, 2023 09:02
Show Gist options
  • Select an option

  • Save ugreek85/068eaf6f5ea77f452c6032d23ba8b71d to your computer and use it in GitHub Desktop.

Select an option

Save ugreek85/068eaf6f5ea77f452c6032d23ba8b71d 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