diff options
author | OmarSquircleArt <omar.squircleart@gmail.com> | 2019-08-22 14:47:24 +0300 |
---|---|---|
committer | OmarSquircleArt <omar.squircleart@gmail.com> | 2019-08-22 14:51:39 +0300 |
commit | c6f8ea7b45af72fa7f7d1a47140fd946c1db3d5e (patch) | |
tree | a2b0bb5df2e3357a82dcf418c551e0c8eeb5ee7f | |
parent | b208096538aa65eb0b5df9ee080ad4b42441aca5 (diff) |
Fix T69044: OpenCL fail due to bad fract function.
The fract function in OpenCL does more than just return the fraction.
It also writes the floor to the second argument. Which wasn't put
in consideration.
Instead, we use a simple `a - floor(a)` like the Math node.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5553
-rw-r--r-- | intern/cycles/kernel/svm/svm_math_util.h | 2 | ||||
-rw-r--r-- | intern/cycles/util/util_math_float3.h | 6 |
2 files changed, 1 insertions, 7 deletions
diff --git a/intern/cycles/kernel/svm/svm_math_util.h b/intern/cycles/kernel/svm/svm_math_util.h index c87ca0defa7..c07a1e4ed98 100644 --- a/intern/cycles/kernel/svm/svm_math_util.h +++ b/intern/cycles/kernel/svm/svm_math_util.h @@ -69,7 +69,7 @@ ccl_device void svm_vector_math( *vector = make_float3(safe_modulo(a.x, b.x), safe_modulo(a.y, b.y), safe_modulo(a.z, b.z)); break; case NODE_VECTOR_MATH_FRACTION: - *vector = fract(a); + *vector = a - floor(a); break; case NODE_VECTOR_MATH_ABSOLUTE: *vector = fabs(a); diff --git a/intern/cycles/util/util_math_float3.h b/intern/cycles/util/util_math_float3.h index 0d7588da690..c9a5b34aa58 100644 --- a/intern/cycles/util/util_math_float3.h +++ b/intern/cycles/util/util_math_float3.h @@ -61,7 +61,6 @@ ccl_device_inline float3 rcp(const float3 &a); ccl_device_inline float3 sqrt(const float3 &a); ccl_device_inline float3 floor(const float3 &a); ccl_device_inline float3 ceil(const float3 &a); -ccl_device_inline float3 fract(const float3 &a); #endif /* !__KERNEL_OPENCL__ */ ccl_device_inline float min3(float3 a); @@ -313,11 +312,6 @@ ccl_device_inline float3 ceil(const float3 &a) # endif } -ccl_device_inline float3 fract(const float3 &a) -{ - return a - floor(a); -} - ccl_device_inline float3 mix(const float3 &a, const float3 &b, float t) { return a + t * (b - a); |