[Mesa-stable] [Mesa-dev] [PATCH v2 1/3] i965/miptree: Enforce that height == 1 for 1-D array textures

Iago Toral itoral at igalia.com
Wed Jul 20 07:03:55 UTC 2016


All 4 patches are:
Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>

On Tue, 2016-07-19 at 08:26 -0700, Jason Ekstrand wrote:
> The GL API and mesa internals do this differently than we do.  In GL,
> there
> is no depth parameter for 1-D arrays and height is used.  In the i965
> miptree code we do the sane thing and make height == 1 and use depth
> for
> number of slices.  This makes for a mismatch every time we create a
> 1-D
> array texture from GL.  Instead of actually solving this problem, we
> just
> said "1-D is hard, let's make sure it works no matter which way we
> pass the
> parameters" and called it a day.
> 
> This commit fixes the one GL -> i965 transition point where we
> weren't
> already handling 1-D array textures to do the right thing and then
> replaces
> the magic fixup code with an assert that you're doing the right
> thing.
> 
> 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_mipmap_tree.c | 22 +++------------
> -------
>  src/mesa/drivers/dri/i965/intel_tex.c         |  2 ++
>  2 files changed, 5 insertions(+), 19 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> index c705c98..10158fe 100644
> --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> @@ -364,25 +364,8 @@ intel_miptree_create_layout(struct brw_context
> *brw,
>         _mesa_get_format_name(format),
>         first_level, last_level, depth0, mt);
>  
> -   if (target == GL_TEXTURE_1D_ARRAY) {
> -      /* For a 1D Array texture the OpenGL API will treat the
> height0
> -       * parameter as the number of array slices. For Intel
> hardware, we treat
> -       * the 1D array as a 2D Array with a height of 1.
> -       *
> -       * So, when we first come through this path to create a 1D
> Array
> -       * texture, height0 stores the number of slices, and depth0 is
> 1. In
> -       * this case, we want to swap height0 and depth0.
> -       *
> -       * Since some miptrees will be created based on the base
> miptree, we may
> -       * come through this path and see height0 as 1 and depth0
> being the
> -       * number of slices. In this case we don't need to do the
> swap.
> -       */
> -      assert(height0 == 1 || depth0 == 1);
> -      if (height0 > 1) {
> -         depth0 = height0;
> -         height0 = 1;
> -      }
> -   }
> +   if (target == GL_TEXTURE_1D_ARRAY)
> +      assert(height0 == 1);
>  
>     mt->target = target;
>     mt->format = format;
> @@ -1048,6 +1031,7 @@ intel_get_image_dims(struct gl_texture_image
> *image,
>         * as a 2D Array with a height of 1. So, here we want to swap
> image
>         * height and depth.
>         */
> +      assert(image->Depth == 1);
>        *width = image->Width;
>        *height = 1;
>        *depth = image->Height;
> 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);
>        intel_texobj->mt = intel_miptree_create(brw, texobj->Target,
>                                                first_image-
> >TexFormat,
>                                                0, levels - 1,


More information about the mesa-stable mailing list