diff options
author | Brecht Van Lommel <brecht@blender.org> | 2021-12-20 04:52:56 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-12-20 16:14:43 +0300 |
commit | e2e7f7ea529e352e34c6bed8e9cbf1fa0975f3e8 (patch) | |
tree | a1345c27bf0d4300020f2278487d7bb98208298a /intern/cycles/kernel/bvh | |
parent | 5adc06d2d89819522a355cec6bd3022e1b2f41d3 (diff) |
Fix Cycles OptiX crash with 3D curves after point cloud changes
Includes refactoring to reduce the number of bits taken by primitive types,
so they more easily fit in the OptiX limit.
Diffstat (limited to 'intern/cycles/kernel/bvh')
-rw-r--r-- | intern/cycles/kernel/bvh/shadow_all.h | 6 | ||||
-rw-r--r-- | intern/cycles/kernel/bvh/traversal.h | 4 | ||||
-rw-r--r-- | intern/cycles/kernel/bvh/util.h | 12 |
3 files changed, 11 insertions, 11 deletions
diff --git a/intern/cycles/kernel/bvh/shadow_all.h b/intern/cycles/kernel/bvh/shadow_all.h index caca85aac1a..b0e799675e0 100644 --- a/intern/cycles/kernel/bvh/shadow_all.h +++ b/intern/cycles/kernel/bvh/shadow_all.h @@ -174,7 +174,7 @@ ccl_device_inline case PRIMITIVE_MOTION_CURVE_THICK: case PRIMITIVE_CURVE_RIBBON: case PRIMITIVE_MOTION_CURVE_RIBBON: { - if ((type & PRIMITIVE_ALL_MOTION) && kernel_data.bvh.use_bvh_steps) { + if ((type & PRIMITIVE_MOTION) && kernel_data.bvh.use_bvh_steps) { const float2 prim_time = kernel_tex_fetch(__prim_time, prim_addr); if (ray->time < prim_time.x || ray->time > prim_time.y) { hit = false; @@ -203,7 +203,7 @@ ccl_device_inline #if BVH_FEATURE(BVH_POINTCLOUD) case PRIMITIVE_POINT: case PRIMITIVE_MOTION_POINT: { - if ((type & PRIMITIVE_ALL_MOTION) && kernel_data.bvh.use_bvh_steps) { + if ((type & PRIMITIVE_MOTION) && kernel_data.bvh.use_bvh_steps) { const float2 prim_time = kernel_tex_fetch(__prim_time, prim_addr); if (ray->time < prim_time.x || ray->time > prim_time.y) { hit = false; @@ -255,7 +255,7 @@ ccl_device_inline bool record_intersection = true; /* Always use baked shadow transparency for curves. */ - if (isect.type & PRIMITIVE_ALL_CURVE) { + if (isect.type & PRIMITIVE_CURVE) { *throughput *= intersection_curve_shadow_transparency( kg, isect.object, isect.prim, isect.u); diff --git a/intern/cycles/kernel/bvh/traversal.h b/intern/cycles/kernel/bvh/traversal.h index 180f19d11c5..e4bff1a8a80 100644 --- a/intern/cycles/kernel/bvh/traversal.h +++ b/intern/cycles/kernel/bvh/traversal.h @@ -166,7 +166,7 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals kg, case PRIMITIVE_CURVE_RIBBON: case PRIMITIVE_MOTION_CURVE_RIBBON: { for (; prim_addr < prim_addr2; prim_addr++) { - if ((type & PRIMITIVE_ALL_MOTION) && kernel_data.bvh.use_bvh_steps) { + if ((type & PRIMITIVE_MOTION) && kernel_data.bvh.use_bvh_steps) { const float2 prim_time = kernel_tex_fetch(__prim_time, prim_addr); if (ray->time < prim_time.x || ray->time > prim_time.y) { continue; @@ -193,7 +193,7 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals kg, case PRIMITIVE_POINT: case PRIMITIVE_MOTION_POINT: { for (; prim_addr < prim_addr2; prim_addr++) { - if ((type & PRIMITIVE_ALL_MOTION) && kernel_data.bvh.use_bvh_steps) { + if ((type & PRIMITIVE_MOTION) && kernel_data.bvh.use_bvh_steps) { const float2 prim_time = kernel_tex_fetch(__prim_time, prim_addr); if (ray->time < prim_time.x || ray->time > prim_time.y) { continue; diff --git a/intern/cycles/kernel/bvh/util.h b/intern/cycles/kernel/bvh/util.h index 57593e42a88..bd79c6e19c6 100644 --- a/intern/cycles/kernel/bvh/util.h +++ b/intern/cycles/kernel/bvh/util.h @@ -118,16 +118,16 @@ ccl_device_forceinline int intersection_get_shader_flags(KernelGlobals kg, { int shader = 0; - if (type & PRIMITIVE_ALL_TRIANGLE) { + if (type & PRIMITIVE_TRIANGLE) { shader = kernel_tex_fetch(__tri_shader, prim); } #ifdef __POINTCLOUD__ - else if (type & PRIMITIVE_ALL_POINT) { + else if (type & PRIMITIVE_POINT) { shader = kernel_tex_fetch(__points_shader, prim); } #endif #ifdef __HAIR__ - else if (type & PRIMITIVE_ALL_CURVE) { + else if (type & PRIMITIVE_CURVE) { shader = kernel_tex_fetch(__curves, prim).shader_id; } #endif @@ -141,16 +141,16 @@ ccl_device_forceinline int intersection_get_shader_from_isect_prim(KernelGlobals { int shader = 0; - if (isect_type & PRIMITIVE_ALL_TRIANGLE) { + if (isect_type & PRIMITIVE_TRIANGLE) { shader = kernel_tex_fetch(__tri_shader, prim); } #ifdef __POINTCLOUD__ - else if (isect_type & PRIMITIVE_ALL_POINT) { + else if (isect_type & PRIMITIVE_POINT) { shader = kernel_tex_fetch(__points_shader, prim); } #endif #ifdef __HAIR__ - else if (isect_type & PRIMITIVE_ALL_CURVE) { + else if (isect_type & PRIMITIVE_CURVE) { shader = kernel_tex_fetch(__curves, prim).shader_id; } #endif |