mesa: Set initial internal format of a texture to GL_RGBA
authorAnuj Phogat <anuj.phogat@gmail.com>
Sat, 22 Feb 2014 00:58:07 +0000 (16:58 -0800)
committerAnuj Phogat <anuj.phogat@gmail.com>
Tue, 4 Mar 2014 19:22:39 +0000 (11:22 -0800)
From OpenGL 4.0 spec, page 398:
   "The initial internal format of a texel array is RGBA
    instead of 1. TEXTURE_COMPONENTS is deprecated; always
    use TEXTURE_INTERNAL_FORMAT."

Fixes Khronos OpenGL CTS test failure: proxy_textures_invalid_size

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
src/mesa/main/texparam.c

index bbdbc276388fd0dcc07cf9404add4d0d27cd2517..e867dbf740c238cd5f5f8864e4733c84fd09af8c 100644 (file)
@@ -1038,9 +1038,16 @@ get_tex_level_parameter_image(struct gl_context *ctx,
 
    img = _mesa_select_tex_image(ctx, texObj, target, level);
    if (!img || img->TexFormat == MESA_FORMAT_NONE) {
-      /* undefined texture image */
-      if (pname == GL_TEXTURE_COMPONENTS)
-         *params = 1;
+      /* In case of undefined texture image return the default values.
+       *
+       * From OpenGL 4.0 spec, page 398:
+       *    "The initial internal format of a texel array is RGBA
+       *     instead of 1. TEXTURE_COMPONENTS is deprecated; always
+       *     use TEXTURE_INTERNAL_FORMAT."
+       */
+
+      if (pname == GL_TEXTURE_INTERNAL_FORMAT)
+         *params = GL_RGBA;
       else
          *params = 0;
       return;