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

Re: [whatwg] Adding features needed for WebGL to ImageBitmap

From: Kenneth Russell <kbr@google.com>
Date: Wed, 10 Jul 2013 16:48:53 -0700
Message-ID: <CAMYvS2cqdqwDfNoEV-P7zVvN_Ln8Mehd-85+ipvi15CBKSyA2A@mail.gmail.com>
To: Ian Hickson <ian@hixie.ch>
Cc: WHATWG <whatwg@whatwg.org>, "Tab Atkins Jr." <jackalmage@gmail.com>, Rik Cabanier <cabanier@gmail.com>
On Wed, Jul 10, 2013 at 4:37 PM, Ian Hickson <ian@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.

-Ken


> --
> Ian Hickson               U+1047E                )\._.,--....,'``.    fL
> http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
> Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Wednesday, 10 July 2013 23:49:18 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:03 UTC