[Bf-blender-cvs] [c8fb488] master: Fix T41066: An actual fix for curve intersection on FMA-enabled CPUs

Sv. Lockal noreply at git.blender.org
Sat Mar 7 17:22:32 CET 2015


Commit: c8fb488b087f91ba58ac16e4e76050b660122417
Author: Sv. Lockal
Date:   Sat Mar 7 16:15:01 2015 +0000
Branches: master
https://developer.blender.org/rBc8fb488b087f91ba58ac16e4e76050b660122417

Fix T41066: An actual fix for curve intersection on FMA-enabled CPUs

===================================================================

M	intern/cycles/kernel/geom/geom_curve.h
M	intern/cycles/util/util_ssef.h

===================================================================

diff --git a/intern/cycles/kernel/geom/geom_curve.h b/intern/cycles/kernel/geom/geom_curve.h
index 5509fef..ac6c6ec 100644
--- a/intern/cycles/kernel/geom/geom_curve.h
+++ b/intern/cycles/kernel/geom/geom_curve.h
@@ -709,7 +709,7 @@ ccl_device_inline bool bvh_curve_intersect(KernelGlobals *kg, Intersection *isec
 	const ssef sphere_dif1 = (dif + dif_second) * 0.5f;
 	const ssef dir = load4f(direction);
 	const ssef sphere_b_tmp = dot3_splat(dir, sphere_dif1);
-	const ssef sphere_dif2 = nmsub(sphere_b_tmp, dir, sphere_dif1);
+	const ssef sphere_dif2 = nmadd(sphere_b_tmp, dir, sphere_dif1);
 #endif
 
 	float mr = max(r1, r2);
diff --git a/intern/cycles/util/util_ssef.h b/intern/cycles/util/util_ssef.h
index a9503d6..ca69924 100644
--- a/intern/cycles/util/util_ssef.h
+++ b/intern/cycles/util/util_ssef.h
@@ -151,7 +151,7 @@ __forceinline ssef maxi(const ssef& a, const ssef& b) {
 /// Ternary Operators
 ////////////////////////////////////////////////////////////////////////////////
 
-#if defined(__KERNEL_AVX2__) && !defined(_MSC_VER) // see T41066
+#if defined(__KERNEL_AVX2__)
 __forceinline const ssef madd (const ssef& a, const ssef& b, const ssef& c) { return _mm_fmadd_ps(a,b,c); }
 __forceinline const ssef msub (const ssef& a, const ssef& b, const ssef& c) { return _mm_fmsub_ps(a,b,c); }
 __forceinline const ssef nmadd(const ssef& a, const ssef& b, const ssef& c) { return _mm_fnmadd_ps(a,b,c); }
@@ -159,8 +159,8 @@ __forceinline const ssef nmsub(const ssef& a, const ssef& b, const ssef& c) { re
 #else
 __forceinline const ssef madd (const ssef& a, const ssef& b, const ssef& c) { return a*b+c; }
 __forceinline const ssef msub (const ssef& a, const ssef& b, const ssef& c) { return a*b-c; }
-__forceinline const ssef nmadd(const ssef& a, const ssef& b, const ssef& c) { return -a*b-c;}
-__forceinline const ssef nmsub(const ssef& a, const ssef& b, const ssef& c) { return c-a*b; }
+__forceinline const ssef nmadd(const ssef& a, const ssef& b, const ssef& c) { return c-a*b;}
+__forceinline const ssef nmsub(const ssef& a, const ssef& b, const ssef& c) { return -a*b-c; }
 #endif
 
 ////////////////////////////////////////////////////////////////////////////////




More information about the Bf-blender-cvs mailing list