Skip to content

Instantly share code, notes, and snippets.

@artmsv
Forked from cvan/webgl-detect-gpu.js
Created November 8, 2023 17:22
Show Gist options
  • Select an option

  • Save artmsv/902fd1c8e02d41624c13b54f19a56a17 to your computer and use it in GitHub Desktop.

Select an option

Save artmsv/902fd1c8e02d41624c13b54f19a56a17 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