[Mesa-dev] [PATCH 3/8] mesa: Validate internalFormat with target in glTexStorage paths

Ian Romanick idr at freedesktop.org
Fri Jan 24 17:13:12 PST 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/24/2014 02:44 PM, Kenneth Graunke wrote:
> On 01/24/2014 02:18 PM, Ian Romanick wrote:
>> From: Ian Romanick <ian.d.romanick at intel.com>
>> 
>> 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 at intel.com> --- 
>> src/mesa/main/teximage.c   | 4 +++- src/mesa/main/texstorage.c |
>> 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-)
>> 
>> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c 
>> index 1417582..1b5b827 100644 --- a/src/mesa/main/teximage.c +++
>> b/src/mesa/main/teximage.c @@ -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) &&
> 
> This also affects non-TexStorage paths, so I'm not sure why it's in
> this patch...but otherwise, this series looks good.

Technically, yes, but practically, no.  GL_TEXTURE_CUBE_MAP isn't
legal for non-TexStorage paths, and those paths already generate
errors for that enum before getting to this point.  If
GL_TEXTURE_CUBE_MAP were allowed for those paths, the same set of base
formats would be legal.

Basically, the TexStorage paths need a slight superset of the
functionality needed by the non-TexStorage paths.  Rather than
duplicate the code and add one case, I decided to just use the same code.

> Series is: Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
> 
>> (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 || diff --git
>> a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c index
>> 2220857..c1d2a5a 100644 --- a/src/mesa/main/texstorage.c +++
>> b/src/mesa/main/texstorage.c @@ -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; 
>> }
>> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)

iEYEARECAAYFAlLjD6gACgkQX1gOwKyEAw8/TwCfXRbQAIxuZTq6N3IM+d0+eV9O
ZX0AnjatOf7xTNnWRuieV9ruFCxlE1Bs
=PdWv
-----END PGP SIGNATURE-----


More information about the mesa-dev mailing list