W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2012

Re: [whatwg] [canvas] Proposal for supportsContext

From: Mike Taylor <miket@opera.com>
Date: Mon, 10 Sep 2012 16:40:40 -0500
To: "Dean Jackson" <dino@apple.com>
Message-ID: <op.wkfvt2einlz9g3@omg.local>
Cc: "whatwg@lists.whatwg.org" <whatwg@lists.whatwg.org>
On Mon, 10 Sep 2012 13:14:30 -0500, Dean Jackson <dino@apple.com> wrote:

> To give a real world example, the popular tool Modernizr tests for the
> availability of WebGL by attempting to create a WebGL context. This can  
> happen
> even on pages that have no intention of using WebGL - an author has just
> inserted Modernizr into their page and is using it to test for another  
> feature.
> As I said, creating a context is not a free operation. In fact, on  
> shipping
> Safari (Mountain Lion) this causes us to switch to a more powerful GPU
> on systems that have two graphics processors.
>
> An alternative (for the WebGL case) would be to have the author test for  
> the
> presence of window.WebGLRenderingContext. However, this is not reliable.

This is actually what Modernizr does these days [1], but older versions  
did in fact create the context.

[1]  
https://github.com/Modernizr/Modernizr/blob/master/modernizr.js#L429-436

-- 
Mike Taylor
Opera Software
Received on Monday, 10 September 2012 21:41:20 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:45 UTC