[Mesa-stable] [PATCH 1/3] mesa: Set initial internal format of a texture to GL_RGBA

Anuj Phogat anuj.phogat at gmail.com
Mon Mar 3 18:48:45 PST 2014


>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 at lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
 src/mesa/main/texparam.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index bbdbc27..e867dbf 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -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;
-- 
1.8.3.1



More information about the mesa-stable mailing list