r600g: upload translated indices via the uploader
[mesa.git] / src / gallium / drivers / llvmpipe / lp_tile_image.c
index 0852150ba7216010573252dc86a219cd9d17fe52..0938f7aea7e0d39c8f80affe03b965f0c12cb6ee 100644 (file)
@@ -122,14 +122,15 @@ tile_4_4_uint16(const uint16_t *src, uint16_t *dst, unsigned src_stride)
 
 /**
  * Convert a tiled image into a linear image.
- * \param src_stride  source row stride in bytes (bytes per row of tiles)
  * \param dst_stride  dest row stride in bytes
  */
 void
 lp_tiled_to_linear(const void *src, void *dst,
                    unsigned x, unsigned y,
                    unsigned width, unsigned height,
-                   enum pipe_format format, unsigned dst_stride)
+                   enum pipe_format format,
+                   unsigned dst_stride,
+                   unsigned tiles_per_row)
 {
    assert(x % TILE_SIZE == 0);
    assert(y % TILE_SIZE == 0);
@@ -191,8 +192,6 @@ lp_tiled_to_linear(const void *src, void *dst,
       const uint bpp = 4;
       const uint tile_w = TILE_SIZE, tile_h = TILE_SIZE;
       const uint bytes_per_tile = tile_w * tile_h * bpp;
-      const uint src_stride = dst_stride * tile_w;
-      const uint tiles_per_row = src_stride / bytes_per_tile;
       uint i, j;
 
       for (j = 0; j < height; j += tile_h) {
@@ -202,10 +201,10 @@ lp_tiled_to_linear(const void *src, void *dst,
             uint byte_offset = tile_offset * bytes_per_tile;
             const uint8_t *src_tile = (uint8_t *) src + byte_offset;
 
-            lp_tile_write_4ub(format,
+            lp_tile_unswizzle_4ub(format,
                               src_tile,
                               dst, dst_stride,
-                              ii, jj, tile_w, tile_h);
+                              ii, jj);
          }
       }
    }
@@ -215,13 +214,14 @@ lp_tiled_to_linear(const void *src, void *dst,
 /**
  * Convert a linear image into a tiled image.
  * \param src_stride  source row stride in bytes
- * \param dst_stride  dest row stride in bytes (bytes per row of tiles)
  */
 void
 lp_linear_to_tiled(const void *src, void *dst,
                    unsigned x, unsigned y,
                    unsigned width, unsigned height,
-                   enum pipe_format format, unsigned src_stride)
+                   enum pipe_format format,
+                   unsigned src_stride,
+                   unsigned tiles_per_row)
 {
    assert(x % TILE_SIZE == 0);
    assert(y % TILE_SIZE == 0);
@@ -281,8 +281,6 @@ lp_linear_to_tiled(const void *src, void *dst,
       const uint bpp = 4;
       const uint tile_w = TILE_SIZE, tile_h = TILE_SIZE;
       const uint bytes_per_tile = tile_w * tile_h * bpp;
-      const uint dst_stride = src_stride * tile_w;
-      const uint tiles_per_row = dst_stride / bytes_per_tile;
       uint i, j;
 
       for (j = 0; j < height; j += TILE_SIZE) {
@@ -292,10 +290,10 @@ lp_linear_to_tiled(const void *src, void *dst,
             uint byte_offset = tile_offset * bytes_per_tile;
             uint8_t *dst_tile = (uint8_t *) dst + byte_offset;
 
-            lp_tile_read_4ub(format,
+            lp_tile_swizzle_4ub(format,
                              dst_tile,
                              src, src_stride,
-                             ii, jj, tile_w, tile_h);
+                             ii, jj);
          }
       }
    }
@@ -320,10 +318,10 @@ test_tiled_linear_conversion(void *data,
    /*unsigned tiled_stride = wt * TILE_SIZE * TILE_SIZE * 4;*/
 
    lp_linear_to_tiled(data, tiled, 0, 0, width, height, format,
-                      stride);
+                      stride, wt);
 
    lp_tiled_to_linear(tiled, data, 0, 0, width, height, format,
-                      stride);
+                      stride, wt);
 
    free(tiled);
 }