Skip to content

Instantly share code, notes, and snippets.

@demonixis
Last active June 25, 2020 22:44
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save demonixis/2ec409c5e8a5912c3882 to your computer and use it in GitHub Desktop.
Save demonixis/2ec409c5e8a5912c3882 to your computer and use it in GitHub Desktop.
Gets the user's GPU name using the `WEBGL_debug_renderer_info` WebGL extension. It returns a `string` with the graphics card name or `unknow` if the extension is not supported.
function getGraphicsCardName() {
var canvas = document.createElement("canvas");
var gl = canvas.getContext("experimental-webgl") || canvas.getContext("webgl");
if (!gl) {
return "Unknow";
}
var ext = gl.getExtension("WEBGL_debug_renderer_info");
if (!ext) {
return "Unknow";
}
return gl.getParameter(ext.UNMASKED_RENDERER_WEBGL);
}
getGraphicsCardName();
// ANGLE (Intel(R) HD Graphics 4600 Direct3D11 vs_5_0 ps_5_0) On Google Chrome 50 dev
// Intel(R) HD Graphics 4600 On Microsoft Edge 13 or Internet Explorer 11.63.10586.0 / 11.0.26
// Unknow on Firefox 44 by default
// ANGLE (Intel(R) HD Graphics 4600 Direct3D11 vs_5_0 ps_5_0) on Firefox 44 by enabling the `webgl.enable-debug-renderer-info` flag in `about:config`
@mkateregga
Copy link

If I have webgl debugger renderer data, how can I filter out malicious ones?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment