Mesa (gallium-0.1): util: Support PIPE_FORMAT_Z32_FLOAT in pipe_tile_raw_to_rgba

Jose Fonseca jrfonseca at kemper.freedesktop.org
Thu Feb 19 12:57:06 UTC 2009


Module: Mesa
Branch: gallium-0.1
Commit: 43b31fc6fcee6deb52a8bd033dada62e9ce67ecb
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=43b31fc6fcee6deb52a8bd033dada62e9ce67ecb

Author: José Fonseca <jfonseca at vmware.com>
Date:   Thu Feb 19 12:56:56 2009 +0000

util: Support PIPE_FORMAT_Z32_FLOAT in pipe_tile_raw_to_rgba

---

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

diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c
index 853c503..788cc56 100644
--- a/src/gallium/auxiliary/util/u_tile.c
+++ b/src/gallium/auxiliary/util/u_tile.c
@@ -769,6 +769,32 @@ z24s8_get_tile_rgba(const unsigned *src,
 }
 
 
+/*** PIPE_FORMAT_Z32_FLOAT ***/
+
+/**
+ * Return each Z value as four floats.
+ */
+static void
+z32f_get_tile_rgba(const float *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] = *src++;
+      }
+      p += dst_stride;
+   }
+}
+
+
 /*** PIPE_FORMAT_YCBCR / PIPE_FORMAT_YCBCR_REV ***/
 
 /**
@@ -913,6 +939,9 @@ pipe_tile_raw_to_rgba(enum pipe_format format,
    case PIPE_FORMAT_Z24S8_UNORM:
       z24s8_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride);
       break;
+   case PIPE_FORMAT_Z32_FLOAT:
+      z32f_get_tile_rgba((float *) src, w, h, dst, dst_stride);
+      break;
    case PIPE_FORMAT_YCBCR:
       ycbcr_get_tile_rgba((ushort *) src, w, h, dst, dst_stride, FALSE);
       break;




More information about the mesa-commit mailing list