aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util
diff options
context:
space:
mode:
authorMichal Krol <[email protected]>2010-03-10 16:32:34 +0100
committerMichal Krol <[email protected]>2010-03-10 16:32:34 +0100
commit5d4360d10cd39e28ee3b563e95959f3dd22c5242 (patch)
tree317e6cbd2278ba25b6f9e907f2410f9c7e63fd2c /src/gallium/auxiliary/util
parent3ce4375912c8ea488460e593e07c5bb15b92dca9 (diff)
gallium: pipe_get_tile_swizzle() accepts format parameter.
Enables casting of texture data.
Diffstat (limited to 'src/gallium/auxiliary/util')
-rw-r--r--src/gallium/auxiliary/util/u_tile.c22
-rw-r--r--src/gallium/auxiliary/util/u_tile.h1
2 files changed, 22 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c
index 024d9577bc9..8a36d4d9d18 100644
--- a/src/gallium/auxiliary/util/u_tile.c
+++ b/src/gallium/auxiliary/util/u_tile.c
@@ -1283,12 +1283,32 @@ pipe_get_tile_swizzle(struct pipe_transfer *pt,
uint swizzle_g,
uint swizzle_b,
uint swizzle_a,
+ enum pipe_format format,
float *p)
{
+ unsigned dst_stride = w * 4;
+ void *packed;
uint i;
float rgba01[6];
- pipe_get_tile_rgba(pt, x, y, w, h, p);
+ if (pipe_clip_tile(x, y, &w, &h, pt)) {
+ return;
+ }
+
+ packed = MALLOC(util_format_get_nblocks(format, w, h) * util_format_get_blocksize(format));
+ if (!packed) {
+ return;
+ }
+
+ if (format == PIPE_FORMAT_UYVY || format == PIPE_FORMAT_YUYV) {
+ assert((x & 1) == 0);
+ }
+
+ pipe_get_tile_raw(pt, x, y, w, h, packed, 0);
+
+ 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 &&
diff --git a/src/gallium/auxiliary/util/u_tile.h b/src/gallium/auxiliary/util/u_tile.h
index b4706179a55..d665fdb1bb1 100644
--- a/src/gallium/auxiliary/util/u_tile.h
+++ b/src/gallium/auxiliary/util/u_tile.h
@@ -81,6 +81,7 @@ pipe_get_tile_swizzle(struct pipe_transfer *pt,
uint swizzle_g,
uint swizzle_b,
uint swizzle_a,
+ enum pipe_format format,
float *p);
void