[Mesa-dev] [PATCH 1/5] mesa: Skip texstore for 0-sized texture data.

Brian Paul brianp at vmware.com
Tue Oct 25 15:29:53 PDT 2011


On 10/25/2011 03:58 PM, Eric Anholt wrote:
> The intel driver (and gallium, it looks like, though it doesn't use
> these texstore functions at this point) doesn't bother making storage
> for textures with 0 width, height, or depth.  This avoids them having
> to deal with returning a mapping for that nonexistent data.
>
> Fixes assertion failures with an upcoming intel driver change.

For the series:  Reviewed-by: Brian Paul <brianp at vmware.com>


However, there are some additional issues with texture borders that 
have existed all along that we should probably fix up in follow-on 
patches.

Suppose we've got a GL_TEXTURE_2D_ARRAY texture, if there's a border, 
it only applies to the width and height, not the depth.  So we don't 
want to change the texture depth in this case.  Similarly for 1D 
texture arrays and the height.

We should fix this in the border stipping code and in 
_mesa_init_teximage_fields() and probably other places TBD.

A helper function like this might be useful to split up the 
user-provided border value into per-dimension values:

void
split_border(GLenum target, GLint border,
              GLint *w_border, GLint *h_border, GLint *d_border)
{
    switch (target) {
    case GL_TEXTURE_1D:
    case GL_TEXTURE_1D_ARRAY:
       *w_border = border;
       *h_border = *d_border = 0;
       break;
    case GL_TEXTURE_2D:
    case GL_TEXTURE_2D_ARRAY:
       *w_border = *h_border = border;
       *d_border = 0;
       break;
    case GL_TEXTURE_3D:
       *w_border = *h_border = *d_border = border;
       break;
    case ...
    }
}


-Brian


More information about the mesa-dev mailing list