Closed mramato closed 10 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.
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
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.
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
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?
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.
@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.
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;
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.
I'm not sure. In Santa, I wanted to be conservative.
My Nexus 4 reports 251 in both Chrome Beta and Firefox, FWIW.
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.
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.
Ha, it looks like my test is already broken by the latest SwiftShader.
Here's the most prominent ones to me:
Cross-reference with http://webglstats.com/
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.
My Nexus 4 has the same Max Combined Texture Image Units: 20.
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.
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.