W3C home > Mailing lists > Public > whatwg@whatwg.org > June 2013

Re: [whatwg] Challenging canvas.supportsContext

From: Benoit Jacob <jacob.benoit.1@gmail.com>
Date: Wed, 19 Jun 2013 19:22:20 -0400
Message-ID: <CAJTmd9pSD5r5-0sorvGtwHcEwhwNW0tz5+rB=mrMHj9X12SqNA@mail.gmail.com>
To: Kenneth Russell <kbr@google.com>
Cc: whatwg <whatwg@lists.whatwg.org>, Brandon Benvie <bbenvie@mozilla.com>, James Robinson <jamesr@google.com>
2013/6/19 Kenneth Russell <kbr@google.com>

> In my experience, in Chromium, creation of the underlying OpenGL
> context for a WebGLRenderingContext almost never fails in isolation.
> Instead, more general failures happen such as the GPU process failing
> to boot, or creation of all OpenGL contexts (including the
> compositor's) failing. These failures would be detected before the app
> calls supportsContext('webgl'). For this reason I believe
> supportsContext's answer can be highly accurate in almost every
> situation.

In Mozilla code, we fail WebGL context creation if any GL error occurs
during initialization, where we have to make a number of specific OpenGL
calls (e.g. querying many constants, enabling point sprites...). So it is
perfectly possible for WebGL specifically to fail on a given device where
OpenGL compositing works, without being specifically blacklisted, and
currently we can rely on these automatic checks rather than having to
curate a blacklist for these problems, which is very nice.

Another way in which WebGL specifically can fail, is that some driver bugs
cause errors that we may want to ignore in our compositor code but not in
WebGL. To give an example, on many Vivante GPU drivers, which are very
common in Chinese mobile devices, the first eglMakeCurrent call on a newly
created context can return false without any actual EGL error [1]. A
browser may want to ignore this error in its compositor to be able to run
nonetheless on such devices, but without WebGL support.

To summarize, blacklisting is not the only reason why WebGL specifically
may fail, and this is particularly concrete on low-end mobile devices.

Checking whether any WebGL context creation succeeded in the current
browser session is a very useful data point indeed, but doesn't help with
the _first_ context creation (which seems particularly relevant for the
Chrome Web Store use case mentioned earlier).


[1] https://bugzilla.mozilla.org/show_bug.cgi?id=771774#c2
Received on Wednesday, 19 June 2013 23:22:44 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:22 UTC