mesa: Don't override S3TC internalFormat if data is pre-compressed.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 19 Sep 2012 19:01:14 +0000 (12:01 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 25 Sep 2012 14:17:33 +0000 (07:17 -0700)
commit3dd84a58bb3a066eeaf854dd83a8d33801011367
tree94ea1cf26ae4f9bd2abcc46178af203e8a5373b7
parent0231c54ebbfd4ace99c3be6bb6e5c76127279aca
mesa: Don't override S3TC internalFormat if data is pre-compressed.

Commit 42723d88d intended to override an S3TC internalFormat to a
generic compressed format when the application requested online
compression of uncompressed data.  Unfortunately, it also broke
pre-compressed textures when libtxc_dxtn isn't installed but the
extensions are forced on.

Both glCompressedTexImage2D() and glTexImage2D() call teximage(), which
calls _mesa_choose_texture_format(), hitting this override code.  If we
have actual S3TC source data, we can't treat it as any other format, and
need to avoid the override.

Since glCompressedTexImage2D() passes in a format of GL_NONE (which is
illegal for glTexImage), we can use that to detect the pre-compressed
case and avoid the overrides.

Fixes a regression since 42723d88d370a7599398cc1c2349aeb951ba1c57.

NOTE: This is a candidate for the 9.0 branch.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-and-tested-by: Jordan Justen <jordan.l.justen@intel.com>
(cherry picked from commit 328961d95586931a17fe81ba816d362e8389c105)
src/mesa/main/teximage.c