Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/bvh/bvh.h
| Show All 28 Lines | |||||
| #ifdef __EMBREE__ | #ifdef __EMBREE__ | ||||
| # include "kernel/bvh/bvh_embree.h" | # include "kernel/bvh/bvh_embree.h" | ||||
| #endif | #endif | ||||
| #include "kernel/bvh/bvh_types.h" | #include "kernel/bvh/bvh_types.h" | ||||
| #include "kernel/bvh/bvh_util.h" | #include "kernel/bvh/bvh_util.h" | ||||
| #include "kernel/integrator/integrator_state_util.h" | |||||
| CCL_NAMESPACE_BEGIN | CCL_NAMESPACE_BEGIN | ||||
| #ifndef __KERNEL_OPTIX__ | #ifndef __KERNEL_OPTIX__ | ||||
| /* Regular BVH traversal */ | /* Regular BVH traversal */ | ||||
| # include "kernel/bvh/bvh_nodes.h" | # include "kernel/bvh/bvh_nodes.h" | ||||
| ▲ Show 20 Lines • Show All 311 Lines • ▼ Show 20 Lines | |||||
| # 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(KernelGlobals kg, | ccl_device_intersect bool scene_intersect_shadow_all(KernelGlobals kg, | ||||
| IntegratorShadowState state, | |||||
| ccl_private const Ray *ray, | ccl_private const Ray *ray, | ||||
| 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 = state; | ||||
| uint p1 = pointer_pack_to_uint_1(isect); | uint p1 = 0; /* Number of hits. */ | ||||
| uint p2 = 0; /* Number of hits. */ | uint p2 = max_hits; | ||||
| uint p3 = max_hits; | uint p3 = visibility; | ||||
| uint p4 = visibility; | uint p4 = false; /* Opaque hit. */ | ||||
| uint p5 = false; | uint p5 = 0; /* Unused. */ | ||||
| uint ray_mask = visibility & 0xFF; | uint ray_mask = visibility & 0xFF; | ||||
| if (0 == ray_mask && (visibility & ~0xFF) != 0) { | if (0 == ray_mask && (visibility & ~0xFF) != 0) { | ||||
| ray_mask = 0xFF; | ray_mask = 0xFF; | ||||
| } | } | ||||
| *num_hits = 0; /* Initialize hit count to zero. */ | *num_hits = 0; /* Initialize hit count to zero. */ | ||||
| optixTrace(scene_intersect_valid(ray) ? kernel_data.bvh.scene : 0, | optixTrace(scene_intersect_valid(ray) ? kernel_data.bvh.scene : 0, | ||||
| Show All 22 Lines | # else /* __KERNEL_OPTIX__ */ | ||||
| if (!scene_intersect_valid(ray)) { | if (!scene_intersect_valid(ray)) { | ||||
| *num_hits = 0; | *num_hits = 0; | ||||
| return false; | return false; | ||||
| } | } | ||||
| # ifdef __EMBREE__ | # ifdef __EMBREE__ | ||||
| if (kernel_data.bvh.scene) { | if (kernel_data.bvh.scene) { | ||||
| CCLIntersectContext ctx(kg, CCLIntersectContext::RAY_SHADOW_ALL); | CCLIntersectContext ctx(kg, CCLIntersectContext::RAY_SHADOW_ALL); | ||||
| ctx.isect_s = isect; | Intersection *isect_array = (Intersection *)state->shadow_isect; | ||||
| ctx.isect_s = isect_array; | |||||
| ctx.max_hits = max_hits; | ctx.max_hits = max_hits; | ||||
| IntersectContext rtc_ctx(&ctx); | IntersectContext rtc_ctx(&ctx); | ||||
| RTCRay rtc_ray; | RTCRay rtc_ray; | ||||
| kernel_embree_setup_ray(*ray, rtc_ray, visibility); | kernel_embree_setup_ray(*ray, rtc_ray, visibility); | ||||
| rtcOccluded1(kernel_data.bvh.scene, &rtc_ctx.context, &rtc_ray); | rtcOccluded1(kernel_data.bvh.scene, &rtc_ctx.context, &rtc_ray); | ||||
| *num_hits = ctx.num_hits; | *num_hits = ctx.num_hits; | ||||
| return ctx.opaque_hit; | return ctx.opaque_hit; | ||||
| } | } | ||||
| # endif /* __EMBREE__ */ | # endif /* __EMBREE__ */ | ||||
| # ifdef __OBJECT_MOTION__ | # ifdef __OBJECT_MOTION__ | ||||
| if (kernel_data.bvh.have_motion) { | if (kernel_data.bvh.have_motion) { | ||||
| # ifdef __HAIR__ | # ifdef __HAIR__ | ||||
| if (kernel_data.bvh.have_curves) { | if (kernel_data.bvh.have_curves) { | ||||
| return bvh_intersect_shadow_all_hair_motion(kg, ray, isect, visibility, max_hits, num_hits); | return bvh_intersect_shadow_all_hair_motion(kg, ray, state, visibility, max_hits, num_hits); | ||||
| } | } | ||||
| # endif /* __HAIR__ */ | # endif /* __HAIR__ */ | ||||
| return bvh_intersect_shadow_all_motion(kg, ray, isect, visibility, max_hits, num_hits); | return bvh_intersect_shadow_all_motion(kg, ray, state, visibility, max_hits, num_hits); | ||||
| } | } | ||||
| # endif /* __OBJECT_MOTION__ */ | # endif /* __OBJECT_MOTION__ */ | ||||
| # ifdef __HAIR__ | # ifdef __HAIR__ | ||||
| if (kernel_data.bvh.have_curves) { | if (kernel_data.bvh.have_curves) { | ||||
| return bvh_intersect_shadow_all_hair(kg, ray, isect, visibility, max_hits, num_hits); | return bvh_intersect_shadow_all_hair(kg, ray, state, visibility, max_hits, num_hits); | ||||
| } | } | ||||
| # endif /* __HAIR__ */ | # endif /* __HAIR__ */ | ||||
| return bvh_intersect_shadow_all(kg, ray, isect, visibility, max_hits, num_hits); | return bvh_intersect_shadow_all(kg, ray, state, 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(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, | ||||
| ▲ Show 20 Lines • Show All 94 Lines • Show Last 20 Lines | |||||