Revision: 23646
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23646
Author:   jaguarandi
Date:     2009-10-06 02:28:07 +0200 (Tue, 06 Oct 2009)

Log Message:
-----------
Added #ifdef __SSE__ so it can still build when SSE is disabled at compile time

Modified Paths:
--------------
    branches/soc-2009-jaguarandi/source/blender/render/intern/raytrace/bvh.h
    
branches/soc-2009-jaguarandi/source/blender/render/intern/raytrace/rayobject_qbvh.cpp
    
branches/soc-2009-jaguarandi/source/blender/render/intern/raytrace/rayobject_svbvh.cpp
    branches/soc-2009-jaguarandi/source/blender/render/intern/raytrace/svbvh.h
    branches/soc-2009-jaguarandi/source/blender/render/intern/source/rayshade.c

Modified: 
branches/soc-2009-jaguarandi/source/blender/render/intern/raytrace/bvh.h
===================================================================
--- branches/soc-2009-jaguarandi/source/blender/render/intern/raytrace/bvh.h    
2009-10-05 23:30:00 UTC (rev 23645)
+++ branches/soc-2009-jaguarandi/source/blender/render/intern/raytrace/bvh.h    
2009-10-06 00:28:07 UTC (rev 23646)
@@ -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 @@
        
        return _mm_movemask_ps(_mm_cmpge_ps(tmax3, tmin3));
 }
+#endif
 
 
 /* bvh tree generics */
@@ -159,6 +164,7 @@
 }
 
 
+#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 @@
        }
        return hit;
 }
+#endif
 
 /*
  * recursively transverse a BVH looking for a rayhit using system stack

Modified: 
branches/soc-2009-jaguarandi/source/blender/render/intern/raytrace/rayobject_qbvh.cpp
===================================================================
--- 
branches/soc-2009-jaguarandi/source/blender/render/intern/raytrace/rayobject_qbvh.cpp
       2009-10-05 23:30:00 UTC (rev 23645)
+++ 
branches/soc-2009-jaguarandi/source/blender/render/intern/raytrace/rayobject_qbvh.cpp
       2009-10-06 00:28:07 UTC (rev 23646)
@@ -30,6 +30,8 @@
 #include "svbvh.h"
 #include "reorganize.h"
 
+#ifdef __SSE__
+
 #define DFS_STACK_SIZE 256
 
 struct QBVHTree
@@ -134,3 +136,14 @@
 {
        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

Modified: 
branches/soc-2009-jaguarandi/source/blender/render/intern/raytrace/rayobject_svbvh.cpp
===================================================================
--- 
branches/soc-2009-jaguarandi/source/blender/render/intern/raytrace/rayobject_svbvh.cpp
      2009-10-05 23:30:00 UTC (rev 23645)
+++ 
branches/soc-2009-jaguarandi/source/blender/render/intern/raytrace/rayobject_svbvh.cpp
      2009-10-06 00:28:07 UTC (rev 23646)
@@ -30,6 +30,8 @@
 #include "svbvh.h"
 #include "reorganize.h"
 
+#ifdef __SSE__
+
 #define DFS_STACK_SIZE 256
 
 struct SVBVHTree
@@ -168,3 +170,12 @@
 {
        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

Modified: 
branches/soc-2009-jaguarandi/source/blender/render/intern/raytrace/svbvh.h
===================================================================
--- branches/soc-2009-jaguarandi/source/blender/render/intern/raytrace/svbvh.h  
2009-10-05 23:30:00 UTC (rev 23645)
+++ branches/soc-2009-jaguarandi/source/blender/render/intern/raytrace/svbvh.h  
2009-10-06 00:28:07 UTC (rev 23646)
@@ -26,6 +26,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
+#ifdef __SSE__
+ 
 #ifndef RE_RAYTRACE_SVBVH_H
 #define RE_RAYTRACE_SVBVH_H
 
@@ -243,3 +245,5 @@
 };
 
 #endif
+
+#endif //__SSE__
\ No newline at end of file

Modified: 
branches/soc-2009-jaguarandi/source/blender/render/intern/source/rayshade.c
===================================================================
--- branches/soc-2009-jaguarandi/source/blender/render/intern/source/rayshade.c 
2009-10-05 23:30:00 UTC (rev 23645)
+++ branches/soc-2009-jaguarandi/source/blender/render/intern/source/rayshade.c 
2009-10-06 00:28:07 UTC (rev 23646)
@@ -78,7 +78,7 @@
        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 @@
        {
                //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,7 +122,10 @@
                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 );
        


_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to