Cycles: Move BVK kernel files to own directory

BVH traversal is not really that much a geometry and we've got
quite some traversals now. Makes sense to keep them separate in
the name of source structure clarity.
This commit is contained in:
Sergey Sharybin 2016-07-11 12:28:45 +02:00
parent c58ae20f6c
commit 4355603790
19 changed files with 62 additions and 48 deletions

View File

@ -28,6 +28,22 @@ set(SRC
kernels/cuda/kernel.cu
)
set(SRC_BVH_HEADERS
bvh/bvh.h
bvh/bvh_nodes.h
bvh/bvh_shadow.h
bvh/bvh_subsurface.h
bvh/bvh_traversal.h
bvh/bvh_volume.h
bvh/bvh_volume_all.h
bvh/qbvh_nodes.h
bvh/qbvh_shadow.h
bvh/qbvh_subsurface.h
bvh/qbvh_traversal.h
bvh/qbvh_volume.h
bvh/qbvh_volume_all.h
)
set(SRC_HEADERS
kernel_accumulate.h
kernel_bake.h
@ -140,24 +156,11 @@ set(SRC_SVM_HEADERS
set(SRC_GEOM_HEADERS
geom/geom.h
geom/geom_attribute.h
geom/geom_bvh.h
geom/geom_bvh_nodes.h
geom/geom_bvh_shadow.h
geom/geom_bvh_subsurface.h
geom/geom_bvh_traversal.h
geom/geom_bvh_volume.h
geom/geom_bvh_volume_all.h
geom/geom_curve.h
geom/geom_motion_curve.h
geom/geom_motion_triangle.h
geom/geom_object.h
geom/geom_primitive.h
geom/geom_qbvh.h
geom/geom_qbvh_shadow.h
geom/geom_qbvh_subsurface.h
geom/geom_qbvh_traversal.h
geom/geom_qbvh_volume.h
geom/geom_qbvh_volume_all.h
geom/geom_triangle.h
geom/geom_triangle_intersect.h
geom/geom_volume.h
@ -213,7 +216,14 @@ if(WITH_CYCLES_CUDA_BINARIES)
endif()
# build for each arch
set(cuda_sources kernels/cuda/kernel.cu ${SRC_HEADERS} ${SRC_SVM_HEADERS} ${SRC_GEOM_HEADERS} ${SRC_CLOSURE_HEADERS} ${SRC_UTIL_HEADERS})
set(cuda_sources kernels/cuda/kernel.cu
${SRC_HEADERS}
${SRC_BVH_HEADERS}
${SRC_SVM_HEADERS}
${SRC_GEOM_HEADERS}
${SRC_CLOSURE_HEADERS}
${SRC_UTIL_HEADERS}
)
set(cuda_cubins)
macro(CYCLES_CUDA_KERNEL_ADD arch experimental)
@ -313,6 +323,7 @@ add_library(cycles_kernel
${SRC}
${SRC_HEADERS}
${SRC_KERNELS_CPU_HEADERS}
${SRC_BVH_HEADERS}
${SRC_CLOSURE_HEADERS}
${SRC_SVM_HEADERS}
${SRC_GEOM_HEADERS}
@ -347,6 +358,7 @@ delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "kernels/opencl/kernel_next_iteratio
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "kernels/opencl/kernel_sum_all_radiance.cl" ${CYCLES_INSTALL_PATH}/kernel/kernels/opencl)
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "kernels/cuda/kernel.cu" ${CYCLES_INSTALL_PATH}/kernel/kernels/cuda)
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_HEADERS}" ${CYCLES_INSTALL_PATH}/kernel)
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_BVH_HEADERS}" ${CYCLES_INSTALL_PATH}/kernel/bvh)
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)

View File

@ -35,6 +35,13 @@ CCL_NAMESPACE_BEGIN
# define ccl_device_intersect ccl_device_inline
#endif
/* bottom-most stack entry, indicating the end of traversal */
#define ENTRYPOINT_SENTINEL 0x76543210
/* 64 object BVH + 64 mesh BVH + 64 object node splitting */
#define BVH_STACK_SIZE 192
#define BVH_QSTACK_SIZE 384
/* BVH intersection function variations */
#define BVH_INSTANCING 1
@ -72,39 +79,39 @@ CCL_NAMESPACE_BEGIN
/* Common QBVH functions. */
#ifdef __QBVH__
# include "geom_qbvh.h"
# include "qbvh_nodes.h"
#endif
/* Regular BVH traversal */
#include "geom_bvh_nodes.h"
#include "bvh_nodes.h"
#define BVH_FUNCTION_NAME bvh_intersect
#define BVH_FUNCTION_FEATURES 0
#include "geom_bvh_traversal.h"
#include "bvh_traversal.h"
#if defined(__INSTANCING__)
# define BVH_FUNCTION_NAME bvh_intersect_instancing
# define BVH_FUNCTION_FEATURES BVH_INSTANCING
# include "geom_bvh_traversal.h"
# include "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 "geom_bvh_traversal.h"
# include "bvh_traversal.h"
#endif
#if defined(__OBJECT_MOTION__)
# define BVH_FUNCTION_NAME bvh_intersect_motion
# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_MOTION
# include "geom_bvh_traversal.h"
# include "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 "geom_bvh_traversal.h"
# include "bvh_traversal.h"
#endif
/* Subsurface scattering BVH traversal */
@ -112,13 +119,13 @@ CCL_NAMESPACE_BEGIN
#if defined(__SUBSURFACE__)
# define BVH_FUNCTION_NAME bvh_intersect_subsurface
# define BVH_FUNCTION_FEATURES BVH_HAIR
# include "geom_bvh_subsurface.h"
# include "bvh_subsurface.h"
#endif
#if defined(__SUBSURFACE__) && defined(__OBJECT_MOTION__)
# define BVH_FUNCTION_NAME bvh_intersect_subsurface_motion
# define BVH_FUNCTION_FEATURES BVH_MOTION|BVH_HAIR
# include "geom_bvh_subsurface.h"
# include "bvh_subsurface.h"
#endif
/* Volume BVH traversal */
@ -126,19 +133,19 @@ CCL_NAMESPACE_BEGIN
#if defined(__VOLUME__)
# define BVH_FUNCTION_NAME bvh_intersect_volume
# define BVH_FUNCTION_FEATURES BVH_HAIR
# include "geom_bvh_volume.h"
# include "bvh_volume.h"
#endif
#if defined(__VOLUME__) && defined(__INSTANCING__)
# define BVH_FUNCTION_NAME bvh_intersect_volume_instancing
# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR
# include "geom_bvh_volume.h"
# include "bvh_volume.h"
#endif
#if defined(__VOLUME__) && defined(__OBJECT_MOTION__)
# define BVH_FUNCTION_NAME bvh_intersect_volume_motion
# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_MOTION|BVH_HAIR
# include "geom_bvh_volume.h"
# include "bvh_volume.h"
#endif
/* Record all intersections - Shadow BVH traversal */
@ -146,31 +153,31 @@ CCL_NAMESPACE_BEGIN
#if defined(__SHADOW_RECORD_ALL__)
# define BVH_FUNCTION_NAME bvh_intersect_shadow_all
# define BVH_FUNCTION_FEATURES 0
# include "geom_bvh_shadow.h"
# include "bvh_shadow.h"
#endif
#if defined(__SHADOW_RECORD_ALL__) && defined(__INSTANCING__)
# define BVH_FUNCTION_NAME bvh_intersect_shadow_all_instancing
# define BVH_FUNCTION_FEATURES BVH_INSTANCING
# include "geom_bvh_shadow.h"
# include "bvh_shadow.h"
#endif
#if defined(__SHADOW_RECORD_ALL__) && defined(__HAIR__)
# define BVH_FUNCTION_NAME bvh_intersect_shadow_all_hair
# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR
# include "geom_bvh_shadow.h"
# include "bvh_shadow.h"
#endif
#if defined(__SHADOW_RECORD_ALL__) && defined(__OBJECT_MOTION__)
# define BVH_FUNCTION_NAME bvh_intersect_shadow_all_motion
# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_MOTION
# include "geom_bvh_shadow.h"
# include "bvh_shadow.h"
#endif
#if defined(__SHADOW_RECORD_ALL__) && defined(__HAIR__) && defined(__OBJECT_MOTION__)
# define BVH_FUNCTION_NAME bvh_intersect_shadow_all_hair_motion
# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR|BVH_MOTION
# include "geom_bvh_shadow.h"
# include "bvh_shadow.h"
#endif
/* Record all intersections - Volume BVH traversal */
@ -178,19 +185,19 @@ CCL_NAMESPACE_BEGIN
#if defined(__VOLUME_RECORD_ALL__)
# define BVH_FUNCTION_NAME bvh_intersect_volume_all
# define BVH_FUNCTION_FEATURES BVH_HAIR
# include "geom_bvh_volume_all.h"
# include "bvh_volume_all.h"
#endif
#if defined(__VOLUME_RECORD_ALL__) && defined(__INSTANCING__)
# define BVH_FUNCTION_NAME bvh_intersect_volume_all_instancing
# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR
# include "geom_bvh_volume_all.h"
# include "bvh_volume_all.h"
#endif
#if defined(__VOLUME_RECORD_ALL__) && defined(__OBJECT_MOTION__)
# define BVH_FUNCTION_NAME bvh_intersect_volume_all_motion
# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_MOTION|BVH_HAIR
# include "geom_bvh_volume_all.h"
# include "bvh_volume_all.h"
#endif
#undef BVH_FEATURE

View File

@ -18,7 +18,7 @@
*/
#ifdef __QBVH__
# include "geom_qbvh_shadow.h"
# include "qbvh_shadow.h"
#endif
#if BVH_FEATURE(BVH_HAIR)

View File

@ -18,7 +18,7 @@
*/
#ifdef __QBVH__
# include "geom_qbvh_subsurface.h"
# include "qbvh_subsurface.h"
#endif
#if BVH_FEATURE(BVH_HAIR)

View File

@ -18,7 +18,7 @@
*/
#ifdef __QBVH__
# include "geom_qbvh_traversal.h"
# include "qbvh_traversal.h"
#endif
#if BVH_FEATURE(BVH_HAIR)

View File

@ -18,7 +18,7 @@
*/
#ifdef __QBVH__
# include "geom_qbvh_volume.h"
# include "qbvh_volume.h"
#endif
#if BVH_FEATURE(BVH_HAIR)

View File

@ -18,7 +18,7 @@
*/
#ifdef __QBVH__
# include "geom_qbvh_volume_all.h"
# include "qbvh_volume_all.h"
#endif
#if BVH_FEATURE(BVH_HAIR)

View File

@ -15,14 +15,6 @@
* limitations under the License.
*/
/* bottom-most stack entry, indicating the end of traversal */
#define ENTRYPOINT_SENTINEL 0x76543210
/* 64 object BVH + 64 mesh BVH + 64 object node splitting */
#define BVH_STACK_SIZE 192
#define BVH_QSTACK_SIZE 384
#define TRI_NODE_SIZE 3
#include "geom_attribute.h"
#include "geom_object.h"
#include "geom_triangle.h"
@ -32,5 +24,4 @@
#include "geom_curve.h"
#include "geom_volume.h"
#include "geom_primitive.h"
#include "geom_bvh.h"

View File

@ -25,6 +25,7 @@
#include "kernel_camera.h"
#include "geom/geom.h"
#include "bvh/bvh.h"
#include "kernel_accumulate.h"
#include "kernel_shader.h"

View File

@ -35,6 +35,7 @@
# include "../../kernel_montecarlo.h"
# include "../../kernel_projection.h"
# include "../../geom/geom.h"
# include "../../bvh/bvh.h"
# include "../../kernel_accumulate.h"
# include "../../kernel_camera.h"

View File

@ -47,6 +47,7 @@
#include "kernel_camera.h"
#include "kernels/cpu/kernel_cpu_image.h"
#include "geom/geom.h"
#include "bvh/bvh.h"
#include "kernel_projection.h"
#include "kernel_accumulate.h"

View File

@ -31,6 +31,7 @@
#include "kernel_camera.h"
#include "geom/geom.h"
#include "bvh/bvh.h"
#include "kernel_accumulate.h"
#include "kernel_shader.h"