[webkit-dev] Image decoding on demand?

Mo, Zhenyao zhenyao at gmail.com
Mon Jan 10 10:12:31 PST 2011


I am working on improving WebGL texture uploading performance.  At the
moment, for each texture loaded from HTMLImageElement, images are
always decoded twice: the first pass is regular decoding, the second
pass is for WebGL only.  The reason is that for WebGL, we sometimes
want the raw RGBA data without applying gamma and color profile, and
without premultiplying alpha.

I am wondering if there is any way we can avoid decoding twice.  In
many cases, the HTMLImageElement used as WebGL texture won't be
displayed, so we don't need the first pass regular decoding.

The problem is that HTMLImageElement does not know how it is going to
be used.  So we can not just pass in some parameter and let the first
pass decoding behave like we desire.

So my question is, is it possible to let HTMLImageElement'd image
decoding to be on-demand?  Say, only decode it once it's rendered or
used by WebGL?

Please advise.


More information about the webkit-dev mailing list