[Bf-blender-cvs] [8512e28] master: Fix T46906: Cycles syntax error while compiling OpenCL kernels
Lukas Stockner
noreply at git.blender.org
Tue Dec 1 14:03:06 CET 2015
Commit: 8512e284a001fdf464488112f4d19d598d37342b
Author: Lukas Stockner
Date: Tue Dec 1 13:53:29 2015 +0100
Branches: master
https://developer.blender.org/rB8512e284a001fdf464488112f4d19d598d37342b
Fix T46906: Cycles syntax error while compiling OpenCL kernels
The safe normalization was using a float as a condition, now the intended non-zero test is explicit.
===================================================================
M intern/cycles/util/util_math.h
===================================================================
diff --git a/intern/cycles/util/util_math.h b/intern/cycles/util/util_math.h
index 7d6dfd3..4a676d0 100644
--- a/intern/cycles/util/util_math.h
+++ b/intern/cycles/util/util_math.h
@@ -351,7 +351,7 @@ ccl_device_inline float2 normalize_len(const float2 a, float *t)
ccl_device_inline float2 safe_normalize(const float2 a)
{
float t = len(a);
- return (t)? a/t: a;
+ return (t != 0.0f)? a/t: a;
}
ccl_device_inline bool operator==(const float2 a, const float2 b)
@@ -553,7 +553,7 @@ ccl_device_inline float3 normalize_len(const float3 a, float *t)
ccl_device_inline float3 safe_normalize(const float3 a)
{
float t = len(a);
- return (t)? a/t: a;
+ return (t != 0.0f)? a/t: a;
}
#ifndef __KERNEL_OPENCL__
@@ -866,7 +866,7 @@ ccl_device_inline float4 normalize(const float4 a)
ccl_device_inline float4 safe_normalize(const float4 a)
{
float t = len(a);
- return (t)? a/t: a;
+ return (t != 0.0f)? a/t: a;
}
ccl_device_inline float4 min(float4 a, float4 b)
More information about the Bf-blender-cvs
mailing list