svga: loop over box.depth for ReadBack_image on each slice
authorNeha Bhende <bhenden@vmware.com>
Thu, 27 Oct 2016 19:35:03 +0000 (12:35 -0700)
committerBrian Paul <brianp@vmware.com>
Fri, 30 Jun 2017 14:24:27 +0000 (08:24 -0600)
piglit test ext_texture_array-gen-mipmap is fixed with this patch.

Tested with mtt piglit, glretrace, viewperf and conform. No regression.

Reviewed-by: Brian Paul <brianp@vmware.com>
src/gallium/drivers/svga/svga_resource_texture.c

index a24d630cb5e36bb5cb3319cc77eae1346f3440df..670100cb568b4e10650306bc1440e48d9df07f37 100644 (file)
@@ -414,7 +414,7 @@ svga_texture_transfer_map_direct(struct svga_context *svga,
    struct svga_texture *tex = svga_texture(texture);
    struct svga_winsys_surface *surf = tex->handle;
    unsigned level = st->base.level;
-   unsigned w, h, nblocksx, nblocksy;
+   unsigned w, h, nblocksx, nblocksy, i;
    unsigned usage = st->base.usage;
 
    if (need_tex_readback(transfer)) {
@@ -422,13 +422,14 @@ svga_texture_transfer_map_direct(struct svga_context *svga,
 
       svga_surfaces_flush(svga);
 
-      if (svga_have_vgpu10(svga)) {
-         ret = readback_image_vgpu10(svga, surf, st->slice, level,
-                                     tex->b.b.last_level + 1);
-      } else {
-         ret = readback_image_vgpu9(svga, surf, st->slice, level);
+      for (i = 0; i < st->base.box.depth; i++) {
+         if (svga_have_vgpu10(svga)) {
+            ret = readback_image_vgpu10(svga, surf, st->slice + i, level,
+                                        tex->b.b.last_level + 1);
+         } else {
+            ret = readback_image_vgpu9(svga, surf, st->slice + i, level);
+         }
       }
-
       svga->hud.num_readbacks++;
       SVGA_STATS_COUNT_INC(sws, SVGA_STATS_COUNT_TEXREADBACK);