Module: Mesa
Branch: staging/20.2
Commit: 36ccd8d9fd40cd15b5ace3047f907d5d9452b243
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=36ccd8d9fd40cd15b5ace3047f907d5d9452b243

Author: Kenneth Graunke <[email protected]>
Date:   Mon Oct 26 12:39:12 2020 -0700

iris: fix source/destination layers for 3D blits

See commit ea326912575fad09af59486ad62d126c4ea0ede7 for the
corresponding fix in anv.

Fixes Piglit's fbo-generatemipmap-3d.

Cc: mesa-stable
Reviewed-by: Lionel Landwerlin <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7321>
(cherry picked from commit 382451ff9d7bfa4f807e8ca447180642c91b92e6)

---

 .pick_status.json                    |  2 +-
 src/gallium/drivers/iris/iris_blit.c | 17 +++++++++++++++--
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 29142218806..880bb85a876 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -4045,7 +4045,7 @@
         "description": "iris: fix source/destination layers for 3D blits",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": null
     },
diff --git a/src/gallium/drivers/iris/iris_blit.c 
b/src/gallium/drivers/iris/iris_blit.c
index 283d30bcfe2..6f019a2db6b 100644
--- a/src/gallium/drivers/iris/iris_blit.c
+++ b/src/gallium/drivers/iris/iris_blit.c
@@ -485,15 +485,28 @@ iris_blit(struct pipe_context *ctx, const struct 
pipe_blit_info *info)
    else
       main_mask = PIPE_MASK_RGBA;
 
+   float src_z_step = (float)info->src.box.depth / (float)info->dst.box.depth;
+
+   /* There is no interpolation to the pixel center during rendering, so
+    * add the 0.5 offset ourselves here.
+    */
+   float depth_center_offset = 0;
+   if (src_res->surf.dim == ISL_SURF_DIM_3D)
+      depth_center_offset = 0.5 / info->dst.box.depth * info->src.box.depth;
+
    if (info->mask & main_mask) {
       for (int slice = 0; slice < info->dst.box.depth; slice++) {
+         unsigned dst_z = info->dst.box.z + slice;
+         float src_z = info->src.box.z + slice * src_z_step +
+                       depth_center_offset;
+
          iris_batch_maybe_flush(batch, 1500);
          iris_batch_sync_region_start(batch);
 
          blorp_blit(&blorp_batch,
-                    &src_surf, info->src.level, info->src.box.z + slice,
+                    &src_surf, info->src.level, src_z,
                     src_fmt.fmt, src_fmt.swizzle,
-                    &dst_surf, info->dst.level, info->dst.box.z + slice,
+                    &dst_surf, info->dst.level, dst_z,
                     dst_fmt.fmt, dst_fmt.swizzle,
                     src_x0, src_y0, src_x1, src_y1,
                     dst_x0, dst_y0, dst_x1, dst_y1,

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to