From c06d3b6c3650be099d50da5830e956ae77896693 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 11 Jul 2016 18:15:51 +0200 Subject: Cycles: Fix compilation error on Windows with OSL enabled Seems there's some conflict around `near` identifier in that configuration. --- intern/cycles/kernel/bvh/bvh_nodes.h | 64 +++++++++++++------------- intern/cycles/kernel/bvh/qbvh_nodes.h | 86 +++++++++++++++++------------------ 2 files changed, 75 insertions(+), 75 deletions(-) (limited to 'intern/cycles/kernel/bvh') diff --git a/intern/cycles/kernel/bvh/bvh_nodes.h b/intern/cycles/kernel/bvh/bvh_nodes.h index 853976fdf06..db2275b0ff8 100644 --- a/intern/cycles/kernel/bvh/bvh_nodes.h +++ b/intern/cycles/kernel/bvh/bvh_nodes.h @@ -160,10 +160,10 @@ ccl_device_inline bool bvh_unaligned_node_intersect_child( const float far_x = max(lower_xyz.x, upper_xyz.x); const float far_y = max(lower_xyz.y, upper_xyz.y); const float far_z = max(lower_xyz.z, upper_xyz.z); - const float near = max4(0.0f, near_x, near_y, near_z); - const float far = min4(t, far_x, far_y, far_z); - *dist = near; - return near <= far; + const float tnear = max4(0.0f, near_x, near_y, near_z); + const float tfar = min4(t, far_x, far_y, far_z); + *dist = tnear; + return tnear <= tfar; } ccl_device_inline bool bvh_unaligned_node_intersect_child_robust( @@ -188,17 +188,17 @@ ccl_device_inline bool bvh_unaligned_node_intersect_child_robust( const float far_x = max(tLowerXYZ.x, tUpperXYZ.x); const float far_y = max(tLowerXYZ.y, tUpperXYZ.y); const float far_z = max(tLowerXYZ.z, tUpperXYZ.z); - const float near = max4(0.0f, near_x, near_y, near_z); - const float far = min4(t, far_x, far_y, far_z); - *dist = near; + const float tnear = max4(0.0f, near_x, near_y, near_z); + const float tfar = min4(t, far_x, far_y, far_z); + *dist = tnear; if(difl != 0.0f) { /* TODO(sergey): Same as for QBVH, needs a proper use. */ const float round_down = 1.0f - difl; const float round_up = 1.0f + difl; - return round_down*near <= round_up*far; + return round_down*tnear <= round_up*tfar; } else { - return near <= far; + return tnear <= tfar; } } @@ -444,8 +444,8 @@ int ccl_device_inline bvh_aligned_node_intersect_robust( int ccl_device_inline bvh_unaligned_node_intersect(KernelGlobals *kg, const float3 P, const float3 dir, - const ssef& tnear, - const ssef& tfar, + const ssef& isect_near, + const ssef& isect_far, const int node_addr, const uint visibility, float dist[2]) @@ -483,11 +483,11 @@ int ccl_device_inline bvh_unaligned_node_intersect(KernelGlobals *kg, ssef tfar_y = max(lower_y, upper_y); ssef tfar_z = max(lower_z, upper_z); - const ssef near = max4(tnear_x, tnear_y, tnear_z, tnear); - const ssef far = min4(tfar_x, tfar_y, tfar_z, tfar); - sseb vmask = near <= far; - dist[0] = near.f[0]; - dist[1] = near.f[1]; + const ssef tnear = max4(tnear_x, tnear_y, tnear_z, isect_near); + const ssef tfar = min4(tfar_x, tfar_y, tfar_z, isect_far); + sseb vmask = tnear <= tfar; + dist[0] = tnear.f[0]; + dist[1] = tnear.f[1]; int mask = (int)movemask(vmask); @@ -505,8 +505,8 @@ int ccl_device_inline bvh_unaligned_node_intersect(KernelGlobals *kg, int ccl_device_inline bvh_unaligned_node_intersect_robust(KernelGlobals *kg, const float3 P, const float3 dir, - const ssef& tnear, - const ssef& tfar, + const ssef& isect_near, + const ssef& isect_far, const float difl, const int node_addr, const uint visibility, @@ -545,20 +545,20 @@ int ccl_device_inline bvh_unaligned_node_intersect_robust(KernelGlobals *kg, ssef tfar_y = max(lower_y, upper_y); ssef tfar_z = max(lower_z, upper_z); - const ssef near = max4(tnear_x, tnear_y, tnear_z, tnear); - const ssef far = min4(tfar_x, tfar_y, tfar_z, tfar); + const ssef tnear = max4(tnear_x, tnear_y, tnear_z, isect_near); + const ssef tfar = min4(tfar_x, tfar_y, tfar_z, isect_far); sseb vmask; if(difl != 0.0f) { const float round_down = 1.0f - difl; const float round_up = 1.0f + difl; - vmask = round_down*near <= round_up*far; + vmask = round_down*tnear <= round_up*tfar; } else { - vmask = near <= far; + vmask = tnear <= tfar; } - dist[0] = near.f[0]; - dist[1] = near.f[1]; + dist[0] = tnear.f[0]; + dist[1] = tnear.f[1]; int mask = (int)movemask(vmask); @@ -576,8 +576,8 @@ int ccl_device_inline bvh_unaligned_node_intersect_robust(KernelGlobals *kg, ccl_device_inline int bvh_node_intersect(KernelGlobals *kg, const float3& P, const float3& dir, - const ssef& tnear, - const ssef& tfar, + const ssef& isect_near, + const ssef& isect_far, const ssef& tsplat, const ssef Psplat[3], const ssef idirsplat[3], @@ -591,8 +591,8 @@ ccl_device_inline int bvh_node_intersect(KernelGlobals *kg, return bvh_unaligned_node_intersect(kg, P, dir, - tnear, - tfar, + isect_near, + isect_far, node_addr, visibility, dist); @@ -614,8 +614,8 @@ ccl_device_inline int bvh_node_intersect(KernelGlobals *kg, ccl_device_inline int bvh_node_intersect_robust(KernelGlobals *kg, const float3& P, const float3& dir, - const ssef& tnear, - const ssef& tfar, + const ssef& isect_near, + const ssef& isect_far, const ssef& tsplat, const ssef Psplat[3], const ssef idirsplat[3], @@ -631,8 +631,8 @@ ccl_device_inline int bvh_node_intersect_robust(KernelGlobals *kg, return bvh_unaligned_node_intersect_robust(kg, P, dir, - tnear, - tfar, + isect_near, + isect_far, difl, node_addr, visibility, diff --git a/intern/cycles/kernel/bvh/qbvh_nodes.h b/intern/cycles/kernel/bvh/qbvh_nodes.h index a833f4b1248..4d8695bedec 100644 --- a/intern/cycles/kernel/bvh/qbvh_nodes.h +++ b/intern/cycles/kernel/bvh/qbvh_nodes.h @@ -54,8 +54,8 @@ ccl_device_inline void qbvh_stack_sort(QBVHStackItem *ccl_restrict s1, /* Axis-aligned nodes intersection */ ccl_device_inline int qbvh_aligned_node_intersect(KernelGlobals *ccl_restrict kg, - const ssef& tnear, - const ssef& tfar, + const ssef& isect_near, + const ssef& isect_far, #ifdef __KERNEL_AVX2__ const sse3f& org_idir, #else @@ -89,24 +89,24 @@ ccl_device_inline int qbvh_aligned_node_intersect(KernelGlobals *ccl_restrict kg #endif #ifdef __KERNEL_SSE41__ - const ssef near = maxi(maxi(tnear_x, tnear_y), maxi(tnear_z, tnear)); - const ssef far = mini(mini(tfar_x, tfar_y), mini(tfar_z, tfar)); - const sseb vmask = cast(near) > cast(far); + 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 sseb vmask = cast(tnear) > cast(tfar); int mask = (int)movemask(vmask)^0xf; #else - const ssef near = max4(tnear_x, tnear_y, tnear_z, tnear); - const ssef far = min4(tfar_x, tfar_y, tfar_z, tfar); - const sseb vmask = near <= far; + const ssef tnear = max4(tnear_x, tnear_y, tnear_z, isect_near); + const ssef tfar = min4(tfar_x, tfar_y, tfar_z, isect_far); + const sseb vmask = tnear <= tfar; int mask = (int)movemask(vmask); #endif - *dist = near; + *dist = tnear; return mask; } ccl_device_inline int qbvh_aligned_node_intersect_robust( KernelGlobals *ccl_restrict kg, - const ssef& tnear, - const ssef& tfar, + const ssef& isect_near, + const ssef& isect_far, #ifdef __KERNEL_AVX2__ const sse3f& P_idir, #else @@ -142,10 +142,10 @@ ccl_device_inline int qbvh_aligned_node_intersect_robust( const float round_down = 1.0f - difl; const float round_up = 1.0f + difl; - const ssef near = max4(tnear_x, tnear_y, tnear_z, tnear); - const ssef far = min4(tfar_x, tfar_y, tfar_z, tfar); - const sseb vmask = round_down*near <= round_up*far; - *dist = near; + const ssef tnear = max4(tnear_x, tnear_y, tnear_z, isect_near); + const ssef tfar = min4(tfar_x, tfar_y, tfar_z, isect_far); + const sseb vmask = round_down*tnear <= round_up*tfar; + *dist = tnear; return (int)movemask(vmask); } @@ -153,8 +153,8 @@ ccl_device_inline int qbvh_aligned_node_intersect_robust( ccl_device_inline int qbvh_unaligned_node_intersect( KernelGlobals *ccl_restrict kg, - const ssef& tnear, - const ssef& tfar, + const ssef& isect_near, + const ssef& isect_far, #ifdef __KERNEL_AVX2__ const sse3f& org_idir, #endif @@ -215,10 +215,10 @@ ccl_device_inline int qbvh_unaligned_node_intersect( const ssef tfar_x = maxi(tlower_x, tupper_x); const ssef tfar_y = maxi(tlower_y, tupper_y); const ssef tfar_z = maxi(tlower_z, tupper_z); - const ssef near = max4(tnear, tnear_x, tnear_y, tnear_z); - const ssef far = min4(tfar, tfar_x, tfar_y, tfar_z); - const sseb vmask = near <= far; - *dist = near; + const ssef tnear = max4(isect_near, tnear_x, tnear_y, tnear_z); + const ssef tfar = min4(isect_far, tfar_x, tfar_y, tfar_z); + const sseb vmask = tnear <= tfar; + *dist = tnear; return movemask(vmask); #else const ssef tnear_x = min(tlower_x, tupper_x); @@ -227,18 +227,18 @@ ccl_device_inline int qbvh_unaligned_node_intersect( const ssef tfar_x = max(tlower_x, tupper_x); const ssef tfar_y = max(tlower_y, tupper_y); const ssef tfar_z = max(tlower_z, tupper_z); - const ssef near = max4(tnear, tnear_x, tnear_y, tnear_z); - const ssef far = min4(tfar, tfar_x, tfar_y, tfar_z); - const sseb vmask = near <= far; - *dist = near; + const ssef tnear = max4(isect_near, tnear_x, tnear_y, tnear_z); + const ssef tfar = min4(isect_far, tfar_x, tfar_y, tfar_z); + const sseb vmask = tnear <= tfar; + *dist = tnear; return movemask(vmask); #endif } ccl_device_inline int qbvh_unaligned_node_intersect_robust( KernelGlobals *ccl_restrict kg, - const ssef& tnear, - const ssef& tfar, + const ssef& isect_near, + const ssef& isect_far, #ifdef __KERNEL_AVX2__ const sse3f& P_idir, #endif @@ -311,10 +311,10 @@ ccl_device_inline int qbvh_unaligned_node_intersect_robust( const ssef tfar_y = max(tlower_y, tupper_y); const ssef tfar_z = max(tlower_z, tupper_z); #endif - const ssef near = max4(tnear, tnear_x, tnear_y, tnear_z); - const ssef far = min4(tfar, tfar_x, tfar_y, tfar_z); - const sseb vmask = round_down*near <= round_up*far; - *dist = near; + const ssef tnear = max4(isect_near, tnear_x, tnear_y, tnear_z); + const ssef tfar = min4(isect_far, tfar_x, tfar_y, tfar_z); + const sseb vmask = round_down*tnear <= round_up*tfar; + *dist = tnear; return movemask(vmask); } @@ -325,8 +325,8 @@ ccl_device_inline int qbvh_unaligned_node_intersect_robust( ccl_device_inline int qbvh_node_intersect( KernelGlobals *ccl_restrict kg, - const ssef& tnear, - const ssef& tfar, + const ssef& isect_near, + const ssef& isect_far, #ifdef __KERNEL_AVX2__ const sse3f& org_idir, #endif @@ -346,8 +346,8 @@ ccl_device_inline int qbvh_node_intersect( const float4 node = kernel_tex_fetch(__bvh_nodes, offset); if(__float_as_uint(node.x) & PATH_RAY_NODE_UNALIGNED) { return qbvh_unaligned_node_intersect(kg, - tnear, - tfar, + isect_near, + isect_far, #ifdef __KERNEL_AVX2__ org_idir, #endif @@ -361,8 +361,8 @@ ccl_device_inline int qbvh_node_intersect( } else { return qbvh_aligned_node_intersect(kg, - tnear, - tfar, + isect_near, + isect_far, #ifdef __KERNEL_AVX2__ org_idir, #else @@ -378,8 +378,8 @@ ccl_device_inline int qbvh_node_intersect( ccl_device_inline int qbvh_node_intersect_robust( KernelGlobals *ccl_restrict kg, - const ssef& tnear, - const ssef& tfar, + const ssef& isect_near, + const ssef& isect_far, #ifdef __KERNEL_AVX2__ const sse3f& P_idir, #endif @@ -400,8 +400,8 @@ ccl_device_inline int qbvh_node_intersect_robust( const float4 node = kernel_tex_fetch(__bvh_nodes, offset); if(__float_as_uint(node.x) & PATH_RAY_NODE_UNALIGNED) { return qbvh_unaligned_node_intersect_robust(kg, - tnear, - tfar, + isect_near, + isect_far, #ifdef __KERNEL_AVX2__ P_idir, #endif @@ -416,8 +416,8 @@ ccl_device_inline int qbvh_node_intersect_robust( } else { return qbvh_aligned_node_intersect_robust(kg, - tnear, - tfar, + isect_near, + isect_far, #ifdef __KERNEL_AVX2__ P_idir, #else -- cgit v1.2.3