util: Support Z24S8/Z24X8 -> unsigned conversion.
authorJosé Fonseca <jfonseca@vmware.com>
Tue, 2 Jun 2009 18:46:53 +0000 (11:46 -0700)
committerJosé Fonseca <jfonseca@vmware.com>
Tue, 2 Jun 2009 18:46:53 +0000 (11:46 -0700)
src/gallium/auxiliary/util/u_tile.c

index 9becd9fea430bf716066a7d300ecfa46b1a54a55..a2fcdad9e4d0ae3068ac1d3641a9a00d62903c5e 100644 (file)
@@ -1133,6 +1133,21 @@ pipe_get_tile_z(struct pipe_transfer *pt,
          }
       }
       break;
+   case PIPE_FORMAT_Z24S8_UNORM:
+   case PIPE_FORMAT_Z24X8_UNORM:
+      {
+         const uint *ptrc
+            = (const uint *)(map + y * pt->stride + x*4);
+         for (i = 0; i < h; i++) {
+            for (j = 0; j < w; j++) {
+               /* convert 24-bit Z to 32-bit Z */
+               pDest[j] = (ptrc[j] & 0xffffff00) | (ptrc[j] & 0xff);
+            }
+            pDest += dstStride;
+            ptrc += pt->stride/4;
+         }
+      }
+      break;
    case PIPE_FORMAT_Z16_UNORM:
       {
          const ushort *ptrc