diff options
author | Brecht Van Lommel <brecht@blender.org> | 2020-02-23 12:15:35 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2020-06-22 14:28:01 +0300 |
commit | 1de0e13af619e405f351bf42924f819dc3a9bc44 (patch) | |
tree | d1174cd7d3b362d21a9dddfb178ae15b5d9cc048 /intern/cycles/kernel/bvh/bvh_volume_all.h | |
parent | fed101a7be119f2e0c4ed64d13fd65f7a1c16118 (diff) |
Cycles: remove __UV__ and __INSTANCING__ as kernel options
The kernel did not work correctly when these were disabled anyway. The
optimized BVH traversal for the no instances case was also only used on
the CPU, so no longer makes sense to keep.
Ref T73778
Depends on D8010
Maniphest Tasks: T73778
Differential Revision: https://developer.blender.org/D8011
Diffstat (limited to 'intern/cycles/kernel/bvh/bvh_volume_all.h')
-rw-r--r-- | intern/cycles/kernel/bvh/bvh_volume_all.h | 47 |
1 files changed, 15 insertions, 32 deletions
diff --git a/intern/cycles/kernel/bvh/bvh_volume_all.h b/intern/cycles/kernel/bvh/bvh_volume_all.h index ae8c4d12e8a..7b1834c7c6f 100644 --- a/intern/cycles/kernel/bvh/bvh_volume_all.h +++ b/intern/cycles/kernel/bvh/bvh_volume_all.h @@ -34,7 +34,6 @@ * various features can be enabled/disabled. This way we can compile optimized * versions for each case without new features slowing things down. * - * BVH_INSTANCING: object instancing * BVH_MOTION: motion blur rendering */ @@ -76,9 +75,7 @@ ccl_device_inline Transform ob_itfm; #endif -#if BVH_FEATURE(BVH_INSTANCING) int num_hits_in_instance = 0; -#endif uint num_hits = 0; isect_array->t = tmax; @@ -174,9 +171,7 @@ ccl_device_inline float4 leaf = kernel_tex_fetch(__bvh_leaf_nodes, (-node_addr - 1)); int prim_addr = __float_as_int(leaf.x); -#if BVH_FEATURE(BVH_INSTANCING) if (prim_addr >= 0) { -#endif const int prim_addr2 = __float_as_int(leaf.y); const uint type = __float_as_int(leaf.w); bool hit; @@ -204,25 +199,21 @@ ccl_device_inline /* Move on to next entry in intersections array. */ isect_array++; num_hits++; -#if BVH_FEATURE(BVH_INSTANCING) num_hits_in_instance++; -#endif isect_array->t = isect_t; if (num_hits == max_hits) { -#if BVH_FEATURE(BVH_INSTANCING) if (object != OBJECT_NONE) { -# if BVH_FEATURE(BVH_MOTION) +#if BVH_FEATURE(BVH_MOTION) float t_fac = 1.0f / len(transform_direction(&ob_itfm, dir)); -# else +#else Transform itfm = object_fetch_transform( kg, object, OBJECT_INVERSE_TRANSFORM); float t_fac = 1.0f / len(transform_direction(&itfm, dir)); -# endif +#endif for (int i = 0; i < num_hits_in_instance; i++) { (isect_array - i - 1)->t *= t_fac; } } -#endif /* BVH_FEATURE(BVH_INSTANCING) */ return num_hits; } } @@ -248,25 +239,21 @@ ccl_device_inline /* Move on to next entry in intersections array. */ isect_array++; num_hits++; -# if BVH_FEATURE(BVH_INSTANCING) num_hits_in_instance++; -# endif isect_array->t = isect_t; if (num_hits == max_hits) { -# if BVH_FEATURE(BVH_INSTANCING) if (object != OBJECT_NONE) { -# if BVH_FEATURE(BVH_MOTION) +# if BVH_FEATURE(BVH_MOTION) float t_fac = 1.0f / len(transform_direction(&ob_itfm, dir)); -# else +# else Transform itfm = object_fetch_transform( kg, object, OBJECT_INVERSE_TRANSFORM); float t_fac = 1.0f / len(transform_direction(&itfm, dir)); -# endif +# endif for (int i = 0; i < num_hits_in_instance; i++) { (isect_array - i - 1)->t *= t_fac; } } -# endif /* BVH_FEATURE(BVH_INSTANCING) */ return num_hits; } } @@ -279,18 +266,17 @@ ccl_device_inline } } } -#if BVH_FEATURE(BVH_INSTANCING) else { /* instance push */ object = kernel_tex_fetch(__prim_object, -prim_addr - 1); int object_flag = kernel_tex_fetch(__object_flag, object); if (object_flag & SD_OBJECT_HAS_VOLUME) { -# if BVH_FEATURE(BVH_MOTION) +#if BVH_FEATURE(BVH_MOTION) isect_t = bvh_instance_motion_push( kg, object, ray, &P, &dir, &idir, isect_t, &ob_itfm); -# else +#else isect_t = bvh_instance_push(kg, object, ray, &P, &dir, &idir, isect_t); -# endif +#endif num_hits_in_instance = 0; isect_array->t = isect_t; @@ -322,32 +308,30 @@ ccl_device_inline } } } -#endif /* FEATURE(BVH_INSTANCING) */ } while (node_addr != ENTRYPOINT_SENTINEL); -#if BVH_FEATURE(BVH_INSTANCING) if (stack_ptr >= 0) { kernel_assert(object != OBJECT_NONE); /* Instance pop. */ if (num_hits_in_instance) { float t_fac; -# if BVH_FEATURE(BVH_MOTION) +#if BVH_FEATURE(BVH_MOTION) bvh_instance_motion_pop_factor(kg, object, ray, &P, &dir, &idir, &t_fac, &ob_itfm); -# else +#else bvh_instance_pop_factor(kg, object, ray, &P, &dir, &idir, &t_fac); -# endif +#endif /* Scale isect->t to adjust for instancing. */ for (int i = 0; i < num_hits_in_instance; i++) { (isect_array - i - 1)->t *= t_fac; } } else { -# if BVH_FEATURE(BVH_MOTION) +#if BVH_FEATURE(BVH_MOTION) bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, FLT_MAX, &ob_itfm); -# else +#else bvh_instance_pop(kg, object, ray, &P, &dir, &idir, FLT_MAX); -# endif +#endif } isect_t = tmax; @@ -370,7 +354,6 @@ ccl_device_inline node_addr = traversal_stack[stack_ptr]; --stack_ptr; } -#endif /* FEATURE(BVH_INSTANCING) */ } while (node_addr != ENTRYPOINT_SENTINEL); return num_hits; |