diff options
author | Daniel Borca <[email protected]> | 2004-09-24 07:03:53 +0000 |
---|---|---|
committer | Daniel Borca <[email protected]> | 2004-09-24 07:03:53 +0000 |
commit | d9873c59ef4d14b5e3137cb2d7c765797f82ac56 (patch) | |
tree | 25b11356a6fbb6568ac3c7790538fb1db373547f /src/mesa/drivers/glide/fxdrv.h | |
parent | 303c342d5353e7fb1b480da97ce505357eafe0c0 (diff) |
added (back!) option to use non-packedcolor
Diffstat (limited to 'src/mesa/drivers/glide/fxdrv.h')
-rw-r--r-- | src/mesa/drivers/glide/fxdrv.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mesa/drivers/glide/fxdrv.h b/src/mesa/drivers/glide/fxdrv.h index c246444d1c3..9cc6d15e0bb 100644 --- a/src/mesa/drivers/glide/fxdrv.h +++ b/src/mesa/drivers/glide/fxdrv.h @@ -731,6 +731,28 @@ void fxSetupStencil (GLcontext *ctx); extern GLuint fx_check_IsInHardware(GLcontext *ctx); +/*** + *** CNORM: clamp float to [0,1] and map to float in [0,255] + ***/ +#if defined(USE_IEEE) && !defined(DEBUG) +#define IEEE_0996 0x3f7f0000 /* 0.996 or so */ +#define CNORM(N, F) \ + do { \ + fi_type __tmp; \ + __tmp.f = (F); \ + if (__tmp.i < 0) \ + N = 0; \ + else if (__tmp.i >= IEEE_0996) \ + N = 255.0f; \ + else { \ + N = (F) * 255.0f; \ + } \ + } while (0) +#else +#define CNORM(n, f) \ + n = (CLAMP((f), 0.0F, 1.0F) * 255.0F) +#endif + /* run-time debugging */ #ifndef FX_DEBUG #define FX_DEBUG 0 |