[Mesa-dev] [PATCH 1/3] mesa: do internal format error checking for glTexStorage()

Andreas Boll andreas.boll.dev at gmail.com
Wed Sep 12 09:34:06 PDT 2012


This commit introduces a regression.
Now the piglit test spec/ARB_texture_storage/texture-storage fails on
r600g, llvmpipe and softpipe

2e4fc54977977e674ee77294e6632a24e594d17f is the first bad commit
commit 2e4fc54977977e674ee77294e6632a24e594d17f
Author: Brian Paul <brianp at vmware.com>
Date:   Sat Sep 8 09:27:46 2012 -0600

    mesa: do internal format error checking for glTexStorage()

    Turns out we weren't doing any format checking before.  Now check
    the internal format and, in particular, make sure that unsized internal
    formats aren't accepted.

    Note: This is a candidate for the stable branches.

Steps to reproduce:

$ ./bin/arb_texture_storage-texture-storage -auto

texture-storage: bad width: 0, should be 64
texture-storage: bad width: 0, should be 64
texture-storage: bad width: 0, should be 64
texture-storage: GL_TEXTURE_1D GL_TEXTURE_IMMUTABLE_FORMAT query returned false
texture-storage: GL_TEXTURE_2D GL_TEXTURE_IMMUTABLE_FORMAT query returned false
texture-storage: GL_TEXTURE_3D GL_TEXTURE_IMMUTABLE_FORMAT query returned false
texture-storage: level 0: bad width: 0, should be 128
PIGLIT: {'result': 'fail' }

Andreas


2012/9/8 Brian Paul <brianp at vmware.com>:
> Turns out we weren't doing any format checking before.  Now check
> the internal format and, in particular, make sure that unsized internal
> formats aren't accepted.
>
> Note: This is a candidate for the stable branches.
> ---
>  src/mesa/main/texstorage.c |   48 ++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 48 insertions(+), 0 deletions(-)
>
> diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c
> index f8af8bf..8e03e5e 100644
> --- a/src/mesa/main/texstorage.c
> +++ b/src/mesa/main/texstorage.c
> @@ -245,6 +245,54 @@ tex_storage_error_check(struct gl_context *ctx, GLuint dims, GLenum target,
>     const GLboolean isProxy = _mesa_is_proxy_texture(target);
>     struct gl_texture_object *texObj;
>     GLuint maxDim;
> +   GLboolean legalFormat;
> +
> +   /* check internal format - note that only sized formats are allowed */
> +   switch (internalformat) {
> +   case GL_ALPHA:
> +   case GL_LUMINANCE:
> +   case GL_LUMINANCE_ALPHA:
> +   case GL_INTENSITY:
> +   case GL_RED:
> +   case GL_RG:
> +   case GL_RGB:
> +   case GL_RGBA:
> +   case GL_BGRA:
> +   case GL_DEPTH_COMPONENT:
> +   case GL_DEPTH_STENCIL:
> +   case GL_COMPRESSED_ALPHA:
> +   case GL_COMPRESSED_LUMINANCE_ALPHA:
> +   case GL_COMPRESSED_LUMINANCE:
> +   case GL_COMPRESSED_INTENSITY:
> +   case GL_COMPRESSED_RGB:
> +   case GL_COMPRESSED_RGBA:
> +   case GL_COMPRESSED_SRGB:
> +   case GL_COMPRESSED_SRGB_ALPHA:
> +   case GL_COMPRESSED_SLUMINANCE:
> +   case GL_COMPRESSED_SLUMINANCE_ALPHA:
> +   case GL_RED_INTEGER:
> +   case GL_GREEN_INTEGER:
> +   case GL_BLUE_INTEGER:
> +   case GL_ALPHA_INTEGER:
> +   case GL_RGB_INTEGER:
> +   case GL_RGBA_INTEGER:
> +   case GL_BGR_INTEGER:
> +   case GL_BGRA_INTEGER:
> +   case GL_LUMINANCE_INTEGER_EXT:
> +   case GL_LUMINANCE_ALPHA_INTEGER_EXT:
> +      /* these unsized formats are illegal */
> +      legalFormat = GL_FALSE;
> +      break;
> +   default:
> +      legalFormat = _mesa_base_tex_format(ctx, internalformat) > 0;
> +   }
> +
> +   if (!legalFormat) {
> +      _mesa_error(ctx, GL_INVALID_ENUM,
> +                  "glTexStorage%uD(internalformat = %s)", dims,
> +                  _mesa_lookup_enum_by_nr(internalformat));
> +      return GL_TRUE;
> +   }
>
>     /* size check */
>     if (width < 1 || height < 1 || depth < 1) {
> --
> 1.7.3.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list