[Mesa-dev] [PATCH 08/13] mesa: rewrite/consolidate code in _mesa_test_texobj_completeness()

Eric Anholt eric at anholt.net
Mon Mar 19 23:56:03 PDT 2012


On Sun, 18 Mar 2012 10:49:24 -0600, Brian Paul <brianp at vmware.com> wrote:
> Merge the mipmap level checking code that was separate cases for 1D,
> 2D, 3D and CUBE before.

> -               if (img->_BaseFormat == GL_DEPTH_COMPONENT) {
> -                  incomplete(t, "GL_DEPTH_COMPONENT only works with 1/2D tex");
> -                  return;
> -               }

[...]

> -		  /* Don't support GL_DEPTH_COMPONENT for cube maps */
> -                  if (ctx->VersionMajor < 3 && !ctx->Extensions.EXT_gpu_shader4) {
> -                     if (t->Image[face][i]->_BaseFormat == GL_DEPTH_COMPONENT) {
> -                        incomplete(t, "GL_DEPTH_COMPONENT only works with 1/2D tex");
> -                        return;
> -                     }
> -		  }

It was a surprise tosee these two blocks be dropped.  However, it looks
totally safe: texture image creation already errors out in these cases,
so we shouldn't have any reason to check for it at completeness time.

> -		  /* check that all six images have same size */
> -                  if (t->Image[face][i]->Width2 != width || 
> -                      t->Image[face][i]->Height2 != height) {
> +
> +               /* Extra checks for cube textures */
> +               if (face > 0) {
> +                  /* check that cube faces are the same size */
> +                  if (img->Width2 != t->Image[0][i]->Width2 || 
> +                      img->Height2 != t->Image[0][i]->Height2) {
>  		     incomplete(t, "CubeMap Image[n][i] bad size");
>  		     return;
>  		  }

I thought this testing might be wrong, since we're not checking that
cube faces have width == height.  That's also tested at image creation
time, though, so it's true at this point (and so, technically, we
wouldn't even need to test for Height2s matching up)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20120319/ae06a4ae/attachment.pgp>


More information about the mesa-dev mailing list