Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/bvh/qbvh_nodes.h
| Show First 20 Lines • Show All 120 Lines • ▼ Show 20 Lines | |||||
| #endif | #endif | ||||
| #ifdef __KERNEL_SSE41__ | #ifdef __KERNEL_SSE41__ | ||||
| const ssef tnear = maxi(maxi(tnear_x, tnear_y), maxi(tnear_z, isect_near)); | const ssef tnear = maxi(maxi(tnear_x, tnear_y), maxi(tnear_z, isect_near)); | ||||
| const ssef tfar = mini(mini(tfar_x, tfar_y), mini(tfar_z, isect_far)); | const ssef tfar = mini(mini(tfar_x, tfar_y), mini(tfar_z, isect_far)); | ||||
| const sseb vmask = cast(tnear) > cast(tfar); | const sseb vmask = cast(tnear) > cast(tfar); | ||||
| int mask = (int)movemask(vmask)^0xf; | int mask = (int)movemask(vmask)^0xf; | ||||
| #else | #else | ||||
| const ssef tnear = max4(tnear_x, tnear_y, tnear_z, isect_near); | const ssef tnear = max4(isect_near, tnear_x, tnear_y, tnear_z); | ||||
| const ssef tfar = min4(tfar_x, tfar_y, tfar_z, isect_far); | const ssef tfar = min4(isect_far, tfar_x, tfar_y, tfar_z); | ||||
| const sseb vmask = tnear <= tfar; | const sseb vmask = tnear <= tfar; | ||||
| int mask = (int)movemask(vmask); | int mask = (int)movemask(vmask); | ||||
| #endif | #endif | ||||
| *dist = tnear; | *dist = tnear; | ||||
| return mask; | return mask; | ||||
| } | } | ||||
| ccl_device_inline int qbvh_aligned_node_intersect_robust( | ccl_device_inline int qbvh_aligned_node_intersect_robust( | ||||
| Show All 30 Lines | #else | ||||
| const ssef tnear_z = (kernel_tex_fetch_ssef(__bvh_nodes, offset+near_z) - P.z) * idir.z; | const ssef tnear_z = (kernel_tex_fetch_ssef(__bvh_nodes, offset+near_z) - P.z) * idir.z; | ||||
| const ssef tfar_x = (kernel_tex_fetch_ssef(__bvh_nodes, offset+far_x) - P.x) * idir.x; | const ssef tfar_x = (kernel_tex_fetch_ssef(__bvh_nodes, offset+far_x) - P.x) * idir.x; | ||||
| const ssef tfar_y = (kernel_tex_fetch_ssef(__bvh_nodes, offset+far_y) - P.y) * idir.y; | const ssef tfar_y = (kernel_tex_fetch_ssef(__bvh_nodes, offset+far_y) - P.y) * idir.y; | ||||
| const ssef tfar_z = (kernel_tex_fetch_ssef(__bvh_nodes, offset+far_z) - P.z) * idir.z; | const ssef tfar_z = (kernel_tex_fetch_ssef(__bvh_nodes, offset+far_z) - P.z) * idir.z; | ||||
| #endif | #endif | ||||
| const float round_down = 1.0f - difl; | const float round_down = 1.0f - difl; | ||||
| const float round_up = 1.0f + difl; | const float round_up = 1.0f + difl; | ||||
| const ssef tnear = max4(tnear_x, tnear_y, tnear_z, isect_near); | const ssef tnear = max4(isect_near, tnear_x, tnear_y, tnear_z); | ||||
| const ssef tfar = min4(tfar_x, tfar_y, tfar_z, isect_far); | const ssef tfar = min4(isect_far, tfar_x, tfar_y, tfar_z); | ||||
| const sseb vmask = round_down*tnear <= round_up*tfar; | const sseb vmask = round_down*tnear <= round_up*tfar; | ||||
| *dist = tnear; | *dist = tnear; | ||||
| return (int)movemask(vmask); | return (int)movemask(vmask); | ||||
| } | } | ||||
| /* Unaligned nodes intersection */ | /* Unaligned nodes intersection */ | ||||
| ccl_device_inline int qbvh_unaligned_node_intersect( | ccl_device_inline int qbvh_unaligned_node_intersect( | ||||
| ▲ Show 20 Lines • Show All 279 Lines • Show Last 20 Lines | |||||