Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Susano Pinto <andresusanopinto@gmail.com>2009-10-06 04:28:07 +0400
committerAndre Susano Pinto <andresusanopinto@gmail.com>2009-10-06 04:28:07 +0400
commit11bdf6ea10ee7bc5e2862cdddbf42eddb06c42fa (patch)
tree55b3def9d986ceaee75fe7d978561464f7731205
parenta62e37bfbe5a1430b204b39dcc2e1156d2a6f2bc (diff)
Added #ifdef __SSE__ so it can still build when SSE is disabled at compile time
-rw-r--r--source/blender/render/intern/raytrace/bvh.h7
-rw-r--r--source/blender/render/intern/raytrace/rayobject_qbvh.cpp13
-rw-r--r--source/blender/render/intern/raytrace/rayobject_svbvh.cpp11
-rw-r--r--source/blender/render/intern/raytrace/svbvh.h4
-rw-r--r--source/blender/render/intern/source/rayshade.c22
5 files changed, 53 insertions, 4 deletions
diff --git a/source/blender/render/intern/raytrace/bvh.h b/source/blender/render/intern/raytrace/bvh.h
index f0302ddba3a..0e74bbc923b 100644
--- a/source/blender/render/intern/raytrace/bvh.h
+++ b/source/blender/render/intern/raytrace/bvh.h
@@ -33,11 +33,15 @@
#include "rayobject_hint.h"
#include <assert.h>
+
+#ifdef __SSE__
#include <xmmintrin.h>
+#endif
#ifndef RE_RAYTRACE_BVH_H
#define RE_RAYTRACE_BVH_H
+#ifdef __SSE__
inline int test_bb_group4(__m128 *bb_group, const Isect *isec)
{
@@ -53,6 +57,7 @@ inline int test_bb_group4(__m128 *bb_group, const Isect *isec)
return _mm_movemask_ps(_mm_cmpge_ps(tmax3, tmin3));
}
+#endif
/* bvh tree generics */
@@ -159,6 +164,7 @@ static int bvh_node_stack_raycast(Node *root, Isect *isec)
}
+#ifdef __SSE__
/*
* Generic SIMD bvh recursion
* this was created to be able to use any simd (with the cost of some memmoves)
@@ -287,6 +293,7 @@ static int bvh_node_stack_raycast_simd(Node *root, Isect *isec)
}
return hit;
}
+#endif
/*
* recursively transverse a BVH looking for a rayhit using system stack
diff --git a/source/blender/render/intern/raytrace/rayobject_qbvh.cpp b/source/blender/render/intern/raytrace/rayobject_qbvh.cpp
index b18ee0824cf..8d35848c9ec 100644
--- a/source/blender/render/intern/raytrace/rayobject_qbvh.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_qbvh.cpp
@@ -30,6 +30,8 @@
#include "svbvh.h"
#include "reorganize.h"
+#ifdef __SSE__
+
#define DFS_STACK_SIZE 256
struct QBVHTree
@@ -134,3 +136,14 @@ RayObject *RE_rayobject_qbvh_create(int size)
{
return bvh_create_tree<QBVHTree,DFS_STACK_SIZE>(size);
}
+
+
+#else
+
+RayObject *RE_rayobject_qbvh_create(int size)
+{
+ puts("WARNING: SSE disabled at compile time\n");
+ return NULL;
+}
+
+#endif \ No newline at end of file
diff --git a/source/blender/render/intern/raytrace/rayobject_svbvh.cpp b/source/blender/render/intern/raytrace/rayobject_svbvh.cpp
index 229e82dfa68..a877b91e2ff 100644
--- a/source/blender/render/intern/raytrace/rayobject_svbvh.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_svbvh.cpp
@@ -30,6 +30,8 @@
#include "svbvh.h"
#include "reorganize.h"
+#ifdef __SSE__
+
#define DFS_STACK_SIZE 256
struct SVBVHTree
@@ -168,3 +170,12 @@ RayObject *RE_rayobject_svbvh_create(int size)
{
return bvh_create_tree<SVBVHTree,DFS_STACK_SIZE>(size);
}
+#else
+
+RayObject *RE_rayobject_svbvh_create(int size)
+{
+ puts("WARNING: SSE disabled at compile time\n");
+ return NULL;
+}
+
+#endif
diff --git a/source/blender/render/intern/raytrace/svbvh.h b/source/blender/render/intern/raytrace/svbvh.h
index 840ccc24d1a..3c733b6b402 100644
--- a/source/blender/render/intern/raytrace/svbvh.h
+++ b/source/blender/render/intern/raytrace/svbvh.h
@@ -26,6 +26,8 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
+#ifdef __SSE__
+
#ifndef RE_RAYTRACE_SVBVH_H
#define RE_RAYTRACE_SVBVH_H
@@ -243,3 +245,5 @@ struct Reorganize_SVBVH
};
#endif
+
+#endif //__SSE__ \ No newline at end of file
diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c
index 9ef8aa3aba2..7f112f2e79c 100644
--- a/source/blender/render/intern/source/rayshade.c
+++ b/source/blender/render/intern/source/rayshade.c
@@ -78,7 +78,7 @@ static int test_break(void *data)
return re->test_break(re->tbh);
}
-static RE_rayobject_config_control(RayObject *r, Render *re)
+static void RE_rayobject_config_control(RayObject *r, Render *re)
{
if(RE_rayobject_isRayAPI(r))
{
@@ -96,10 +96,21 @@ RayObject* RE_rayobject_create(Render *re, int type, int size)
{
//TODO
//if(detect_simd())
- type = R_RAYSTRUCTURE_SIMD_SVBVH;
- //else
- // type = R_RAYSTRUCTURE_VBVH;
+#ifdef __SSE__
+ type = R_RAYSTRUCTURE_SIMD_SVBVH;
+#else
+ type = R_RAYSTRUCTURE_VBVH;
+#endif
+ }
+
+#ifndef __SSE__
+ if(type == R_RAYSTRUCTURE_SIMD_SVBVH || type == R_RAYSTRUCTURE_SIMD_QBVH)
+ {
+ puts("Warning: Using VBVH (SSE was disabled at compile time)");
+ type = R_RAYSTRUCTURE_VBVH;
}
+#endif
+
if(type == R_RAYSTRUCTURE_OCTREE) //TODO dynamic ocres
res = RE_rayobject_octree_create(re->r.ocres, size);
@@ -111,6 +122,9 @@ RayObject* RE_rayobject_create(Render *re, int type, int size)
res = RE_rayobject_svbvh_create(size);
else if(type == R_RAYSTRUCTURE_SIMD_QBVH)
res = RE_rayobject_qbvh_create(size);
+ else
+ res = RE_rayobject_vbvh_create(size); //Fallback
+
if(res)
RE_rayobject_config_control( res, re );