[Bf-blender-cvs] [12bbbf9] cycles_bvh: Cycles: Bring back extmax to aligned node rebust intersector

Sergey Sharybin noreply at git.blender.org
Fri Jun 17 16:22:02 CEST 2016


Commit: 12bbbf9724e12b21328c2182b5eed19dadd5b6f0
Author: Sergey Sharybin
Date:   Fri Jun 17 15:28:58 2016 +0200
Branches: cycles_bvh
https://developer.blender.org/rB12bbbf9724e12b21328c2182b5eed19dadd5b6f0

Cycles: Bring back extmax to aligned node rebust intersector

Hopefully will solve any possible regressions in behavior.
However, all unit tests are passing just fine.

===================================================================

M	intern/cycles/kernel/geom/geom_bvh_nodes.h
M	intern/cycles/kernel/geom/geom_bvh_traversal.h

===================================================================

diff --git a/intern/cycles/kernel/geom/geom_bvh_nodes.h b/intern/cycles/kernel/geom/geom_bvh_nodes.h
index 6763ec9..1c9114d 100644
--- a/intern/cycles/kernel/geom/geom_bvh_nodes.h
+++ b/intern/cycles/kernel/geom/geom_bvh_nodes.h
@@ -87,6 +87,7 @@ ccl_device_inline int bvh_aligned_node_intersect_robust(KernelGlobals *kg,
                                                         const float3 idir,
                                                         const float t,
                                                         const float difl,
+                                                        const float /*extmax*/,
                                                         const int nodeAddr,
                                                         const uint visibility,
                                                         float *dist)
@@ -178,7 +179,8 @@ ccl_device_inline bool bvh_unaligned_node_intersect_child_robust(
         const float3 P,
         const float3 dir,
         const float t,
-        float difl,
+        const float difl,
+        const float /*extmax*/,
         int nodeAddr,
         int child,
         float *dist)
@@ -248,13 +250,14 @@ ccl_device_inline int bvh_unaligned_node_intersect_robust(KernelGlobals *kg,
                                                           const float3 idir,
                                                           const float t,
                                                           const float difl,
+                                                          const float extmax,
                                                           const int nodeAddr,
                                                           const uint visibility,
                                                           float *dist)
 {
 	int mask = 0;
 	float4 cnodes = kernel_tex_fetch(__bvh_nodes, nodeAddr+0);
-	if(bvh_unaligned_node_intersect_child_robust(kg, P, dir, t, difl, nodeAddr, 0, &dist[0])) {
+	if(bvh_unaligned_node_intersect_child_robust(kg, P, dir, t, difl, extmax, nodeAddr, 0, &dist[0])) {
 #ifdef __VISIBILITY_FLAG__
 		if((__float_as_uint(cnodes.x) & visibility))
 #endif
@@ -262,7 +265,7 @@ ccl_device_inline int bvh_unaligned_node_intersect_robust(KernelGlobals *kg,
 			mask |= 1;
 		}
 	}
-	if(bvh_unaligned_node_intersect_child_robust(kg, P, dir, t, difl, nodeAddr, 1, &dist[1])) {
+	if(bvh_unaligned_node_intersect_child_robust(kg, P, dir, t, difl, extmax, nodeAddr, 1, &dist[1])) {
 #ifdef __VISIBILITY_FLAG__
 		if((__float_as_uint(cnodes.y) & visibility))
 #endif
@@ -310,6 +313,7 @@ ccl_device_inline int bvh_node_intersect_robust(KernelGlobals *kg,
                                                 const float3 idir,
                                                 const float t,
                                                 const float difl,
+                                                const float extmax,
                                                 const int nodeAddr,
                                                 const uint visibility,
                                                 float dist[2])
@@ -322,6 +326,7 @@ ccl_device_inline int bvh_node_intersect_robust(KernelGlobals *kg,
 		                                           idir,
 		                                           t,
 		                                           difl,
+		                                           extmax,
 		                                           nodeAddr,
 		                                           visibility,
 		                                           dist);
@@ -332,6 +337,7 @@ ccl_device_inline int bvh_node_intersect_robust(KernelGlobals *kg,
 		                                         idir,
 		                                         t,
 		                                         difl,
+		                                         extmax,
 		                                         nodeAddr,
 		                                         visibility,
 		                                         dist);
@@ -392,6 +398,7 @@ int ccl_device_inline bvh_aligned_node_intersect_robust(
         const ssef idirsplat[3],
         const shuffle_swap_t shufflexyz[3],
         const float difl,
+        const float extmax,
         const int nodeAddr,
         const uint visibility,
         float dist[2])
@@ -418,8 +425,6 @@ int ccl_device_inline bvh_aligned_node_intersect_robust(
 		float& c0max = tminmaxview->z, &c1max = tminmaxview->w;
 		float hdiff = 1.0f + difl;
 		float ldiff = 1.0f - difl;
-#if 0
-		/* TODO(sergey): Need to bring back extmax. */
 		if(__float_as_int(cnodes.x) & PATH_RAY_CURVE) {
 			c0min = max(ldiff * c0min, c0min - extmax);
 			c0max = min(hdiff * c0max, c0max + extmax);
@@ -428,16 +433,6 @@ int ccl_device_inline bvh_aligned_node_intersect_robust(
 			c1min = max(ldiff * c1min, c1min - extmax);
 			c1max = min(hdiff * c1max, c1max + extmax);
 		}
-#else
-		if(__float_as_int(cnodes.x) & PATH_RAY_CURVE) {
-			c0min *= ldiff;
-			c0max *= hdiff;
-		}
-		if(__float_as_int(cnodes.y) & PATH_RAY_CURVE) {
-			c1min *= ldiff;
-			c1max *= hdiff;
-		}
-#endif
 	}
 
 	const sseb lrhit = tminmax <= shuffle<2, 3, 0, 1>(tminmax);
@@ -525,6 +520,7 @@ int ccl_device_inline bvh_unaligned_node_intersect_robust(KernelGlobals *kg,
                                                           const ssef& tnear,
                                                           const ssef& tfar,
                                                           const float difl,
+                                                          const float /*extmax*/,
                                                           const int nodeAddr,
                                                           const uint visibility,
                                                           float dist[2])
@@ -638,6 +634,7 @@ ccl_device_inline int bvh_node_intersect_robust(KernelGlobals *kg,
                                                 const ssef idirsplat[3],
                                                 const shuffle_swap_t shufflexyz[3],
                                                 const float difl,
+                                                const float extmax,
                                                 const int nodeAddr,
                                                 const uint visibility,
                                                 float dist[2])
@@ -650,6 +647,7 @@ ccl_device_inline int bvh_node_intersect_robust(KernelGlobals *kg,
 		                                           tnear,
 		                                           tfar,
 		                                           difl,
+		                                           extmax,
 		                                           nodeAddr,
 		                                           visibility,
 		                                           dist);
@@ -663,6 +661,7 @@ ccl_device_inline int bvh_node_intersect_robust(KernelGlobals *kg,
 		                                         idirsplat,
 		                                         shufflexyz,
 		                                         difl,
+		                                         extmax,
 		                                         nodeAddr,
 		                                         visibility,
 		                                         dist);
diff --git a/intern/cycles/kernel/geom/geom_bvh_traversal.h b/intern/cycles/kernel/geom/geom_bvh_traversal.h
index 9d1422d..cc7275a 100644
--- a/intern/cycles/kernel/geom/geom_bvh_traversal.h
+++ b/intern/cycles/kernel/geom/geom_bvh_traversal.h
@@ -125,6 +125,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
 					                                      idir,
 					                                      isect->t,
 					                                      difl,
+					                                      extmax,
 					                                      nodeAddr,
 					                                      visibility,
 					                                      dist);
@@ -158,6 +159,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
 					                                      idirsplat,
 					                                      shufflexyz,
 					                                      difl,
+					                                      extmax,
 					                                      nodeAddr,
 					                                      visibility,
 					                                      dist);




More information about the Bf-blender-cvs mailing list