diff options
| author | Matt Turner <mattst88@gmail.com> | 2015-07-31 15:00:32 -0700 |
|---|---|---|
| committer | Matt Turner <mattst88@gmail.com> | 2015-08-06 15:32:15 -0700 |
| commit | be70171bbce9bda1ea1e5effdde7194d5a957064 (patch) | |
| tree | 263b482af240e31a49c6827595b11e81257ec47f | |
| parent | dd6c7a2add9bf0cd53395bf3a069da957e44fa4c (diff) | |
mesa: Use same (UN)CLAMPED_FLOAT_TO_UBYTE macro in debug builds.
| -rw-r--r-- | src/mesa/main/macros.h | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h index f9546988041..d03f9e12ea0 100644 --- a/src/mesa/main/macros.h +++ b/src/mesa/main/macros.h @@ -139,13 +139,8 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256]; #define UNCLAMPED_FLOAT_TO_SHORT(s, f) \ s = ( (GLshort) _mesa_lroundevenf( CLAMP((f), -1.0F, 1.0F) * 32767.0F) ) -/*** - *** UNCLAMPED_FLOAT_TO_UBYTE: clamp float to [0,1] and map to ubyte in [0,255] - *** CLAMPED_FLOAT_TO_UBYTE: map float known to be in [0,1] to ubyte in [0,255] - ***/ -#ifndef DEBUG -/* This function/macro is sensitive to precision. Test very carefully - * if you change it! +/** + * UNCLAMPED_FLOAT_TO_UBYTE: clamp float to [0,1] and map to ubyte in [0,255] */ #define UNCLAMPED_FLOAT_TO_UBYTE(UB, FLT) \ do { \ @@ -160,18 +155,15 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256]; UB = (GLubyte) __tmp.i; \ } \ } while (0) +/** + * CLAMPED_FLOAT_TO_UBYTE: map float known to be in [0,1] to ubyte in [0,255] + */ #define CLAMPED_FLOAT_TO_UBYTE(UB, FLT) \ do { \ fi_type __tmp; \ __tmp.f = (FLT) + (1 << 23); \ UB = (GLubyte) __tmp.i; \ } while (0) -#else -#define UNCLAMPED_FLOAT_TO_UBYTE(ub, f) \ - ub = ((GLubyte) _mesa_lroundevenf(CLAMP((f), 0.0F, 1.0F) * 255.0F)) -#define CLAMPED_FLOAT_TO_UBYTE(ub, f) \ - ub = ((GLubyte) _mesa_lroundevenf((f) * 255.0F)) -#endif static fi_type UINT_AS_UNION(GLuint u) { |
