gallium: add another value check to util_fast_pow()
authorBrian Paul <brian.paul@tungstengraphics.com>
Sat, 13 Sep 2008 21:20:31 +0000 (15:20 -0600)
committerBrian Paul <brian.paul@tungstengraphics.com>
Sat, 13 Sep 2008 21:22:52 +0000 (15:22 -0600)
Fixes glitches seen in morph3d demo.

src/gallium/auxiliary/util/u_math.h

index 9b4ca393714d3bf0dcf4d5c91670522f99d7b6aa..0b10622ee75372a61417d36ecfc7fc43251ad3bc 100644 (file)
@@ -272,8 +272,10 @@ util_fast_log2(float val)
 static INLINE float
 util_fast_pow(float x, float y)
 {
-   /* XXX this test may need adjustment */
-   if (y >= 3.0 && -0.02f <= x && x <= 0.02f)
+   /* XXX these tests may need adjustment */
+   if (y >= 3.0f && (-0.02f <= x && x <= 0.02f))
+      return 0.0f;
+   if (y >= 50.0f && (-0.9f <= x && x <= 0.9f))
       return 0.0f;
    return util_fast_exp2(util_fast_log2(x) * y);
 }