diff options
author | Keith Whitwell <[email protected]> | 2005-06-09 18:59:41 +0000 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2005-06-09 18:59:41 +0000 |
commit | 44367aab2a987a03ee1acfb7aa3a9116f3618af0 (patch) | |
tree | d68f7854a1ffd6b43760ee0a93e9a5a455eb7a60 | |
parent | 2c6e8e90ec848de0693919bf6c584b1111d6281f (diff) |
Further clean up RoughApproxPow2 and disable the optimized version --
it's a very poor approximation.
-rw-r--r-- | src/mesa/tnl/t_vb_arbprogram.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/mesa/tnl/t_vb_arbprogram.c b/src/mesa/tnl/t_vb_arbprogram.c index c569d93478f..70e1048f140 100644 --- a/src/mesa/tnl/t_vb_arbprogram.c +++ b/src/mesa/tnl/t_vb_arbprogram.c @@ -96,16 +96,17 @@ static GLfloat RoughApproxLog2(GLfloat t) static GLfloat RoughApproxPow2(GLfloat t) { - GLfloat q; -#ifdef USE_IEEE - GLint ii = (GLint) t; - ii = (ii << 23) + 0x3f800000; - SET_FLOAT_BITS(q, ii); - q = *((GLfloat *) (void *)&ii); +#if 0 + /* This isn't nearly accurate enough - it discards all of t's + * fractional bits! + */ + fi_type fi; + fi.i = (GLint) t; + fi.i = (fi.i << 23) + 0x3f800000; + return fi.f; #else - q = (GLfloat) pow(2.0, floor_t0); + return (GLfloat) _mesa_pow(2.0, floor_t0); #endif - return q; } static GLfloat RoughApproxPower(GLfloat x, GLfloat y) |