Cycles code refactor: move geometry related kernel files into own directory.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Sat, 29 Mar 2014 12:03:45 +0000 (13:03 +0100)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Sat, 29 Mar 2014 12:03:45 +0000 (13:03 +0100)
intern/cycles/kernel/CMakeLists.txt
intern/cycles/kernel/SConscript
intern/cycles/kernel/geom/geom_bvh.h [moved from intern/cycles/kernel/kernel_bvh.h with 98% similarity]
intern/cycles/kernel/geom/geom_bvh_subsurface.h [moved from intern/cycles/kernel/kernel_bvh_subsurface.h with 100% similarity]
intern/cycles/kernel/geom/geom_bvh_traversal.h [moved from intern/cycles/kernel/kernel_bvh_traversal.h with 100% similarity]
intern/cycles/kernel/geom/geom_curve.h [moved from intern/cycles/kernel/kernel_curve.h with 100% similarity]
intern/cycles/kernel/geom/geom_object.h [moved from intern/cycles/kernel/kernel_object.h with 100% similarity]
intern/cycles/kernel/geom/geom_triangle.h [moved from intern/cycles/kernel/kernel_triangle.h with 100% similarity]
intern/cycles/kernel/kernel_path.h
intern/cycles/kernel/osl/osl_services.cpp
intern/cycles/kernel/osl/osl_shader.cpp

index ebeebe20c0f08cdae03f79ab925a2083c4f830fa..ccefb314894f1a03cf8fcc232e8f1e25c26f7ac3 100644 (file)
@@ -19,14 +19,10 @@ set(SRC
 set(SRC_HEADERS
        kernel.h
        kernel_accumulate.h
-       kernel_bvh.h
-       kernel_bvh_subsurface.h
-       kernel_bvh_traversal.h
        kernel_camera.h
        kernel_compat_cpu.h
        kernel_compat_cuda.h
        kernel_compat_opencl.h
-       kernel_curve.h
        kernel_differential.h
        kernel_displace.h
        kernel_emission.h
@@ -36,7 +32,6 @@ set(SRC_HEADERS
        kernel_light.h
        kernel_math.h
        kernel_montecarlo.h
-       kernel_object.h
        kernel_passes.h
        kernel_path.h
        kernel_path_state.h
@@ -47,7 +42,6 @@ set(SRC_HEADERS
        kernel_shadow.h
        kernel_subsurface.h
        kernel_textures.h
-       kernel_triangle.h
        kernel_types.h
        kernel_volume.h
 )
@@ -114,6 +108,15 @@ set(SRC_SVM_HEADERS
        svm/svm_wave.h
 )
 
+set(SRC_GEOM_HEADERS
+       geom/geom_bvh.h
+       geom/geom_bvh_subsurface.h
+       geom/geom_bvh_traversal.h
+       geom/geom_curve.h
+       geom/geom_object.h
+       geom/geom_triangle.h
+)
+
 set(SRC_UTIL_HEADERS
        ../util/util_color.h
        ../util/util_half.h
@@ -146,7 +149,7 @@ if(WITH_CYCLES_CUDA_BINARIES)
        endif()
 
        # build for each arch
-       set(cuda_sources kernel.cu ${SRC_HEADERS} ${SRC_SVM_HEADERS} ${SRC_CLOSURE_HEADERS} ${SRC_UTIL_HEADERS})
+       set(cuda_sources kernel.cu ${SRC_HEADERS} ${SRC_SVM_HEADERS} ${SRC_GEOM_HEADERS} ${SRC_CLOSURE_HEADERS} ${SRC_UTIL_HEADERS})
        set(cuda_cubins)
 
        foreach(arch ${CYCLES_CUDA_BINARIES_ARCH})
@@ -222,7 +225,7 @@ if(CXX_HAS_SSE)
 endif()
 
 
-add_library(cycles_kernel ${SRC} ${SRC_HEADERS} ${SRC_CLOSURE_HEADERS} ${SRC_SVM_HEADERS})
+add_library(cycles_kernel ${SRC} ${SRC_HEADERS} ${SRC_CLOSURE_HEADERS} ${SRC_SVM_HEADERS} ${SRC_GEOM_HEADERS})
 
 if(WITH_CYCLES_CUDA)
        add_dependencies(cycles_kernel cycles_kernel_cuda)
@@ -243,5 +246,6 @@ delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "kernel.cu" ${CYCLES_INSTALL_PATH}/k
 delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_HEADERS}" ${CYCLES_INSTALL_PATH}/kernel)
 delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_CLOSURE_HEADERS}" ${CYCLES_INSTALL_PATH}/kernel/closure)
 delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_SVM_HEADERS}" ${CYCLES_INSTALL_PATH}/kernel/svm)
+delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_GEOM_HEADERS}" ${CYCLES_INSTALL_PATH}/kernel/geom)
 delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_UTIL_HEADERS}" ${CYCLES_INSTALL_PATH}/kernel)
 
index 5077d8c96b0d02f5c010851d7eb01d2c082a1028..b2eafe6a83d7e87a384a18157fecfd659c3aac90 100644 (file)
@@ -60,6 +60,7 @@ if env['WITH_BF_CYCLES_CUDA_BINARIES']:
     kernel_file = os.path.join(source_dir, "kernel.cu")
     util_dir = os.path.join(source_dir, "../util")
     svm_dir = os.path.join(source_dir, "../svm")
+    geom_dir = os.path.join(source_dir, "../geom")
     closure_dir = os.path.join(source_dir, "../closure")
 
     # get CUDA version
@@ -76,10 +77,10 @@ if env['WITH_BF_CYCLES_CUDA_BINARIES']:
     nvcc_flags += " --cubin --ptxas-options=\"-v\""
     nvcc_flags += " -D__KERNEL_CUDA_VERSION__=%d" % (cuda_version)
     nvcc_flags += " -DCCL_NAMESPACE_BEGIN= -DCCL_NAMESPACE_END= -DNVCC"
-    nvcc_flags += " -I \"%s\" -I \"%s\" -I \"%s\"" % (util_dir, svm_dir, closure_dir)
+    nvcc_flags += " -I \"%s\" -I \"%s\" -I \"%s\"" % (util_dir, svm_dir, geom_dir, closure_dir)
 
     # dependencies
-    dependencies = ['kernel.cu'] + kernel.Glob('*.h') + kernel.Glob('../util/*.h') + kernel.Glob('svm/*.h') + kernel.Glob('closure/*.h')
+    dependencies = ['kernel.cu'] + kernel.Glob('*.h') + kernel.Glob('../util/*.h') + kernel.Glob('svm/*.h') + kernel.Glob('geom/*.h') + kernel.Glob('closure/*.h')
     last_cubin_file = None
 
     # add command for each cuda architecture
similarity index 98%
rename from intern/cycles/kernel/kernel_bvh.h
rename to intern/cycles/kernel/geom/geom_bvh.h
index 942c7abce65f9e31bcf0631c3d8d599d25775460..0272dff5115262b1451efc67232d0d37029b869a 100644 (file)
@@ -15,8 +15,6 @@
  * limitations under the License.
  */
 
-CCL_NAMESPACE_BEGIN
-
 /*
  * "Persistent while-while kernel" used in:
  *
@@ -42,6 +40,12 @@ CCL_NAMESPACE_BEGIN
 #define NO_EXTENDED_PRECISION volatile
 #endif
 
+#include "geom_object.h"
+#include "geom_curve.h"
+#include "geom_triangle.h"
+
+CCL_NAMESPACE_BEGIN
+
 ccl_device_inline float3 bvh_inverse_direction(float3 dir)
 {
        /* avoid divide by zero (ooeps = exp2f(-80.0f)) */
@@ -884,60 +888,60 @@ ccl_device_inline void bvh_triangle_intersect_subsurface(KernelGlobals *kg, Inte
 
 #define BVH_FUNCTION_NAME bvh_intersect
 #define BVH_FUNCTION_FEATURES 0
-#include "kernel_bvh_traversal.h"
+#include "geom_bvh_traversal.h"
 
 #if defined(__INSTANCING__)
 #define BVH_FUNCTION_NAME bvh_intersect_instancing
 #define BVH_FUNCTION_FEATURES BVH_INSTANCING
-#include "kernel_bvh_traversal.h"
+#include "geom_bvh_traversal.h"
 #endif
 
 #if defined(__HAIR__)
 #define BVH_FUNCTION_NAME bvh_intersect_hair
 #define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR|BVH_HAIR_MINIMUM_WIDTH
-#include "kernel_bvh_traversal.h"
+#include "geom_bvh_traversal.h"
 #endif
 
 #if defined(__OBJECT_MOTION__)
 #define BVH_FUNCTION_NAME bvh_intersect_motion
 #define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_MOTION
-#include "kernel_bvh_traversal.h"
+#include "geom_bvh_traversal.h"
 #endif
 
 #if defined(__HAIR__) && defined(__OBJECT_MOTION__)
 #define BVH_FUNCTION_NAME bvh_intersect_hair_motion
 #define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR|BVH_HAIR_MINIMUM_WIDTH|BVH_MOTION
-#include "kernel_bvh_traversal.h"
+#include "geom_bvh_traversal.h"
 #endif
 
 #if defined(__SUBSURFACE__)
 #define BVH_FUNCTION_NAME bvh_intersect_subsurface
 #define BVH_FUNCTION_FEATURES 0
-#include "kernel_bvh_subsurface.h"
+#include "geom_bvh_subsurface.h"
 #endif
 
 #if defined(__SUBSURFACE__) && defined(__INSTANCING__)
 #define BVH_FUNCTION_NAME bvh_intersect_subsurface_instancing
 #define BVH_FUNCTION_FEATURES BVH_INSTANCING
-#include "kernel_bvh_subsurface.h"
+#include "geom_bvh_subsurface.h"
 #endif
 
 #if defined(__SUBSURFACE__) && defined(__HAIR__)
 #define BVH_FUNCTION_NAME bvh_intersect_subsurface_hair
 #define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR
-#include "kernel_bvh_subsurface.h"
+#include "geom_bvh_subsurface.h"
 #endif
 
 #if defined(__SUBSURFACE__) && defined(__OBJECT_MOTION__)
 #define BVH_FUNCTION_NAME bvh_intersect_subsurface_motion
 #define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_MOTION
-#include "kernel_bvh_subsurface.h"
+#include "geom_bvh_subsurface.h"
 #endif
 
 #if defined(__SUBSURFACE__) && defined(__HAIR__) && defined(__OBJECT_MOTION__)
 #define BVH_FUNCTION_NAME bvh_intersect_subsurface_hair_motion
 #define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR|BVH_MOTION
-#include "kernel_bvh_subsurface.h"
+#include "geom_bvh_subsurface.h"
 #endif
 
 /* to work around titan bug when using arrays instead of textures */
index 81b61a54a6ada553d6bc844f57d74055fe5c3311..9b3ddbb755784d214c6d9d72bbfd179b812a36d6 100644 (file)
 #include "osl_shader.h"
 #endif
 
+#include "kernel_random.h"
+
+#include "geom/geom_bvh.h"
+
 #include "kernel_differential.h"
 #include "kernel_montecarlo.h"
 #include "kernel_projection.h"
-#include "kernel_object.h"
-#include "kernel_triangle.h"
-#include "kernel_curve.h"
 #include "kernel_primitive.h"
 #include "kernel_projection.h"
-#include "kernel_random.h"
-#include "kernel_bvh.h"
 #include "kernel_accumulate.h"
 #include "kernel_camera.h"
 #include "kernel_shader.h"
index 58858c3766ec6c33cf3bb060df77d2f35530acd0..a25d2fe03b53feab991b2d4f24b27a15f5199fa8 100644 (file)
 
 #include "kernel_compat_cpu.h"
 #include "kernel_globals.h"
+#include "kernel_random.h"
+
+#include "geom/geom_bvh.h"
+
 #include "kernel_montecarlo.h"
 #include "kernel_projection.h"
 #include "kernel_differential.h"
-#include "kernel_object.h"
-#include "kernel_random.h"
-#include "kernel_bvh.h"
-#include "kernel_triangle.h"
-#include "kernel_curve.h"
 #include "kernel_primitive.h"
 #include "kernel_projection.h"
 #include "kernel_accumulate.h"
index 554f647df7cce15c8188bdc8bee27aef26ec71ad..34d9ebefdb35dd7f4c8cdba08996445faae99518 100644 (file)
@@ -18,7 +18,8 @@
 #include "kernel_montecarlo.h"
 #include "kernel_types.h"
 #include "kernel_globals.h"
-#include "kernel_object.h"
+
+#include "geom/geom_object.h"
 
 #include "closure/bsdf_diffuse.h"
 #include "closure/bssrdf.h"