[Bf-blender-cvs] [1de0e13af61] master: Cycles: remove __UV__ and __INSTANCING__ as kernel options

Brecht Van Lommel noreply at git.blender.org
Mon Jun 22 13:28:15 CEST 2020


Commit: 1de0e13af619e405f351bf42924f819dc3a9bc44
Author: Brecht Van Lommel
Date:   Sun Feb 23 10:15:35 2020 +0100
Branches: master
https://developer.blender.org/rB1de0e13af619e405f351bf42924f819dc3a9bc44

Cycles: remove __UV__ and __INSTANCING__ as kernel options

The kernel did not work correctly when these were disabled anyway. The
optimized BVH traversal for the no instances case was also only used on
the CPU, so no longer makes sense to keep.

Ref T73778

Depends on D8010

Maniphest Tasks: T73778

Differential Revision: https://developer.blender.org/D8011

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

M	intern/cycles/kernel/bvh/bvh.h
M	intern/cycles/kernel/bvh/bvh_shadow_all.h
M	intern/cycles/kernel/bvh/bvh_traversal.h
M	intern/cycles/kernel/bvh/bvh_types.h
M	intern/cycles/kernel/bvh/bvh_volume.h
M	intern/cycles/kernel/bvh/bvh_volume_all.h
M	intern/cycles/kernel/geom/geom_curve_intersect.h
M	intern/cycles/kernel/kernel_light.h
M	intern/cycles/kernel/kernel_shader.h
M	intern/cycles/kernel/kernel_types.h
M	intern/cycles/kernel/svm/svm_geometry.h
M	intern/cycles/render/object.cpp

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

diff --git a/intern/cycles/kernel/bvh/bvh.h b/intern/cycles/kernel/bvh/bvh.h
index 9b9df883b62..bf48d3dd826 100644
--- a/intern/cycles/kernel/bvh/bvh.h
+++ b/intern/cycles/kernel/bvh/bvh.h
@@ -51,27 +51,21 @@ CCL_NAMESPACE_BEGIN
 #  define BVH_FUNCTION_FEATURES 0
 #  include "kernel/bvh/bvh_traversal.h"
 
-#  if defined(__INSTANCING__)
-#    define BVH_FUNCTION_NAME bvh_intersect_instancing
-#    define BVH_FUNCTION_FEATURES BVH_INSTANCING
-#    include "kernel/bvh/bvh_traversal.h"
-#  endif
-
 #  if defined(__HAIR__)
 #    define BVH_FUNCTION_NAME bvh_intersect_hair
-#    define BVH_FUNCTION_FEATURES BVH_INSTANCING | BVH_HAIR
+#    define BVH_FUNCTION_FEATURES BVH_HAIR
 #    include "kernel/bvh/bvh_traversal.h"
 #  endif
 
 #  if defined(__OBJECT_MOTION__)
 #    define BVH_FUNCTION_NAME bvh_intersect_motion
-#    define BVH_FUNCTION_FEATURES BVH_INSTANCING | BVH_MOTION
+#    define BVH_FUNCTION_FEATURES BVH_MOTION
 #    include "kernel/bvh/bvh_traversal.h"
 #  endif
 
 #  if defined(__HAIR__) && defined(__OBJECT_MOTION__)
 #    define BVH_FUNCTION_NAME bvh_intersect_hair_motion
-#    define BVH_FUNCTION_FEATURES BVH_INSTANCING | BVH_HAIR | BVH_MOTION
+#    define BVH_FUNCTION_FEATURES BVH_HAIR | BVH_MOTION
 #    include "kernel/bvh/bvh_traversal.h"
 #  endif
 
@@ -96,15 +90,9 @@ CCL_NAMESPACE_BEGIN
 #    define BVH_FUNCTION_FEATURES BVH_HAIR
 #    include "kernel/bvh/bvh_volume.h"
 
-#    if defined(__INSTANCING__)
-#      define BVH_FUNCTION_NAME bvh_intersect_volume_instancing
-#      define BVH_FUNCTION_FEATURES BVH_INSTANCING | BVH_HAIR
-#      include "kernel/bvh/bvh_volume.h"
-#    endif
-
 #    if defined(__OBJECT_MOTION__)
 #      define BVH_FUNCTION_NAME bvh_intersect_volume_motion
-#      define BVH_FUNCTION_FEATURES BVH_INSTANCING | BVH_MOTION | BVH_HAIR
+#      define BVH_FUNCTION_FEATURES BVH_MOTION | BVH_HAIR
 #      include "kernel/bvh/bvh_volume.h"
 #    endif
 #  endif /* __VOLUME__ */
@@ -116,27 +104,21 @@ CCL_NAMESPACE_BEGIN
 #    define BVH_FUNCTION_FEATURES 0
 #    include "kernel/bvh/bvh_shadow_all.h"
 
-#    if defined(__INSTANCING__)
-#      define BVH_FUNCTION_NAME bvh_intersect_shadow_all_instancing
-#      define BVH_FUNCTION_FEATURES BVH_INSTANCING
-#      include "kernel/bvh/bvh_shadow_all.h"
-#    endif
-
 #    if defined(__HAIR__)
 #      define BVH_FUNCTION_NAME bvh_intersect_shadow_all_hair
-#      define BVH_FUNCTION_FEATURES BVH_INSTANCING | BVH_HAIR
+#      define BVH_FUNCTION_FEATURES BVH_HAIR
 #      include "kernel/bvh/bvh_shadow_all.h"
 #    endif
 
 #    if defined(__OBJECT_MOTION__)
 #      define BVH_FUNCTION_NAME bvh_intersect_shadow_all_motion
-#      define BVH_FUNCTION_FEATURES BVH_INSTANCING | BVH_MOTION
+#      define BVH_FUNCTION_FEATURES BVH_MOTION
 #      include "kernel/bvh/bvh_shadow_all.h"
 #    endif
 
 #    if defined(__HAIR__) && defined(__OBJECT_MOTION__)
 #      define BVH_FUNCTION_NAME bvh_intersect_shadow_all_hair_motion
-#      define BVH_FUNCTION_FEATURES BVH_INSTANCING | BVH_HAIR | BVH_MOTION
+#      define BVH_FUNCTION_FEATURES BVH_HAIR | BVH_MOTION
 #      include "kernel/bvh/bvh_shadow_all.h"
 #    endif
 #  endif /* __SHADOW_RECORD_ALL__ */
@@ -148,15 +130,9 @@ CCL_NAMESPACE_BEGIN
 #    define BVH_FUNCTION_FEATURES BVH_HAIR
 #    include "kernel/bvh/bvh_volume_all.h"
 
-#    if defined(__INSTANCING__)
-#      define BVH_FUNCTION_NAME bvh_intersect_volume_all_instancing
-#      define BVH_FUNCTION_FEATURES BVH_INSTANCING | BVH_HAIR
-#      include "kernel/bvh/bvh_volume_all.h"
-#    endif
-
 #    if defined(__OBJECT_MOTION__)
 #      define BVH_FUNCTION_NAME bvh_intersect_volume_all_motion
-#      define BVH_FUNCTION_FEATURES BVH_INSTANCING | BVH_MOTION | BVH_HAIR
+#      define BVH_FUNCTION_FEATURES BVH_MOTION | BVH_HAIR
 #      include "kernel/bvh/bvh_volume_all.h"
 #    endif
 #  endif /* __VOLUME_RECORD_ALL__ */
@@ -264,21 +240,8 @@ ccl_device_intersect bool scene_intersect(KernelGlobals *kg,
   }
 #  endif /* __HAIR__ */
 
-#  ifdef __KERNEL_CPU__
-#    ifdef __INSTANCING__
-  if (kernel_data.bvh.have_instancing) {
-    return bvh_intersect_instancing(kg, ray, isect, visibility);
-  }
-#    endif /* __INSTANCING__ */
-  return bvh_intersect(kg, ray, isect, visibility);
-#  else    /* __KERNEL_CPU__ */
-#    ifdef __INSTANCING__
-  return bvh_intersect_instancing(kg, ray, isect, visibility);
-#    else
   return bvh_intersect(kg, ray, isect, visibility);
-#    endif /* __INSTANCING__ */
-#  endif   /* __KERNEL_CPU__ */
-#endif     /* __KERNEL_OPTIX__ */
+#endif   /* __KERNEL_OPTIX__ */
 }
 
 #ifdef __BVH_LOCAL__
@@ -476,21 +439,8 @@ ccl_device_intersect bool scene_intersect_shadow_all(KernelGlobals *kg,
   }
 #    endif /* __HAIR__ */
 
-#    ifdef __KERNEL_CPU__
-#      ifdef __INSTANCING__
-  if (kernel_data.bvh.have_instancing) {
-    return bvh_intersect_shadow_all_instancing(kg, ray, isect, visibility, max_hits, num_hits);
-  }
-#      endif /* __INSTANCING__ */
   return bvh_intersect_shadow_all(kg, ray, isect, visibility, max_hits, num_hits);
-#    else
-#      ifdef __INSTANCING__
-  return bvh_intersect_shadow_all_instancing(kg, ray, isect, visibility, max_hits, num_hits);
-#      else
-  return bvh_intersect_shadow_all(kg, ray, isect, visibility, max_hits, num_hits);
-#      endif /* __INSTANCING__ */
-#    endif   /* __KERNEL_CPU__ */
-#  endif     /* __KERNEL_OPTIX__ */
+#  endif   /* __KERNEL_OPTIX__ */
 }
 #endif /* __SHADOW_RECORD_ALL__ */
 
@@ -548,21 +498,8 @@ ccl_device_intersect bool scene_intersect_volume(KernelGlobals *kg,
   }
 #    endif /* __OBJECT_MOTION__ */
 
-#    ifdef __KERNEL_CPU__
-#      ifdef __INSTANCING__
-  if (kernel_data.bvh.have_instancing) {
-    return bvh_intersect_volume_instancing(kg, ray, isect, visibility);
-  }
-#      endif /* __INSTANCING__ */
   return bvh_intersect_volume(kg, ray, isect, visibility);
-#    else    /* __KERNEL_CPU__ */
-#      ifdef __INSTANCING__
-  return bvh_intersect_volume_instancing(kg, ray, isect, visibility);
-#      else
-  return bvh_intersect_volume(kg, ray, isect, visibility);
-#      endif /* __INSTANCING__ */
-#    endif   /* __KERNEL_CPU__ */
-#  endif     /* __KERNEL_OPTIX__ */
+#  endif   /* __KERNEL_OPTIX__ */
 }
 #endif /* __VOLUME__ */
 
@@ -599,11 +536,6 @@ ccl_device_intersect uint scene_intersect_volume_all(KernelGlobals *kg,
   }
 #  endif /* __OBJECT_MOTION__ */
 
-#  ifdef __INSTANCING__
-  if (kernel_data.bvh.have_instancing) {
-    return bvh_intersect_volume_all_instancing(kg, ray, isect, max_hits, visibility);
-  }
-#  endif /* __INSTANCING__ */
   return bvh_intersect_volume_all(kg, ray, isect, max_hits, visibility);
 }
 #endif /* __VOLUME_RECORD_ALL__ */
diff --git a/intern/cycles/kernel/bvh/bvh_shadow_all.h b/intern/cycles/kernel/bvh/bvh_shadow_all.h
index 385481983e4..03916bfdca9 100644
--- a/intern/cycles/kernel/bvh/bvh_shadow_all.h
+++ b/intern/cycles/kernel/bvh/bvh_shadow_all.h
@@ -34,7 +34,6 @@
  * enabled/disabled. This way we can compile optimized versions for each case
  * without new features slowing things down.
  *
- * BVH_INSTANCING: object instancing
  * BVH_HAIR: hair curve rendering
  * BVH_MOTION: motion blur rendering
  */
@@ -76,9 +75,7 @@ ccl_device_inline
   Transform ob_itfm;
 #endif
 
-#if BVH_FEATURE(BVH_INSTANCING)
   int num_hits_in_instance = 0;
-#endif
 
   *num_hits = 0;
   isect_array->t = tmax;
@@ -174,9 +171,7 @@ ccl_device_inline
         float4 leaf = kernel_tex_fetch(__bvh_leaf_nodes, (-node_addr - 1));
         int prim_addr = __float_as_int(leaf.x);
 
-#if BVH_FEATURE(BVH_INSTANCING)
         if (prim_addr >= 0) {
-#endif
           const int prim_addr2 = __float_as_int(leaf.y);
           const uint type = __float_as_int(leaf.w);
           const uint p_type = type & PRIMITIVE_ALL;
@@ -256,9 +251,7 @@ ccl_device_inline
               /* move on to next entry in intersections array */
               isect_array++;
               (*num_hits)++;
-#if BVH_FEATURE(BVH_INSTANCING)
               num_hits_in_instance++;
-#endif
 
               isect_array->t = isect_t;
             }
@@ -266,16 +259,15 @@ ccl_device_inline
             prim_addr++;
           }
         }
-#if BVH_FEATURE(BVH_INSTANCING)
         else {
           /* instance push */
           object = kernel_tex_fetch(__prim_object, -prim_addr - 1);
 
-#  if BVH_FEATURE(BVH_MOTION)
+#if BVH_FEATURE(BVH_MOTION)
           isect_t = bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, isect_t, &ob_itfm);
-#  else
+#else
           isect_t = bvh_instance_push(kg, object, ray, &P, &dir, &idir, isect_t);
-#  endif
+#endif
 
           num_hits_in_instance = 0;
           isect_array->t = isect_t;
@@ -299,10 +291,8 @@ ccl_device_inline
           node_addr = kernel_tex_fetch(__object_node, object);
         }
       }
-#endif /* FEATURE(BVH_INSTANCING) */
     } while (node_addr != ENTRYPOINT_SENTINEL);
 
-#if BVH_FEATURE(BVH_INSTANCING)
     if (stack_ptr >= 0) {
       kernel_assert(object != OBJECT_NONE);
 
@@ -310,11 +300,11 @@ ccl_device_inline
       if (num_hits_in_instance) {
         float t_fac;
 
-#  if BVH_FEATURE(BVH_MOTION)
+#if BVH_FEATURE(BVH_MOTION)
         bvh_instance_motion_pop_factor(kg, object, ray, &P, &dir, &idir, &t_fac, &ob_itfm);
-#  else
+#else
         bvh_instance_pop_factor(kg, object, ray, &P, &dir, &idir, &t_fac);
-#  endif
+#endif
 
         /* scale isect->t to adjust for instancing */
         for (int i = 0; i < num_hits_in_instance; i++) {
@@ -322,11 +312,11 @@ ccl_device_inline
         }
       }
       else {
-#  if BVH_FEATURE(BVH_MOTION)
+#if BVH_FEATURE(BVH_MOTION)
         bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, FLT_MAX, &ob_itfm);
-#  else
+#else
         bvh_instance_pop(kg, object, ray, &P, &dir, &idir, FLT_MAX);
-#  endif
+#endif
       }
 
       isect_t = tmax;
@@ -348,7 +338,6 @@ ccl_device_inline
       node_addr = traversal_stack[stack_ptr];
       --stack_ptr;
     }
-#endif /* FEATURE(BVH_INSTANCING) */
   } while (node_addr != ENTRYPOINT_SENTINEL);
 
   return false;
diff --git a/intern/cycles/kernel/bvh/bvh_traversal.h b/intern/cycles/kernel/bvh/bvh_traversal.h
index ba83690dfef..2a4677928c5 100644
--- a/intern/cycles/kernel/bvh/bvh_traversal.h
+++ b/intern/cycles/kernel/bvh/bvh_traversal.h
@@ -34,7

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list