Mesa (master): mesa: added UNCLAMPED_FLOAT_TO_SHORT macro

Brian Paul brianp at kemper.freedesktop.org
Mon May 10 03:21:18 UTC 2010


Module: Mesa
Branch: master
Commit: 6274bb865fcb00bdb888f4388f7a6de825f14723
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6274bb865fcb00bdb888f4388f7a6de825f14723

Author: Brian Paul <brianp at vmware.com>
Date:   Sun May  9 19:25:52 2010 -0600

mesa: added UNCLAMPED_FLOAT_TO_SHORT macro

---

 src/mesa/main/macros.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index a862457..40e17e5 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -127,6 +127,9 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256];
 #define CLAMPED_FLOAT_TO_USHORT(us, f)  \
         us = ( (GLushort) IROUND( (f) * 65535.0F) )
 
+#define UNCLAMPED_FLOAT_TO_SHORT(s, f)  \
+        s = ( (GLshort) IROUND( CLAMP((f), -1.0F, 1.0F) * 32767.0F) )
+
 /*@}*/
 
 




More information about the mesa-commit mailing list