diff options
author | Brecht Van Lommel <brecht@blender.org> | 2021-10-14 18:51:27 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-10-15 16:42:44 +0300 |
commit | eb71157e2a9c7abdeb7045bdf9b79d8ca27ba263 (patch) | |
tree | 16debc9c1a427e28d909890c917e55e9dfd16c5e /intern/cycles/kernel/bvh | |
parent | 2ba7c3aa650c3c795d903a24998204f67c75b017 (diff) |
Cleanup: add utility functions for packing integers
Diffstat (limited to 'intern/cycles/kernel/bvh')
-rw-r--r-- | intern/cycles/kernel/bvh/bvh.h | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/intern/cycles/kernel/bvh/bvh.h b/intern/cycles/kernel/bvh/bvh.h index 8f6dcd0adb9..a501cbe7a4b 100644 --- a/intern/cycles/kernel/bvh/bvh.h +++ b/intern/cycles/kernel/bvh/bvh.h @@ -256,10 +256,10 @@ ccl_device_intersect bool scene_intersect_local(ccl_global const KernelGlobals * int max_hits) { # ifdef __KERNEL_OPTIX__ - uint p0 = ((uint64_t)lcg_state) & 0xFFFFFFFF; - uint p1 = (((uint64_t)lcg_state) >> 32) & 0xFFFFFFFF; - uint p2 = ((uint64_t)local_isect) & 0xFFFFFFFF; - uint p3 = (((uint64_t)local_isect) >> 32) & 0xFFFFFFFF; + uint p0 = pointer_pack_to_uint_0(lcg_state); + uint p1 = pointer_pack_to_uint_1(lcg_state); + uint p2 = pointer_pack_to_uint_0(local_isect); + uint p3 = pointer_pack_to_uint_1(local_isect); uint p4 = local_object; /* Is set to zero on miss or if ray is aborted, so can be used as return value. */ uint p5 = max_hits; @@ -368,8 +368,9 @@ ccl_device_intersect bool scene_intersect_shadow_all(ccl_global const KernelGlob ccl_private uint *num_hits) { # ifdef __KERNEL_OPTIX__ - uint p0 = ((uint64_t)isect) & 0xFFFFFFFF; - uint p1 = (((uint64_t)isect) >> 32) & 0xFFFFFFFF; + uint p0 = pointer_pack_to_uint_0(isect); + uint p1 = pointer_pack_to_uint_1(isect); + uint p2 = 0; /* Number of hits. */ uint p3 = max_hits; uint p4 = visibility; uint p5 = false; @@ -394,11 +395,13 @@ ccl_device_intersect bool scene_intersect_shadow_all(ccl_global const KernelGlob 0, p0, p1, - *num_hits, + p2, p3, p4, p5); + *num_hits = p2; + return p5; # else /* __KERNEL_OPTIX__ */ if (!scene_intersect_valid(ray)) { |