Mesa (master): gallium/util: add S8 tile sampling support.

Dave Airlie airlied at kemper.freedesktop.org
Tue Oct 12 23:39:38 UTC 2010


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

Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Oct  7 15:34:31 2010 +1000

gallium/util: add S8 tile sampling support.

---

 src/gallium/auxiliary/util/u_tile.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c
index 3099bc6..44cadbf 100644
--- a/src/gallium/auxiliary/util/u_tile.c
+++ b/src/gallium/auxiliary/util/u_tile.c
@@ -269,6 +269,30 @@ x24s8_get_tile_rgba(const unsigned *src,
    }
 }
 
+
+/**
+ * Return S component as four uint32_t in [0..255].  Z part ignored.
+ */
+static void
+s8_get_tile_rgba(const unsigned char *src,
+		 unsigned w, unsigned h,
+		 float *p,
+		 unsigned dst_stride)
+{
+   unsigned i, j;
+
+   for (i = 0; i < h; i++) {
+      float *pRow = p;
+      for (j = 0; j < w; j++, pRow += 4) {
+         pRow[0] =
+         pRow[1] =
+         pRow[2] =
+         pRow[3] = (float)(*src++ & 0xff);
+      }
+      p += dst_stride;
+   }
+}
+
 /*** PIPE_FORMAT_Z32_FLOAT ***/
 
 /**
@@ -312,6 +336,9 @@ pipe_tile_raw_to_rgba(enum pipe_format format,
    case PIPE_FORMAT_Z24X8_UNORM:
       s8z24_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride);
       break;
+   case PIPE_FORMAT_S8_USCALED:
+      s8_get_tile_rgba((unsigned char *) src, w, h, dst, dst_stride);
+      break;
    case PIPE_FORMAT_X24S8_USCALED:
       s8x24_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride);
       break;




More information about the mesa-commit mailing list