playcanvas / editor

Issue tracker for the PlayCanvas Editor
https://playcanvas.com/
154 stars 28 forks source link

PlayCanvas loading screen blocks WebGL not supported error #399

Open Christopher-Hayes opened 4 years ago

Christopher-Hayes commented 4 years ago

Description

It seems on some devices that either have WebGL disabled or hardware in some doesn't support WebGL, will cause PlayCanvas to hang at the loading screen with 0% progress. No console errors are logged either. It should be noted this is a situation where the browser does support WebGL, but for some other reason WebGL isn't available.

I'll try to pin down exactly what circumstances this happens, but I've come across this a number of times testing Mac devices on https://crossbrowsertesting.com. Of course, this is an unusual situation to lack WebGL support, but as a user I would expect an error of some sort to show indicating WebGL isn't available.

The code below is from __start__.js, I would expect pc.ContextCreationError to trip when a device is in this situation, but for whatever reason it does not. I don't believe __start__.js is part of the PlayCanvas engine, so this repo may not be the appropriate place for this issue and maybe it should really be down to the developer utilizing PlayCanvas to figure this type of stuff out, if so LMK.

    try {
        app = new pc.Application(canvas, {
            elementInput: devices.elementInput,
            keyboard: devices.keyboard,
            mouse: devices.mouse,
            gamepads: devices.gamepads,
            touch: devices.touch,
            graphicsDeviceOptions: window.CONTEXT_OPTIONS,
            assetPrefix: window.ASSET_PREFIX || "",
            scriptPrefix: window.SCRIPT_PREFIX || "",
            scriptsOrder: window.SCRIPTS || []
        });
    } catch (e) {
        if (e instanceof pc.UnsupportedBrowserError) {
            displayError('This page requires a browser that supports WebGL.<br/>' +
                    '<a href="http://get.webgl.org">Click here to find out more.</a>');
        } else if (e instanceof pc.ContextCreationError) {
            displayError("It doesn't appear your computer can support WebGL.<br/>" +
                    '<a href="http://get.webgl.org/troubleshooting/">Click here for more information.</a>');
        } else {
            displayError('Could not initialize application. Error: ' + e);
        }

        return;
    }

Expected Behavior

On devices that don't have WebGL available, PlayCanvas would show an error message to the user or at least throw some error that a developer can handle.

Actual Behavior

The PlayCanvas loading screen hangs at 0%. (No console errors either)

image

WebGL Report on these devices (note how it mentions the browser supports WebGL, but it's somehow unavailable)

image

Additional info

Device/browser reproduced on: Safari 13 on Mac 10.15 PlayCanvas discussion: https://forum.playcanvas.com/t/does-playcanvas-have-api-to-check-webgl-support/14779/4

Christopher-Hayes commented 4 years ago

Update

Actually after further testing, it does trip the pc.UnsupportedBrowserError, but the error is never shown.

image

Okay yeah the WebGL error gets blocked by the loading screen. I was under the assumption PlayCanvas was oblivious that WebGL was not supported.

image

Christopher-Hayes commented 4 years ago

Updating the <table> inline styling to have position: relative; z-index: 1; would fix this.

image