[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46026] trunk/blender/intern/cycles/util/ util_math.h: Cycles: fix for CUDA build.

Brecht Van Lommel brechtvanlommel at pandora.be
Sat Apr 28 11:10:20 CEST 2012


Revision: 46026
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46026
Author:   blendix
Date:     2012-04-28 09:10:20 +0000 (Sat, 28 Apr 2012)
Log Message:
-----------
Cycles: fix for CUDA build.

Modified Paths:
--------------
    trunk/blender/intern/cycles/util/util_math.h

Modified: trunk/blender/intern/cycles/util/util_math.h
===================================================================
--- trunk/blender/intern/cycles/util/util_math.h	2012-04-28 09:00:11 UTC (rev 46025)
+++ trunk/blender/intern/cycles/util/util_math.h	2012-04-28 09:10:20 UTC (rev 46026)
@@ -515,15 +515,6 @@
 	printf("%s: %.8f %.8f %.8f\n", label, a.x, a.y, a.z);
 }
 
-__device_inline float reduce_add(const float3& a)
-{
-#ifdef __KERNEL_SSE__
-	return (a.x + a.y + a.z);
-#else
-	return (a.x + a.y + a.z);
-#endif
-}
-
 __device_inline float3 rcp(const float3& a)
 {
 #ifdef __KERNEL_SSE__
@@ -550,6 +541,15 @@
 #endif
 }
 
+__device_inline float reduce_add(const float3& a)
+{
+#ifdef __KERNEL_SSE__
+	return (a.x + a.y + a.z);
+#else
+	return (a.x + a.y + a.z);
+#endif
+}
+
 __device_inline float average(const float3 a)
 {
 	return reduce_add(a)*(1.0f/3.0f);
@@ -783,16 +783,6 @@
 }
 #endif
 
-__device_inline float reduce_add(const float4& a)
-{
-#ifdef __KERNEL_SSE__
-	float4 h = shuffle<1,0,3,2>(a) + a;
-	return _mm_cvtss_f32(shuffle<2,3,0,1>(h) + h); /* todo: efficiency? */
-#else
-	return ((a.x + a.y) + (a.z + a.w));
-#endif
-}
-
 __device_inline void print_float4(const char *label, const float4& a)
 {
 	printf("%s: %.8f %.8f %.8f %.8f\n", label, a.x, a.y, a.z, a.w);
@@ -811,6 +801,16 @@
 #endif
 }
 
+__device_inline float reduce_add(const float4& a)
+{
+#ifdef __KERNEL_SSE__
+	float4 h = shuffle<1,0,3,2>(a) + a;
+	return _mm_cvtss_f32(shuffle<2,3,0,1>(h) + h); /* todo: efficiency? */
+#else
+	return ((a.x + a.y) + (a.z + a.w));
+#endif
+}
+
 __device_inline float average(const float4& a)
 {
 	return reduce_add(a) * 0.25f;




More information about the Bf-blender-cvs mailing list