CesiumGS / webglreport

A web page that reports a browser's WebGL capabilities, including supported extensions and implementation specific capabilities, such as the maximum number of texture units.
https://webglreport.com
Apache License 2.0
391 stars 99 forks source link

Detect software rendering... #7

Closed mramato closed 10 years ago

mramato commented 11 years ago

I know that @kring put in checks for SwiftShader in the 2012 Cesium Santa application; it would be nice to do the same for the WebGL report. I believe it's something like detecting if Max Vertex Uniform Vectors is 254 (if I recall correctly). This is no different than our ANGLE check (which I believe involves looking for max line width > 1.

kring commented 11 years ago

I believe I checked for an exact set of extensions plus that max uniform vectors. Such a test is inherently fragile - if SwiftShader adds support for more extensions, the test breaks. But we can't do any better unless web browsers gain the ability to learn more about the hardware they're running on. I feel that's inevitable because the current situation makes WebGL much less useful than it could be, but it may be awhile before browser vendors figure out how to do it without creating privacy concerns.

mramato commented 11 years ago

I just found this: http://stackoverflow.com/questions/10456491/detect-swiftshader-webgl-renderer-in-chrome-18

Which lead me to this: http://code.google.com/p/angleproject/wiki/ExtensionSupport

and this: http://code.google.com/p/angleproject/source/browse/trunk/extensions/EGL_ANGLE_software_display.txt?r=705

Long story short: It looks like we can just check for the EGL_ANGLE_software_display extension. SwiftShader via ANGLE is the only software rendering implementation of WebGL that exists, so I think that covers it.

kring commented 11 years ago

I saw this when I was working on Santa, but one of the comments on Stack Overflow sums up the problem:

The problem is: currently there's no way to verify EGL extensions (at least from javascript, you should check NaCl to see if it's possible from there) – Chiguireitor May 5 '12 at 3:39

mramato commented 11 years ago

I figured it was too good to be true. So do you think the method we used for Santa is too fragile, or were you just raising a concern?

kring commented 11 years ago

Just raising a concern. Like you said, it's just like the line width thing. It works now, but it might not forever. And if it stops working we'll have to change the WebGL Report. That's just the way it goes.

pjcozzi commented 11 years ago

@kring what is the exact test you used? I can take a pretty good guess as to how well it will stand the test of time.

kring commented 11 years ago
var isSwiftShader = supportedExtensions.length === 3 &&
                                supportedExtensions[0] === 'OES_texture_float' &&
                                supportedExtensions[1] === 'OES_standard_derivatives' &&
                                supportedExtensions[2] === 'WEBKIT_WEBGL_lose_context' &&
                                gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS) === 253;
pjcozzi commented 11 years ago

Is gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS) === 253 true for any other setups that we're aware of? Android? If not, perhaps just this check is the least fragile thing to do.

kring commented 11 years ago

I'm not sure. In Santa, I wanted to be conservative.

kring commented 11 years ago

My Nexus 4 reports 251 in both Chrome Beta and Firefox, FWIW.

pjcozzi commented 11 years ago

To break this, two things can happen:

Overall, I think your original test is probably the safest. I can also look at a SwiftShader report if you want other ideas.

We can also add a tooltip or footnote for how we do the test, which I thought we did for ANGLE, but it doesn't look like it.

kring commented 11 years ago

You can force Chrome to run with SwiftShader by adding --blacklist-accelerated-compositing --blacklist-webgl to the command-line. You have to restart it, of course. And then it downloads and installs SwiftShader in the background, so it may take a few minutes before you have any WebGL support at all.

kring commented 11 years ago

SwiftShader

kring commented 11 years ago

Ha, it looks like my test is already broken by the latest SwiftShader.

pjcozzi commented 11 years ago

Here's the most prominent ones to me:

Cross-reference with http://webglstats.com/

shunter commented 11 years ago

FYI instead of taking screenshots, the WebGL report is designed to produce readable text if you just select all and copy/paste. We should probably say that on the page I guess.

kring commented 11 years ago

My Nexus 4 has the same Max Combined Texture Image Units: 20.

mramato commented 11 years ago

We currently incorrectly report SwiftShader as ANGLE.

Actually, I think this is still correct. Unless I'm mistaken, SwiftShader is an implementation detail of ANGLE software rendering fallback. Without ANGLE, SwiftShader is not available.