Mesa (8.0): mesa: fix Z32_FLOAT -> uint conversion functions

Brian Paul brianp at kemper.freedesktop.org
Mon Jun 18 16:34:36 UTC 2012


Module: Mesa
Branch: 8.0
Commit: dc8134fe9836d61a32f7ce807a9dd8497bb4b04b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=dc8134fe9836d61a32f7ce807a9dd8497bb4b04b

Author: Brian Paul <brianp at vmware.com>
Date:   Fri May 18 13:33:53 2012 -0600

mesa: fix Z32_FLOAT -> uint conversion functions

The IROUND converted all arguments to 0 or 1.  That's not what we wanted.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: José Fonseca <jfonseca at vmware.com>
(cherry picked from commit 31d59c78f01925c199fd3a49a27718b0659bbaf4)

---

 src/mesa/main/format_unpack.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c
index a484979..fece8d9 100644
--- a/src/mesa/main/format_unpack.c
+++ b/src/mesa/main/format_unpack.c
@@ -2922,7 +2922,7 @@ 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)));
+      dst[i] = FLOAT_TO_UINT(CLAMP(s[i], 0.0F, 1.0F));
    }
 }
 
@@ -2938,7 +2938,7 @@ unpack_uint_z_Z32_FLOAT_X24S8(const void *src, GLuint *dst, GLuint n)
    GLuint i;
 
    for (i = 0; i < n; i++) {
-      dst[i] = FLOAT_TO_UINT(IROUND(CLAMP((s[i].z), 0.0F, 1.0F)));
+      dst[i] = FLOAT_TO_UINT(CLAMP(s[i].z, 0.0F, 1.0F));
    }
 }
 




More information about the mesa-commit mailing list