W3C home > Mailing lists > Public > whatwg@whatwg.org > April 2011

[whatwg] Canvas.getContext error handling

From: Glenn Maynard <glenn@zewt.org>
Date: Tue, 12 Apr 2011 19:32:45 -0400
Message-ID: <BANLkTi=RRBpCL8PV48C1f44AEtfNFavpnw@mail.gmail.com>
Based on some discussion[1], it looks like a clean way to handle the
"permanent failure" case is: If the GPU is blacklisted, or any other
permanent error occurs, treat "webgl" as an unsupported context.  This means
instead of WebGL's context creation algorithm executing and returning null,
it would never be run at all; instead, step 2 of getContext[2] would return
null.

For transient errors, eg. too many open contexts, return a WebGL context in
the "lost" state as Kenneth described.

It was mentioned that the GPU blacklist can change as the browser runs.
That's supported with this method, since whether a context type is
"supported" or not can change over time.

Are there any cases where this wouldn't work?

(I'm not sure if or how webglcontextcreationerror fits in this.  It would
either go away entirely, or be wedged between steps 1 and 2 of getContext; I
don't know how WebGL would specify that.)


[1] http://krijnhoetmer.nl/irc-logs/whatwg/20110413#l-77
[2]
http://dev.w3.org/html5/spec/the-canvas-element.html#dom-canvas-getcontext

-- 
Glenn Maynard
Received on Tuesday, 12 April 2011 16:32:45 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:03 GMT