gallium/softpipe: replace pipe_get_tile_swizzle()
authorBrian Paul <brianp@vmware.com>
Sat, 22 Jan 2011 23:59:22 +0000 (16:59 -0700)
committerBrian Paul <brianp@vmware.com>
Sun, 23 Jan 2011 01:33:35 +0000 (18:33 -0700)
The new function, pipe_get_tile_rgba_format(), no longer takes a
swizzle (we weren't actually using it anywhere).  Rename it to
indicate that the format is passed explicitly.

src/gallium/auxiliary/util/u_tile.c
src/gallium/auxiliary/util/u_tile.h
src/gallium/drivers/softpipe/sp_tex_tile_cache.c

index 44cadbfcdd0ce186a04c398b154b49ec2b3cf073..24b02be7cfb8ff13b859e70b04ae0dbb1f14b3b7 100644 (file)
@@ -391,23 +391,14 @@ pipe_get_tile_rgba(struct pipe_context *pipe,
 
 
 void
-pipe_get_tile_swizzle(struct pipe_context *pipe,
-                     struct pipe_transfer *pt,
-                      uint x,
-                      uint y,
-                      uint w,
-                      uint h,
-                      uint swizzle_r,
-                      uint swizzle_g,
-                      uint swizzle_b,
-                      uint swizzle_a,
-                      enum pipe_format format,
-                      float *p)
+pipe_get_tile_rgba_format(struct pipe_context *pipe,
+                          struct pipe_transfer *pt,
+                          uint x, uint y, uint w, uint h,
+                          enum pipe_format format,
+                          float *p)
 {
    unsigned dst_stride = w * 4;
    void *packed;
-   uint iy;
-   float rgba01[6];
 
    if (u_clip_tile(x, y, &w, &h, &pt->box)) {
       return;
@@ -427,35 +418,6 @@ pipe_get_tile_swizzle(struct pipe_context *pipe,
    pipe_tile_raw_to_rgba(format, packed, w, h, p, dst_stride);
 
    FREE(packed);
-
-   if (swizzle_r == PIPE_SWIZZLE_RED &&
-       swizzle_g == PIPE_SWIZZLE_GREEN &&
-       swizzle_b == PIPE_SWIZZLE_BLUE &&
-       swizzle_a == PIPE_SWIZZLE_ALPHA) {
-      /* no-op, skip */
-      return;
-   }
-
-   rgba01[PIPE_SWIZZLE_ZERO] = 0.0f;
-   rgba01[PIPE_SWIZZLE_ONE] = 1.0f;
-
-   for (iy = 0; iy < h; iy++) {
-      float *row = p;
-      uint ix;
-
-      for (ix = 0; ix < w; ix++) {
-         rgba01[PIPE_SWIZZLE_RED] = row[0];
-         rgba01[PIPE_SWIZZLE_GREEN] = row[1];
-         rgba01[PIPE_SWIZZLE_BLUE] = row[2];
-         rgba01[PIPE_SWIZZLE_ALPHA] = row[3];
-
-         *row++ = rgba01[swizzle_r];
-         *row++ = rgba01[swizzle_g];
-         *row++ = rgba01[swizzle_b];
-         *row++ = rgba01[swizzle_a];
-      }
-      p += dst_stride;
-   }
 }
 
 
index 558351d0ce5866a150d5cb711cbb0bd9cc0ed723..b198837e5ce194de26744b30cd9b9b971f1ccbc5 100644 (file)
@@ -80,18 +80,11 @@ pipe_get_tile_rgba(struct pipe_context *pipe,
                    float *p);
 
 void
-pipe_get_tile_swizzle(struct pipe_context *pipe,
-                     struct pipe_transfer *pt,
-                      uint x,
-                      uint y,
-                      uint w,
-                      uint h,
-                      uint swizzle_r,
-                      uint swizzle_g,
-                      uint swizzle_b,
-                      uint swizzle_a,
-                      enum pipe_format format,
-                      float *p);
+pipe_get_tile_rgba_format(struct pipe_context *pipe,
+                          struct pipe_transfer *pt,
+                          uint x, uint y, uint w, uint h,
+                          enum pipe_format format,
+                          float *p);
 
 void
 pipe_put_tile_rgba(struct pipe_context *pipe,
index e42015ad498099e0a5674081d368da7c28d28231..5105e77d4366daf6a0e9e968ba2ce168cfe5e487 100644 (file)
@@ -278,22 +278,17 @@ sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc,
          tc->tex_z = addr.bits.z;
       }
 
-      /* get tile from the transfer (view into texture)
-       * Note we're using the swizzle version of this fuction only because
-       * we need to pass the texture cache's format explicitly.
+      /* Get tile from the transfer (view into texture), explicitly passing
+       * the image format.
        */
-      pipe_get_tile_swizzle(tc->pipe,
-                           tc->tex_trans,
-                            addr.bits.x * TILE_SIZE, 
-                            addr.bits.y * TILE_SIZE,
-                            TILE_SIZE,
-                            TILE_SIZE,
-                            PIPE_SWIZZLE_RED,
-                            PIPE_SWIZZLE_GREEN,
-                            PIPE_SWIZZLE_BLUE,
-                            PIPE_SWIZZLE_ALPHA,
-                            tc->format,
-                            (float *) tile->data.color);
+      pipe_get_tile_rgba_format(tc->pipe,
+                                tc->tex_trans,
+                                addr.bits.x * TILE_SIZE, 
+                                addr.bits.y * TILE_SIZE,
+                                TILE_SIZE,
+                                TILE_SIZE,
+                                tc->format,
+                                (float *) tile->data.color);
 
       tile->addr = addr;
    }