diff options
author | marha <marha@users.sourceforge.net> | 2012-02-06 08:19:53 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-02-06 08:19:53 +0100 |
commit | ada3d2c30b5a7a1a79e128b7326d50c3bab77a8a (patch) | |
tree | 30539a1a7c6b011c3a5d8028d7428a1ad2b07546 /mesalib/src/mesa/main/format_unpack.c | |
parent | 58ff764d4111bfaa7360c57bc62dd620fbdce06f (diff) | |
download | vcxsrv-ada3d2c30b5a7a1a79e128b7326d50c3bab77a8a.tar.gz vcxsrv-ada3d2c30b5a7a1a79e128b7326d50c3bab77a8a.tar.bz2 vcxsrv-ada3d2c30b5a7a1a79e128b7326d50c3bab77a8a.zip |
mesa git update 6 feb 2012
Diffstat (limited to 'mesalib/src/mesa/main/format_unpack.c')
-rw-r--r-- | mesalib/src/mesa/main/format_unpack.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/mesalib/src/mesa/main/format_unpack.c b/mesalib/src/mesa/main/format_unpack.c index cd16a9ea6..a484979e2 100644 --- a/mesalib/src/mesa/main/format_unpack.c +++ b/mesalib/src/mesa/main/format_unpack.c @@ -2916,6 +2916,32 @@ unpack_uint_z_Z32(const void *src, GLuint *dst, GLuint n) memcpy(dst, src, n * sizeof(GLuint)); } +static void +unpack_uint_z_Z32_FLOAT(const void *src, GLuint *dst, GLuint n) +{ + const float *s = (const float *)src; + GLuint i; + for (i = 0; i < n; i++) { + dst[i] = FLOAT_TO_UINT(IROUND(CLAMP((s[i]), 0.0F, 1.0F))); + } +} + +static void +unpack_uint_z_Z32_FLOAT_X24S8(const void *src, GLuint *dst, GLuint n) +{ + struct z32f_x24s8 { + float z; + uint32_t x24s8; + }; + + const struct z32f_x24s8 *s = (const struct z32f_x24s8 *) src; + GLuint i; + + for (i = 0; i < n; i++) { + dst[i] = FLOAT_TO_UINT(IROUND(CLAMP((s[i].z), 0.0F, 1.0F))); + } +} + /** * Unpack Z values. @@ -2943,6 +2969,12 @@ _mesa_unpack_uint_z_row(gl_format format, GLuint n, case MESA_FORMAT_Z32: unpack = unpack_uint_z_Z32; break; + case MESA_FORMAT_Z32_FLOAT: + unpack = unpack_uint_z_Z32_FLOAT; + break; + case MESA_FORMAT_Z32_FLOAT_X24S8: + unpack = unpack_uint_z_Z32_FLOAT_X24S8; + break; default: _mesa_problem(NULL, "bad format %s in _mesa_unpack_uint_z_row", _mesa_get_format_name(format)); |