I want to get a string like: Intel Open Source Technology Center Mesa DRI Intel(R) HD Graphics 520 (Skylake GT2)
Only using javascript on the browser. I know that a library from augur.io can find that value but I need a open source solution or to know what js method can be used.
To find out what graphics card you have, open the Start menu or desktop search bar on your PC, start typing Device Manager, and select it when the option appears. You'll see an entry near the top for Display adapters. Click the drop-down arrow and the name and model of your GPU will appear right below.
Video card (also called Graphics Processing Unit (GPU)) driver is a software that allows the operating system and software application to use the PC's graphics hardware. In order to get the best performance out of the hardware, it is recommended that the video card (GPU) drivers are updated.
You can use WebGL's WEBGL_debug_renderer_info
extension. Though (a) the user might not have WebGL and (b) the extension might not be available depending on the browser.
function getVideoCardInfo() {
const gl = document.createElement('canvas').getContext('webgl');
if (!gl) {
return {
error: "no webgl",
};
}
const debugInfo = gl.getExtension('WEBGL_debug_renderer_info');
return debugInfo ? {
vendor: gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL),
renderer: gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL),
} : {
error: "no WEBGL_debug_renderer_info",
};
}
console.log(getVideoCardInfo());
per @jaromanda X's comment this extension was controversial. Some people maintain that knowing the GPU is a privacy issue. For example the MacPro has (or had) a MacPro only GPU. The MacPro was like a $6000 machine so by knowing the person's GPU you gained some idea that they have $$$$. As in "if GPU = MacPro's GPU then show ad for expensive things". Similarly it's one more piece of info to ID your particular machine.
The counter arguments are many
You could to some degree already figure out of the user has a high end GPU by checking the webgl parameters, things like max texture size, number of uniforms supported, etc. Something required to make WebGL useful.
In regards to using the info to ID a machine you can already get most of that info by fingerprinting the WebGL parameters and rendering artifacts.
For tech support it's often important to know the user's GPU and asking a non tech users to dig through their system to figure it out is not very helpful.
Some drivers have bugs and while it's the browser's job to work around those bugs it often takes 3 to 6 months for a bug to be fixed and for that fix to percolate to the release version of a browser. In the meantime companies need a way to work around the bugs which is often in the form of "If GPU = X do Y" where Y could be anything from "use a different technique" to "don't use WebGL for this user". This is what Google Maps does. If the particular GPU/Driver is known to be unstable then Google Maps will fall back to a canvas2d version with much less features.
In relation to the last 2 points many websites track errors and or crashes as best they can. By tracking the GPU they can see if crashes correlate to a specific GPU/Driver and implement workarounds.
Note: S.O. really isn't the place to debate whether or not this extension is good or bad. The info above is mostly just FYI. Both sides have their merits.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With