[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57553] trunk/blender/intern/cycles: Fix cycles crash on some processors.
Brecht Van Lommel
brechtvanlommel at pandora.be
Tue Jun 18 18:52:02 CEST 2013
Revision: 57553
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57553
Author: blendix
Date: 2013-06-18 16:52:02 +0000 (Tue, 18 Jun 2013)
Log Message:
-----------
Fix cycles crash on some processors. We actually need S-SSE3 support for this
new BVH traversal code, not just SSE3.
Modified Paths:
--------------
trunk/blender/intern/cycles/kernel/kernel_bvh_traversal.h
trunk/blender/intern/cycles/kernel/kernel_sse3.cpp
trunk/blender/intern/cycles/util/util_system.cpp
trunk/blender/intern/cycles/util/util_types.h
Modified: trunk/blender/intern/cycles/kernel/kernel_bvh_traversal.h
===================================================================
--- trunk/blender/intern/cycles/kernel/kernel_bvh_traversal.h 2013-06-18 16:13:28 UTC (rev 57552)
+++ trunk/blender/intern/cycles/kernel/kernel_bvh_traversal.h 2013-06-18 16:52:02 UTC (rev 57553)
@@ -80,7 +80,7 @@
isect->u = 0.0f;
isect->v = 0.0f;
-#if defined(__KERNEL_SSE3__) && !FEATURE(BVH_HAIR_MINIMUM_WIDTH)
+#if defined(__KERNEL_SSSE3__) && !FEATURE(BVH_HAIR_MINIMUM_WIDTH)
const __m128i shuffle_identity = _mm_set_epi8(15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
const __m128i shuffle_swap = _mm_set_epi8(7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8);
@@ -111,10 +111,10 @@
{
bool traverseChild0, traverseChild1;
int nodeAddrChild1;
- float t = isect->t;
-#if !defined(__KERNEL_SSE3__) || FEATURE(BVH_HAIR_MINIMUM_WIDTH)
+#if !defined(__KERNEL_SSSE3__) || FEATURE(BVH_HAIR_MINIMUM_WIDTH)
/* Intersect two child bounding boxes, non-SSE version */
+ float t = isect->t;
/* fetch node data */
float4 node0 = kernel_tex_fetch(__bvh_nodes, nodeAddr*BVH_NODE_SIZE+0);
@@ -166,8 +166,8 @@
traverseChild1 = (c1max >= c1min);
#endif
-#else // __KERNEL_SSE3__
- /* Intersect two child bounding boxes, SSE3 version adapted from Embree */
+#else // __KERNEL_SSSE3__
+ /* Intersect two child bounding boxes, SSSE3 version adapted from Embree */
/* fetch node data */
__m128 *bvh_nodes = (__m128*)kg->__bvh_nodes.data + nodeAddr*BVH_NODE_SIZE;
@@ -190,14 +190,14 @@
traverseChild0 = (_mm_movemask_ps(lrhit) & 1);
traverseChild1 = (_mm_movemask_ps(lrhit) & 2);
#endif
-#endif // __KERNEL_SSE3__
+#endif // __KERNEL_SSSE3__
nodeAddr = __float_as_int(cnodes.x);
nodeAddrChild1 = __float_as_int(cnodes.y);
if(traverseChild0 && traverseChild1) {
/* both children were intersected, push the farther one */
-#if !defined(__KERNEL_SSE3__) || FEATURE(BVH_HAIR_MINIMUM_WIDTH)
+#if !defined(__KERNEL_SSSE3__) || FEATURE(BVH_HAIR_MINIMUM_WIDTH)
bool closestChild1 = (c1min < c0min);
#else
union { __m128 m128; float v[4]; } uminmax;
@@ -282,7 +282,7 @@
hit = bvh_triangle_intersect(kg, isect, P, idir, visibility, object, primAddr);
/* shadow ray early termination */
-#if defined(__KERNEL_SSE3__) && !FEATURE(BVH_HAIR_MINIMUM_WIDTH)
+#if defined(__KERNEL_SSSE3__) && !FEATURE(BVH_HAIR_MINIMUM_WIDTH)
if(hit) {
if(visibility == PATH_RAY_SHADOW_OPAQUE)
return true;
@@ -315,7 +315,7 @@
bvh_instance_push(kg, object, ray, &P, &idir, &isect->t, tmax);
#endif
-#if defined(__KERNEL_SSE3__) && !FEATURE(BVH_HAIR_MINIMUM_WIDTH)
+#if defined(__KERNEL_SSSE3__) && !FEATURE(BVH_HAIR_MINIMUM_WIDTH)
Psplat[0] = _mm_set_ps1(P.x);
Psplat[1] = _mm_set_ps1(P.y);
Psplat[2] = _mm_set_ps1(P.z);
@@ -359,7 +359,7 @@
bvh_instance_pop(kg, object, ray, &P, &idir, &isect->t, tmax);
#endif
-#if defined(__KERNEL_SSE3__) && !FEATURE(BVH_HAIR_MINIMUM_WIDTH)
+#if defined(__KERNEL_SSSE3__) && !FEATURE(BVH_HAIR_MINIMUM_WIDTH)
Psplat[0] = _mm_set_ps1(P.x);
Psplat[1] = _mm_set_ps1(P.y);
Psplat[2] = _mm_set_ps1(P.z);
Modified: trunk/blender/intern/cycles/kernel/kernel_sse3.cpp
===================================================================
--- trunk/blender/intern/cycles/kernel/kernel_sse3.cpp 2013-06-18 16:13:28 UTC (rev 57552)
+++ trunk/blender/intern/cycles/kernel/kernel_sse3.cpp 2013-06-18 16:52:02 UTC (rev 57553)
@@ -16,13 +16,14 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-/* Optimized CPU kernel entry points. This file is compiled with SSE3
+/* Optimized CPU kernel entry points. This file is compiled with SSE3/SSSE3
* optimization flags and nearly all functions inlined, while kernel.cpp
* is compiled without for other CPU's. */
#ifdef WITH_OPTIMIZED_KERNEL
#define __KERNEL_SSE3__
+#define __KERNEL_SSSE3__
#include "kernel.h"
#include "kernel_compat_cpu.h"
Modified: trunk/blender/intern/cycles/util/util_system.cpp
===================================================================
--- trunk/blender/intern/cycles/util/util_system.cpp 2013-06-18 16:13:28 UTC (rev 57552)
+++ trunk/blender/intern/cycles/util/util_system.cpp 2013-06-18 16:52:02 UTC (rev 57553)
@@ -194,7 +194,7 @@
bool system_cpu_support_sse3()
{
CPUCapabilities& caps = system_cpu_capabilities();
- return caps.sse && caps.sse2 && caps.sse3;
+ return caps.sse && caps.sse2 && caps.sse3 && caps.ssse3;
}
#else
Modified: trunk/blender/intern/cycles/util/util_types.h
===================================================================
--- trunk/blender/intern/cycles/util/util_types.h 2013-06-18 16:13:28 UTC (rev 57552)
+++ trunk/blender/intern/cycles/util/util_types.h 2013-06-18 16:52:02 UTC (rev 57553)
@@ -69,24 +69,28 @@
#include <xmmintrin.h> /* SSE 1 */
#include <emmintrin.h> /* SSE 2 */
#include <pmmintrin.h> /* SSE 3 */
-#include <tmmintrin.h> /* SSE 3 */
+#include <tmmintrin.h> /* SSSE 3 */
#include <smmintrin.h> /* SSE 4 */
#ifndef __KERNEL_SSE2__
#define __KERNEL_SSE2__
#endif
-#ifndef __KERNEL_SSE3__
-#define __KERNEL_SSE3__
+#ifndef __KERNEL_SSSE3__
+#define __KERNEL_SSSE3__
#endif
+#ifndef __KERNEL_SSSE3__
+#define __KERNEL_SSSE3__
+#endif
+
#ifndef __KERNEL_SSE4__
#define __KERNEL_SSE4__
#endif
#else
-#if defined(__x86_64__) || defined(__KERNEL_SSE3__)
+#if defined(__x86_64__) || defined(__KERNEL_SSSE3__)
/* MinGW64 has conflicting declarations for these SSE headers in <windows.h>.
* Since we can't avoid including <windows.h>, better only include that */
@@ -96,11 +100,13 @@
#include <xmmintrin.h> /* SSE 1 */
#include <emmintrin.h> /* SSE 2 */
-#ifdef __KERNEL_SSE3__
+#ifdef __KERNEL_SSSE3__
#include <pmmintrin.h> /* SSE 3 */
-#include <tmmintrin.h> /* SSE 3 */
#endif
+#ifdef __KERNEL_SSSE3__
+#include <tmmintrin.h> /* SSSE 3 */
#endif
+#endif
#ifndef __KERNEL_SSE2__
#define __KERNEL_SSE2__
@@ -110,10 +116,9 @@
#endif
+/* int8_t, uint16_t, and friends */
#ifndef _WIN32
-
#include <stdint.h>
-
#endif
#endif
@@ -486,7 +491,7 @@
#endif
-#ifdef __KERNEL_SSE3__
+#ifdef __KERNEL_SSSE3__
/* SSE shuffle utility functions */
More information about the Bf-blender-cvs
mailing list