diff options
Diffstat (limited to 'intern/cycles/kernel/bvh')
-rw-r--r-- | intern/cycles/kernel/bvh/bvh.h | 50 | ||||
-rw-r--r-- | intern/cycles/kernel/bvh/bvh_local.h (renamed from intern/cycles/kernel/bvh/bvh_subsurface.h) | 77 | ||||
-rw-r--r-- | intern/cycles/kernel/bvh/qbvh_local.h (renamed from intern/cycles/kernel/bvh/qbvh_subsurface.h) | 63 |
3 files changed, 98 insertions, 92 deletions
diff --git a/intern/cycles/kernel/bvh/bvh.h b/intern/cycles/kernel/bvh/bvh.h index cf0c8542d69..d3e0b25a200 100644 --- a/intern/cycles/kernel/bvh/bvh.h +++ b/intern/cycles/kernel/bvh/bvh.h @@ -68,17 +68,17 @@ CCL_NAMESPACE_BEGIN /* Subsurface scattering BVH traversal */ -#if defined(__SUBSURFACE__) -# define BVH_FUNCTION_NAME bvh_intersect_subsurface +#if defined(__BVH_LOCAL__) +# define BVH_FUNCTION_NAME bvh_intersect_local # define BVH_FUNCTION_FEATURES BVH_HAIR -# include "kernel/bvh/bvh_subsurface.h" +# include "kernel/bvh/bvh_local.h" # if defined(__OBJECT_MOTION__) -# define BVH_FUNCTION_NAME bvh_intersect_subsurface_motion +# define BVH_FUNCTION_NAME bvh_intersect_local_motion # define BVH_FUNCTION_FEATURES BVH_MOTION|BVH_HAIR -# include "kernel/bvh/bvh_subsurface.h" +# include "kernel/bvh/bvh_local.h" # endif -#endif /* __SUBSURFACE__ */ +#endif /* __BVH_LOCAL__ */ /* Volume BVH traversal */ @@ -201,31 +201,31 @@ ccl_device_intersect bool scene_intersect(KernelGlobals *kg, #endif /* __KERNEL_CPU__ */ } -#ifdef __SUBSURFACE__ +#ifdef __BVH_LOCAL__ /* Note: ray is passed by value to work around a possible CUDA compiler bug. */ -ccl_device_intersect void scene_intersect_subsurface(KernelGlobals *kg, - const Ray ray, - SubsurfaceIntersection *ss_isect, - int subsurface_object, - uint *lcg_state, - int max_hits) +ccl_device_intersect void scene_intersect_local(KernelGlobals *kg, + const Ray ray, + LocalIntersection *local_isect, + int local_object, + uint *lcg_state, + int max_hits) { #ifdef __OBJECT_MOTION__ if(kernel_data.bvh.have_motion) { - return bvh_intersect_subsurface_motion(kg, - &ray, - ss_isect, - subsurface_object, - lcg_state, - max_hits); + return bvh_intersect_local_motion(kg, + &ray, + local_isect, + local_object, + lcg_state, + max_hits); } #endif /* __OBJECT_MOTION__ */ - return bvh_intersect_subsurface(kg, - &ray, - ss_isect, - subsurface_object, - lcg_state, - max_hits); + return bvh_intersect_local(kg, + &ray, + local_isect, + local_object, + lcg_state, + max_hits); } #endif diff --git a/intern/cycles/kernel/bvh/bvh_subsurface.h b/intern/cycles/kernel/bvh/bvh_local.h index bda7e34907a..12d14428d6d 100644 --- a/intern/cycles/kernel/bvh/bvh_subsurface.h +++ b/intern/cycles/kernel/bvh/bvh_local.h @@ -18,7 +18,7 @@ */ #ifdef __QBVH__ -# include "kernel/bvh/qbvh_subsurface.h" +# include "kernel/bvh/qbvh_local.h" #endif #if BVH_FEATURE(BVH_HAIR) @@ -27,9 +27,10 @@ # define NODE_INTERSECT bvh_aligned_node_intersect #endif -/* This is a template BVH traversal function for subsurface scattering, where - * various features can be enabled/disabled. This way we can compile optimized - * versions for each case without new features slowing things down. +/* This is a template BVH traversal function for finding local intersections + * around the shading point, for subsurface scattering and bevel. We disable + * various features for performance, and for instanced objects avoid traversing + * other parts of the scene. * * BVH_MOTION: motion blur rendering * @@ -42,8 +43,8 @@ ccl_device_inline #endif void BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, const Ray *ray, - SubsurfaceIntersection *ss_isect, - int subsurface_object, + LocalIntersection *local_isect, + int local_object, uint *lcg_state, int max_hits) { @@ -60,7 +61,7 @@ void BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, /* traversal variables in registers */ int stack_ptr = 0; - int node_addr = kernel_tex_fetch(__object_node, subsurface_object); + int node_addr = kernel_tex_fetch(__object_node, local_object); /* ray parameters in registers */ float3 P = ray->P; @@ -69,14 +70,14 @@ void BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, int object = OBJECT_NONE; float isect_t = ray->t; - ss_isect->num_hits = 0; + local_isect->num_hits = 0; - const int object_flag = kernel_tex_fetch(__object_flag, subsurface_object); + const int object_flag = kernel_tex_fetch(__object_flag, local_object); if(!(object_flag & SD_OBJECT_TRANSFORM_APPLIED)) { #if BVH_FEATURE(BVH_MOTION) Transform ob_itfm; isect_t = bvh_instance_motion_push(kg, - subsurface_object, + local_object, ray, &P, &dir, @@ -84,9 +85,9 @@ void BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, isect_t, &ob_itfm); #else - isect_t = bvh_instance_push(kg, subsurface_object, ray, &P, &dir, &idir, isect_t); + isect_t = bvh_instance_push(kg, local_object, ray, &P, &dir, &idir, isect_t); #endif - object = subsurface_object; + object = local_object; } #if defined(__KERNEL_SSE2__) @@ -193,15 +194,16 @@ void BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, /* intersect ray against primitive */ for(; prim_addr < prim_addr2; prim_addr++) { kernel_assert(kernel_tex_fetch(__prim_type, prim_addr) == type); - triangle_intersect_subsurface(kg, - ss_isect, - P, - dir, - object, - prim_addr, - isect_t, - lcg_state, - max_hits); + triangle_intersect_local(kg, + local_isect, + P, + dir, + object, + local_object, + prim_addr, + isect_t, + lcg_state, + max_hits); } break; } @@ -210,16 +212,17 @@ void BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, /* intersect ray against primitive */ for(; prim_addr < prim_addr2; prim_addr++) { kernel_assert(kernel_tex_fetch(__prim_type, prim_addr) == type); - motion_triangle_intersect_subsurface(kg, - ss_isect, - P, - dir, - ray->time, - object, - prim_addr, - isect_t, - lcg_state, - max_hits); + motion_triangle_intersect_local(kg, + local_isect, + P, + dir, + ray->time, + object, + local_object, + prim_addr, + isect_t, + lcg_state, + max_hits); } break; } @@ -235,8 +238,8 @@ void BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, ccl_device_inline void BVH_FUNCTION_NAME(KernelGlobals *kg, const Ray *ray, - SubsurfaceIntersection *ss_isect, - int subsurface_object, + LocalIntersection *local_isect, + int local_object, uint *lcg_state, int max_hits) { @@ -244,8 +247,8 @@ ccl_device_inline void BVH_FUNCTION_NAME(KernelGlobals *kg, if(kernel_data.bvh.use_qbvh) { return BVH_FUNCTION_FULL_NAME(QBVH)(kg, ray, - ss_isect, - subsurface_object, + local_isect, + local_object, lcg_state, max_hits); } @@ -255,8 +258,8 @@ ccl_device_inline void BVH_FUNCTION_NAME(KernelGlobals *kg, kernel_assert(kernel_data.bvh.use_qbvh == false); return BVH_FUNCTION_FULL_NAME(BVH)(kg, ray, - ss_isect, - subsurface_object, + local_isect, + local_object, lcg_state, max_hits); } diff --git a/intern/cycles/kernel/bvh/qbvh_subsurface.h b/intern/cycles/kernel/bvh/qbvh_local.h index be7658d11d7..2386fa1a1e8 100644 --- a/intern/cycles/kernel/bvh/qbvh_subsurface.h +++ b/intern/cycles/kernel/bvh/qbvh_local.h @@ -14,9 +14,10 @@ * limitations under the License. */ -/* This is a template BVH traversal function for subsurface scattering, where - * various features can be enabled/disabled. This way we can compile optimized - * versions for each case without new features slowing things down. +/* This is a template BVH traversal function for finding local intersections + * around the shading point, for subsurface scattering and bevel. We disable + * various features for performance, and for instanced objects avoid traversing + * other parts of the scene. * * BVH_MOTION: motion blur rendering * @@ -30,8 +31,8 @@ ccl_device void BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, const Ray *ray, - SubsurfaceIntersection *ss_isect, - int subsurface_object, + LocalIntersection *local_isect, + int local_object, uint *lcg_state, int max_hits) { @@ -49,7 +50,7 @@ ccl_device void BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, /* Traversal variables in registers. */ int stack_ptr = 0; - int node_addr = kernel_tex_fetch(__object_node, subsurface_object); + int node_addr = kernel_tex_fetch(__object_node, local_object); /* Ray parameters in registers. */ float3 P = ray->P; @@ -58,14 +59,14 @@ ccl_device void BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, int object = OBJECT_NONE; float isect_t = ray->t; - ss_isect->num_hits = 0; + local_isect->num_hits = 0; - const int object_flag = kernel_tex_fetch(__object_flag, subsurface_object); + const int object_flag = kernel_tex_fetch(__object_flag, local_object); if(!(object_flag & SD_OBJECT_TRANSFORM_APPLIED)) { #if BVH_FEATURE(BVH_MOTION) Transform ob_itfm; isect_t = bvh_instance_motion_push(kg, - subsurface_object, + local_object, ray, &P, &dir, @@ -73,9 +74,9 @@ ccl_device void BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, isect_t, &ob_itfm); #else - isect_t = bvh_instance_push(kg, subsurface_object, ray, &P, &dir, &idir, isect_t); + isect_t = bvh_instance_push(kg, local_object, ray, &P, &dir, &idir, isect_t); #endif - object = subsurface_object; + object = local_object; } #ifndef __KERNEL_SSE41__ @@ -249,15 +250,16 @@ ccl_device void BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, /* Intersect ray against primitive, */ for(; prim_addr < prim_addr2; prim_addr++) { kernel_assert(kernel_tex_fetch(__prim_type, prim_addr) == type); - triangle_intersect_subsurface(kg, - ss_isect, - P, - dir, - object, - prim_addr, - isect_t, - lcg_state, - max_hits); + triangle_intersect_local(kg, + local_isect, + P, + dir, + object, + local_object, + prim_addr, + isect_t, + lcg_state, + max_hits); } break; } @@ -266,16 +268,17 @@ ccl_device void BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, /* Intersect ray against primitive. */ for(; prim_addr < prim_addr2; prim_addr++) { kernel_assert(kernel_tex_fetch(__prim_type, prim_addr) == type); - motion_triangle_intersect_subsurface(kg, - ss_isect, - P, - dir, - ray->time, - object, - prim_addr, - isect_t, - lcg_state, - max_hits); + motion_triangle_intersect_local(kg, + local_isect, + P, + dir, + ray->time, + object, + local_object, + prim_addr, + isect_t, + lcg_state, + max_hits); } break; } |