* WITH_BF_RAYOPTIMIZATION cleanup and flag separation by matd.
authorNathan Letwory <nathan@letworyinteractive.com>
Thu, 10 Dec 2009 00:51:13 +0000 (00:51 +0000)
committerNathan Letwory <nathan@letworyinteractive.com>
Thu, 10 Dec 2009 00:51:13 +0000 (00:51 +0000)
  This adds BF_RAYOPTIMIZATION_SSE_FLAGS through which one can manage
  what SSE flags are best for the platform built for.

  Note that the ray optimizations coded by jaguarandi are SSE-intrinsics only.

config/darwin-config.py
config/linux2-config.py
config/win32-mingw-config.py
config/win32-vc-config.py
config/win64-vc-config.py
source/blender/render/SConscript
tools/btools.py

index 55cb5d6a253f3f715023cb99cf0e9330a9750cb9..049fe62f3b0390a6a48eaff2863ba73c9a7000ae 100644 (file)
@@ -270,6 +270,14 @@ BF_PCRE_LIBPATH = '${BF_PCRE}/lib'
 #BF_EXPAT_LIB = 'expat'
 #BF_EXPAT_LIBPATH = '/usr/lib'
 
+#Ray trace optimization
+WITH_BF_RAYOPTIMIZATION = False
+if MACOSX_ARCHITECTURE == 'i386':
+    BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse']
+elif MACOSX_ARCHITECTURE == 'x86_64':
+    BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse','-msse2']
+    
+
 #############################################################################
 ###################  various compile settings and flags    ##################
 #############################################################################
index 3e40b7af4162473d2a03d09dcfcfff52f12623e0..abe79ba5806e72eb8e9ee5c37e7f793870638e82 100644 (file)
@@ -167,6 +167,10 @@ BF_EXPAT_LIBPATH = '/usr/lib'
 
 WITH_BF_OPENMP = True
 
+#Ray trace optimization
+WITH_BF_RAYOPTIMIZATION = False
+BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse','-pthread']
+
 ##
 CC = 'gcc'
 CXX = 'g++'
index 7973ae930b4c495e6468441f2633e721b4b1fad9..00c70aaaf1fe76862cecef2aa3e42897c644dc3b 100644 (file)
@@ -137,6 +137,10 @@ BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include'
 BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver xml2 pcre'
 BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib'
 
+#Ray trace optimization
+WITH_BF_RAYOPTIMIZATION = False
+BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse']
+
 ##
 CC = 'gcc'
 CXX = 'g++'
index 60463a07a329003d43240d6dfe7389ab45617896..f18ed3e20074e7612755a8337cb89c692b752afb 100644 (file)
@@ -148,6 +148,10 @@ BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include'
 BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver xml2 pcre'
 BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib'
 
+#Ray trace optimization
+WITH_BF_RAYOPTIMIZATION = False
+BF_RAYOPTIMIZATION_SSE_FLAGS = ['/arch:SSE']
+
 WITH_BF_STATICOPENGL = False
 BF_OPENGL_INC = '${BF_OPENGL}/include'
 BF_OPENGL_LIBINC = '${BF_OPENGL}/lib'
@@ -155,6 +159,7 @@ BF_OPENGL_LIB = 'opengl32 glu32'
 BF_OPENGL_LIB_STATIC = [ '${BF_OPENGL}/lib/libGL.a', '${BF_OPENGL}/lib/libGLU.a',
                          '${BF_OPENGL}/lib/libXmu.a', '${BF_OPENGL}/lib/libXext.a',
                          '${BF_OPENGL}/lib/libX11.a', '${BF_OPENGL}/lib/libXi.a' ]
+                         
 CC = 'cl.exe'
 CXX = 'cl.exe'
 
index 53df6d96bf8e5fae77145ccba5b95e41614e01c5..457640507da03a964c1dfd4a30450e35ca551bc9 100644 (file)
@@ -161,6 +161,10 @@ BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include'
 BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver xml2 pcre'
 BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib'
 
+#Ray trace optimization
+WITH_BF_RAYOPTIMIZATION = False
+BF_RAYOPTIMIZATION_SSE_FLAGS = ['/arch:SSE','/arch:SSE2']
+
 WITH_BF_STATICOPENGL = False
 BF_OPENGL_INC = '${BF_OPENGL}/include'
 BF_OPENGL_LIBINC = '${BF_OPENGL}/lib'
index 2642d31bd35f1f50abb9382fd3f090e04159bb13..71c60e046cc1d66cfca99892da98433b20f44474 100644 (file)
@@ -4,18 +4,28 @@ Import ('env')
 cflags = env['CCFLAGS']
 cxxflags = env['CXXFLAGS']
 
+defs = []
+
 if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
     if env['WITH_BF_RAYOPTIMIZATION']:
-        cflags = env['CCFLAGS'] + ['/arch:SSE']
+        cflags = env['CCFLAGS'] + env['BF_RAYOPTIMIZATION_SSE_FLAGS']
+        cxxflags = env['CCFLAGS'] + env['BF_RAYOPTIMIZATION_SSE_FLAGS']
 
 if env['OURPLATFORM'] == 'win32-mingw':
     if env['WITH_BF_RAYOPTIMIZATION']:
-        cflags = env['CCFLAGS'] + ['-mfpmath=sse']
+        cflags = env['CCFLAGS'] + env['BF_RAYOPTIMIZATION_SSE_FLAGS']
+        cxxflags = env['CXXFLAGS'] + env['BF_RAYOPTIMIZATION_SSE_FLAGS']
 
 if env['OURPLATFORM'] == 'darwin':
     if env['MACOSX_ARCHITECTURE'] in ('i386', 'x86_64') and env['WITH_BF_RAYOPTIMIZATION']:
-        cflags = env['CFLAGS'] + ['-mfpmath=sse']
-        cxxflags = env['CXXFLAGS'] + ['-mfpmath=sse']
+        cflags = env['CFLAGS'] + env['BF_RAYOPTIMIZATION_SSE_FLAGS']
+        cxxflags = env['CXXFLAGS'] + env['BF_RAYOPTIMIZATION_SSE_FLAGS']
+        
+if env['OURPLATFORM'] == 'linux2':
+    if env['WITH_BF_RAYOPTIMIZATION']:
+        cflags = env['CCFLAGS'] +  env['BF_RAYOPTIMIZATION_SSE_FLAGS']
+        cxxflags = env['CXXFLAGS'] +  env['BF_RAYOPTIMIZATION_SSE_FLAGS']
+    incs += ' ../../../extern/binreloc/include'
 
 sources = env.Glob('intern/source/*.c')
 raysources = env.Glob('intern/raytrace/*.cpp')
@@ -24,8 +34,6 @@ incs = 'intern/include #/intern/guardedalloc ../blenlib ../makesdna ../makesrna'
 incs += ' extern/include ../blenkernel ../radiosity/extern/include ../imbuf'
 incs += ' ../include ../blenloader ../../../intern/smoke/extern'
 
-defs = []
-
 if env['WITH_BF_QUICKTIME']:
     defs.append('WITH_QUICKTIME')
     incs += ' ../quicktime ' + env['BF_QUICKTIME_INC']
@@ -33,15 +41,6 @@ if env['WITH_BF_QUICKTIME']:
 if env['WITH_BF_OPENEXR']:
     defs.append('WITH_OPENEXR')
 
-if env['OURPLATFORM'] == 'linux2':
-#    SSE is NOT safe all the time on linux, plus that ignores users compile flags and therefore no no
-#    cflags = ['-O2','-msse2','-mfpmath=sse', '-pthread']
-#    cxxflags = ['-O2','-msse2','-mfpmath=sse', '-pthread']
-    if env['WITH_BF_RAYOPTIMIZATION']:
-        cflags = env['CCFLAGS'] +  ['-O2','-msse2','-mfpmath=sse', '-pthread']
-        cxxflags = env['CXXFLAGS'] +  ['-O2','-msse2','-mfpmath=sse', '-pthread']
-    incs += ' ../../../extern/binreloc/include'
-
 if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
     incs += ' ' + env['BF_PTHREADS_INC']
 
index d5cc8a543b4356d58db9aef9120b8f9e9f593a01..556cb9b901a94d8232459bac9295491ae12a7ffa 100755 (executable)
@@ -76,7 +76,8 @@ def validate_arguments(args, bc):
             'WITH_BF_FHS',
             'BF_VERSION',
             'BF_GHOST_DEBUG',
-            'WITH_BF_RAYOPTIMIZATION'
+            'WITH_BF_RAYOPTIMIZATION',
+            'BF_RAYOPTIMIZATION_SSE_FLAGS'
             ]
     
     # Have options here that scons expects to be lists
@@ -423,7 +424,9 @@ def read_opts(cfg, args):
         (BoolVariable('BF_UNIT_TEST', 'Build with unit test support.', False)),
         
         (BoolVariable('BF_GHOST_DEBUG', 'Make GHOST print events and info to stdout. (very verbose)', False)),
-        (BoolVariable('WITH_BF_RAYOPTIMIZATION', 'Enable raytracer SSE/SIMD optimization.', False))
+        
+        (BoolVariable('WITH_BF_RAYOPTIMIZATION', 'Enable raytracer SSE/SIMD optimization.', False)),
+        ('BF_RAYOPTIMIZATION_SSE_FLAGS', 'SSE flags', '')
     ) # end of opts.AddOptions()
 
     return localopts