meta: Fix datatype computation in get_temp_image_type()

Changes in the patch will cause datatype to be computed
correctly for 8 and 16 bit integer formats. For example:
GL_RG8I, GL_RG16I etc.

Fixes many failures in gles3 Khronos CTS test:
copy_tex_image_conversions_required
copy_tex_image_conversions_forbidden

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
(cherry picked from commit 338fef61f8)

Conflicts:
	src/mesa/drivers/common/meta.c
This commit is contained in:
Anuj Phogat 2014-06-12 14:49:50 -07:00 committed by Carl Worth
parent 82d46ebc07
commit 3e541f0ab8

View file

@ -2743,6 +2743,7 @@ get_temp_image_type(struct gl_context *ctx, mesa_format format)
{
const GLenum baseFormat = _mesa_get_format_base_format(format);
const GLint format_red_bits = _mesa_get_format_bits(format, GL_RED_BITS);
GLenum datatype = _mesa_get_format_datatype(format);
switch (baseFormat) {
case GL_RGBA:
@ -2753,18 +2754,15 @@ get_temp_image_type(struct gl_context *ctx, mesa_format format)
case GL_LUMINANCE:
case GL_LUMINANCE_ALPHA:
case GL_INTENSITY:
if (format_red_bits <= 8) {
if (datatype == GL_INT || datatype == GL_UNSIGNED_INT) {
return datatype;
} else if (format_red_bits <= 8) {
return GL_UNSIGNED_BYTE;
} else if (format_red_bits <= 16) {
return GL_UNSIGNED_SHORT;
} else {
GLenum datatype = _mesa_get_format_datatype(format);
if (datatype == GL_INT || datatype == GL_UNSIGNED_INT)
return datatype;
return GL_FLOAT;
}
return GL_FLOAT;
case GL_DEPTH_COMPONENT: {
GLenum datatype = _mesa_get_format_datatype(format);
if (datatype == GL_FLOAT)
return GL_FLOAT;
else