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
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user