summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnuj Phogat <anuj.phogat@gmail.com>2014-02-21 16:58:07 -0800
committerCarl Worth <cworth@cworth.org>2014-04-14 11:48:49 -0700
commitdf15372b65fe7cc1e1247e9d5249e85f7c7ee83a (patch)
tree1faac6f5c2b1b0e4c6030cc74bf705792d5aa4ab
parent50d65b4374b070719fb00963ea622e1074cd261e (diff)
mesa: Set initial internal format of a texture to GL_RGBA
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> (cherry picked from commit 063980151e801fca6c314e14c82e9a7b8c04a4d2)
-rw-r--r--src/mesa/main/texparam.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index bbdbc276388..e867dbf740c 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;