[whatwg] Adding features needed for WebGL to ImageBitmap

Kenneth Russell kbr at google.com
Wed Jul 10 16:48:53 PDT 2013

On Wed, Jul 10, 2013 at 4:37 PM, Ian Hickson <ian at hixie.ch> wrote:
> On Wed, 10 Jul 2013, Kenneth Russell wrote:
>> Some background: when uploading HTMLImageElements to WebGL it's required
>> to be able to specify certain options, such as whether to premultiply
>> the alpha channel, or perform colorspace conversion. Because it seemed
>> infeasible at the time to modify the HTML spec, these options are set
>> via the WebGL API. If they're set differently from the browser's
>> defaults (which are generally to do premultiplication, and do colorspace
>> conversion), then the WebGL implementation has to re-decode the image
>> when it's uploaded to a WebGL texture. (There's no way to know in
>> advance whether a given image is intended for upload to WebGL as opposed
>> to insertion into the document, and making image decoding lazier than it
>> currently is would introduce bad hiccups while scrolling.)
> It seems like the right solution is to create a primitive for WebGL that
> represents images that are going to be used in WebGL calls. Such a
> primitive could use the same sources for images as ImageBitmap, but would
> be specifically for use with WebGL, in the same way that ImageBitmap is
> used just by the 2D Canvas API.

That sounds like the wrong solution to me. The goal of HTML5 should be
good integration of all of the component APIs, not to treat some, like
WebGL, as bolt-on mechanisms.

ImageBitmap can cleanly address all of the desired use cases simply by
adding an optional dictionary of options. I suspect that in the future
some options will be desired even for the 2D canvas use case, and
having the dictionary already specified will make that easier. There
is no need to invent a new primitive and means of loading it.


> --
> Ian Hickson               U+1047E                )\._.,--....,'``.    fL
> http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
> Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list