We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Can you programmatically check WebGL is supported?

Home Forums WebGL & WebXR Troubleshooting Can you programmatically check WebGL is supported?


Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #34088

    We’re using a JavaScript charting library, which renders graphs using WebGL. Unfortunately, its not rendering on a few older machines, using the latest Chrome browser. Interestingly enough the browser reports both WebGL and WebGL2 as “Hardware accelerated” via chrome://gpu. The spinning cube shows when testing https://get.webgl.org, but does not show when testing https://get.webgl.org/webgl2. Instead it displays a message stating: “Hmm. While your browser seems to support WebGL2, it is disabled or unavailable. If possible, please ensure that you are running the latest drivers for your video card.” The graphs display when we disable “hardware acceleration”, from Chrome’s settings. The graphs also display with “hardware acceleration” on, and with additional settings enabled in chrome://flags. I’m not exactly sure what component, from the software rendering list, did the trick, but unfortunately my stake-holders aren’t very keen about having settings we can tell our customers to enable/disable, etc. So I’m looking for a way to determine through JavaScript, on page load, whether or not components relying on WebGL will function properly or not. The charting libraries I’m using functions well enough without a secondary library that helps boost rendering performance. Ideally we would like to continue using it and only exclude it for clients that cannot support WebGL fully.

    Here is part of the chrome://gpu output:

    Graphics Feature Status
    • Canvas: Hardware accelerated
    • Compositing: Hardware accelerated
    • Multiple Raster Threads: Enabled
    • Out-of-process Rasterization: Unavailable
    • OpenGL: Enabled
    • Hardware Protected Video Decode: Unavailable
    • Rasterization: Unavailable
    • Skia Renderer: Enabled
    • Video Decode: Hardware accelerated
    • Vulkan: Disabled
    • WebGL: Hardware accelerated
    • WebGL2: Hardware accelerated

    Problems Detected
    • GPU rasterization should only be enabled on NVIDIA and Intel and AMD RX-R2 GPUs with DX11+ or any GPU using ANGLE’s GL backend.: 1047002
    Disabled Features: gpu_rasterization
    • Protected video decoding with swap chain is for certain Intel and AMD GPUs on Windows: 1093625
    Disabled Features: protected_video_decode

    (There were many more, but these were the only ones that specified as “Disabled Features”)

    There also seem to be a lot of logs around “D3D workarounds” being disabled. The machine in question is running Windows 7 with SP 1. Its simply being used for testing old configurations.

    Here are warnings I’m seeing in the browser’s console:

    “D3D shader compilation failed with avoid flow control flags. (ps_3_0)”

    “Warning: D3D shader compilation failed with prefer flow control flags. (ps_3_0)”

    “Failed to create D3D Shaders”

    “Unable to init WebGL renderer”

    Obviously there is something wrong with the D3D Shaders, but I don’t know how to test for it. Best I’ve come up with thus far is creating a canvas and attempting to obtain a rendering context for type “WebGLRenderingContext” and “WebGL2RenderingContext”. The former works, but latter fails.

    Any suggestions would be greatly appreciated.



    WebGL 2 can be unsupported on some systems. So trying to get the context is a correct method for detecting the system capabilities.

    3D Verger, the CEO
    LinkedIn | FB | Twitter | VK | 新浪微博

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.