[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] webgl texture format conversions: doable in 17k of executable code (x86-64) !

Nice work! Firefox was already quite speedy when it came to texture uploads, it would be great if this improved that. Even if it's break-even, however, the code simplification is very nice.


On Tue, May 8, 2012 at 7:05 AM, Benoit Jacob <bjacob@mozilla.com> wrote:


This email is 50% bragging rights and 50% sharing hopefully useful info with other browser vendors.

You know that a WebGL implementation has to handle a large number of cases of texture format conversions: there are many source formats, many destination formats, and the possibility of premultiplication or unpremultiplication.

Here is a changeset (currently only on mozilla-inbound) that brings this code size down to 17k on x86-64 (as measured with nm -S on linux). Our previous version, which was already quite careful, was 44k. This is using the 'fully templatized' approach i.e. a separate conversion loop is compiled for each case, traversing the bitmaps only once, with all the texel conversion functions inlined into it.


The key was to avoid compiling paths that are never called, the code for this is there:


You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email:
unsubscribe public_webgl