[Mesa-dev] [PATCH 1/3] i965: Use intel_get_image_dims in alloc_texture_storage

Iago Toral itoral at igalia.com
Tue Jul 19 12:56:51 UTC 2016


On Mon, 2016-07-18 at 22:16 -0700, Jason Ekstrand wrote:
> The intel_get_image_dims helper function handles some image dimension
> sanitization for us for things such as 1-D array textures.  We should
> probably be using it here.
> 
> Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
> Cc: "12.0 11.2 11.1" <mesa-stable at lists.freedesktop.org>
> ---
>  src/mesa/drivers/dri/i965/intel_tex.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/mesa/drivers/dri/i965/intel_tex.c
> b/src/mesa/drivers/dri/i965/intel_tex.c
> index 8c32fe3..d3e24f4 100644
> --- a/src/mesa/drivers/dri/i965/intel_tex.c
> +++ b/src/mesa/drivers/dri/i965/intel_tex.c
> @@ -141,6 +141,8 @@ intel_alloc_texture_storage(struct gl_context
> *ctx,
>         !intel_miptree_match_image(intel_texobj->mt, first_image) ||
>         intel_texobj->mt->last_level != levels - 1) {
>        intel_miptree_release(&intel_texobj->mt);
> +
> +      intel_get_image_dims(first_image, &width, &height, &depth);

I don't think we want this. This code calls intel_miptree_create below,
which then calls miptree_create and that
calls intel_miptree_create_layout, which has this code:

   if (target == GL_TEXTURE_1D_ARRAY) {
      /* ... */
      assert(height0 == 1 || depth0 == 1);
      if (height0 > 1) {
         depth0 = height0;
         height0 = 1;
      }
   }

Maybe we should just call the function in intel_miptree_create_layout
instead?

Iago

>        intel_texobj->mt = intel_miptree_create(brw, texobj->Target,
>                                                first_image-
> >TexFormat,
>                                                0, levels - 1,


More information about the mesa-dev mailing list