summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-09-13 15:20:31 -0600
committerBrian Paul <[email protected]>2008-09-13 15:22:52 -0600
commit75c19eb5a1caf0c36e04270174579d0d7fec9ccb (patch)
tree2cfa2e8563fc9aa9f9b07a81f98c797bcda684ac /src/gallium/auxiliary
parent44e53b37a02933f238b438e5dc3a2891da5eb51a (diff)
gallium: add another value check to util_fast_pow()
Fixes glitches seen in morph3d demo.
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/util/u_math.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h
index 9b4ca393714..0b10622ee75 100644
--- a/src/gallium/auxiliary/util/u_math.h
+++ b/src/gallium/auxiliary/util/u_math.h
@@ -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);
}