aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/gallium/auxiliary/util/u_format.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-09-26 17:04:30 +0200
committermarha <marha@users.sourceforge.net>2011-09-26 17:04:30 +0200
commit873965b49f283ad028dd4e0e5b7e93a758c84993 (patch)
tree84122d76cb641b54ea85cee9b631fb51c25052b5 /mesalib/src/gallium/auxiliary/util/u_format.c
parentc1e6c7428a8d2c1b60ffac7df7a3f56c300fa983 (diff)
downloadvcxsrv-873965b49f283ad028dd4e0e5b7e93a758c84993.tar.gz
vcxsrv-873965b49f283ad028dd4e0e5b7e93a758c84993.tar.bz2
vcxsrv-873965b49f283ad028dd4e0e5b7e93a758c84993.zip
fontconfig libX11 libXext libXft libXmu mesa git update 26 sep 2011
Diffstat (limited to 'mesalib/src/gallium/auxiliary/util/u_format.c')
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_format.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_format.c b/mesalib/src/gallium/auxiliary/util/u_format.c
index 700382a0f..9bf42583e 100644
--- a/mesalib/src/gallium/auxiliary/util/u_format.c
+++ b/mesalib/src/gallium/auxiliary/util/u_format.c
@@ -432,6 +432,50 @@ util_format_translate(enum pipe_format dst_format,
* TODO: Add a special case for formats that are mere swizzles of each other
*/
+ if (src_format_desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS ||
+ dst_format_desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS) {
+ float *tmp_z = NULL;
+ uint8_t *tmp_s = NULL;
+
+ assert(x_step == 1);
+ assert(y_step == 1);
+
+ if (src_format_desc->unpack_z_float &&
+ dst_format_desc->pack_z_float) {
+ tmp_z = MALLOC(width * sizeof *tmp_z);
+ }
+
+ if (src_format_desc->unpack_s_8uscaled &&
+ dst_format_desc->pack_s_8uscaled) {
+ tmp_s = MALLOC(width * sizeof *tmp_s);
+ }
+
+ while (height--) {
+ if (tmp_z) {
+ src_format_desc->unpack_z_float(tmp_z, 0, src_row, src_stride, width, 1);
+ dst_format_desc->pack_z_float(dst_row, dst_stride, tmp_z, 0, width, 1);
+ }
+
+ if (tmp_s) {
+ src_format_desc->unpack_s_8uscaled(tmp_s, 0, src_row, src_stride, width, 1);
+ dst_format_desc->pack_s_8uscaled(dst_row, dst_stride, tmp_s, 0, width, 1);
+ }
+
+ dst_row += dst_step;
+ src_row += src_step;
+ }
+
+ if (tmp_s) {
+ FREE(tmp_s);
+ }
+
+ if (tmp_z) {
+ FREE(tmp_z);
+ }
+
+ return;
+ }
+
if (util_format_fits_8unorm(src_format_desc) ||
util_format_fits_8unorm(dst_format_desc)) {
unsigned tmp_stride;