Merging r57518 through r57545 from trunk into soc-20133-depsgraph_mt
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 18 Jun 2013 11:33:13 +0000 (11:33 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 18 Jun 2013 11:33:13 +0000 (11:33 +0000)
29 files changed:
CMakeLists.txt
build_files/cmake/macros.cmake
intern/cycles/CMakeLists.txt
intern/cycles/SConscript
intern/cycles/blender/addon/properties.py
intern/cycles/blender/addon/ui.py
intern/cycles/blender/blender_shader.cpp
intern/cycles/bvh/bvh.cpp
intern/cycles/kernel/kernel_bvh.h
intern/cycles/kernel/kernel_bvh_traversal.h
intern/cycles/kernel/kernel_emission.h
intern/cycles/kernel/kernel_shader.h
intern/cycles/kernel/kernel_sse3.cpp
intern/cycles/kernel/kernel_types.h
intern/cycles/render/light.cpp
intern/cycles/render/object.cpp
intern/cycles/render/osl.cpp
intern/cycles/render/shader.cpp
intern/cycles/render/shader.h
intern/cycles/render/svm.cpp
intern/cycles/util/util_types.h
release/scripts/modules/bl_i18n_utils/settings.py
release/scripts/startup/bl_ui/space_view3d.py
source/blender/blenlib/BLI_utildefines.h
source/blender/editors/interface/interface_widgets.c
source/blender/editors/transform/transform_conversions.c
source/creator/CMakeLists.txt
source/gameengine/Ketsji/KX_KetsjiEngine.cpp
source/gameengine/Ketsji/KX_KetsjiEngine.h

index 39b75d9a32b46d95af316474542b41c859ac05b5..16d00dd4b54d1af544e9fdbf7b60f03ad87838dc 100644 (file)
@@ -1124,26 +1124,22 @@ elseif(WIN32)
                                ${OPENCOLLADA}/include/opencollada/COLLADASaxFrameworkLoader
                                ${OPENCOLLADA}/include/opencollada/GeneratedSaxParser
                        )
-                       set_lib_path(OPENCOLLADA_LIBPATH "opencollada")
 
                        set(OPENCOLLADA_LIBRARIES
-                               ${OPENCOLLADA_LIBPATH}/lib/opencollada/OpenCOLLADASaxFrameworkLoader.lib
-                               ${OPENCOLLADA_LIBPATH}/lib/opencollada/OpenCOLLADAFramework.lib
-                               ${OPENCOLLADA_LIBPATH}/lib/opencollada/OpenCOLLADABaseUtils.lib
-                               ${OPENCOLLADA_LIBPATH}/lib/opencollada/OpenCOLLADAStreamWriter.lib
-                               ${OPENCOLLADA_LIBPATH}/lib/opencollada/MathMLSolver.lib
-                               ${OPENCOLLADA_LIBPATH}/lib/opencollada/GeneratedSaxParser.lib
-                               ${OPENCOLLADA_LIBPATH}/lib/opencollada/xml.lib
-                               ${OPENCOLLADA_LIBPATH}/lib/opencollada/buffer.lib
-                               ${OPENCOLLADA_LIBPATH}/lib/opencollada/ftoa.lib
-                               ${OPENCOLLADA_LIBPATH}/lib/opencollada/UTF.lib
+                               ${OPENCOLLADA}/lib/opencollada/OpenCOLLADASaxFrameworkLoader.lib
+                               ${OPENCOLLADA}/lib/opencollada/OpenCOLLADAFramework.lib
+                               ${OPENCOLLADA}/lib/opencollada/OpenCOLLADABaseUtils.lib
+                               ${OPENCOLLADA}/lib/opencollada/OpenCOLLADAStreamWriter.lib
+                               ${OPENCOLLADA}/lib/opencollada/MathMLSolver.lib
+                               ${OPENCOLLADA}/lib/opencollada/GeneratedSaxParser.lib
+                               ${OPENCOLLADA}/lib/opencollada/xml.lib
+                               ${OPENCOLLADA}/lib/opencollada/buffer.lib
+                               ${OPENCOLLADA}/lib/opencollada/ftoa.lib
+                               ${OPENCOLLADA}/lib/opencollada/UTF.lib
                        )
                        set(PCRE_LIBRARIES
-                               ${OPENCOLLADA_LIBPATH}/lib/opencollada/pcre.lib
+                               ${OPENCOLLADA}/lib/opencollada/pcre.lib
                        )
-                       
-                       unset(OPENCOLLADA_LIBPATH)
-                       
                endif()
 
                if(WITH_CODEC_FFMPEG)
@@ -1172,7 +1168,7 @@ elseif(WIN32)
                endif()
 
                if(WITH_IMAGE_OPENEXR)
-                       set_lib_path(OPENEXR "openexr")
+                       set(OPENEXR ${LIBDIR}/openexr)
                        set(OPENEXR_INCLUDE_DIR ${OPENEXR}/include)
                        set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR)
                        set(OPENEXR_LIBPATH ${OPENEXR}/lib)
@@ -1199,18 +1195,11 @@ elseif(WIN32)
                endif()
 
                if(WITH_PYTHON)
-                       # normally cached but not since we include them with blender
-                       if(MSVC10)
-                               set(PYTHON_VERSION 3.3) # CACHE STRING)
-                       else()
-                               set(PYTHON_VERSION 3.3) # CACHE STRING)
-                       endif()
+                       set(PYTHON_VERSION 3.3) # CACHE STRING)
 
-                       set_lib_path(PYTHON "python")
                        string(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
                        # Use shared libs for vc2008 and vc2010 until we actually have vc2010 libs
                        set(PYTHON_LIBRARY ${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}.lib)
-                       # set(PYTHON_LIBRARY ${PYTHON}/lib/python${_PYTHON_VERSION_NO_DOTS}.lib) #CACHE FILEPATH
                        unset(_PYTHON_VERSION_NO_DOTS)
 
                        # Shared includes for both vc2008 and vc2010
@@ -1228,10 +1217,6 @@ elseif(WIN32)
                                set(BOOST_LIBPATH ${BOOST}/lib)
                                set(BOOST_POSTFIX "vc110-mt-s-1_53.lib")
                                set(BOOST_DEBUG_POSTFIX "vc110-mt-sgd-1_53.lib")
-                       elseif(MSVC10)
-                               set(BOOST_LIBPATH ${BOOST}/vc2010/lib)
-                               set(BOOST_POSTFIX "vc100-mt-s-1_49.lib")
-                               set(BOOST_DEBUG_POSTFIX "vc100-mt-sgd-1_49.lib")
                        else()
                                set(BOOST_LIBPATH ${BOOST}/lib)
                                set(BOOST_POSTFIX "vc90-mt-s-1_49.lib")
@@ -2084,13 +2069,6 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
 
 endif()
 
-# MSVC2010 fails to links C++ libs right
-if(MSVC10)
-       if(WITH_OPENCOLLADA)
-               message(WARNING "MSVC 2010 does not support OpenCollada, disabling WITH_OPENCOLLADA. To enable support use Use MSVC 2008")
-       endif()
-endif()
-
 # ensure python header is found since detection can fail, this could happen
 # with _any_ library but since we used a fixed python version this tends to
 # be most problematic.
index 2b5cfbc31ccb542e9dfb5e396e8261088d43836b..b1dd76fbd14eceab83cf2fd25ecca48f4c01e444 100644 (file)
@@ -751,17 +751,6 @@ function(delayed_do_install
        endif()
 endfunction()
 
-macro(set_lib_path
-               lvar
-               lproj)
-
-       if(MSVC10)
-               set(${lvar} ${LIBDIR}/${lproj}/vc2010)
-       else()
-               set(${lvar} ${LIBDIR}/${lproj})
-       endif()
-endmacro()
-
 
 macro(data_to_c
       file_from file_to
index 226218ae512f4bcdd5aaa9f8c8c3e82731a55f88..9f067bede33b0aa4144167525e9b9f19d8a041b4 100644 (file)
@@ -18,7 +18,7 @@ if(WIN32 AND MSVC)
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:fast -D_CRT_SECURE_NO_WARNINGS /EHsc")
 elseif(CMAKE_COMPILER_IS_GNUCC)
        set(CYCLES_SSE2_KERNEL_FLAGS "-ffast-math -msse -msse2 -mfpmath=sse")
-       set(CYCLES_SSE3_KERNEL_FLAGS "-ffast-math -msse -msse2 -msse3 -mfpmath=sse")
+       set(CYCLES_SSE3_KERNEL_FLAGS "-ffast-math -msse -msse2 -msse3 -mssse3 -mfpmath=sse")
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math")
 endif()
 
index a7a4bc22dea9904fc2e728b14e479d48666dfa1c..43f838157b9f2823a3bfcaece9c4210614b1689b 100644 (file)
@@ -86,7 +86,7 @@ if env['WITH_BF_RAYOPTIMIZATION']:
         sse3_cxxflags.append('-D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc'.split())
     else:
         sse2_cxxflags.append('-ffast-math -msse -msse2 -mfpmath=sse'.split())
-        sse3_cxxflags.append('-ffast-math -msse -msse2 -msse3 -mfpmath=sse'.split())
+        sse3_cxxflags.append('-ffast-math -msse -msse2 -msse3 -mssse3 -mfpmath=sse'.split())
     
     defs.append('WITH_OPTIMIZED_KERNEL')
     optim_defs = defs[:]
index 0c6cf9f513a2dd0f8a3af9e06c6b63ebeb7636b8..b94dd32fad0116536674ebadc725540a065eedf9 100644 (file)
@@ -504,6 +504,12 @@ class CyclesMaterialSettings(bpy.types.PropertyGroup):
                             "objects that emit little light compared to other light sources",
                 default=True,
                 )
+        cls.use_transparent_shadow = BoolProperty(
+                name="Transparent Shadows",
+                description="Use transparent shadows for this material if it contains a Transparent BSDF"
+                            "disabling will render faster but not give accurate shadows",
+                default=True,
+                )
         cls.homogeneous_volume = BoolProperty(
                 name="Homogeneous Volume",
                 description="When using volume rendering, assume volume has the same density everywhere, "
index a30622a36ac4b542d9ec67c0d37fc0ae7229acf3..e9f8a4f0a8d19d8f42e59ced6e87cf43f9a06e7f 100644 (file)
@@ -919,6 +919,7 @@ class CyclesMaterial_PT_settings(CyclesButtonsPanel, Panel):
 
         col = split.column()
         col.prop(mat, "pass_index")
+        col.prop(cmat, "use_transparent_shadow")
 
         layout.prop(cmat, "sample_as_light")
 
index a9db10b21d77d426a9f6f8f526c1c54d6e51112b..923f9b1e726d2ed3a029f815fcac6ca7fbd4eef9 100644 (file)
@@ -860,7 +860,8 @@ void BlenderSync::sync_materials(bool update_all)
 
                        /* settings */
                        PointerRNA cmat = RNA_pointer_get(&b_mat->ptr, "cycles");
-                       shader->sample_as_light = get_boolean(cmat, "sample_as_light");
+                       shader->use_mis = get_boolean(cmat, "sample_as_light");
+                       shader->use_transparent_shadow = get_boolean(cmat, "use_transparent_shadow");
                        shader->homogeneous_volume = get_boolean(cmat, "homogeneous_volume");
 
                        shader->set_graph(graph);
index 82a444bda76662c87552706abf7d0426d11bcab4..69ccf2588c9969396c63ef25934082d5aa62e54e 100644 (file)
@@ -552,9 +552,9 @@ void RegularBVH::pack_node(int idx, const BoundBox& b0, const BoundBox& b1, int
 {
        int4 data[BVH_NODE_SIZE] =
        {
-               make_int4(__float_as_int(b0.min.x), __float_as_int(b0.max.x), __float_as_int(b0.min.y), __float_as_int(b0.max.y)),
-               make_int4(__float_as_int(b1.min.x), __float_as_int(b1.max.x), __float_as_int(b1.min.y), __float_as_int(b1.max.y)),
-               make_int4(__float_as_int(b0.min.z), __float_as_int(b0.max.z), __float_as_int(b1.min.z), __float_as_int(b1.max.z)),
+               make_int4(__float_as_int(b0.min.x), __float_as_int(b1.min.x), __float_as_int(b0.max.x), __float_as_int(b1.max.x)),
+               make_int4(__float_as_int(b0.min.y), __float_as_int(b1.min.y), __float_as_int(b0.max.y), __float_as_int(b1.max.y)),
+               make_int4(__float_as_int(b0.min.z), __float_as_int(b1.min.z), __float_as_int(b0.max.z), __float_as_int(b1.max.z)),
                make_int4(c0, c1, visibility0, visibility1)
        };
 
index ae9677ed5cbd266e588386b4d575418148d83d26..9f6d79e13fbb209d726bb920d62bc42e80760c2d 100644 (file)
@@ -112,80 +112,8 @@ __device_inline void bvh_instance_motion_pop(KernelGlobals *kg, int object, cons
 }
 #endif
 
-/* intersect two bounding boxes */
-#ifdef __HAIR__
-__device_inline void bvh_node_intersect(KernelGlobals *kg,
-       bool *traverseChild0, bool *traverseChild1,
-       bool *closestChild1, int *nodeAddr0, int *nodeAddr1,
-       float3 P, float3 idir, float t, uint visibility, int nodeAddr, float difl, float extmax)
-{
-#else
-__device_inline void bvh_node_intersect(KernelGlobals *kg,
-       bool *traverseChild0, bool *traverseChild1,
-       bool *closestChild1, int *nodeAddr0, int *nodeAddr1,
-       float3 P, float3 idir, float t, uint visibility, int nodeAddr)
-{
-#endif
-
-       /* fetch node data */
-       float4 n0xy = kernel_tex_fetch(__bvh_nodes, nodeAddr*BVH_NODE_SIZE+0);
-       float4 n1xy = kernel_tex_fetch(__bvh_nodes, nodeAddr*BVH_NODE_SIZE+1);
-       float4 nz = kernel_tex_fetch(__bvh_nodes, nodeAddr*BVH_NODE_SIZE+2);
-       float4 cnodes = kernel_tex_fetch(__bvh_nodes, nodeAddr*BVH_NODE_SIZE+3);
-
-       /* intersect ray against child nodes */
-       float3 ood = P * idir;
-       NO_EXTENDED_PRECISION float c0lox = n0xy.x * idir.x - ood.x;
-       NO_EXTENDED_PRECISION float c0hix = n0xy.y * idir.x - ood.x;
-       NO_EXTENDED_PRECISION float c0loy = n0xy.z * idir.y - ood.y;
-       NO_EXTENDED_PRECISION float c0hiy = n0xy.w * idir.y - ood.y;
-       NO_EXTENDED_PRECISION float c0loz = nz.x * idir.z - ood.z;
-       NO_EXTENDED_PRECISION float c0hiz = nz.y * idir.z - ood.z;
-       NO_EXTENDED_PRECISION float c0min = max4(min(c0lox, c0hix), min(c0loy, c0hiy), min(c0loz, c0hiz), 0.0f);
-       NO_EXTENDED_PRECISION float c0max = min4(max(c0lox, c0hix), max(c0loy, c0hiy), max(c0loz, c0hiz), t);
-
-       NO_EXTENDED_PRECISION float c1loz = nz.z * idir.z - ood.z;
-       NO_EXTENDED_PRECISION float c1hiz = nz.w * idir.z - ood.z;
-       NO_EXTENDED_PRECISION float c1lox = n1xy.x * idir.x - ood.x;
-       NO_EXTENDED_PRECISION float c1hix = n1xy.y * idir.x - ood.x;
-       NO_EXTENDED_PRECISION float c1loy = n1xy.z * idir.y - ood.y;
-       NO_EXTENDED_PRECISION float c1hiy = n1xy.w * idir.y - ood.y;
-       NO_EXTENDED_PRECISION float c1min = max4(min(c1lox, c1hix), min(c1loy, c1hiy), min(c1loz, c1hiz), 0.0f);
-       NO_EXTENDED_PRECISION float c1max = min4(max(c1lox, c1hix), max(c1loy, c1hiy), max(c1loz, c1hiz), t);
-
-#ifdef __HAIR__
-       if(difl != 0.0f) {
-               float hdiff = 1.0f + difl;
-               float ldiff = 1.0f - difl;
-               if(__float_as_int(cnodes.z) & PATH_RAY_CURVE) {
-                       c0min = max(ldiff * c0min, c0min - extmax);
-                       c0max = min(hdiff * c0max, c0max + extmax);
-               }
-               if(__float_as_int(cnodes.w) & PATH_RAY_CURVE) {
-                       c1min = max(ldiff * c1min, c1min - extmax);
-                       c1max = min(hdiff * c1max, c1max + extmax);
-               }
-       }
-#endif
-
-       /* decide which nodes to traverse next */
-#ifdef __VISIBILITY_FLAG__
-       /* this visibility test gives a 5% performance hit, how to solve? */
-       *traverseChild0 = (c0max >= c0min) && (__float_as_uint(cnodes.z) & visibility);
-       *traverseChild1 = (c1max >= c1min) && (__float_as_uint(cnodes.w) & visibility);
-#else
-       *traverseChild0 = (c0max >= c0min);
-       *traverseChild1 = (c1max >= c1min);
-#endif
-
-       *nodeAddr0 = __float_as_int(cnodes.x);
-       *nodeAddr1 = __float_as_int(cnodes.y);
-
-       *closestChild1 = (c1min < c0min);
-}
-
 /* Sven Woop's algorithm */
-__device_inline void bvh_triangle_intersect(KernelGlobals *kg, Intersection *isect,
+__device_inline bool bvh_triangle_intersect(KernelGlobals *kg, Intersection *isect,
        float3 P, float3 idir, uint visibility, int object, int triAddr)
 {
        /* compute and check intersection t-value */
@@ -223,10 +151,13 @@ __device_inline void bvh_triangle_intersect(KernelGlobals *kg, Intersection *ise
                                        isect->u = u;
                                        isect->v = v;
                                        isect->t = t;
+                                       return true;
                                }
                        }
                }
        }
+
+       return false;
 }
 
 #ifdef __HAIR__
@@ -280,7 +211,7 @@ __device_inline void curvebounds(float *lower, float *upper, float *extremta, fl
        }
 }
 
-__device_inline void bvh_cardinal_curve_intersect(KernelGlobals *kg, Intersection *isect,
+__device_inline bool bvh_cardinal_curve_intersect(KernelGlobals *kg, Intersection *isect,
        float3 P, float3 idir, uint visibility, int object, int curveAddr, int segment, uint *lcg_state, float difl, float extmax)
 {
        float epsilon = 0.0f;
@@ -346,7 +277,7 @@ __device_inline void bvh_cardinal_curve_intersect(KernelGlobals *kg, Intersectio
        float zextrem[4];
        curvebounds(&lower, &upper, &zextrem[0], &zextrem[1], &zextrem[2], &zextrem[3], curve_coef[0].z, curve_coef[1].z, curve_coef[2].z, curve_coef[3].z);
        if(lower - r_curr > isect->t || upper + r_curr < epsilon)
-               return;
+               return false;
 
        /*minimum width extension*/
        float mw_extension = min(difl * fabsf(upper), extmax);
@@ -355,17 +286,18 @@ __device_inline void bvh_cardinal_curve_intersect(KernelGlobals *kg, Intersectio
        float xextrem[4];
        curvebounds(&lower, &upper, &xextrem[0], &xextrem[1], &xextrem[2], &xextrem[3], curve_coef[0].x, curve_coef[1].x, curve_coef[2].x, curve_coef[3].x);
        if(lower > r_ext || upper < -r_ext)
-               return;
+               return false;
 
        float yextrem[4];
        curvebounds(&lower, &upper, &yextrem[0], &yextrem[1], &yextrem[2], &yextrem[3], curve_coef[0].y, curve_coef[1].y, curve_coef[2].y, curve_coef[3].y);
        if(lower > r_ext || upper < -r_ext)
-               return;
+               return false;
 
        /*setup recurrent loop*/
        int level = 1 << depth;
        int tree = 0;
        float resol = 1.0f / (float)level;
+       bool hit = false;
 
        /*begin loop*/
        while(!(tree >> (depth))) {
@@ -557,7 +489,7 @@ __device_inline void bvh_cardinal_curve_intersect(KernelGlobals *kg, Intersectio
                        /*stochastic fade from minimum width*/
                        if(lcg_state && coverage != 1.0f) {
                                if(lcg_step(lcg_state) > coverage)
-                                       return;
+                                       return hit;
                        }
 
 #ifdef __VISIBILITY_FLAG__
@@ -574,6 +506,7 @@ __device_inline void bvh_cardinal_curve_intersect(KernelGlobals *kg, Intersectio
                                isect->v = 0.0f;
                                /*isect->v = 1.0f - coverage; */
                                isect->t = t;
+                               hit = true;
                        }
                        
                        tree++;
@@ -584,9 +517,11 @@ __device_inline void bvh_cardinal_curve_intersect(KernelGlobals *kg, Intersectio
                        level = level >> 1;
                }
        }
+
+       return hit;
 }
 
-__device_inline void bvh_curve_intersect(KernelGlobals *kg, Intersection *isect,
+__device_inline bool bvh_curve_intersect(KernelGlobals *kg, Intersection *isect,
        float3 P, float3 idir, uint visibility, int object, int curveAddr, int segment, uint *lcg_state, float difl, float extmax)
 {
        /* curve Intersection check */
@@ -630,7 +565,7 @@ __device_inline void bvh_curve_intersect(KernelGlobals *kg, Intersection *isect,
        sphere_b = dot(dir,sphere_dif);
        float sdisc = sphere_b * sphere_b - len_squared(sphere_dif) + sp_r * sp_r;
        if(sdisc < 0.0f)
-               return;
+               return false;
 
        /* obtain parameters and test midpoint distance for suitable modes*/
        float3 tg = (p2 - p1) / l;
@@ -645,9 +580,9 @@ __device_inline void bvh_curve_intersect(KernelGlobals *kg, Intersection *isect,
        float zcentre = difz + (dirz * tcentre);
 
        if((tcentre > isect->t) && !(flags & CURVE_KN_ACCURATE))
-               return;
+               return false;
        if((zcentre < 0 || zcentre > l) && !(flags & CURVE_KN_ACCURATE) && !(flags & CURVE_KN_INTERSECTCORRECTION))
-               return;
+               return false;
 
        /* test minimum separation*/
        float3 cprod = cross(tg, dir);
@@ -662,7 +597,7 @@ __device_inline void bvh_curve_intersect(KernelGlobals *kg, Intersection *isect,
                distscaled = (distscaled*distscaled)/cprodsq;
 
        if(distscaled > mr*mr)
-               return;
+               return false;
 
        /* calculate true intersection*/
        float3 tdif = P - p1 + tcentre * dir;
@@ -672,7 +607,7 @@ __device_inline void bvh_curve_intersect(KernelGlobals *kg, Intersection *isect,
        float td = tb*tb - 4*a*tc;
 
        if (td < 0.0f)
-               return;
+               return false;
 
        float rootd = 0.0f;
        float correction = 0.0f;
@@ -706,7 +641,7 @@ __device_inline void bvh_curve_intersect(KernelGlobals *kg, Intersection *isect,
                adjradius = adjradius / (r1 + z * gd);
                if(lcg_state && adjradius != 1.0f) {
                        if(lcg_step(lcg_state) > adjradius)
-                               return;
+                               return false;
                }
                /* --- */
 
@@ -719,7 +654,7 @@ __device_inline void bvh_curve_intersect(KernelGlobals *kg, Intersection *isect,
                                        float a2 = 1.0f - (dirz*dirz*(1 + gd*gd*enc_ratio*enc_ratio));
                                        float c2 = dot(dif,dif) - difz * difz * (1 + gd*gd*enc_ratio*enc_ratio) - r1*r1*enc_ratio*enc_ratio - 2*r1*difz*gd*enc_ratio;
                                        if(a2*c2 < 0.0f)
-                                               return;
+                                               return false;
                                }
                        }
 
@@ -740,9 +675,13 @@ __device_inline void bvh_curve_intersect(KernelGlobals *kg, Intersection *isect,
 
                                if(backface) 
                                        isect->u = -isect->u;
+                               
+                               return true;
                        }
                }
        }
+
+       return false;
 }
 #endif
 
@@ -751,7 +690,7 @@ __device_inline void bvh_curve_intersect(KernelGlobals *kg, Intersection *isect,
  * only want to intersect with primitives in the same object, and if case of
  * multiple hits we pick a single random primitive as the intersection point. */
 
-__device_inline void bvh_triangle_intersect_subsurface(KernelGlobals *kg, Intersection *isect,
+__device_inline bool bvh_triangle_intersect_subsurface(KernelGlobals *kg, Intersection *isect,
        float3 P, float3 idir, int object, int triAddr, float tmax, int *num_hits, float subsurface_random)
 {
        /* compute and check intersection t-value */
@@ -786,10 +725,13 @@ __device_inline void bvh_triangle_intersect_subsurface(KernelGlobals *kg, Inters
                                        isect->u = u;
                                        isect->v = v;
                                        isect->t = t;
+                                       return true;
                                }
                        }
                }
        }
+
+       return false;
 }
 #endif
 
index 2d75af32abd0117079c9a2a6218b26ad5eb6f316..9fd466a67310f430aa4a5297caa243f7f3d9da6d 100644 (file)
@@ -1,6 +1,8 @@
 /*
- * Adapted from code Copyright 2009-2010 NVIDIA Corporation
- * Modifications Copyright 2011, Blender Foundation.
+ * Adapted from code Copyright 2009-2010 NVIDIA Corporation,
+ * and code copyright 2009-2012 Intel Corporation
+ *
+ * Modifications Copyright 2011-2013, Blender Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -41,6 +43,14 @@ __device bool BVH_FUNCTION_NAME
 #endif
 )
 {
+       /* todo:
+        * - test if pushing distance on the stack helps (for non shadow rays)
+        * - separate version for shadow rays
+        * - likely and unlikely for if() statements
+        * - SSE for hair
+        * - test restrict attribute for pointers
+        */
+       
        /* traversal stack in CUDA thread-local memory */
        int traversalStack[BVH_STACK_SIZE];
        traversalStack[0] = ENTRYPOINT_SENTINEL;
@@ -70,6 +80,28 @@ __device bool BVH_FUNCTION_NAME
        isect->u = 0.0f;
        isect->v = 0.0f;
 
+#if defined(__KERNEL_SSE3__) && !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);
+
+       const __m128i pn = _mm_set_epi32(0x80000000, 0x80000000, 0x00000000, 0x00000000);
+       __m128 Psplat[3], idirsplat[3];
+
+       Psplat[0] = _mm_set_ps1(P.x);
+       Psplat[1] = _mm_set_ps1(P.y);
+       Psplat[2] = _mm_set_ps1(P.z);
+
+       idirsplat[0] = _mm_xor_ps(_mm_set_ps1(idir.x), _mm_castsi128_ps(pn));
+       idirsplat[1] = _mm_xor_ps(_mm_set_ps1(idir.y), _mm_castsi128_ps(pn));
+       idirsplat[2] = _mm_xor_ps(_mm_set_ps1(idir.z), _mm_castsi128_ps(pn));
+
+       __m128 tsplat = _mm_set_ps(-isect->t, -isect->t, 0.0f, 0.0f);
+
+       __m128i shufflex = (idir.x >= 0)? shuffle_identity: shuffle_swap;
+       __m128i shuffley = (idir.y >= 0)? shuffle_identity: shuffle_swap;
+       __m128i shufflez = (idir.z >= 0)? shuffle_identity: shuffle_swap;
+#endif
+
        /* traversal loop */
        do {
                do
@@ -77,46 +109,121 @@ __device bool BVH_FUNCTION_NAME
                        /* traverse internal nodes */
                        while(nodeAddr >= 0 && nodeAddr != ENTRYPOINT_SENTINEL)
                        {
-                               bool traverseChild0, traverseChild1, closestChild1;
+                               bool traverseChild0, traverseChild1;
                                int nodeAddrChild1;
+                               float t = isect->t;
+
+#if !defined(__KERNEL_SSE3__) || FEATURE(BVH_HAIR_MINIMUM_WIDTH)
+                               /* Intersect two child bounding boxes, non-SSE version */
+
+                               /* fetch node data */
+                               float4 node0 = kernel_tex_fetch(__bvh_nodes, nodeAddr*BVH_NODE_SIZE+0);
+                               float4 node1 = kernel_tex_fetch(__bvh_nodes, nodeAddr*BVH_NODE_SIZE+1);
+                               float4 node2 = kernel_tex_fetch(__bvh_nodes, nodeAddr*BVH_NODE_SIZE+2);
+                               float4 cnodes = kernel_tex_fetch(__bvh_nodes, nodeAddr*BVH_NODE_SIZE+3);
+
+                               /* intersect ray against child nodes */
+                               NO_EXTENDED_PRECISION float c0lox = (node0.x - P.x) * idir.x;
+                               NO_EXTENDED_PRECISION float c0hix = (node0.z - P.x) * idir.x;
+                               NO_EXTENDED_PRECISION float c0loy = (node1.x - P.y) * idir.y;
+                               NO_EXTENDED_PRECISION float c0hiy = (node1.z - P.y) * idir.y;
+                               NO_EXTENDED_PRECISION float c0loz = (node2.x - P.z) * idir.z;
+                               NO_EXTENDED_PRECISION float c0hiz = (node2.z - P.z) * idir.z;
+                               NO_EXTENDED_PRECISION float c0min = max4(min(c0lox, c0hix), min(c0loy, c0hiy), min(c0loz, c0hiz), 0.0f);
+                               NO_EXTENDED_PRECISION float c0max = min4(max(c0lox, c0hix), max(c0loy, c0hiy), max(c0loz, c0hiz), t);
+
+                               NO_EXTENDED_PRECISION float c1lox = (node0.y - P.x) * idir.x;
+                               NO_EXTENDED_PRECISION float c1hix = (node0.w - P.x) * idir.x;
+                               NO_EXTENDED_PRECISION float c1loy = (node1.y - P.y) * idir.y;
+                               NO_EXTENDED_PRECISION float c1hiy = (node1.w - P.y) * idir.y;
+                               NO_EXTENDED_PRECISION float c1loz = (node2.y - P.z) * idir.z;
+                               NO_EXTENDED_PRECISION float c1hiz = (node2.w - P.z) * idir.z;
+                               NO_EXTENDED_PRECISION float c1min = max4(min(c1lox, c1hix), min(c1loy, c1hiy), min(c1loz, c1hiz), 0.0f);
+                               NO_EXTENDED_PRECISION float c1max = min4(max(c1lox, c1hix), max(c1loy, c1hiy), max(c1loz, c1hiz), t);
 
 #if FEATURE(BVH_HAIR_MINIMUM_WIDTH) && !FEATURE(BVH_SUBSURFACE)
-                               bvh_node_intersect(kg, &traverseChild0, &traverseChild1,
-                                       &closestChild1, &nodeAddr, &nodeAddrChild1,
-                                       P, idir, isect->t, visibility, nodeAddr, difl, extmax);
+                               if(difl != 0.0f) {
+                                       float hdiff = 1.0f + difl;
+                                       float ldiff = 1.0f - difl;
+                                       if(__float_as_int(cnodes.z) & PATH_RAY_CURVE) {
+                                               c0min = max(ldiff * c0min, c0min - extmax);
+                                               c0max = min(hdiff * c0max, c0max + extmax);
+                                       }
+                                       if(__float_as_int(cnodes.w) & PATH_RAY_CURVE) {
+                                               c1min = max(ldiff * c1min, c1min - extmax);
+                                               c1max = min(hdiff * c1max, c1max + extmax);
+                                       }
+                               }
+#endif
+
+                               /* decide which nodes to traverse next */
+#ifdef __VISIBILITY_FLAG__
+                               /* this visibility test gives a 5% performance hit, how to solve? */
+                               traverseChild0 = (c0max >= c0min) && (__float_as_uint(cnodes.z) & visibility);
+                               traverseChild1 = (c1max >= c1min) && (__float_as_uint(cnodes.w) & visibility);
 #else
-                               bvh_node_intersect(kg, &traverseChild0, &traverseChild1,
-                                       &closestChild1, &nodeAddr, &nodeAddrChild1,
-#ifdef __HAIR__
-                                       P, idir, isect->t, visibility, nodeAddr, 0.0f, 0.0f);
+                               traverseChild0 = (c0max >= c0min);
+                               traverseChild1 = (c1max >= c1min);
+#endif
+
+#else // __KERNEL_SSE3__
+                               /* Intersect two child bounding boxes, SSE3 version adapted from Embree */
+
+                               /* fetch node data */
+                               __m128 *bvh_nodes = (__m128*)kg->__bvh_nodes.data + nodeAddr*BVH_NODE_SIZE;
+                               float4 cnodes = ((float4*)bvh_nodes)[3];
+
+                               /* intersect ray against child nodes */
+                               const __m128 tminmaxx = _mm_mul_ps(_mm_sub_ps(shuffle8(bvh_nodes[0], shufflex), Psplat[0]), idirsplat[0]);
+                               const __m128 tminmaxy = _mm_mul_ps(_mm_sub_ps(shuffle8(bvh_nodes[1], shuffley), Psplat[1]), idirsplat[1]);
+                               const __m128 tminmaxz = _mm_mul_ps(_mm_sub_ps(shuffle8(bvh_nodes[2], shufflez), Psplat[2]), idirsplat[2]);
+
+                               const __m128 tminmax = _mm_xor_ps(_mm_max_ps(_mm_max_ps(tminmaxx, tminmaxy), _mm_max_ps(tminmaxz, tsplat)), _mm_castsi128_ps(pn));
+                               const __m128 lrhit = _mm_cmple_ps(tminmax, shuffle8(tminmax, shuffle_swap));
+
+                               /* decide which nodes to traverse next */
+#ifdef __VISIBILITY_FLAG__
+                               /* this visibility test gives a 5% performance hit, how to solve? */
+                               traverseChild0 = (_mm_movemask_ps(lrhit) & 1) && (__float_as_uint(cnodes.z) & visibility);
+                               traverseChild1 = (_mm_movemask_ps(lrhit) & 2) && (__float_as_uint(cnodes.w) & visibility);
 #else
-                                       P, idir, isect->t, visibility, nodeAddr);
+                               traverseChild0 = (_mm_movemask_ps(lrhit) & 1);
+                               traverseChild1 = (_mm_movemask_ps(lrhit) & 2);
 #endif
+#endif // __KERNEL_SSE3__
+
+                               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)
+                                       bool closestChild1 = (c1min < c0min);
+#else
+                                       union { __m128 m128; float v[4]; } uminmax;
+                                       uminmax.m128 = tminmax;
+                                       bool closestChild1 = uminmax.v[1] < uminmax.v[0];
 #endif
 
-                               if(traverseChild0 != traverseChild1) {
-                                       /* one child was intersected */
-                                       if(traverseChild1) {
+                                       if(closestChild1) {
+                                               int tmp = nodeAddr;
                                                nodeAddr = nodeAddrChild1;
+                                               nodeAddrChild1 = tmp;
                                        }
+
+                                       ++stackPtr;
+                                       traversalStack[stackPtr] = nodeAddrChild1;
                                }
                                else {
-                                       if(!traverseChild0) {
+                                       /* one child was intersected */
+                                       if(traverseChild1) {
+                                               nodeAddr = nodeAddrChild1;
+                                       }
+                                       else if(!traverseChild0) {
                                                /* neither child was intersected */
                                                nodeAddr = traversalStack[stackPtr];
                                                --stackPtr;
                                        }
-                                       else {
-                                               /* both children were intersected, push the farther one */
-                                               if(closestChild1) {
-                                                       int tmp = nodeAddr;
-                                                       nodeAddr = nodeAddrChild1;
-                                                       nodeAddrChild1 = tmp;
-                                               }
-
-                                               ++stackPtr;
-                                               traversalStack[stackPtr] = nodeAddrChild1;
-                                       }
                                }
                        }
 
@@ -136,6 +243,7 @@ __device bool BVH_FUNCTION_NAME
 
                                        /* primitive intersection */
                                        while(primAddr < primAddr2) {
+                                               bool hit;
 #if FEATURE(BVH_SUBSURFACE)
                                                /* only primitives from the same object */
                                                uint tri_object = (object == ~0)? kernel_tex_fetch(__prim_object, primAddr): object;
@@ -148,15 +256,16 @@ __device bool BVH_FUNCTION_NAME
                                                        uint segment = kernel_tex_fetch(__prim_segment, primAddr);
 #if !FEATURE(BVH_SUBSURFACE)
                                                        if(segment != ~0) {
+
                                                                if(kernel_data.curve_kernel_data.curveflags & CURVE_KN_INTERPOLATE) 
 #if FEATURE(BVH_HAIR_MINIMUM_WIDTH)
-                                                                       bvh_cardinal_curve_intersect(kg, isect, P, idir, visibility, object, primAddr, segment, lcg_state, difl, extmax);
+                                                                       hit = bvh_cardinal_curve_intersect(kg, isect, P, idir, visibility, object, primAddr, segment, lcg_state, difl, extmax);
                                                                else
-                                                                       bvh_curve_intersect(kg, isect, P, idir, visibility, object, primAddr, segment, lcg_state, difl, extmax);
+                                                                       hit = bvh_curve_intersect(kg, isect, P, idir, visibility, object, primAddr, segment, lcg_state, difl, extmax);
 #else
-                                                                       bvh_cardinal_curve_intersect(kg, isect, P, idir, visibility, object, primAddr, segment);
+                                                                       hit = bvh_cardinal_curve_intersect(kg, isect, P, idir, visibility, object, primAddr, segment);
                                                                else
-                                                                       bvh_curve_intersect(kg, isect, P, idir, visibility, object, primAddr, segment);
+                                                                       hit = bvh_curve_intersect(kg, isect, P, idir, visibility, object, primAddr, segment);
 #endif
                                                        }
                                                        else
@@ -166,15 +275,25 @@ __device bool BVH_FUNCTION_NAME
 #if FEATURE(BVH_HAIR)
                                                        if(segment == ~0)
 #endif
-                                                               bvh_triangle_intersect_subsurface(kg, isect, P, idir, object, primAddr, tmax, &num_hits, subsurface_random);
+                                                               hit = bvh_triangle_intersect_subsurface(kg, isect, P, idir, object, primAddr, tmax, &num_hits, subsurface_random);
 
                                                }
 #else
-                                                               bvh_triangle_intersect(kg, isect, P, idir, visibility, object, primAddr);
+                                                               hit = bvh_triangle_intersect(kg, isect, P, idir, visibility, object, primAddr);
 
                                                        /* shadow ray early termination */
-                                                       if(visibility == PATH_RAY_SHADOW_OPAQUE && isect->prim != ~0)
+#if defined(__KERNEL_SSE3__) && !FEATURE(BVH_HAIR_MINIMUM_WIDTH)
+                                                       if(hit) {
+                                                               if(visibility == PATH_RAY_SHADOW_OPAQUE)
+                                                                       return true;
+
+                                                               tsplat = _mm_set_ps(-isect->t, -isect->t, 0.0f, 0.0f);
+                                                       }
+#else
+                                                       if(hit && visibility == PATH_RAY_SHADOW_OPAQUE)
                                                                return true;
+#endif
+
 #endif
 
                                                primAddr++;
@@ -196,6 +315,22 @@ __device bool BVH_FUNCTION_NAME
                                                bvh_instance_push(kg, object, ray, &P, &idir, &isect->t, tmax);
 #endif
 
+#if defined(__KERNEL_SSE3__) && !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);
+
+                                               idirsplat[0] = _mm_xor_ps(_mm_set_ps1(idir.x), _mm_castsi128_ps(pn));
+                                               idirsplat[1] = _mm_xor_ps(_mm_set_ps1(idir.y), _mm_castsi128_ps(pn));
+                                               idirsplat[2] = _mm_xor_ps(_mm_set_ps1(idir.z), _mm_castsi128_ps(pn));
+
+                                               tsplat = _mm_set_ps(-isect->t, -isect->t, 0.0f, 0.0f);
+
+                                               shufflex = (idir.x >= 0)? shuffle_identity: shuffle_swap;
+                                               shuffley = (idir.y >= 0)? shuffle_identity: shuffle_swap;
+                                               shufflez = (idir.z >= 0)? shuffle_identity: shuffle_swap;
+#endif
+
                                                ++stackPtr;
                                                traversalStack[stackPtr] = ENTRYPOINT_SENTINEL;
 
@@ -223,6 +358,23 @@ __device bool BVH_FUNCTION_NAME
 #else
                        bvh_instance_pop(kg, object, ray, &P, &idir, &isect->t, tmax);
 #endif
+
+#if defined(__KERNEL_SSE3__) && !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);
+
+                       idirsplat[0] = _mm_xor_ps(_mm_set_ps1(idir.x), _mm_castsi128_ps(pn));
+                       idirsplat[1] = _mm_xor_ps(_mm_set_ps1(idir.y), _mm_castsi128_ps(pn));
+                       idirsplat[2] = _mm_xor_ps(_mm_set_ps1(idir.z), _mm_castsi128_ps(pn));
+
+                       tsplat = _mm_set_ps(-isect->t, -isect->t, 0.0f, 0.0f);
+
+                       shufflex = (idir.x >= 0)? shuffle_identity: shuffle_swap;
+                       shuffley = (idir.y >= 0)? shuffle_identity: shuffle_swap;
+                       shufflez = (idir.z >= 0)? shuffle_identity: shuffle_swap;
+#endif
+
                        object = ~0;
                        nodeAddr = traversalStack[stackPtr];
                        --stackPtr;
index c430a40d814f9dfdb9002b34ce1f2b53af8749ce..77dc59d2691fe4fed592e19141fe4007ad35f043 100644 (file)
@@ -168,9 +168,9 @@ __device_noinline float3 indirect_primitive_emission(KernelGlobals *kg, ShaderDa
        float3 L = shader_emissive_eval(kg, sd);
 
 #ifdef __HAIR__
-       if(!(path_flag & PATH_RAY_MIS_SKIP) && (sd->flag & SD_SAMPLE_AS_LIGHT) && (sd->segment == ~0)) {
+       if(!(path_flag & PATH_RAY_MIS_SKIP) && (sd->flag & SD_USE_MIS) && (sd->segment == ~0)) {
 #else
-       if(!(path_flag & PATH_RAY_MIS_SKIP) && (sd->flag & SD_SAMPLE_AS_LIGHT)) {
+       if(!(path_flag & PATH_RAY_MIS_SKIP) && (sd->flag & SD_USE_MIS)) {
 #endif
                /* multiple importance sampling, get triangle light pdf,
                 * and compute weight with respect to BSDF pdf */
index 347c066962aa1603024d0731bff3b477f75027ad..7e41ee35ae044f0fcb06adbf5ec6965b62a73441 100644 (file)
@@ -891,7 +891,7 @@ __device bool shader_transparent_shadow(KernelGlobals *kg, Intersection *isect)
 #endif
        int flag = kernel_tex_fetch(__shader_flag, (shader & SHADER_MASK)*2);
 
-       return (flag & SD_HAS_SURFACE_TRANSPARENT) != 0;
+       return (flag & SD_HAS_TRANSPARENT_SHADOW) != 0;
 }
 #endif
 
index 6982570c59bd497145f8d367f8a6626812205733..ccd3ee5ac74e4c23a5bb58812115b88ba160f8e6 100644 (file)
@@ -22,6 +22,8 @@
 
 #ifdef WITH_OPTIMIZED_KERNEL
 
+#define __KERNEL_SSE3__
+
 #include "kernel.h"
 #include "kernel_compat_cpu.h"
 #include "kernel_math.h"
index 6ae3b10595c505499c59e4115e6bd6fb219207c0..a9f1831fc7dbdf4b07d9017d2c6ee939e69e866f 100644 (file)
@@ -492,8 +492,8 @@ enum ShaderDataFlag {
        SD_CLOSURE_FLAGS = (SD_EMISSION|SD_BSDF|SD_BSDF_HAS_EVAL|SD_BSDF_GLOSSY|SD_BSSRDF|SD_HOLDOUT|SD_VOLUME|SD_AO),
 
        /* shader flags */
-       SD_SAMPLE_AS_LIGHT = 512,                       /* direct light sample */
-       SD_HAS_SURFACE_TRANSPARENT = 1024,      /* has surface transparency */
+       SD_USE_MIS = 512,                                       /* direct light sample */
+       SD_HAS_TRANSPARENT_SHADOW = 1024,       /* has transparent shadow */
        SD_HAS_VOLUME = 2048,                           /* has volume shader */
        SD_HOMOGENEOUS_VOLUME = 4096,           /* has homogeneous volume */
 
index 1d48ae8f87d098fd3887eb973e65c4431049486b..2f92b957929fb3c30350ff7927d50281e498a57f 100644 (file)
@@ -164,7 +164,7 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen
                foreach(uint sindex, mesh->used_shaders) {
                        Shader *shader = scene->shaders[sindex];
 
-                       if(shader->sample_as_light && shader->has_surface_emission) {
+                       if(shader->use_mis && shader->has_surface_emission) {
                                have_emission = true;
                                break;
                        }
@@ -175,7 +175,7 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen
                        for(size_t i = 0; i < mesh->triangles.size(); i++) {
                                Shader *shader = scene->shaders[mesh->shader[i]];
 
-                               if(shader->sample_as_light && shader->has_surface_emission)
+                               if(shader->use_mis && shader->has_surface_emission)
                                        num_triangles++;
                        }
 
@@ -184,7 +184,7 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen
                        foreach(Mesh::Curve& curve, mesh->curves) {
                                Shader *shader = scene->shaders[curve.shader];
 
-                               if(shader->sample_as_light && shader->has_surface_emission)
+                               if(shader->use_mis && shader->has_surface_emission)
                                        num_curve_segments += curve.num_segments();
 #endif
                }
@@ -215,7 +215,7 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen
                foreach(uint sindex, mesh->used_shaders) {
                        Shader *shader = scene->shaders[sindex];
 
-                       if(shader->sample_as_light && shader->has_surface_emission) {
+                       if(shader->use_mis && shader->has_surface_emission) {
                                have_emission = true;
                                break;
                        }
@@ -247,7 +247,7 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen
                        for(size_t i = 0; i < mesh->triangles.size(); i++) {
                                Shader *shader = scene->shaders[mesh->shader[i]];
 
-                               if(shader->sample_as_light && shader->has_surface_emission) {
+                               if(shader->use_mis && shader->has_surface_emission) {
                                        distribution[offset].x = totarea;
                                        distribution[offset].y = __int_as_float(i + mesh->tri_offset);
                                        distribution[offset].z = __int_as_float(shader_id);
@@ -277,7 +277,7 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen
                                Shader *shader = scene->shaders[curve.shader];
                                int first_key = curve.first_key;
 
-                               if(shader->sample_as_light && shader->has_surface_emission) {
+                               if(shader->use_mis && shader->has_surface_emission) {
                                        for(int j = 0; j < curve.num_segments(); j++) {
                                                distribution[offset].x = totarea;
                                                distribution[offset].y = __int_as_float(i + mesh->curve_offset); // XXX fix kernel code
index 1a2780995e3dc0b7bdb370decc1137a46e2a637a..7931a51b99d94dfe1faa659dc0a56a2f47182dd5 100644 (file)
@@ -127,7 +127,7 @@ void Object::tag_update(Scene *scene)
                foreach(uint sindex, mesh->used_shaders) {
                        Shader *shader = scene->shaders[sindex];
 
-                       if(shader->sample_as_light && shader->has_surface_emission)
+                       if(shader->use_mis && shader->has_surface_emission)
                                scene->light_manager->need_update = true;
                }
        }
index 8efc6b553e01bf31f72885e216b9823cc840adf0..52e4c697ba800968e2492d269022f8549095d24e 100644 (file)
@@ -100,7 +100,7 @@ void OSLShaderManager::device_update(Device *device, DeviceScene *dscene, Scene
                compiler.background = (shader == scene->shaders[scene->default_background]);
                compiler.compile(og, shader);
 
-               if(shader->sample_as_light && shader->has_surface_emission)
+               if(shader->use_mis && shader->has_surface_emission)
                        scene->light_manager->need_update = true;
        }
 
index b061e869e2f34682a8c51c7aed3e444ea3fbde16..da6c3566f6990dca8cc6814a438cfa69b5bf3640 100644 (file)
@@ -42,7 +42,8 @@ Shader::Shader()
        graph = NULL;
        graph_bump = NULL;
 
-       sample_as_light = true;
+       use_mis = true;
+       use_transparent_shadow = true;
        homogeneous_volume = false;
 
        has_surface = false;
@@ -88,7 +89,7 @@ void Shader::tag_update(Scene *scene)
        /* if the shader previously was emissive, update light distribution,
         * if the new shader is emissive, a light manager update tag will be
         * done in the shader manager device update. */
-       if(sample_as_light && has_surface_emission)
+       if(use_mis && has_surface_emission)
                scene->light_manager->need_update = true;
 
        /* get requested attributes. this could be optimized by pruning unused
@@ -220,10 +221,10 @@ void ShaderManager::device_update_common(Device *device, DeviceScene *dscene, Sc
        foreach(Shader *shader, scene->shaders) {
                uint flag = 0;
 
-               if(shader->sample_as_light)
-                       flag |= SD_SAMPLE_AS_LIGHT;
-               if(shader->has_surface_transparent)
-                       flag |= SD_HAS_SURFACE_TRANSPARENT;
+               if(shader->use_mis)
+                       flag |= SD_USE_MIS;
+               if(shader->has_surface_transparent && shader->use_transparent_shadow)
+                       flag |= SD_HAS_TRANSPARENT_SHADOW;
                if(shader->has_volume)
                        flag |= SD_HAS_VOLUME;
                if(shader->homogeneous_volume)
index 2a9f119846754d1a935e5f4341ee6b5c492028ea..8810017068bff577f6354b12cb933caf73a1af0a 100644 (file)
@@ -62,7 +62,8 @@ public:
        ShaderGraph *graph_bump;
 
        /* sampling */
-       bool sample_as_light;
+       bool use_mis;
+       bool use_transparent_shadow;
        bool homogeneous_volume;
 
        /* synchronization */
index f61f9ca0fe381d7c84b5e27bbfccef0a2b1e9670..3e211a3ee24f723aab7a4a2172518fe094f8af11 100644 (file)
@@ -74,7 +74,7 @@ void SVMShaderManager::device_update(Device *device, DeviceScene *dscene, Scene
 
                assert(shader->graph);
 
-               if(shader->sample_as_light && shader->has_surface_emission)
+               if(shader->use_mis && shader->has_surface_emission)
                        scene->light_manager->need_update = true;
 
                SVMCompiler compiler(scene->shader_manager, scene->image_manager,
index 472a707d8fd752f39f3beac479bce52ee397696a..d4ff95b06632bf6b763e26eeb54f215f5df047b3 100644 (file)
 #include <tmmintrin.h> /* SSE 3 */
 #include <smmintrin.h> /* SSE 4 */
 
+#ifndef __KERNEL_SSE2__
 #define __KERNEL_SSE2__
+#endif
+
+#ifndef __KERNEL_SSE3__
 #define __KERNEL_SSE3__
+#endif
+
+#ifndef __KERNEL_SSE4__
 #define __KERNEL_SSE4__
+#endif
 
 #else
 
-#ifdef __x86_64__
+#if defined(__x86_64__) || defined(__KERNEL_SSE3__)
 
 /* MinGW64 has conflicting declarations for these SSE headers in <windows.h>.
  * Since we can't avoid including <windows.h>, better only include that */
 #else
 #include <xmmintrin.h> /* SSE 1 */
 #include <emmintrin.h> /* SSE 2 */
+
+#ifdef __KERNEL_SSE3__
+#include <pmmintrin.h> /* SSE 3 */
+#include <tmmintrin.h> /* SSE 3 */
+#endif
 #endif
 
+#ifndef __KERNEL_SSE2__
 #define __KERNEL_SSE2__
+#endif
 
 #endif
 
@@ -471,6 +486,46 @@ __device_inline int4 make_int4(const float3& f)
 
 #endif
 
+#ifdef __KERNEL_SSE3__
+
+/* SSE shuffle utility functions */
+
+__device_inline const __m128 shuffle8(const __m128& a, const __m128i& shuf)
+{
+       return _mm_castsi128_ps(_mm_shuffle_epi8(_mm_castps_si128(a), shuf));
+}
+
+template<size_t i0, size_t i1, size_t i2, size_t i3> __device_inline const __m128 shuffle(const __m128& a, const __m128& b)
+{
+       return _mm_shuffle_ps(a, b, _MM_SHUFFLE(i3, i2, i1, i0));
+}
+
+template<size_t i0, size_t i1, size_t i2, size_t i3> __device_inline const __m128 shuffle(const __m128& b)
+{
+       return _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(b), _MM_SHUFFLE(i3, i2, i1, i0)));
+}
+#endif
+
+#if defined(__KERNEL_SSE2__) && defined(_MSC_VER)
+
+/* count zeros from start or end of integer bits */
+
+__device_inline uint32_t __builtin_ctz(uint32_t i)
+{
+       unsigned long r = 0;
+       _BitScanForward(&r, i);
+       return (uint32_t)r;
+}
+
+__device_inline uint32_t __builtin_clz(uint32_t i)
+{
+       unsigned long r = 0;
+       _BitScanReverse(&r, i);
+       return (uint32_t)r;
+}
+
+#endif
+
 CCL_NAMESPACE_END
 
 #endif /* __UTIL_TYPES_H__ */
index 4ca4c18cc7b60a16a20acb94b6b145edf0526c4d..001f044f1c4fed015899dc0bd4c226248bf88821 100644 (file)
@@ -101,7 +101,7 @@ IMPORT_MIN_LEVEL = 0.0
 
 # Languages in /branches we do not want to import in /trunk currently...
 IMPORT_LANGUAGES_SKIP = {
-    'am_ET', 'bg_BG', 'fi_FI', 'el_GR', 'et_EE', 'ne_NP', 'nl_NL', 'pl_PL', 'ro_RO', 'uz_UZ', 'uz_UZ@cyrillic',
+    'am_ET', 'bg_BG', 'fi_FI', 'el_GR', 'et_EE', 'ne_NP', 'pl_PL', 'ro_RO', 'uz_UZ', 'uz_UZ@cyrillic',
 }
 
 # Languages that need RTL pre-processing.
index b8cbd0580638a01bb3287a916ada35dd9958ed7a..e0449931fc9a01177accfa5cd842af83f4021d4a 100644 (file)
@@ -966,26 +966,30 @@ class VIEW3D_MT_object_specials(Menu):
             if scene.render.use_shading_nodes:
                 try:
                     value = lamp.node_tree.nodes["Emission"].inputs["Strength"].default_value
+                except AttributeError:
+                    value = None
 
+                if value is not None:
                     props = layout.operator("wm.context_modal_mouse", text="Strength")
                     props.data_path_iter = "selected_editable_objects"
                     props.data_path_item = "data.node_tree.nodes[\"Emission\"].inputs[\"Strength\"].default_value"
                     props.header_text = "Lamp Strength: %.3f"
                     props.input_scale = 0.1
-                except AttributeError:
-                    pass
+                del value
 
-                if lamp.type == 'AREA' and lamp.shape == 'RECTANGLE':
+                if lamp.type == 'AREA':
                     props = layout.operator("wm.context_modal_mouse", text="Size X")
                     props.data_path_iter = "selected_editable_objects"
                     props.data_path_item = "data.size"
                     props.header_text = "Lamp Size X: %.3f"
 
-                    props = layout.operator("wm.context_modal_mouse", text="Size Y")
-                    props.data_path_iter = "selected_editable_objects"
-                    props.data_path_item = "data.size"
-                    props.header_text = "Lamp Size Y: %.3f"
-                elif lamp.type in  {'SPOT', 'AREA', 'POINT', 'SUN'}:
+                    if lamp.shape == 'RECTANGLE':
+                        props = layout.operator("wm.context_modal_mouse", text="Size Y")
+                        props.data_path_iter = "selected_editable_objects"
+                        props.data_path_item = "data.size_y"
+                        props.header_text = "Lamp Size Y: %.3f"
+
+                elif lamp.type in  {'SPOT', 'POINT', 'SUN'}:
                     props = layout.operator("wm.context_modal_mouse", text="Size")
                     props.data_path_iter = "selected_editable_objects"
                     props.data_path_item = "data.shadow_soft_size"
index 224d02163cb5bec20690ac2c7412f2bfccf85e27..4d80080ed86e308c29b0916197cc3c02e4a48c4c 100644 (file)
 #define STACK_PUSH(stack, val)  (void)((stack)[(_##stack##_index)++] = val)
 #define STACK_PUSH_RET(stack)  ((void)stack, ((stack)[(_##stack##_index)++]))
 #define STACK_PUSH_RET_PTR(stack)  ((void)stack, &((stack)[(_##stack##_index)++]))
-#define STACK_POP(stack)         ((_##stack##_index) ? ((stack)[--(_##stack##_index)]) : NULL)
-#define STACK_POP_ELSE(stack, r) ((_##stack##_index) ? ((stack)[--(_##stack##_index)]) : r)
+#define STACK_POP(stack)         ((_##stack##_index) ?  ((stack)[--(_##stack##_index)]) : NULL)
+#define STACK_POP_PTR(stack)     ((_##stack##_index) ? &((stack)[--(_##stack##_index)]) : NULL)
+#define STACK_POP_ELSE(stack, r) ((_##stack##_index) ?  ((stack)[--(_##stack##_index)]) : r)
 #define STACK_FREE(stack)      ((void)stack)
+#ifdef __GNUC__
+#define STACK_SWAP(stack_a, stack_b) { \
+       SWAP(typeof(stack_a), stack_a, stack_b); \
+       SWAP(unsigned int, _##stack_a##_index, _##stack_b##_index); \
+       } (void)0
+#else
+#define STACK_SWAP(stack_a, stack_b) { \
+       SWAP(void *, stack_a, stack_b); \
+       SWAP(unsigned int, _##stack_a##_index, _##stack_b##_index); \
+       } (void)0
+#endif
 
 /* array helpers */
 #define ARRAY_LAST_ITEM(arr_start, arr_dtype, elem_size, tot) \
index 00eabad729ea176bdc0575a64ee50e8e12de1c44..d8efb972ce9a15161876d73dc6c103dc73b598e7 100644 (file)
@@ -2286,8 +2286,7 @@ static void ui_draw_separator(const rcti *rect,  uiWidgetColors *wcol)
 }
 
 /* ************ button callbacks, draw ***************** */
-
-static void widget_numbut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
+static void widget_numbut_draw(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign, bool emboss)
 {
        uiWidgetBase wtb;
        const float rad = 0.5f * BLI_rcti_size_y(rect);
@@ -2298,9 +2297,10 @@ static void widget_numbut(uiWidgetColors *wcol, rcti *rect, int state, int round
        
        widget_init(&wtb);
        
-       /* fully rounded */
-       round_box_edges(&wtb, roundboxalign, rect, rad);
-       
+       if (!emboss) {
+               round_box_edges(&wtb, roundboxalign, rect, rad);
+       }
+
        /* decoration */
        if (!(state & UI_TEXTINPUT)) {
                widget_num_tria(&wtb.tria1, rect, 0.6f, 'l');
@@ -2314,6 +2314,19 @@ static void widget_numbut(uiWidgetColors *wcol, rcti *rect, int state, int round
        rect->xmax -= textofs;
 }
 
+static void widget_numbut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
+{
+       widget_numbut_draw(wcol, rect, state, roundboxalign, false);
+}
+
+/*
+ * Draw number buttons still with triangles when field is not embossed
+*/
+static void widget_numbut_embossn(uiBut *UNUSED(but), uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
+{
+       widget_numbut_draw(wcol, rect, state, roundboxalign, true);
+}
+
 int ui_link_bezier_points(const rcti *rect, float coord_array[][2], int resol)
 {
        float dist, vec[4][2];
@@ -2671,7 +2684,7 @@ static void widget_normal(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUS
        ui_draw_but_NORMAL(but, wcol, rect);
 }
 
-static void widget_icon_has_anim(uiBut *UNUSED(but), uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign))
+static void widget_icon_has_anim(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
 {
        if (state & (UI_BUT_ANIMATED | UI_BUT_ANIMATED_KEY | UI_BUT_DRIVEN | UI_BUT_REDALERT)) {
                uiWidgetBase wtb;
@@ -2685,6 +2698,11 @@ static void widget_icon_has_anim(uiBut *UNUSED(but), uiWidgetColors *wcol, rcti
                round_box_edges(&wtb, UI_CNR_ALL, rect, rad);
                widgetbase_draw(&wtb, wcol);
        }
+       else if (but->type == NUM) {
+               /* Draw number buttons still with left/right 
+                * triangles when field is not embossed */
+               widget_numbut_embossn(but, wcol, rect, state, roundboxalign);
+       }
 }
 
 
index d8f763c6a54afa9aabe095b9ad80d937a52edc0c..ac5727a116c659c60cd9772a5967717a7afaeabe 100644 (file)
@@ -196,7 +196,7 @@ static void sort_trans_data(TransInfo *t)
 
 /* distance calculated from not-selected vertex to nearest selected vertex
  * warning; this is loops inside loop, has minor N^2 issues, but by sorting list it is OK */
-static void set_prop_dist(TransInfo *t, short with_dist)
+static void set_prop_dist(TransInfo *t, const bool with_dist)
 {
        TransData *tob;
        int a;
@@ -216,12 +216,9 @@ static void set_prop_dist(TransInfo *t, short with_dist)
                                if (td->flag & TD_SELECTED) {
                                        sub_v3_v3v3(vec, tob->center, td->center);
                                        mul_m3_v3(tob->mtx, vec);
-                                       dist = normalize_v3(vec);
-                                       if (tob->rdist == -1.0f) {
-                                               tob->rdist = dist;
-                                       }
-                                       else if (dist < tob->rdist) {
-                                               tob->rdist = dist;
+                                       dist = len_squared_v3(vec);
+                                       if ((tob->rdist == -1.0f) || (dist < (tob->rdist * tob->rdist))) {
+                                               tob->rdist = sqrtf(dist);
                                        }
                                }
                                else {
@@ -1778,90 +1775,125 @@ void flushTransParticles(TransInfo *t)
 
 /* ********************* mesh ****************** */
 
-/* I did this wrong, it should be a breadth-first search
- * but instead it's a depth-first search, fudged
- * to report shortest distances.  I have no idea how fast
- * or slow this is. */
-static void editmesh_set_connectivity_distance(BMEditMesh *em, float mtx[3][3], float *dists)
+static bool bmesh_test_dist_add(BMVert *v, BMVert *v_other,
+                                float *dists, const float *dists_prev,
+                                float mtx[3][3])
 {
-       BMVert **queue = NULL;
-       float *dqueue = NULL;
-       int *tots = MEM_callocN(sizeof(int) * em->bm->totvert, "tots editmesh_set_connectivity_distance");
-       BLI_array_declare(queue);
-       BLI_array_declare(dqueue);
-       SmallHash svisit, *visit = &svisit;
-       BMVert *v;
-       BMIter viter;
-       int i, start;
-       
-       fill_vn_fl(dists, em->bm->totvert, FLT_MAX);
+       if ((BM_elem_flag_test(v_other, BM_ELEM_SELECT) == 0) &&
+           (BM_elem_flag_test(v_other, BM_ELEM_HIDDEN) == 0))
+       {
+               const int i = BM_elem_index_get(v);
+               const int i_other = BM_elem_index_get(v_other);
+               float vec[3];
+               float dist_other;
+               sub_v3_v3v3(vec, v->co, v_other->co);
+               mul_m3_v3(mtx, vec);
+
+               dist_other = dists_prev[i] + len_v3(vec);
+               if (dist_other < dists[i_other]) {
+                       dists[i_other] = dist_other;
+                       return true;
+               }
+       }
 
-       BM_mesh_elem_index_ensure(em->bm, BM_VERT);
+       return false;
+}
 
-       BLI_smallhash_init(visit);
+static void editmesh_set_connectivity_distance(BMesh *bm, float mtx[3][3], float *dists)
+{
+       /* need to be very careful of feedback loops here, store previous dist's to avoid feedback */
+       float *dists_prev = MEM_mallocN(bm->totvert * sizeof(float), __func__);
 
-       BM_ITER_MESH (v, &viter, em->bm, BM_VERTS_OF_MESH) {
-               if (BM_elem_flag_test(v, BM_ELEM_SELECT) == 0 || BM_elem_flag_test(v, BM_ELEM_HIDDEN))
-                       continue;
-                       
-               
-               BLI_smallhash_insert(visit, (uintptr_t)v, NULL);
-               BLI_array_append(queue, v);
-               BLI_array_append(dqueue, 0.0f);
-               dists[BM_elem_index_get(v)] = 0.0f;
+       BMVert **queue = MEM_mallocN(bm->totvert * sizeof(BMVert *), __func__);
+       STACK_DECLARE(queue);
+
+       /* any BM_ELEM_TAG'd vertex is in 'queue_next', so we don't add in twice */
+       BMVert **queue_next = MEM_mallocN(bm->totvert * sizeof(BMVert *), __func__);
+       STACK_DECLARE(queue_next);
+
+       STACK_INIT(queue);
+       STACK_INIT(queue_next);
+
+       {
+               BMIter viter;
+               BMVert *v;
+               int i;
+
+               BM_ITER_MESH_INDEX (v, &viter, bm, BM_VERTS_OF_MESH, i) {
+                       BM_elem_index_set(v, i); /* set_inline */
+                       BM_elem_flag_disable(v, BM_ELEM_TAG);
+
+                       if (BM_elem_flag_test(v, BM_ELEM_SELECT) == 0 || BM_elem_flag_test(v, BM_ELEM_HIDDEN)) {
+                               dists[i] = FLT_MAX;
+                       }
+                       else {
+                               STACK_PUSH(queue, v);
+
+                               dists[i] = 0.0f;
+                       }
+               }
        }
-       
-       start = 0;
-       while (start < BLI_array_count(queue)) {
-               BMIter eiter;
-               BMEdge *e;
-               BMVert *v3, *v2;
-               float d, vec[3];
-               
-               v2 = queue[start];
-               d = dqueue[start];
-               
-               BM_ITER_ELEM (e, &eiter, v2, BM_EDGES_OF_VERT) {
-                       float d2;
-                       v3 = BM_edge_other_vert(e, v2);
-                       
-                       if (BM_elem_flag_test(v3, BM_ELEM_SELECT) || BM_elem_flag_test(v3, BM_ELEM_HIDDEN))
-                               continue;
-                       
-                       sub_v3_v3v3(vec, v2->co, v3->co);
-                       mul_m3_v3(mtx, vec);
-                       
-                       d2 = d + len_v3(vec);
-                       
-                       if (dists[BM_elem_index_get(v3)] != FLT_MAX)
-                               dists[BM_elem_index_get(v3)] = min_ff(d2, dists[BM_elem_index_get(v3)]);
-                       else
-                               dists[BM_elem_index_get(v3)] = d2;
-                       
-                       tots[BM_elem_index_get(v3)] = 1;
 
-                       if (BLI_smallhash_haskey(visit, (uintptr_t)v3))
-                               continue;
-                       
-                       BLI_smallhash_insert(visit, (uintptr_t)v3, NULL);
+       do {
+               BMVert *v;
+               unsigned int i;
+
+               memcpy(dists_prev, dists, sizeof(float) * bm->totvert);
+
+               while ((v = STACK_POP(queue))) {
+                       BMIter iter;
+                       BMEdge *e;
+                       BMLoop *l;
+
+                       /* connected edge-verts */
+                       BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) {
+                               if (BM_elem_flag_test(e, BM_ELEM_HIDDEN) == 0) {
+                                       BMVert *v_other = BM_edge_other_vert(e, v);
+                                       if (bmesh_test_dist_add(v, v_other, dists, dists_prev, mtx)) {
+                                               if (BM_elem_flag_test(v_other, BM_ELEM_TAG) == 0) {
+                                                       BM_elem_flag_enable(v_other, BM_ELEM_TAG);
+                                                       STACK_PUSH(queue_next, v_other);
+                                               }
+                                       }
+                               }
+                       }
                        
-                       BLI_array_append(queue, v3);
-                       BLI_array_append(dqueue, d2);
+                       /* connected face-verts (excluding adjacent verts) */
+                       BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) {
+                               if ((BM_elem_flag_test(l->f, BM_ELEM_HIDDEN) == 0) && (l->f->len > 3)) {
+                                       BMLoop *l_end = l->prev;
+                                       l = l->next->next;
+                                       do {
+                                               BMVert *v_other = l->v;
+                                               if (bmesh_test_dist_add(v, v_other, dists, dists_prev, mtx)) {
+                                                       if (BM_elem_flag_test(v_other, BM_ELEM_TAG) == 0) {
+                                                               BM_elem_flag_enable(v_other, BM_ELEM_TAG);
+                                                               STACK_PUSH(queue_next, v_other);
+                                                       }
+                                               }
+                                       } while ((l = l->next) != l_end);
+                               }
+                       }
                }
-               
-               start++;
-       }
 
-       BLI_smallhash_release(visit);
-       
-       for (i = 0; i < em->bm->totvert; i++) {
-               if (tots[i])
-                       dists[i] /= (float)tots[i];
-       }
-       
-       BLI_array_free(queue);
-       BLI_array_free(dqueue);
-       MEM_freeN(tots);
+               /* clear for the next loop */
+               for (i = 0; i < STACK_SIZE(queue_next); i++) {
+                       BM_elem_flag_disable(queue_next[i], BM_ELEM_TAG);
+               }
+
+               STACK_SWAP(queue, queue_next);
+
+               /* none should be tagged now since 'queue_next' is empty */
+               BLI_assert(BM_iter_mesh_count_flag(BM_VERTS_OF_MESH, bm, BM_ELEM_TAG, true) == 0);
+
+       } while (STACK_SIZE(queue));
+
+       STACK_FREE(queue);
+       STACK_FREE(queue_next);
+
+       MEM_freeN(queue);
+       MEM_freeN(queue_next);
+       MEM_freeN(dists_prev);
 }
 
 static BMElem *bm_vert_single_select_face(BMVert *eve)
@@ -2099,7 +2131,7 @@ static void createTransEditVerts(TransInfo *t)
        pseudoinverse_m3_m3(smtx, mtx, PSEUDOINVERSE_EPSILON);
 
        if (propmode & T_PROP_CONNECTED) {
-               editmesh_set_connectivity_distance(em, mtx, dists);
+               editmesh_set_connectivity_distance(em->bm, mtx, dists);
        }
 
        /* detect CrazySpace [tm] */
index 7c744d10d63a9d7c0879bd86203ac596683106d0..8ff4ec445ea2e755239a9c830943a005bb72d37e 100644 (file)
@@ -488,18 +488,16 @@ elseif(WIN32)
        )
 
        if(WITH_PYTHON)
-               set_lib_path(PYLIB "python")
-
                string(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
 
                install(
-                       FILES ${PYLIB}/lib/python${_PYTHON_VERSION_NO_DOTS}.dll
+                       FILES ${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}.dll
                        DESTINATION ${TARGETDIR}
                        CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
                )
 
                install(
-                       FILES ${PYLIB}/lib/python${_PYTHON_VERSION_NO_DOTS}_d.dll
+                       FILES ${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}_d.dll
                        DESTINATION ${TARGETDIR}
                        CONFIGURATIONS Debug
                )
index 01b726a8e3f7e997030b7e3de65f7bec43c3e2cd..f02e842ad2e8bbbe65fddc257a06e99b0493beed 100644 (file)
@@ -1649,10 +1649,10 @@ void KX_KetsjiEngine::ConvertAndAddScene(const STR_String& scenename,bool overla
        }
        else {
                if (overlay) {
-                       m_addingOverlayScenes.insert(scenename);
+                       m_addingOverlayScenes.push_back(scenename);
                }
                else {
-                       m_addingBackgroundScenes.insert(scenename);
+                       m_addingBackgroundScenes.push_back(scenename);
                }
        }
 }
@@ -1664,7 +1664,7 @@ void KX_KetsjiEngine::RemoveScene(const STR_String& scenename)
 {
        if (FindScene(scenename))
        {
-               m_removingScenes.insert(scenename);
+               m_removingScenes.push_back(scenename);
        }
        else
        {
@@ -1679,7 +1679,7 @@ void KX_KetsjiEngine::RemoveScheduledScenes()
 {
        if (m_removingScenes.size())
        {
-               set<STR_String>::iterator scenenameit;
+               vector<STR_String>::iterator scenenameit;
                for (scenenameit=m_removingScenes.begin();scenenameit != m_removingScenes.end();scenenameit++)
                {
                        STR_String scenename = *scenenameit;
@@ -1725,7 +1725,7 @@ KX_Scene* KX_KetsjiEngine::CreateScene(const STR_String& scenename)
 
 void KX_KetsjiEngine::AddScheduledScenes()
 {
-       set<STR_String>::iterator scenenameit;
+       vector<STR_String>::iterator scenenameit;
 
        if (m_addingOverlayScenes.size())
        {
@@ -1761,7 +1761,7 @@ void KX_KetsjiEngine::AddScheduledScenes()
 
 void KX_KetsjiEngine::ReplaceScene(const STR_String& oldscene,const STR_String& newscene)
 {
-       m_replace_scenes.insert(std::make_pair(oldscene,newscene));
+       m_replace_scenes.push_back(std::make_pair(oldscene,newscene));
 }
 
 // replace scene is not the same as removing and adding because the
@@ -1772,7 +1772,7 @@ void KX_KetsjiEngine::ReplaceScheduledScenes()
 {
        if (m_replace_scenes.size())
        {
-               set<pair<STR_String,STR_String> >::iterator scenenameit;
+               vector<pair<STR_String,STR_String> >::iterator scenenameit;
                
                for (scenenameit = m_replace_scenes.begin();
                        scenenameit != m_replace_scenes.end();
index 0d7e41d7568a48218db60dc4a74e758ed927e3c2..3cba3558db30b5357bf821f639f84873a891731d 100644 (file)
@@ -41,7 +41,6 @@
 #include "KX_Python.h"
 #include "KX_WorldInfo.h"
 #include <vector>
-#include <set>
 
 class KX_TimeCategoryLogger;
 
@@ -88,13 +87,13 @@ private:
        class KX_Dome*                                          m_dome; // dome stereo mode
 
        /** Lists of scenes scheduled to be removed at the end of the frame. */
-       std::set<STR_String> m_removingScenes;
+       std::vector<STR_String> m_removingScenes;
        /** Lists of overley scenes scheduled to be added at the end of the frame. */
-       std::set<STR_String> m_addingOverlayScenes;
+       std::vector<STR_String> m_addingOverlayScenes;
        /** Lists of background scenes scheduled to be added at the end of the frame. */
-       std::set<STR_String> m_addingBackgroundScenes;
+       std::vector<STR_String> m_addingBackgroundScenes;
        /** Lists of scenes scheduled to be replaced at the end of the frame. */
-       std::set<std::pair<STR_String,STR_String> >     m_replace_scenes;
+       std::vector<std::pair<STR_String,STR_String> >  m_replace_scenes;
 
        /* The current list of scenes. */
        KX_SceneList            m_scenes;