mesa/es: Improve support for GL_OES_compressed_paletted_texture.
mesa/es: Improve support for GL_OES_compressed_paletted_texture.

Add error checking and fix handling of level (it should be negative).
Besides, always use the palette entry format/type when calling
_mesa_TexImage2D.  It respects the base internal formats of the cpal
formats, and is simpler and faster, except for cases where the unpack
alignment needs to be changed.

Signed-off-by: Chia-I Wu <1c78ba4519acc7012ab6d28d2e5ef6630c8f0d2e@gmail.com>

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