diff options
Diffstat (limited to 'intern/cycles/kernel/bvh/bvh.h')
-rw-r--r-- | intern/cycles/kernel/bvh/bvh.h | 121 |
1 files changed, 23 insertions, 98 deletions
diff --git a/intern/cycles/kernel/bvh/bvh.h b/intern/cycles/kernel/bvh/bvh.h index 9b9df883b62..3049f243ae9 100644 --- a/intern/cycles/kernel/bvh/bvh.h +++ b/intern/cycles/kernel/bvh/bvh.h @@ -35,14 +35,6 @@ CCL_NAMESPACE_BEGIN #ifndef __KERNEL_OPTIX__ -/* Common QBVH functions. */ -# ifdef __QBVH__ -# include "kernel/bvh/qbvh_nodes.h" -# ifdef __KERNEL_AVX2__ -# include "kernel/bvh/obvh_nodes.h" -# endif -# endif - /* Regular BVH traversal */ # include "kernel/bvh/bvh_nodes.h" @@ -51,27 +43,21 @@ CCL_NAMESPACE_BEGIN # define BVH_FUNCTION_FEATURES 0 # include "kernel/bvh/bvh_traversal.h" -# if defined(__INSTANCING__) -# define BVH_FUNCTION_NAME bvh_intersect_instancing -# define BVH_FUNCTION_FEATURES BVH_INSTANCING -# include "kernel/bvh/bvh_traversal.h" -# endif - # if defined(__HAIR__) # define BVH_FUNCTION_NAME bvh_intersect_hair -# define BVH_FUNCTION_FEATURES BVH_INSTANCING | BVH_HAIR +# define BVH_FUNCTION_FEATURES BVH_HAIR # include "kernel/bvh/bvh_traversal.h" # endif # if defined(__OBJECT_MOTION__) # define BVH_FUNCTION_NAME bvh_intersect_motion -# define BVH_FUNCTION_FEATURES BVH_INSTANCING | BVH_MOTION +# define BVH_FUNCTION_FEATURES BVH_MOTION # include "kernel/bvh/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_MOTION +# define BVH_FUNCTION_FEATURES BVH_HAIR | BVH_MOTION # include "kernel/bvh/bvh_traversal.h" # endif @@ -96,15 +82,9 @@ CCL_NAMESPACE_BEGIN # define BVH_FUNCTION_FEATURES BVH_HAIR # include "kernel/bvh/bvh_volume.h" -# if defined(__INSTANCING__) -# define BVH_FUNCTION_NAME bvh_intersect_volume_instancing -# define BVH_FUNCTION_FEATURES BVH_INSTANCING | BVH_HAIR -# include "kernel/bvh/bvh_volume.h" -# endif - # if defined(__OBJECT_MOTION__) # define BVH_FUNCTION_NAME bvh_intersect_volume_motion -# define BVH_FUNCTION_FEATURES BVH_INSTANCING | BVH_MOTION | BVH_HAIR +# define BVH_FUNCTION_FEATURES BVH_MOTION | BVH_HAIR # include "kernel/bvh/bvh_volume.h" # endif # endif /* __VOLUME__ */ @@ -116,27 +96,21 @@ CCL_NAMESPACE_BEGIN # define BVH_FUNCTION_FEATURES 0 # include "kernel/bvh/bvh_shadow_all.h" -# if defined(__INSTANCING__) -# define BVH_FUNCTION_NAME bvh_intersect_shadow_all_instancing -# define BVH_FUNCTION_FEATURES BVH_INSTANCING -# include "kernel/bvh/bvh_shadow_all.h" -# endif - # if defined(__HAIR__) # define BVH_FUNCTION_NAME bvh_intersect_shadow_all_hair -# define BVH_FUNCTION_FEATURES BVH_INSTANCING | BVH_HAIR +# define BVH_FUNCTION_FEATURES BVH_HAIR # include "kernel/bvh/bvh_shadow_all.h" # endif # if defined(__OBJECT_MOTION__) # define BVH_FUNCTION_NAME bvh_intersect_shadow_all_motion -# define BVH_FUNCTION_FEATURES BVH_INSTANCING | BVH_MOTION +# define BVH_FUNCTION_FEATURES BVH_MOTION # include "kernel/bvh/bvh_shadow_all.h" # endif # if 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 +# define BVH_FUNCTION_FEATURES BVH_HAIR | BVH_MOTION # include "kernel/bvh/bvh_shadow_all.h" # endif # endif /* __SHADOW_RECORD_ALL__ */ @@ -148,15 +122,9 @@ CCL_NAMESPACE_BEGIN # define BVH_FUNCTION_FEATURES BVH_HAIR # include "kernel/bvh/bvh_volume_all.h" -# if defined(__INSTANCING__) -# define BVH_FUNCTION_NAME bvh_intersect_volume_all_instancing -# define BVH_FUNCTION_FEATURES BVH_INSTANCING | BVH_HAIR -# include "kernel/bvh/bvh_volume_all.h" -# endif - # if defined(__OBJECT_MOTION__) # define BVH_FUNCTION_NAME bvh_intersect_volume_all_motion -# define BVH_FUNCTION_FEATURES BVH_INSTANCING | BVH_MOTION | BVH_HAIR +# define BVH_FUNCTION_FEATURES BVH_MOTION | BVH_HAIR # include "kernel/bvh/bvh_volume_all.h" # endif # endif /* __VOLUME_RECORD_ALL__ */ @@ -204,11 +172,11 @@ ccl_device_intersect bool scene_intersect(KernelGlobals *kg, 0.0f, ray->t, ray->time, - 0xFF, + 0xF, OPTIX_RAY_FLAG_NONE, + 0, // SBT offset for PG_HITD 0, 0, - 0, // SBT offset for PG_HITD p0, p1, p2, @@ -264,21 +232,8 @@ ccl_device_intersect bool scene_intersect(KernelGlobals *kg, } # endif /* __HAIR__ */ -# ifdef __KERNEL_CPU__ -# ifdef __INSTANCING__ - if (kernel_data.bvh.have_instancing) { - return bvh_intersect_instancing(kg, ray, isect, visibility); - } -# endif /* __INSTANCING__ */ return bvh_intersect(kg, ray, isect, visibility); -# else /* __KERNEL_CPU__ */ -# ifdef __INSTANCING__ - return bvh_intersect_instancing(kg, ray, isect, visibility); -# else - return bvh_intersect(kg, ray, isect, visibility); -# endif /* __INSTANCING__ */ -# endif /* __KERNEL_CPU__ */ -#endif /* __KERNEL_OPTIX__ */ +#endif /* __KERNEL_OPTIX__ */ } #ifdef __BVH_LOCAL__ @@ -309,12 +264,13 @@ ccl_device_intersect bool scene_intersect_local(KernelGlobals *kg, 0.0f, ray->t, ray->time, + // Skip curves + 0x3, // Need to always call into __anyhit__kernel_optix_local_hit - 0xFF, OPTIX_RAY_FLAG_ENFORCE_ANYHIT, - 1, + 2, // SBT offset for PG_HITL + 0, 0, - 0, // SBT offset for PG_HITL p0, p1, p2, @@ -419,12 +375,12 @@ ccl_device_intersect bool scene_intersect_shadow_all(KernelGlobals *kg, 0.0f, ray->t, ray->time, + 0xF, // Need to always call into __anyhit__kernel_optix_shadow_all_hit - 0xFF, OPTIX_RAY_FLAG_ENFORCE_ANYHIT, - 2, + 1, // SBT offset for PG_HITS + 0, 0, - 0, // SBT offset for PG_HITS p0, p1, *num_hits, @@ -476,21 +432,8 @@ ccl_device_intersect bool scene_intersect_shadow_all(KernelGlobals *kg, } # endif /* __HAIR__ */ -# ifdef __KERNEL_CPU__ -# ifdef __INSTANCING__ - if (kernel_data.bvh.have_instancing) { - return bvh_intersect_shadow_all_instancing(kg, ray, isect, visibility, max_hits, num_hits); - } -# endif /* __INSTANCING__ */ return bvh_intersect_shadow_all(kg, ray, isect, visibility, max_hits, num_hits); -# else -# ifdef __INSTANCING__ - return bvh_intersect_shadow_all_instancing(kg, ray, isect, visibility, max_hits, num_hits); -# else - return bvh_intersect_shadow_all(kg, ray, isect, visibility, max_hits, num_hits); -# endif /* __INSTANCING__ */ -# endif /* __KERNEL_CPU__ */ -# endif /* __KERNEL_OPTIX__ */ +# endif /* __KERNEL_OPTIX__ */ } #endif /* __SHADOW_RECORD_ALL__ */ @@ -516,12 +459,12 @@ ccl_device_intersect bool scene_intersect_volume(KernelGlobals *kg, 0.0f, ray->t, ray->time, - // Visibility mask set to only intersect objects with volumes - 0x02, + // Skip everything but volumes + 0x2, OPTIX_RAY_FLAG_NONE, + 0, // SBT offset for PG_HITD 0, 0, - 0, // SBT offset for PG_HITD p0, p1, p2, @@ -548,21 +491,8 @@ ccl_device_intersect bool scene_intersect_volume(KernelGlobals *kg, } # endif /* __OBJECT_MOTION__ */ -# ifdef __KERNEL_CPU__ -# ifdef __INSTANCING__ - if (kernel_data.bvh.have_instancing) { - return bvh_intersect_volume_instancing(kg, ray, isect, visibility); - } -# endif /* __INSTANCING__ */ - return bvh_intersect_volume(kg, ray, isect, visibility); -# else /* __KERNEL_CPU__ */ -# ifdef __INSTANCING__ - return bvh_intersect_volume_instancing(kg, ray, isect, visibility); -# else return bvh_intersect_volume(kg, ray, isect, visibility); -# endif /* __INSTANCING__ */ -# endif /* __KERNEL_CPU__ */ -# endif /* __KERNEL_OPTIX__ */ +# endif /* __KERNEL_OPTIX__ */ } #endif /* __VOLUME__ */ @@ -599,11 +529,6 @@ ccl_device_intersect uint scene_intersect_volume_all(KernelGlobals *kg, } # endif /* __OBJECT_MOTION__ */ -# ifdef __INSTANCING__ - if (kernel_data.bvh.have_instancing) { - return bvh_intersect_volume_all_instancing(kg, ray, isect, max_hits, visibility); - } -# endif /* __INSTANCING__ */ return bvh_intersect_volume_all(kg, ray, isect, max_hits, visibility); } #endif /* __VOLUME_RECORD_ALL__ */ |