Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/bvh/bvh.h
| Show First 20 Lines • Show All 148 Lines • ▼ Show 20 Lines | ccl_device_inline bool scene_intersect_valid(ccl_private const Ray *ray) | ||||
| * From production scenes so far it seems it's enough to test first element | * From production scenes so far it seems it's enough to test first element | ||||
| * only. | * only. | ||||
| * Scene intersection may also called with empty rays for conditional trace | * Scene intersection may also called with empty rays for conditional trace | ||||
| * calls that evaluate to false, so filter those out. | * calls that evaluate to false, so filter those out. | ||||
| */ | */ | ||||
| return isfinite_safe(ray->P.x) && isfinite_safe(ray->D.x) && len_squared(ray->D) != 0.0f; | return isfinite_safe(ray->P.x) && isfinite_safe(ray->D.x) && len_squared(ray->D) != 0.0f; | ||||
| } | } | ||||
| ccl_device_intersect bool scene_intersect(ccl_global const KernelGlobals *kg, | ccl_device_intersect bool scene_intersect(KernelGlobals kg, | ||||
| ccl_private const Ray *ray, | ccl_private const Ray *ray, | ||||
| const uint visibility, | const uint visibility, | ||||
| ccl_private Intersection *isect) | ccl_private Intersection *isect) | ||||
| { | { | ||||
| #ifdef __KERNEL_OPTIX__ | #ifdef __KERNEL_OPTIX__ | ||||
| uint p0 = 0; | uint p0 = 0; | ||||
| uint p1 = 0; | uint p1 = 0; | ||||
| uint p2 = 0; | uint p2 = 0; | ||||
| ▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | # ifdef __HAIR__ | ||||
| } | } | ||||
| # endif /* __HAIR__ */ | # endif /* __HAIR__ */ | ||||
| return bvh_intersect(kg, ray, isect, visibility); | return bvh_intersect(kg, ray, isect, visibility); | ||||
| #endif /* __KERNEL_OPTIX__ */ | #endif /* __KERNEL_OPTIX__ */ | ||||
| } | } | ||||
| #ifdef __BVH_LOCAL__ | #ifdef __BVH_LOCAL__ | ||||
| ccl_device_intersect bool scene_intersect_local(ccl_global const KernelGlobals *kg, | ccl_device_intersect bool scene_intersect_local(KernelGlobals kg, | ||||
| ccl_private const Ray *ray, | ccl_private const Ray *ray, | ||||
| ccl_private LocalIntersection *local_isect, | ccl_private LocalIntersection *local_isect, | ||||
| int local_object, | int local_object, | ||||
| ccl_private uint *lcg_state, | ccl_private uint *lcg_state, | ||||
| int max_hits) | int max_hits) | ||||
| { | { | ||||
| # ifdef __KERNEL_OPTIX__ | # ifdef __KERNEL_OPTIX__ | ||||
| uint p0 = pointer_pack_to_uint_0(lcg_state); | uint p0 = pointer_pack_to_uint_0(lcg_state); | ||||
| ▲ Show 20 Lines • Show All 95 Lines • ▼ Show 20 Lines | # ifdef __OBJECT_MOTION__ | ||||
| } | } | ||||
| # endif /* __OBJECT_MOTION__ */ | # endif /* __OBJECT_MOTION__ */ | ||||
| return bvh_intersect_local(kg, ray, local_isect, local_object, lcg_state, max_hits); | return bvh_intersect_local(kg, ray, local_isect, local_object, lcg_state, max_hits); | ||||
| # endif /* __KERNEL_OPTIX__ */ | # endif /* __KERNEL_OPTIX__ */ | ||||
| } | } | ||||
| #endif | #endif | ||||
| #ifdef __SHADOW_RECORD_ALL__ | #ifdef __SHADOW_RECORD_ALL__ | ||||
| ccl_device_intersect bool scene_intersect_shadow_all(ccl_global const KernelGlobals *kg, | ccl_device_intersect bool scene_intersect_shadow_all(KernelGlobals kg, | ||||
| ccl_private const Ray *ray, | ccl_private const Ray *ray, | ||||
| ccl_private Intersection *isect, | ccl_private Intersection *isect, | ||||
| uint visibility, | uint visibility, | ||||
| uint max_hits, | uint max_hits, | ||||
| ccl_private uint *num_hits) | ccl_private uint *num_hits) | ||||
| { | { | ||||
| # ifdef __KERNEL_OPTIX__ | # ifdef __KERNEL_OPTIX__ | ||||
| uint p0 = pointer_pack_to_uint_0(isect); | uint p0 = pointer_pack_to_uint_0(isect); | ||||
| ▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | |||||
| # endif /* __HAIR__ */ | # endif /* __HAIR__ */ | ||||
| return bvh_intersect_shadow_all(kg, ray, isect, visibility, max_hits, num_hits); | return bvh_intersect_shadow_all(kg, ray, isect, visibility, max_hits, num_hits); | ||||
| # endif /* __KERNEL_OPTIX__ */ | # endif /* __KERNEL_OPTIX__ */ | ||||
| } | } | ||||
| #endif /* __SHADOW_RECORD_ALL__ */ | #endif /* __SHADOW_RECORD_ALL__ */ | ||||
| #ifdef __VOLUME__ | #ifdef __VOLUME__ | ||||
| ccl_device_intersect bool scene_intersect_volume(ccl_global const KernelGlobals *kg, | ccl_device_intersect bool scene_intersect_volume(KernelGlobals kg, | ||||
| ccl_private const Ray *ray, | ccl_private const Ray *ray, | ||||
| ccl_private Intersection *isect, | ccl_private Intersection *isect, | ||||
| const uint visibility) | const uint visibility) | ||||
| { | { | ||||
| # ifdef __KERNEL_OPTIX__ | # ifdef __KERNEL_OPTIX__ | ||||
| uint p0 = 0; | uint p0 = 0; | ||||
| uint p1 = 0; | uint p1 = 0; | ||||
| uint p2 = 0; | uint p2 = 0; | ||||
| ▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | |||||
| # endif /* __OBJECT_MOTION__ */ | # endif /* __OBJECT_MOTION__ */ | ||||
| return bvh_intersect_volume(kg, ray, isect, visibility); | return bvh_intersect_volume(kg, ray, isect, visibility); | ||||
| # endif /* __KERNEL_OPTIX__ */ | # endif /* __KERNEL_OPTIX__ */ | ||||
| } | } | ||||
| #endif /* __VOLUME__ */ | #endif /* __VOLUME__ */ | ||||
| #ifdef __VOLUME_RECORD_ALL__ | #ifdef __VOLUME_RECORD_ALL__ | ||||
| ccl_device_intersect uint scene_intersect_volume_all(ccl_global const KernelGlobals *kg, | ccl_device_intersect uint scene_intersect_volume_all(KernelGlobals kg, | ||||
| ccl_private const Ray *ray, | ccl_private const Ray *ray, | ||||
| ccl_private Intersection *isect, | ccl_private Intersection *isect, | ||||
| const uint max_hits, | const uint max_hits, | ||||
| const uint visibility) | const uint visibility) | ||||
| { | { | ||||
| if (!scene_intersect_valid(ray)) { | if (!scene_intersect_valid(ray)) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| Show All 26 Lines | |||||