diff options
author | Brecht Van Lommel <brecht@blender.org> | 2021-10-18 20:20:09 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-10-19 16:10:55 +0300 |
commit | d06828f0b8ebb083de59fd2cb8c5f8fe6af1da22 (patch) | |
tree | 6ed5d1a8a488d1badaf5b8e462f7c1df2e75cbb2 /intern/cycles/kernel/bvh/bvh.h | |
parent | 943e73b07e26d64c04ccb7d8f656e3818a57cca0 (diff) |
Cycles: avoid intermediate stack array for writing shadow intersections
Helps save one OptiX payload and is a bit more efficient.
Differential Revision: https://developer.blender.org/D12909
Diffstat (limited to 'intern/cycles/kernel/bvh/bvh.h')
-rw-r--r-- | intern/cycles/kernel/bvh/bvh.h | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/intern/cycles/kernel/bvh/bvh.h b/intern/cycles/kernel/bvh/bvh.h index bdbd574bf0f..0d9ba7e6369 100644 --- a/intern/cycles/kernel/bvh/bvh.h +++ b/intern/cycles/kernel/bvh/bvh.h @@ -34,6 +34,8 @@ #include "kernel/bvh/bvh_types.h" #include "kernel/bvh/bvh_util.h" +#include "kernel/integrator/integrator_state_util.h" + CCL_NAMESPACE_BEGIN #ifndef __KERNEL_OPTIX__ @@ -361,15 +363,15 @@ ccl_device_intersect bool scene_intersect_local(KernelGlobals kg, #ifdef __SHADOW_RECORD_ALL__ ccl_device_intersect bool scene_intersect_shadow_all(KernelGlobals kg, + IntegratorShadowState state, ccl_private const Ray *ray, - ccl_private Intersection *isect, uint visibility, uint max_hits, ccl_private uint *num_hits) { # ifdef __KERNEL_OPTIX__ - uint p0 = pointer_pack_to_uint_0(isect); - uint p1 = pointer_pack_to_uint_1(isect); + uint p0 = state; + uint p1 = 0; /* Unused */ uint p2 = 0; /* Number of hits. */ uint p3 = max_hits; uint p4 = visibility; @@ -412,7 +414,8 @@ ccl_device_intersect bool scene_intersect_shadow_all(KernelGlobals kg, # ifdef __EMBREE__ if (kernel_data.bvh.scene) { 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; IntersectContext rtc_ctx(&ctx); RTCRay rtc_ray; @@ -428,21 +431,21 @@ ccl_device_intersect bool scene_intersect_shadow_all(KernelGlobals kg, if (kernel_data.bvh.have_motion) { # ifdef __HAIR__ 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__ */ - 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__ */ # ifdef __HAIR__ 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__ */ - 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 /* __SHADOW_RECORD_ALL__ */ |