diff options
Diffstat (limited to 'intern/cycles/kernel/bvh/bvh_volume_all.h')
-rw-r--r-- | intern/cycles/kernel/bvh/bvh_volume_all.h | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/intern/cycles/kernel/bvh/bvh_volume_all.h b/intern/cycles/kernel/bvh/bvh_volume_all.h index d7f6bf86c71..1f6515c9862 100644 --- a/intern/cycles/kernel/bvh/bvh_volume_all.h +++ b/intern/cycles/kernel/bvh/bvh_volume_all.h @@ -36,11 +36,16 @@ * */ -ccl_device uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, - const Ray *ray, - Intersection *isect_array, - const uint max_hits, - const uint visibility) +#ifndef __KERNEL_GPU__ +ccl_device +#else +ccl_device_inline +#endif +uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, + const Ray *ray, + Intersection *isect_array, + const uint max_hits, + const uint visibility) { /* todo: * - test if pushing distance on the stack helps (for non shadow rays) @@ -201,12 +206,14 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, object, prim_addr); if(hit) { - /* Update number of hits now, so we do proper check on max bounces. */ + /* Move on to next entry in intersections array. */ + isect_array++; num_hits++; #if BVH_FEATURE(BVH_INSTANCING) num_hits_in_instance++; #endif - if(num_hits >= max_hits) { + isect_array->t = isect_t; + if(num_hits == max_hits) { #if BVH_FEATURE(BVH_INSTANCING) # if BVH_FEATURE(BVH_MOTION) float t_fac = 1.0f / len(transform_direction(&ob_itfm, dir)); @@ -220,9 +227,6 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, #endif /* BVH_FEATURE(BVH_INSTANCING) */ return num_hits; } - /* Move on to next entry in intersections array */ - isect_array++; - isect_array->t = isect_t; } } break; @@ -247,12 +251,14 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, object, prim_addr); if(hit) { - /* Update number of hits now, so we do proper check on max bounces. */ + /* Move on to next entry in intersections array. */ + isect_array++; num_hits++; # if BVH_FEATURE(BVH_INSTANCING) num_hits_in_instance++; # endif - if(num_hits >= max_hits) { + isect_array->t = isect_t; + if(num_hits == max_hits) { # if BVH_FEATURE(BVH_INSTANCING) # if BVH_FEATURE(BVH_MOTION) float t_fac = 1.0f / len(transform_direction(&ob_itfm, dir)); @@ -266,9 +272,6 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, # endif /* BVH_FEATURE(BVH_INSTANCING) */ return num_hits; } - /* Move on to next entry in intersections array */ - isect_array++; - isect_array->t = isect_t; } } break; |