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

Re: [Public WebGL] Reason for not allowing generateMipmaps with compressed textures

The OpenGL ES specification states that if the baselevel of a texture is uploaded with compressedTexImage2D then trying to invoke generateMipmap on that texture will generate an error. Interestingly enough though it is not like compressed textures would not be mipmappable. like texImage2D you can specify further levels of the compressed texture yourself (however you will have to specify all levels or the texture won't work). The restriction to generateMipmaps is not present in desktop OpenGL. The only extension for compressed textures in WebGL would currently require a function that does not yet exist in WebGL (compressedTexImage2D) as only WebGL 1.0 has yet been ratified (although the latest editor draft of the specification looks like it adds compressedTexImage2D).

I'm guessing that it has been deemed too costly for the driver of OpenGL ES implementations to do a readback and decompress, recompress and upload in order to generate the mip levels, so the responsibility to do it is deferred to the application programmer. We have two choices to do this:

1) upload all levels as well
2) compute the levels on the fly

Unfortunately both of these are somewhat regrettably penalizing for mobiles. Desktops (with broadband internet, copious amounts of ram and fast processors) have plenty of power to go either of these routes. Mobiles on the other hand will suffer disproportionately from having to transfer all miplevels, and they will equally suffer disproportionately by having to compute the miplevels in JS prior to upload. Which is another example where a restriction that is irrelevant for PCs is erected while avoiding to solve it for mobiles.

On Sun, Apr 15, 2012 at 6:23 PM, Brandon Jones <tojiro@gmail.com> wrote:

Just curious about this one, wondering if someone on the list has a
good explanation. In Chrome the behavior of generateMipmaps recently
changed to fail if the bound texture is compressed. It's my
understanding that this was to stay compliant with the ES standard.

However, before it was explicitly disallowed (in this ticket:
http://code.google.com/p/chromium/issues/detail?id=121476) generating
mipmaps on compressed textures seemed to work just fine. So the
question is: If we're capable of doing it why go through the trouble
of preventing it? Is this another mobile vs. desktop issue?


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