<div dir="ltr"><div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br><br></div>Sorry for ignoring you. :(<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 2, 2016 at 6:04 PM, Antia Puentes <span dir="ltr"><<a href="mailto:apuentes@igalia.com" target="_blank">apuentes@igalia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">- Fixes CTS tests:<br>
<br>
* GL44-CTS.shader_image_size.<wbr>advanced-nonMS-cs-float<br>
* GL44-CTS.shader_image_size.<wbr>advanced-nonMS-cs-int<br>
* GL44-CTS.shader_image_size.<wbr>advanced-nonMS-cs-uint<br>
* GL44-CTS.shader_image_size.<wbr>advanced-nonMS-gs-float<br>
* GL44-CTS.shader_image_size.<wbr>advanced-nonMS-gs-int<br>
* GL44-CTS.shader_image_size.<wbr>advanced-nonMS-gs-uint<br>
* GL44-CTS.shader_image_size.<wbr>advanced-nonMS-tes-float<br>
* GL44-CTS.shader_image_size.<wbr>advanced-nonMS-tes-int<br>
* GL44-CTS.shader_image_size.<wbr>advanced-nonMS-tes-uint<br>
* GL44-CTS.shader_image_size.<wbr>advanced-nonMS-vs-float<br>
* GL44-CTS.shader_image_size.<wbr>advanced-nonMS-vs-int<br>
* GL44-CTS.shader_image_size.<wbr>advanced-nonMS-vs-uint<br>
<br>
v1: (written by Dave Airlie) Always shift height images for levels.<br>
</span>Fixed the CTS test.<br>
<span class=""><br>
v2: Only shift height if the texture is not an 1D_ARRAY,<br>
it fixes assertion in GL44-CTS.texture_view.<wbr>gettexparameter<br>
due to the original patch (Antia).<br>
<br>
v3: Remove the loop. Do not shift height either for 1D textures.<br>
Use an explicit switch and add an assertion (levels == 0) for<br>
multisampled textures (Jason).<br>
<br>
</span>v4: Rectangle textures can not have levels either (Ilia Mirkin).<br>
<span class=""><br>
Signed-off-by: Dave Airlie <<a href="mailto:airlied@redhat.com">airlied@redhat.com</a>><br>
Signed-off-by: Antia Puentes <<a href="mailto:apuentes@igalia.com">apuentes@igalia.com</a>><br>
---<br>
 src/mesa/drivers/dri/i965/<wbr>intel_tex_image.c | 27 +++++++++++++++++++++------<br>
 1 file changed, 21 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>intel_tex_image.c b/src/mesa/drivers/dri/i965/<wbr>intel_tex_image.c<br>
</span>index 7affe08..65962eb 100644<br>
<span class="">--- a/src/mesa/drivers/dri/i965/<wbr>intel_tex_image.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>intel_tex_image.c<br>
@@ -47,12 +47,27 @@ intel_miptree_create_for_<wbr>teximage(struct brw_context *brw,<br>
    DBG("%s\n", __func__);<br>
<br>
    /* Figure out image dimensions at start level. */<br>
-   for (i = intelImage->base.Base.Level; i > 0; i--) {<br>
-      width <<= 1;<br>
-      if (height != 1)<br>
-         height <<= 1;<br>
-      if (intelObj->base.Target == GL_TEXTURE_3D)<br>
-         depth <<= 1;<br>
+   switch(intelObj->base.Target) {<br>
+   case GL_TEXTURE_2D_MULTISAMPLE:<br>
+   case GL_TEXTURE_2D_MULTISAMPLE_<wbr>ARRAY:<br>
</span>+   case GL_TEXTURE_RECTANGLE:<br>
<span class="im HOEnZb">+      assert(intelImage->base.Base.<wbr>Level == 0);<br>
+      break;<br>
+   case GL_TEXTURE_3D:<br>
+      depth <<= intelImage->base.Base.Level;<br>
+      /* Fall through */<br>
+   case GL_TEXTURE_2D:<br>
+   case GL_TEXTURE_2D_ARRAY:<br>
</span><div class="HOEnZb"><div class="h5">+   case GL_TEXTURE_CUBE_MAP:<br>
+   case GL_TEXTURE_CUBE_MAP_ARRAY:<br>
+      height <<= intelImage->base.Base.Level;<br>
+      /* Fall through */<br>
+   case GL_TEXTURE_1D:<br>
+   case GL_TEXTURE_1D_ARRAY:<br>
+      width <<= intelImage->base.Base.Level;<br>
+      break;<br>
+   default:<br>
+      unreachable("Unexpected target");<br>
    }<br>
<br>
    /* Guess a reasonable value for lastLevel.  This is probably going<br>
--<br>
2.7.4<br>
<br>
</div></div></blockquote></div><br></div>