mesa: Validate internalFormat with target in glTexStorage paths
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 18 Dec 2013 22:38:16 +0000 (14:38 -0800)
committerIan Romanick <ian.d.romanick@intel.com>
Mon, 27 Jan 2014 21:21:43 +0000 (14:21 -0700)
Fixes the glTexStorage3D failure in
ext_packed_depth_stencil-depth-stencil-texture and
oes_packed_depth_stencil-depth-stencil-texture_gles2.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/main/teximage.c
src/mesa/main/texstorage.c

index 0ba3cd29ff12629e21581d2ccf238a487232551e..5bbcae3710362a4c38d0c66d8eb5ba7ccd4114c7 100644 (file)
@@ -2013,7 +2013,9 @@ _mesa_legal_texture_base_format_for_target(struct gl_context *ctx,
           target != GL_PROXY_TEXTURE_2D_ARRAY &&
           target != GL_TEXTURE_RECTANGLE_ARB &&
           target != GL_PROXY_TEXTURE_RECTANGLE_ARB &&
-         !((_mesa_is_cube_face(target) || target == GL_PROXY_TEXTURE_CUBE_MAP) &&
+         !((_mesa_is_cube_face(target) ||
+            target == GL_TEXTURE_CUBE_MAP ||
+            target == GL_PROXY_TEXTURE_CUBE_MAP) &&
            (ctx->Version >= 30 || ctx->Extensions.EXT_gpu_shader4
             || (ctx->API == API_OPENGLES2 && ctx->Extensions.OES_depth_texture_cube_map))) &&
           !((target == GL_TEXTURE_CUBE_MAP_ARRAY ||
index 22208572f51877037413fb44060b9398c05fb705..c1d2a5a6b773b6a671916ef47439959fee3865d7 100644 (file)
@@ -332,6 +332,11 @@ tex_storage_error_check(struct gl_context *ctx, GLuint dims, GLenum target,
       return GL_TRUE;
    }
 
+   /* additional checks for depth textures */
+   if (!_mesa_legal_texture_base_format_for_target(ctx, target, internalformat,
+                                                   dims, "glTexStorage"))
+      return GL_TRUE;
+
    return GL_FALSE;
 }