Mesa (master): mesa/st: Use direct util_format_pack/unpack instead of u_tile.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Feb 4 19:24:27 UTC 2020


Module: Mesa
Branch: master
Commit: e986f2b7aff6c51e420fbb06553a748f15f55a01
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e986f2b7aff6c51e420fbb06553a748f15f55a01

Author: Eric Anholt <eric at anholt.net>
Date:   Fri Nov  8 13:21:18 2019 -0800

mesa/st: Use direct util_format_pack/unpack instead of u_tile.

We're doing a row at a time, and don't need u_tile's clipping.

Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2744>

---

 src/mesa/state_tracker/st_cb_texture.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index ff0f1a2efa6..3eb4ef62df3 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -2345,20 +2345,19 @@ fallback_copy_texsubimage(struct gl_context *ctx,
       data = malloc(width * sizeof(uint));
 
       if (data) {
+         unsigned dst_stride = (stImage->pt->target == PIPE_TEXTURE_1D_ARRAY ?
+                                transfer->layer_stride : transfer->stride);
          /* To avoid a large temp memory allocation, do copy row by row */
          for (row = 0; row < height; row++, srcY += yStep) {
-            pipe_get_tile_z(src_trans, map, 0, srcY, width, 1, data);
+            util_format_unpack_z_32unorm(strb->texture->format,
+                                         data, (uint8_t *)map + src_trans->stride * srcY,
+                                         width);
             if (scaleOrBias) {
                _mesa_scale_and_bias_depth_uint(ctx, width, data);
             }
 
-            if (stImage->pt->target == PIPE_TEXTURE_1D_ARRAY) {
-               pipe_put_tile_z(transfer, texDest + row*transfer->layer_stride,
-                               0, 0, width, 1, data);
-            }
-            else {
-               pipe_put_tile_z(transfer, texDest, 0, row, width, 1, data);
-            }
+            util_format_pack_z_32unorm(stImage->pt->format,
+                                       texDest + row * dst_stride, data, width);
          }
       }
       else {



More information about the mesa-commit mailing list