Search Unity

Better error response to Firefox's blacklisting

Discussion in 'WebGL' started by petrucio, Feb 13, 2016.

  1. petrucio

    petrucio

    Joined:
    Aug 30, 2011
    Posts:
    126
    Firefox apparently blacklist certain combinations of GPUs and/or drivers from running WebGL content, which throws out the following erros to the browser's console:
    Code (CSharp):
    1. Error: WebGL: Error during ANGLE OpenGL init. UnityConfig.js:30:18
    2. Error: WebGL: Refused to create native OpenGL context because of blacklisting. UnityConfig.js:30:18
    3. Error: WebGL: WebGL creation failed. UnityConfig.js:30:18
    And then pops up a Message Box that says
    which will understandably lead to some very confused players and needless support tickets, so better error handling here would be nice.

    The video card used in this case was a 9800M.
     
    syscrusher likes this.
  2. alexsuvorov

    alexsuvorov

    Unity Technologies

    Joined:
    Nov 15, 2015
    Posts:
    327
    Hello petrucio.

    I totally agree that the error message is misleading and should be replaced.
    As for now, you can implement your own Module.compatibilitycheck handler in index.html to replace this message, for example:
    Code (CSharp):
    1.  
    2.   ...
    3.   var Module = {
    4.     TOTAL_MEMORY: 268435456,
    5.     errorhandler: null,            // arguments: err, url, line. This function must return 'true' if the error is handled, otherwise 'false'
    6.     compatibilitycheck: function () {
    7.       if (!hasWebGL && browser.indexOf("Firefox") != -1) {
    8.         alert("Try to set 'webgl.force-enabled' flag to 'true' in 'about:config' to run this content.");
    9.         throw '';
    10.       }
    11.       CompatibilityCheck();
    12.     },
    13.     dataUrl: "Release/mygame.data",
    14.     codeUrl: "Release/mygame.js",
    15.     memUrl: "Release/mygame.mem",
    16.  
    17.   };
    18.   ...
     
  3. petrucio

    petrucio

    Joined:
    Aug 30, 2011
    Posts:
    126
    Of course, I'll need to translate the alert message into user-friendly language, but this certainly helps. Thanks alexsuvorov!
     
unityunity