diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-09-08 15:45:07 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-09-08 15:47:32 +0300 |
commit | fbb4be061c7ae049c6b1fded43894de18b3afd33 (patch) | |
tree | 3a0cca7280cabfcd250e0f43d6beb5a1e8ffc9f4 /intern/cycles | |
parent | 87cc8550e2cd57b85ffee26a525792eb0688aa58 (diff) |
Cycles: Safer fix for infinite recursion
Previous fix wasn't working correct for certain compiler and CPU intrinsics
mode, causing quite some crashes.
This should be a safer fix, which is closer in behavior to previous release
but which should still fix issues with robust curve intersection.
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/bvh/bvh4.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/intern/cycles/bvh/bvh4.cpp b/intern/cycles/bvh/bvh4.cpp index 3ecea600e1a..78f2c94d39a 100644 --- a/intern/cycles/bvh/bvh4.cpp +++ b/intern/cycles/bvh/bvh4.cpp @@ -242,21 +242,23 @@ void BVH4::pack_unaligned_node(int idx, * so kernel might safely assume there are always 4 child nodes. */ - data[1][i] = NAN; - data[2][i] = NAN; - data[3][i] = NAN; + const float inf = FLT_MAX / 1000.0f; - data[4][i] = NAN; - data[5][i] = NAN; - data[6][i] = NAN; + data[1][i] = inf; + data[2][i] = 0.0f; + data[3][i] = 0.0f; - data[7][i] = NAN; - data[8][i] = NAN; - data[9][i] = NAN; + data[4][i] = 0.0f; + data[5][i] = inf; + data[6][i] = 0.0f; - data[10][i] = NAN; - data[11][i] = NAN; - data[12][i] = NAN; + data[7][i] = 0.0f; + data[8][i] = 0.0f; + data[9][i] = inf; + + data[10][i] = -inf; + data[11][i] = -inf; + data[12][i] = -inf; data[13][i] = __int_as_float(0); } |