[Mesa-dev] [PATCH v3] i965: Fix calculation of the image height at start level

Antía Puentes apuentes at igalia.com
Fri Sep 2 23:20:19 UTC 2016


On vie, 2016-09-02 at 17:49 -0400, Ilia Mirkin wrote:
> On Fri, Sep 2, 2016 at 5:40 PM, Antia Puentes <apuentes at igalia.com>
> wrote:
> > 
> > - Fixes CTS tests:
> > 
> > * GL44-CTS.shader_image_size.advanced-nonMS-cs-float
> > * GL44-CTS.shader_image_size.advanced-nonMS-cs-int
> > * GL44-CTS.shader_image_size.advanced-nonMS-cs-uint
> > * GL44-CTS.shader_image_size.advanced-nonMS-gs-float
> > * GL44-CTS.shader_image_size.advanced-nonMS-gs-int
> > * GL44-CTS.shader_image_size.advanced-nonMS-gs-uint
> > * GL44-CTS.shader_image_size.advanced-nonMS-tes-float
> > * GL44-CTS.shader_image_size.advanced-nonMS-tes-int
> > * GL44-CTS.shader_image_size.advanced-nonMS-tes-uint
> > * GL44-CTS.shader_image_size.advanced-nonMS-vs-float
> > * GL44-CTS.shader_image_size.advanced-nonMS-vs-int
> > * GL44-CTS.shader_image_size.advanced-nonMS-vs-uint
> > 
> > v1: (written by Dave Airlie) Always shift height images for levels.
> > Fixed the CTS tests.
> > 
> > v2: Only shift height if the texture is not an 1D_ARRAY,
> > it fixes assertion in GL44-CTS.texture_view.gettexparameter
> > due to the original patch (Antia).
> > 
> > v3: Remove the loop. Do not shift height either for 1D textures.
> > Use an explicit switch and add an assertion (levels == 0) for
> > multisampled textures (Jason).
> > 
> > Signed-off-by: Dave Airlie <airlied at redhat.com>
> > Signed-off-by: Antia Puentes <apuentes at igalia.com>
> > ---
> >  src/mesa/drivers/dri/i965/intel_tex_image.c | 27
> > +++++++++++++++++++++------
> >  1 file changed, 21 insertions(+), 6 deletions(-)
> > 
> > diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c
> > b/src/mesa/drivers/dri/i965/intel_tex_image.c
> > index 7affe08..cfcbf3c 100644
> > --- a/src/mesa/drivers/dri/i965/intel_tex_image.c
> > +++ b/src/mesa/drivers/dri/i965/intel_tex_image.c
> > @@ -47,12 +47,27 @@ intel_miptree_create_for_teximage(struct
> > brw_context *brw,
> >     DBG("%s\n", __func__);
> > 
> >     /* Figure out image dimensions at start level. */
> > -   for (i = intelImage->base.Base.Level; i > 0; i--) {
> > -      width <<= 1;
> > -      if (height != 1)
> > -         height <<= 1;
> > -      if (intelObj->base.Target == GL_TEXTURE_3D)
> > -         depth <<= 1;
> > +   switch(intelObj->base.Target) {
> > +   case GL_TEXTURE_2D_MULTISAMPLE:
> > +   case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
> > +      assert(intelImage->base.Base.Level == 0);
> > +      break;
> > +   case GL_TEXTURE_3D:
> > +      depth <<= intelImage->base.Base.Level;
> > +      /* Fall through */
> > +   case GL_TEXTURE_2D:
> > +   case GL_TEXTURE_2D_ARRAY:
> > +   case GL_TEXTURE_RECTANGLE:
> FWIW, GL_TEXTURE_RECTANGLE can't have levels either. IMO you should
> move it to the section above with the MS targets.

True, thanks!. Apart from that, I think I should remove:

> > +   case GL_TEXTURE_CUBE_MAP:

and list the cube map faces instead because this is called from
glTexImage*. I will send a new version of the patch after running the
tests. Sorry for the noise.

> > +   case GL_TEXTURE_CUBE_MAP_ARRAY:
> > +      height <<= intelImage->base.Base.Level;
> > +      /* Fall through */
> > +   case GL_TEXTURE_1D:
> > +   case GL_TEXTURE_1D_ARRAY:
> > +      width <<= intelImage->base.Base.Level;
> > +      break;
> > +   default:
> > +      unreachable("Unexpected target");
> >     }
> > 
> >     /* Guess a reasonable value for lastLevel.  This is probably
> > going
> > --
> > 2.7.4
> > 
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list