Cycles:
* Revert r57203 (len() renaming) There seems to be a problem with nVidia OpenCL after this and I haven't figured out the real cause yet. Better to selectively enable native length() later, after figuring out what's wrong. This fixes [#35612].
This commit is contained in:
@@ -296,19 +296,19 @@ __device_inline bool operator==(const int2 a, const int2 b)
|
||||
return (a.x == b.x && a.y == b.y);
|
||||
}
|
||||
|
||||
__device_inline float length(const float2 a)
|
||||
__device_inline float len(const float2 a)
|
||||
{
|
||||
return sqrtf(dot(a, a));
|
||||
}
|
||||
|
||||
__device_inline float2 normalize(const float2 a)
|
||||
{
|
||||
return a/length(a);
|
||||
return a/len(a);
|
||||
}
|
||||
|
||||
__device_inline float2 normalize_length(const float2 a, float *t)
|
||||
__device_inline float2 normalize_len(const float2 a, float *t)
|
||||
{
|
||||
*t = length(a);
|
||||
*t = len(a);
|
||||
return a/(*t);
|
||||
}
|
||||
|
||||
@@ -454,13 +454,14 @@ __device_inline float3 cross(const float3 a, const float3 b)
|
||||
return r;
|
||||
}
|
||||
|
||||
__device_inline float length(const float3 a)
|
||||
#endif
|
||||
|
||||
__device_inline float len(const float3 a)
|
||||
{
|
||||
return sqrtf(dot(a, a));
|
||||
}
|
||||
#endif
|
||||
|
||||
__device_inline float length_squared(const float3 a)
|
||||
__device_inline float len_squared(const float3 a)
|
||||
{
|
||||
return dot(a, a);
|
||||
}
|
||||
@@ -469,14 +470,14 @@ __device_inline float length_squared(const float3 a)
|
||||
|
||||
__device_inline float3 normalize(const float3 a)
|
||||
{
|
||||
return a/length(a);
|
||||
return a/len(a);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
__device_inline float3 normalize_length(const float3 a, float *t)
|
||||
__device_inline float3 normalize_len(const float3 a, float *t)
|
||||
{
|
||||
*t = length(a);
|
||||
*t = len(a);
|
||||
return a/(*t);
|
||||
}
|
||||
|
||||
@@ -786,14 +787,14 @@ __device_inline float dot(const float4& a, const float4& b)
|
||||
return reduce_add(a * b);
|
||||
}
|
||||
|
||||
__device_inline float length(const float4 a)
|
||||
__device_inline float len(const float4 a)
|
||||
{
|
||||
return sqrtf(dot(a, a));
|
||||
}
|
||||
|
||||
__device_inline float4 normalize(const float4 a)
|
||||
{
|
||||
return a/length(a);
|
||||
return a/len(a);
|
||||
}
|
||||
|
||||
__device_inline float4 min(float4 a, float4 b)
|
||||
@@ -1049,7 +1050,7 @@ template<class A, class B> A lerp(const A& a, const A& b, const B& t)
|
||||
|
||||
__device_inline float triangle_area(const float3 v1, const float3 v2, const float3 v3)
|
||||
{
|
||||
return length(cross(v3 - v2, v1 - v2))*0.5f;
|
||||
return len(cross(v3 - v2, v1 - v2))*0.5f;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1211,7 +1212,7 @@ __device bool ray_aligned_disk_intersect(
|
||||
{
|
||||
/* aligned disk normal */
|
||||
float disk_t;
|
||||
float3 disk_N = normalize_length(ray_P - disk_P, &disk_t);
|
||||
float3 disk_N = normalize_len(ray_P - disk_P, &disk_t);
|
||||
float div = dot(ray_D, disk_N);
|
||||
|
||||
if(div == 0.0f)
|
||||
@@ -1224,7 +1225,7 @@ __device bool ray_aligned_disk_intersect(
|
||||
|
||||
/* test if within radius */
|
||||
float3 P = ray_P + ray_D*t;
|
||||
if(length_squared(P - disk_P) > disk_radius*disk_radius)
|
||||
if(len_squared(P - disk_P) > disk_radius*disk_radius)
|
||||
return false;
|
||||
|
||||
*isect_P = P;
|
||||
|
Reference in New Issue
Block a user