gallium/aux: Report error if loading of a pipe driver fails.
[mesa.git] / src / gallium / auxiliary / util / u_format_zs.c
index 69f2f2971f7a939f072afad482fed83850804fda..4c977172b1b978c6d52afc7154763bc6979a41c3 100644 (file)
@@ -26,9 +26,8 @@
  **************************************************************************/
 
 
-#include "u_debug.h"
-#include "u_math.h"
 #include "u_format_zs.h"
+#include "util/u_math.h"
 
 
 /*
@@ -448,6 +447,26 @@ util_format_z24_unorm_s8_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride
    }
 }
 
+void
+util_format_z24_unorm_s8_uint_pack_separate(uint8_t *dst_row, unsigned dst_stride,
+                                            const uint32_t *z_src_row, unsigned z_src_stride,
+                                            const uint8_t *s_src_row, unsigned s_src_stride,
+                                            unsigned width, unsigned height)
+{
+   unsigned x, y;
+   for (y = 0; y < height; ++y) {
+      const uint32_t *z_src = z_src_row;
+      const uint8_t *s_src = s_src_row;
+      uint32_t *dst = (uint32_t *)dst_row;
+      for (x = 0; x < width; ++x) {
+         *dst++ = (*z_src++ & 0x00ffffff) | (*s_src++ << 24);
+      }
+      dst_row += dst_stride / sizeof(*dst_row);
+      z_src_row += z_src_stride / sizeof(*z_src_row);
+      s_src_row += s_src_stride / sizeof(*s_src_row);
+   }
+}
+
 void
 util_format_s8_uint_z24_unorm_unpack_z_float(float *dst_row, unsigned dst_stride,
                                                 const uint8_t *src_row, unsigned src_stride,
@@ -811,11 +830,11 @@ util_format_z32_float_s8x24_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_str
    unsigned x, y;
    for(y = 0; y < height; ++y) {
       const uint8_t *src = src_row;
-      uint8_t *dst = dst_row + 4;
+      uint32_t *dst = ((uint32_t *)dst_row) + 1;
       for(x = 0; x < width; ++x) {
-         *dst = *src;
+         *dst = util_cpu_to_le32(*src);
          src += 1;
-         dst += 8;
+         dst += 2;
       }
       dst_row += dst_stride/sizeof(*dst_row);
       src_row += src_stride/sizeof(*src_row);