mesa: Don't override S3TC internalFormat if data is pre-compressed.
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 <bd2562f754ec92342f93f61c25d731e290a2ffa8@whitecape.org>
Reviewed-by: Ian Romanick <2b237cafb16dc45038e85df6c85e74e6d899eba9@intel.com>
Reviewed-and-tested-by: Jordan Justen <a79006884ba9cf5f4f7fcbb92a15b208780d8c97@intel.com>

mapbox/glsl-optimizer,dellis1972/glsl-optimizer,tokyovigilante/glsl-optimizer,djreep81/glsl-optimizer,wolf96/glsl-optimizer,zeux/glsl-optimizer,benaadams/glsl-optimizer,zz85/glsl-optimizer,djreep81/glsl-optimizer,djreep81/glsl-optimizer,mapbox/glsl-optimizer,tokyovigilante/glsl-optimizer,jbarczak/glsl-optimizer,tokyovigilante/glsl-optimizer,zz85/glsl-optimizer,bkaradzic/glsl-optimizer,zeux/glsl-optimizer,dellis1972/glsl-optimizer,wolf96/glsl-optimizer,zeux/glsl-optimizer,benaadams/glsl-optimizer,wolf96/glsl-optimizer,tokyovigilante/glsl-optimizer,jbarczak/glsl-optimizer,wolf96/glsl-optimizer,mapbox/glsl-optimizer,zz85/glsl-optimizer,mapbox/glsl-optimizer,mcanthony/glsl-optimizer,mcanthony/glsl-optimizer,jbarczak/glsl-optimizer,zz85/glsl-optimizer,benaadams/glsl-optimizer,metora/MesaGLSLCompiler,mapbox/glsl-optimizer,djreep81/glsl-optimizer,benaadams/glsl-optimizer,zeux/glsl-optimizer,benaadams/glsl-optimizer,metora/MesaGLSLCompiler,bkaradzic/glsl-optimizer,dellis1972/glsl-optimizer,bkaradzic/glsl-optimizer,zz85/glsl-optimizer,tokyovigilante/glsl-optimizer,metora/MesaGLSLCompiler,bkaradzic/glsl-optimizer,djreep81/glsl-optimizer,jbarczak/glsl-optimizer,zeux/glsl-optimizer,mcanthony/glsl-optimizer,mcanthony/glsl-optimizer,dellis1972/glsl-optimizer,mcanthony/glsl-optimizer,wolf96/glsl-optimizer,dellis1972/glsl-optimizer,jbarczak/glsl-optimizer,zz85/glsl-optimizer,bkaradzic/glsl-optimizer,benaadams/glsl-optimizer