There is no way to detect ANGLE. WebGLReport guesses and its guess are wrong. Here is their code
function getAngle(gl) {
var lineWidthRange = describeRange(gl.getParameter(gl.ALIASED_LINE_WIDTH_RANGE));
// Heuristic: ANGLE is only on Windows, not in IE, and not in Edge, and does not implement line width greater than one.
var angle = ((navigator.platform === 'Win32') || (navigator.platform === 'Win64')) &&
(gl.getParameter(gl.RENDERER) !== 'Internet Explorer') &&
(gl.getParameter(gl.RENDERER) !== 'Microsoft Edge') &&
(lineWidthRange === describeRange([1, 1]));
if (angle) {
// Heuristic: D3D11 backend does not appear to reserve uniforms like the D3D9 backend, e.g.,
// D3D11 may have 1024 uniforms per stage, but D3D9 has 254 and 221.
//
// We could also test for WEBGL_draw_buffers, but many systems do not have it yet
// due to driver bugs, etc.
if (isPowerOfTwo(gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS)) && isPowerOfTwo(gl.getParameter(gl.MAX_FRAGMENT_UNIFORM_VECTORS))) {
return 'Yes, D3D11';
} else {
return 'Yes, D3D9';
}
}
return 'No';
}
It's wrong and years out of date.
The first guess is looking at lineWidthRange
which even when they wrote it was only a guess. The spec says it is valid to have only lines of width 1. Back when WebGL shipped it was common that ANGLE supported just lines of size 1 and OpenGL supported others. But, that changed when WebGL2 shipped because WebGL2, when running on top of desktop OpenGL, required using the "Core" profile and the "Core" profile disallows lines other than size 1 period.
From the spec
E.2.1 Deprecated But Still Supported Features
The following features are deprecated, but still present in the core profile. They
may be removed from a future version of OpenGL, and are removed in a forwardcompatible context implementing the core profile.
- Wide lines - LineWidth values greater than 1.0 will generate an INVALID_VALUE error
Their second guess is looking at the browser. That's obviously no longer valid. Edge is now based on Chromium and further Safari now uses ANGLE as well.
The last one is one more guess that ANGLE is being used because it assumes ANGLE is running on top of D3D and that certain limits were therefore special but ANGLE is now used on all platforms and can run on top of Desktop OpenGL, D3D, OpenGL ES, Metal, and Vulkan. From the chart on the angle project as of January 2021
Level of OpenGL ES support via backing renderers
|
Direct3D 9 |
Direct3D 11 |
Desktop GL |
GL ES |
Vulkan |
Metal |
OpenGL ES 2.0 |
complete |
complete |
complete |
complete |
complete |
complete |
OpenGL ES 3.0 |
|
complete |
complete |
complete |
complete |
in progress |
OpenGL ES 3.1 |
|
incomplete |
complete |
complete |
complete |
|
OpenGL ES 3.2 |
|
|
in progress |
in progress |
in progress |
|
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…