[Bf-blender-cvs] [c1242874c98] master: Fix: NaN error in smoothminf function
Charlie Jolly
noreply at git.blender.org
Sat Dec 21 04:29:53 CET 2019
Commit: c1242874c98be830a4bdf4db194d3a8001e4969b
Author: Charlie Jolly
Date: Sat Dec 21 03:28:22 2019 +0000
Branches: master
https://developer.blender.org/rBc1242874c98be830a4bdf4db194d3a8001e4969b
Fix: NaN error in smoothminf function
===================================================================
M intern/cycles/util/util_math.h
===================================================================
diff --git a/intern/cycles/util/util_math.h b/intern/cycles/util/util_math.h
index dc211d2ed4e..737c834e073 100644
--- a/intern/cycles/util/util_math.h
+++ b/intern/cycles/util/util_math.h
@@ -363,8 +363,13 @@ ccl_device_inline float pingpongf(float a, float b)
ccl_device_inline float smoothminf(float a, float b, float k)
{
- float h = fmaxf(k - fabsf(a - b), 0.0f) / k;
- return fminf(a, b) - h * h * h * k * (1.0f / 6.0f);
+ if (k != 0.0f) {
+ float h = fmaxf(k - fabsf(a - b), 0.0f) / k;
+ return fminf(a, b) - h * h * h * k * (1.0f / 6.0f);
+ }
+ else {
+ return fminf(a, b);
+ }
}
ccl_device_inline float signf(float f)
More information about the Bf-blender-cvs
mailing list