st/mesa: only minify height if target != 1D array in st_finalize_texture
authorMarek Olšák <marek.olsak@amd.com>
Mon, 21 Mar 2016 11:18:40 +0000 (12:18 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Sun, 27 Mar 2016 22:44:45 +0000 (00:44 +0200)
The st_texture_object documentation says:
  "the number of 1D array layers will be in height0"

We can't minify that.

Spotted by luck. No app is known to hit this issue.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/mesa/state_tracker/st_cb_texture.c

index 460c1790663a00b61779b168e83fd15ef8ddf391..3980f5d2f51c0a6a05685e6d2cc39d794b52aad7 100644 (file)
@@ -2886,12 +2886,17 @@ st_finalize_texture(struct gl_context *ctx,
          /* Need to import images in main memory or held in other textures.
           */
          if (stImage && stObj->pt != stImage->pt) {
+            GLuint height = stObj->height0;
             GLuint depth = stObj->depth0;
+
+            if (stObj->base.Target != GL_TEXTURE_1D_ARRAY)
+               height = u_minify(height, level);
             if (stObj->base.Target == GL_TEXTURE_3D)
                depth = u_minify(depth, level);
+
             if (level == 0 ||
                 (stImage->base.Width == u_minify(stObj->width0, level) &&
-                 stImage->base.Height == u_minify(stObj->height0, level) &&
+                 stImage->base.Height == height &&
                  stImage->base.Depth == depth)) {
                /* src image fits expected dest mipmap level size */
                copy_image_data_to_texture(st, stObj, level, stImage);