diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-02-12 20:33:43 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-03-25 15:55:42 +0300 |
commit | 700722f68633d270584af5463a804742537e30ed (patch) | |
tree | 5b80a5a51dd278e649647f8d0a64c07d570e8eaa /intern/cycles/kernel/geom | |
parent | 0e47e0cc9e9b19a30717042d97cb3b8fb50132ff (diff) |
Cycles: Cleanup, indent nested preprocessor directives
Quite straightforward, main trick is happening in path_source_replace_includes().
Reviewers: brecht, dingto, lukasstockner97, juicyfruit
Differential Revision: https://developer.blender.org/D1794
Diffstat (limited to 'intern/cycles/kernel/geom')
-rw-r--r-- | intern/cycles/kernel/geom/geom.h | 4 | ||||
-rw-r--r-- | intern/cycles/kernel/geom/geom_bvh.h | 218 | ||||
-rw-r--r-- | intern/cycles/kernel/geom/geom_bvh_shadow.h | 42 | ||||
-rw-r--r-- | intern/cycles/kernel/geom/geom_bvh_subsurface.h | 2 | ||||
-rw-r--r-- | intern/cycles/kernel/geom/geom_bvh_traversal.h | 66 | ||||
-rw-r--r-- | intern/cycles/kernel/geom/geom_bvh_volume.h | 20 | ||||
-rw-r--r-- | intern/cycles/kernel/geom/geom_bvh_volume_all.h | 64 | ||||
-rw-r--r-- | intern/cycles/kernel/geom/geom_curve.h | 14 | ||||
-rw-r--r-- | intern/cycles/kernel/geom/geom_motion_triangle.h | 30 | ||||
-rw-r--r-- | intern/cycles/kernel/geom/geom_primitive.h | 6 | ||||
-rw-r--r-- | intern/cycles/kernel/geom/geom_qbvh_shadow.h | 30 | ||||
-rw-r--r-- | intern/cycles/kernel/geom/geom_qbvh_traversal.h | 44 | ||||
-rw-r--r-- | intern/cycles/kernel/geom/geom_qbvh_volume.h | 24 | ||||
-rw-r--r-- | intern/cycles/kernel/geom/geom_qbvh_volume_all.h | 66 | ||||
-rw-r--r-- | intern/cycles/kernel/geom/geom_triangle_intersect.h | 12 |
15 files changed, 321 insertions, 321 deletions
diff --git a/intern/cycles/kernel/geom/geom.h b/intern/cycles/kernel/geom/geom.h index 5ab900d47aa..c94a5384d1f 100644 --- a/intern/cycles/kernel/geom/geom.h +++ b/intern/cycles/kernel/geom/geom.h @@ -31,9 +31,9 @@ * without sse support on x86, it results in different results for float ops * that you would otherwise expect to compare correctly */ #if !defined(__i386__) || defined(__SSE__) -#define NO_EXTENDED_PRECISION +# define NO_EXTENDED_PRECISION #else -#define NO_EXTENDED_PRECISION volatile +# define NO_EXTENDED_PRECISION volatile #endif #include "geom_attribute.h" diff --git a/intern/cycles/kernel/geom/geom_bvh.h b/intern/cycles/kernel/geom/geom_bvh.h index ad983995cc9..e5cd7b76ded 100644 --- a/intern/cycles/kernel/geom/geom_bvh.h +++ b/intern/cycles/kernel/geom/geom_bvh.h @@ -30,9 +30,9 @@ CCL_NAMESPACE_BEGIN /* Don't inline intersect functions on GPU, this is faster */ #ifdef __KERNEL_GPU__ -#define ccl_device_intersect ccl_device_noinline +# define ccl_device_intersect ccl_device_noinline #else -#define ccl_device_intersect ccl_device_inline +# define ccl_device_intersect ccl_device_inline #endif /* BVH intersection function variations */ @@ -50,7 +50,7 @@ CCL_NAMESPACE_BEGIN /* Common QBVH functions. */ #ifdef __QBVH__ -#include "geom_qbvh.h" +# include "geom_qbvh.h" #endif /* Regular BVH traversal */ @@ -60,137 +60,137 @@ CCL_NAMESPACE_BEGIN #include "geom_bvh_traversal.h" #if defined(__INSTANCING__) -#define BVH_FUNCTION_NAME bvh_intersect_instancing -#define BVH_FUNCTION_FEATURES BVH_INSTANCING -#include "geom_bvh_traversal.h" +# define BVH_FUNCTION_NAME bvh_intersect_instancing +# define BVH_FUNCTION_FEATURES BVH_INSTANCING +# include "geom_bvh_traversal.h" #endif #if defined(__HAIR__) -#define BVH_FUNCTION_NAME bvh_intersect_hair -#define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR|BVH_HAIR_MINIMUM_WIDTH -#include "geom_bvh_traversal.h" +# define BVH_FUNCTION_NAME bvh_intersect_hair +# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR|BVH_HAIR_MINIMUM_WIDTH +# include "geom_bvh_traversal.h" #endif #if defined(__OBJECT_MOTION__) -#define BVH_FUNCTION_NAME bvh_intersect_motion -#define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_MOTION -#include "geom_bvh_traversal.h" +# define BVH_FUNCTION_NAME bvh_intersect_motion +# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_MOTION +# include "geom_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_HAIR_MINIMUM_WIDTH|BVH_MOTION -#include "geom_bvh_traversal.h" +# define BVH_FUNCTION_NAME bvh_intersect_hair_motion +# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR|BVH_HAIR_MINIMUM_WIDTH|BVH_MOTION +# include "geom_bvh_traversal.h" #endif /* Subsurface scattering BVH traversal */ #if defined(__SUBSURFACE__) -#define BVH_FUNCTION_NAME bvh_intersect_subsurface -#define BVH_FUNCTION_FEATURES 0 -#include "geom_bvh_subsurface.h" +# define BVH_FUNCTION_NAME bvh_intersect_subsurface +# define BVH_FUNCTION_FEATURES 0 +# include "geom_bvh_subsurface.h" #endif #if defined(__SUBSURFACE__) && defined(__OBJECT_MOTION__) -#define BVH_FUNCTION_NAME bvh_intersect_subsurface_motion -#define BVH_FUNCTION_FEATURES BVH_MOTION -#include "geom_bvh_subsurface.h" +# define BVH_FUNCTION_NAME bvh_intersect_subsurface_motion +# define BVH_FUNCTION_FEATURES BVH_MOTION +# include "geom_bvh_subsurface.h" #endif /* Volume BVH traversal */ #if defined(__VOLUME__) -#define BVH_FUNCTION_NAME bvh_intersect_volume -#define BVH_FUNCTION_FEATURES 0 -#include "geom_bvh_volume.h" +# define BVH_FUNCTION_NAME bvh_intersect_volume +# define BVH_FUNCTION_FEATURES 0 +# include "geom_bvh_volume.h" #endif #if defined(__VOLUME__) && defined(__INSTANCING__) -#define BVH_FUNCTION_NAME bvh_intersect_volume_instancing -#define BVH_FUNCTION_FEATURES BVH_INSTANCING -#include "geom_bvh_volume.h" +# define BVH_FUNCTION_NAME bvh_intersect_volume_instancing +# define BVH_FUNCTION_FEATURES BVH_INSTANCING +# include "geom_bvh_volume.h" #endif #if defined(__VOLUME__) && defined(__HAIR__) -#define BVH_FUNCTION_NAME bvh_intersect_volume_hair -#define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR|BVH_HAIR_MINIMUM_WIDTH -#include "geom_bvh_volume.h" +# define BVH_FUNCTION_NAME bvh_intersect_volume_hair +# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR|BVH_HAIR_MINIMUM_WIDTH +# include "geom_bvh_volume.h" #endif #if defined(__VOLUME__) && defined(__OBJECT_MOTION__) -#define BVH_FUNCTION_NAME bvh_intersect_volume_motion -#define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_MOTION -#include "geom_bvh_volume.h" +# define BVH_FUNCTION_NAME bvh_intersect_volume_motion +# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_MOTION +# include "geom_bvh_volume.h" #endif #if defined(__VOLUME__) && defined(__HAIR__) && defined(__OBJECT_MOTION__) -#define BVH_FUNCTION_NAME bvh_intersect_volume_hair_motion -#define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR|BVH_HAIR_MINIMUM_WIDTH|BVH_MOTION -#include "geom_bvh_volume.h" +# define BVH_FUNCTION_NAME bvh_intersect_volume_hair_motion +# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR|BVH_HAIR_MINIMUM_WIDTH|BVH_MOTION +# include "geom_bvh_volume.h" #endif /* Record all intersections - Shadow BVH traversal */ #if defined(__SHADOW_RECORD_ALL__) -#define BVH_FUNCTION_NAME bvh_intersect_shadow_all -#define BVH_FUNCTION_FEATURES 0 -#include "geom_bvh_shadow.h" +# define BVH_FUNCTION_NAME bvh_intersect_shadow_all +# define BVH_FUNCTION_FEATURES 0 +# include "geom_bvh_shadow.h" #endif #if defined(__SHADOW_RECORD_ALL__) && defined(__INSTANCING__) -#define BVH_FUNCTION_NAME bvh_intersect_shadow_all_instancing -#define BVH_FUNCTION_FEATURES BVH_INSTANCING -#include "geom_bvh_shadow.h" +# define BVH_FUNCTION_NAME bvh_intersect_shadow_all_instancing +# define BVH_FUNCTION_FEATURES BVH_INSTANCING +# include "geom_bvh_shadow.h" #endif #if defined(__SHADOW_RECORD_ALL__) && defined(__HAIR__) -#define BVH_FUNCTION_NAME bvh_intersect_shadow_all_hair -#define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR -#include "geom_bvh_shadow.h" +# define BVH_FUNCTION_NAME bvh_intersect_shadow_all_hair +# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR +# include "geom_bvh_shadow.h" #endif #if defined(__SHADOW_RECORD_ALL__) && defined(__OBJECT_MOTION__) -#define BVH_FUNCTION_NAME bvh_intersect_shadow_all_motion -#define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_MOTION -#include "geom_bvh_shadow.h" +# define BVH_FUNCTION_NAME bvh_intersect_shadow_all_motion +# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_MOTION +# include "geom_bvh_shadow.h" #endif #if defined(__SHADOW_RECORD_ALL__) && 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 -#include "geom_bvh_shadow.h" +# define BVH_FUNCTION_NAME bvh_intersect_shadow_all_hair_motion +# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR|BVH_MOTION +# include "geom_bvh_shadow.h" #endif /* Record all intersections - Volume BVH traversal */ #if defined(__VOLUME_RECORD_ALL__) -#define BVH_FUNCTION_NAME bvh_intersect_volume_all -#define BVH_FUNCTION_FEATURES 0 -#include "geom_bvh_volume_all.h" +# define BVH_FUNCTION_NAME bvh_intersect_volume_all +# define BVH_FUNCTION_FEATURES 0 +# include "geom_bvh_volume_all.h" #endif #if defined(__VOLUME_RECORD_ALL__) && defined(__INSTANCING__) -#define BVH_FUNCTION_NAME bvh_intersect_volume_all_instancing -#define BVH_FUNCTION_FEATURES BVH_INSTANCING -#include "geom_bvh_volume_all.h" +# define BVH_FUNCTION_NAME bvh_intersect_volume_all_instancing +# define BVH_FUNCTION_FEATURES BVH_INSTANCING +# include "geom_bvh_volume_all.h" #endif #if defined(__VOLUME_RECORD_ALL__) && defined(__HAIR__) -#define BVH_FUNCTION_NAME bvh_intersect_volume_all_hair -#define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR|BVH_HAIR_MINIMUM_WIDTH -#include "geom_bvh_volume_all.h" +# define BVH_FUNCTION_NAME bvh_intersect_volume_all_hair +# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR|BVH_HAIR_MINIMUM_WIDTH +# include "geom_bvh_volume_all.h" #endif #if defined(__VOLUME_RECORD_ALL__) && defined(__OBJECT_MOTION__) -#define BVH_FUNCTION_NAME bvh_intersect_volume_all_motion -#define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_MOTION -#include "geom_bvh_volume_all.h" +# define BVH_FUNCTION_NAME bvh_intersect_volume_all_motion +# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_MOTION +# include "geom_bvh_volume_all.h" #endif #if defined(__VOLUME_RECORD_ALL__) && defined(__HAIR__) && defined(__OBJECT_MOTION__) -#define BVH_FUNCTION_NAME bvh_intersect_volume_all_hair_motion -#define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR|BVH_HAIR_MINIMUM_WIDTH|BVH_MOTION -#include "geom_bvh_volume_all.h" +# define BVH_FUNCTION_NAME bvh_intersect_volume_all_hair_motion +# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR|BVH_HAIR_MINIMUM_WIDTH|BVH_MOTION +# include "geom_bvh_volume_all.h" #endif #undef BVH_FEATURE @@ -208,35 +208,35 @@ ccl_device_intersect bool scene_intersect(KernelGlobals *kg, { #ifdef __OBJECT_MOTION__ if(kernel_data.bvh.have_motion) { -#ifdef __HAIR__ +# ifdef __HAIR__ if(kernel_data.bvh.have_curves) return bvh_intersect_hair_motion(kg, ray, isect, visibility, lcg_state, difl, extmax); -#endif /* __HAIR__ */ +# endif /* __HAIR__ */ return bvh_intersect_motion(kg, ray, isect, visibility); } #endif /* __OBJECT_MOTION__ */ -#ifdef __HAIR__ +#ifdef __HAIR__ if(kernel_data.bvh.have_curves) return bvh_intersect_hair(kg, ray, isect, visibility, lcg_state, difl, extmax); #endif /* __HAIR__ */ #ifdef __KERNEL_CPU__ -#ifdef __INSTANCING__ +# ifdef __INSTANCING__ if(kernel_data.bvh.have_instancing) return bvh_intersect_instancing(kg, ray, isect, visibility); -#endif /* __INSTANCING__ */ +# endif /* __INSTANCING__ */ return bvh_intersect(kg, ray, isect, visibility); #else /* __KERNEL_CPU__ */ -#ifdef __INSTANCING__ +# ifdef __INSTANCING__ return bvh_intersect_instancing(kg, ray, isect, visibility); -#else +# else return bvh_intersect(kg, ray, isect, visibility); -#endif /* __INSTANCING__ */ +# endif /* __INSTANCING__ */ #endif /* __KERNEL_CPU__ */ } @@ -271,71 +271,71 @@ ccl_device_intersect void scene_intersect_subsurface(KernelGlobals *kg, #ifdef __SHADOW_RECORD_ALL__ ccl_device_intersect bool scene_intersect_shadow_all(KernelGlobals *kg, const Ray *ray, Intersection *isect, uint max_hits, uint *num_hits) { -#ifdef __OBJECT_MOTION__ +# ifdef __OBJECT_MOTION__ if(kernel_data.bvh.have_motion) { -#ifdef __HAIR__ +# ifdef __HAIR__ if(kernel_data.bvh.have_curves) return bvh_intersect_shadow_all_hair_motion(kg, ray, isect, max_hits, num_hits); -#endif /* __HAIR__ */ +# endif /* __HAIR__ */ return bvh_intersect_shadow_all_motion(kg, ray, isect, max_hits, num_hits); } -#endif /* __OBJECT_MOTION__ */ +# endif /* __OBJECT_MOTION__ */ -#ifdef __HAIR__ +# ifdef __HAIR__ if(kernel_data.bvh.have_curves) return bvh_intersect_shadow_all_hair(kg, ray, isect, max_hits, num_hits); -#endif /* __HAIR__ */ +# endif /* __HAIR__ */ -#ifdef __INSTANCING__ +# ifdef __INSTANCING__ if(kernel_data.bvh.have_instancing) return bvh_intersect_shadow_all_instancing(kg, ray, isect, max_hits, num_hits); -#endif /* __INSTANCING__ */ +# endif /* __INSTANCING__ */ return bvh_intersect_shadow_all(kg, ray, isect, max_hits, num_hits); } -#endif +#endif /* __SHADOW_RECORD_ALL__ */ #ifdef __VOLUME__ ccl_device_intersect bool scene_intersect_volume(KernelGlobals *kg, - const Ray *ray, - Intersection *isect) + const Ray *ray, + Intersection *isect) { -#ifdef __OBJECT_MOTION__ +# ifdef __OBJECT_MOTION__ if(kernel_data.bvh.have_motion) { -#ifdef __HAIR__ +# ifdef __HAIR__ if(kernel_data.bvh.have_curves) return bvh_intersect_volume_hair_motion(kg, ray, isect); -#endif /* __HAIR__ */ +# endif /* __HAIR__ */ return bvh_intersect_volume_motion(kg, ray, isect); } -#endif /* __OBJECT_MOTION__ */ +# endif /* __OBJECT_MOTION__ */ -#ifdef __HAIR__ +# ifdef __HAIR__ if(kernel_data.bvh.have_curves) return bvh_intersect_volume_hair(kg, ray, isect); -#endif /* __HAIR__ */ +# endif /* __HAIR__ */ -#ifdef __KERNEL_CPU__ +# ifdef __KERNEL_CPU__ -#ifdef __INSTANCING__ +# ifdef __INSTANCING__ if(kernel_data.bvh.have_instancing) return bvh_intersect_volume_instancing(kg, ray, isect); -#endif /* __INSTANCING__ */ +# endif /* __INSTANCING__ */ return bvh_intersect_volume(kg, ray, isect); -#else /* __KERNEL_CPU__ */ +# else /* __KERNEL_CPU__ */ -#ifdef __INSTANCING__ +# ifdef __INSTANCING__ return bvh_intersect_volume_instancing(kg, ray, isect); -#else +# else return bvh_intersect_volume(kg, ray, isect); -#endif /* __INSTANCING__ */ +# endif /* __INSTANCING__ */ -#endif /* __KERNEL_CPU__ */ +# endif /* __KERNEL_CPU__ */ } -#endif +#endif /* __VOLUME__ */ #ifdef __VOLUME_RECORD_ALL__ ccl_device_intersect uint scene_intersect_volume_all(KernelGlobals *kg, @@ -343,30 +343,30 @@ ccl_device_intersect uint scene_intersect_volume_all(KernelGlobals *kg, Intersection *isect, const uint max_hits) { -#ifdef __OBJECT_MOTION__ +# ifdef __OBJECT_MOTION__ if(kernel_data.bvh.have_motion) { -#ifdef __HAIR__ +# ifdef __HAIR__ if(kernel_data.bvh.have_curves) return bvh_intersect_volume_all_hair_motion(kg, ray, isect, max_hits); -#endif /* __HAIR__ */ +# endif /* __HAIR__ */ return bvh_intersect_volume_all_motion(kg, ray, isect, max_hits); } -#endif /* __OBJECT_MOTION__ */ +# endif /* __OBJECT_MOTION__ */ -#ifdef __HAIR__ +# ifdef __HAIR__ if(kernel_data.bvh.have_curves) return bvh_intersect_volume_all_hair(kg, ray, isect, max_hits); -#endif /* __HAIR__ */ +# endif /* __HAIR__ */ -#ifdef __INSTANCING__ +# ifdef __INSTANCING__ if(kernel_data.bvh.have_instancing) return bvh_intersect_volume_all_instancing(kg, ray, isect, max_hits); -#endif /* __INSTANCING__ */ +# endif /* __INSTANCING__ */ return bvh_intersect_volume_all(kg, ray, isect, max_hits); } -#endif +#endif /* __VOLUME_RECORD_ALL__ */ /* Ray offset to avoid self intersection. diff --git a/intern/cycles/kernel/geom/geom_bvh_shadow.h b/intern/cycles/kernel/geom/geom_bvh_shadow.h index cb3f75f2a8f..4005489f77d 100644 --- a/intern/cycles/kernel/geom/geom_bvh_shadow.h +++ b/intern/cycles/kernel/geom/geom_bvh_shadow.h @@ -18,7 +18,7 @@ */ #ifdef __QBVH__ -#include "geom_qbvh_shadow.h" +# include "geom_qbvh_shadow.h" #endif /* This is a template BVH traversal function, where various features can be @@ -84,7 +84,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, ssef tsplat(0.0f, 0.0f, -isect_t, -isect_t); gen_idirsplat_swap(pn, shuf_identity, shuf_swap, idir, idirsplat, shufflexyz); -#endif +#endif /* __KERNEL_SSE2__ */ IsectPrecalc isect_precalc; triangle_intersect_precalc(dir, &isect_precalc); @@ -127,14 +127,14 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, NO_EXTENDED_PRECISION float c1max = min4(max(c1lox, c1hix), max(c1loy, c1hiy), max(c1loz, c1hiz), t); /* decide which nodes to traverse next */ -#ifdef __VISIBILITY_FLAG__ +# ifdef __VISIBILITY_FLAG__ /* this visibility test gives a 5% performance hit, how to solve? */ traverseChild0 = (c0max >= c0min) && (__float_as_uint(cnodes.z) & PATH_RAY_SHADOW); traverseChild1 = (c1max >= c1min) && (__float_as_uint(cnodes.w) & PATH_RAY_SHADOW); -#else +# else traverseChild0 = (c0max >= c0min); traverseChild1 = (c1max >= c1min); -#endif +# endif #else // __KERNEL_SSE2__ /* Intersect two child bounding boxes, SSE3 version adapted from Embree */ @@ -154,14 +154,14 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, const sseb lrhit = tminmax <= shuffle<2, 3, 0, 1>(tminmax); /* decide which nodes to traverse next */ -#ifdef __VISIBILITY_FLAG__ +# ifdef __VISIBILITY_FLAG__ /* this visibility test gives a 5% performance hit, how to solve? */ traverseChild0 = (movemask(lrhit) & 1) && (__float_as_uint(cnodes.z) & PATH_RAY_SHADOW); traverseChild1 = (movemask(lrhit) & 2) && (__float_as_uint(cnodes.w) & PATH_RAY_SHADOW); -#else +# else traverseChild0 = (movemask(lrhit) & 1); traverseChild1 = (movemask(lrhit) & 2); -#endif +# endif #endif // __KERNEL_SSE2__ nodeAddr = __float_as_int(cnodes.x); @@ -301,24 +301,24 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, /* instance push */ object = kernel_tex_fetch(__prim_object, -primAddr-1); -#if BVH_FEATURE(BVH_MOTION) +# if BVH_FEATURE(BVH_MOTION) bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect_t, &ob_itfm); -#else +# else bvh_instance_push(kg, object, ray, &P, &dir, &idir, &isect_t); -#endif +# endif triangle_intersect_precalc(dir, &isect_precalc); num_hits_in_instance = 0; isect_array->t = isect_t; -#if defined(__KERNEL_SSE2__) +# if defined(__KERNEL_SSE2__) Psplat[0] = ssef(P.x); Psplat[1] = ssef(P.y); Psplat[2] = ssef(P.z); tsplat = ssef(0.0f, 0.0f, -isect_t, -isect_t); gen_idirsplat_swap(pn, shuf_identity, shuf_swap, idir, idirsplat, shufflexyz); -#endif +# endif ++stackPtr; kernel_assert(stackPtr < BVH_STACK_SIZE); @@ -337,11 +337,11 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, 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 triangle_intersect_precalc(dir, &isect_precalc); @@ -352,25 +352,25 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, else { float ignore_t = FLT_MAX; -#if BVH_FEATURE(BVH_MOTION) +# if BVH_FEATURE(BVH_MOTION) bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, &ignore_t, &ob_itfm); -#else +# else bvh_instance_pop(kg, object, ray, &P, &dir, &idir, &ignore_t); -#endif +# endif triangle_intersect_precalc(dir, &isect_precalc); } isect_t = tmax; isect_array->t = isect_t; -#if defined(__KERNEL_SSE2__) +# if defined(__KERNEL_SSE2__) Psplat[0] = ssef(P.x); Psplat[1] = ssef(P.y); Psplat[2] = ssef(P.z); tsplat = ssef(0.0f, 0.0f, -isect_t, -isect_t); gen_idirsplat_swap(pn, shuf_identity, shuf_swap, idir, idirsplat, shufflexyz); -#endif +# endif object = OBJECT_NONE; nodeAddr = traversalStack[stackPtr]; diff --git a/intern/cycles/kernel/geom/geom_bvh_subsurface.h b/intern/cycles/kernel/geom/geom_bvh_subsurface.h index 43809201761..915e9415c93 100644 --- a/intern/cycles/kernel/geom/geom_bvh_subsurface.h +++ b/intern/cycles/kernel/geom/geom_bvh_subsurface.h @@ -18,7 +18,7 @@ */ #ifdef __QBVH__ -#include "geom_qbvh_subsurface.h" +# include "geom_qbvh_subsurface.h" #endif /* This is a template BVH traversal function for subsurface scattering, where diff --git a/intern/cycles/kernel/geom/geom_bvh_traversal.h b/intern/cycles/kernel/geom/geom_bvh_traversal.h index 13d118b6d19..8560612addc 100644 --- a/intern/cycles/kernel/geom/geom_bvh_traversal.h +++ b/intern/cycles/kernel/geom/geom_bvh_traversal.h @@ -18,7 +18,7 @@ */ #ifdef __QBVH__ -#include "geom_qbvh_traversal.h" +# include "geom_qbvh_traversal.h" #endif /* This is a template BVH traversal function, where various features can be @@ -136,7 +136,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, NO_EXTENDED_PRECISION float c1min = max4(min(c1lox, c1hix), min(c1loy, c1hiy), min(c1loz, c1hiz), 0.0f); NO_EXTENDED_PRECISION float c1max = min4(max(c1lox, c1hix), max(c1loy, c1hiy), max(c1loz, c1hiz), t); -#if BVH_FEATURE(BVH_HAIR_MINIMUM_WIDTH) +# if BVH_FEATURE(BVH_HAIR_MINIMUM_WIDTH) if(difl != 0.0f) { float hdiff = 1.0f + difl; float ldiff = 1.0f - difl; @@ -149,17 +149,17 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, c1max = min(hdiff * c1max, c1max + extmax); } } -#endif +# endif /* decide which nodes to traverse next */ -#ifdef __VISIBILITY_FLAG__ +# ifdef __VISIBILITY_FLAG__ /* this visibility test gives a 5% performance hit, how to solve? */ traverseChild0 = (c0max >= c0min) && (__float_as_uint(cnodes.z) & visibility); traverseChild1 = (c1max >= c1min) && (__float_as_uint(cnodes.w) & visibility); -#else +# else traverseChild0 = (c0max >= c0min); traverseChild1 = (c1max >= c1min); -#endif +# endif #else // __KERNEL_SSE2__ /* Intersect two child bounding boxes, SSE3 version adapted from Embree */ @@ -177,7 +177,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, ssef minmax = max(max(tminmaxx, tminmaxy), max(tminmaxz, tsplat)); const ssef tminmax = minmax ^ pn; -#if BVH_FEATURE(BVH_HAIR_MINIMUM_WIDTH) +# if BVH_FEATURE(BVH_HAIR_MINIMUM_WIDTH) if(difl != 0.0f) { float4 *tminmaxview = (float4*)&tminmax; float &c0min = tminmaxview->x, &c1min = tminmaxview->y; @@ -194,19 +194,19 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, c1max = min(hdiff * c1max, c1max + extmax); } } -#endif +# endif const sseb lrhit = tminmax <= shuffle<2, 3, 0, 1>(tminmax); /* decide which nodes to traverse next */ -#ifdef __VISIBILITY_FLAG__ +# ifdef __VISIBILITY_FLAG__ /* this visibility test gives a 5% performance hit, how to solve? */ traverseChild0 = (movemask(lrhit) & 1) && (__float_as_uint(cnodes.z) & visibility); traverseChild1 = (movemask(lrhit) & 2) && (__float_as_uint(cnodes.w) & visibility); -#else +# else traverseChild0 = (movemask(lrhit) & 1); traverseChild1 = (movemask(lrhit) & 2); -#endif +# endif #endif // __KERNEL_SSE2__ nodeAddr = __float_as_int(cnodes.x); @@ -287,20 +287,20 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, #if BVH_FEATURE(BVH_MOTION) case PRIMITIVE_MOTION_TRIANGLE: { for(; primAddr < primAddr2; primAddr++) { -#if defined(__KERNEL_DEBUG__) +# if defined(__KERNEL_DEBUG__) isect->num_traversal_steps++; -#endif +# endif kernel_assert(kernel_tex_fetch(__prim_type, primAddr) == type); if(motion_triangle_intersect(kg, isect, P, dir, ray->time, visibility, object, primAddr)) { /* shadow ray early termination */ -#if defined(__KERNEL_SSE2__) +# if defined(__KERNEL_SSE2__) if(visibility == PATH_RAY_SHADOW_OPAQUE) return true; tsplat = ssef(0.0f, 0.0f, -isect->t, -isect->t); -#else +# else if(visibility == PATH_RAY_SHADOW_OPAQUE) return true; -#endif +# endif } } break; @@ -310,9 +310,9 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, case PRIMITIVE_CURVE: case PRIMITIVE_MOTION_CURVE: { for(; primAddr < primAddr2; primAddr++) { -#if defined(__KERNEL_DEBUG__) +# if defined(__KERNEL_DEBUG__) isect->num_traversal_steps++; -#endif +# endif kernel_assert(kernel_tex_fetch(__prim_type, primAddr) == type); bool hit; if(kernel_data.curve.curveflags & CURVE_KN_INTERPOLATE) @@ -321,14 +321,14 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, hit = bvh_curve_intersect(kg, isect, P, dir, visibility, object, primAddr, ray->time, type, lcg_state, difl, extmax); if(hit) { /* shadow ray early termination */ -#if defined(__KERNEL_SSE2__) +# if defined(__KERNEL_SSE2__) if(visibility == PATH_RAY_SHADOW_OPAQUE) return true; tsplat = ssef(0.0f, 0.0f, -isect->t, -isect->t); -#else +# else if(visibility == PATH_RAY_SHADOW_OPAQUE) return true; -#endif +# endif } } break; @@ -341,14 +341,14 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, /* instance push */ object = kernel_tex_fetch(__prim_object, -primAddr-1); -#if BVH_FEATURE(BVH_MOTION) +# if BVH_FEATURE(BVH_MOTION) bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect->t, &ob_itfm); -#else +# else bvh_instance_push(kg, object, ray, &P, &dir, &idir, &isect->t); -#endif +# endif triangle_intersect_precalc(dir, &isect_precalc); -#if defined(__KERNEL_SSE2__) +# if defined(__KERNEL_SSE2__) Psplat[0] = ssef(P.x); Psplat[1] = ssef(P.y); Psplat[2] = ssef(P.z); @@ -356,7 +356,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, tsplat = ssef(0.0f, 0.0f, -isect->t, -isect->t); gen_idirsplat_swap(pn, shuf_identity, shuf_swap, idir, idirsplat, shufflexyz); -#endif +# endif ++stackPtr; kernel_assert(stackPtr < BVH_STACK_SIZE); @@ -364,9 +364,9 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, nodeAddr = kernel_tex_fetch(__object_node, object); -#if defined(__KERNEL_DEBUG__) +# if defined(__KERNEL_DEBUG__) isect->num_traversed_instances++; -#endif +# endif } } #endif /* FEATURE(BVH_INSTANCING) */ @@ -377,14 +377,14 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, kernel_assert(object != OBJECT_NONE); /* instance pop */ -#if BVH_FEATURE(BVH_MOTION) +# if BVH_FEATURE(BVH_MOTION) bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, &isect->t, &ob_itfm); -#else +# else bvh_instance_pop(kg, object, ray, &P, &dir, &idir, &isect->t); -#endif +# endif triangle_intersect_precalc(dir, &isect_precalc); -#if defined(__KERNEL_SSE2__) +# if defined(__KERNEL_SSE2__) Psplat[0] = ssef(P.x); Psplat[1] = ssef(P.y); Psplat[2] = ssef(P.z); @@ -392,7 +392,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, tsplat = ssef(0.0f, 0.0f, -isect->t, -isect->t); gen_idirsplat_swap(pn, shuf_identity, shuf_swap, idir, idirsplat, shufflexyz); -#endif +# endif object = OBJECT_NONE; nodeAddr = traversalStack[stackPtr]; diff --git a/intern/cycles/kernel/geom/geom_bvh_volume.h b/intern/cycles/kernel/geom/geom_bvh_volume.h index 656cd6e7a0e..937a5d4aaec 100644 --- a/intern/cycles/kernel/geom/geom_bvh_volume.h +++ b/intern/cycles/kernel/geom/geom_bvh_volume.h @@ -266,15 +266,15 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, if(object_flag & SD_OBJECT_HAS_VOLUME) { -#if BVH_FEATURE(BVH_MOTION) +# if BVH_FEATURE(BVH_MOTION) bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect->t, &ob_itfm); -#else +# else bvh_instance_push(kg, object, ray, &P, &dir, &idir, &isect->t); -#endif +# endif triangle_intersect_precalc(dir, &isect_precalc); -#if defined(__KERNEL_SSE2__) +# if defined(__KERNEL_SSE2__) Psplat[0] = ssef(P.x); Psplat[1] = ssef(P.y); Psplat[2] = ssef(P.z); @@ -282,7 +282,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, tsplat = ssef(0.0f, 0.0f, -isect->t, -isect->t); gen_idirsplat_swap(pn, shuf_identity, shuf_swap, idir, idirsplat, shufflexyz); -#endif +# endif ++stackPtr; kernel_assert(stackPtr < BVH_STACK_SIZE); @@ -306,15 +306,15 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, kernel_assert(object != OBJECT_NONE); /* instance pop */ -#if BVH_FEATURE(BVH_MOTION) +# if BVH_FEATURE(BVH_MOTION) bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, &isect->t, &ob_itfm); -#else +# else bvh_instance_pop(kg, object, ray, &P, &dir, &idir, &isect->t); -#endif +# endif triangle_intersect_precalc(dir, &isect_precalc); -#if defined(__KERNEL_SSE2__) +# if defined(__KERNEL_SSE2__) Psplat[0] = ssef(P.x); Psplat[1] = ssef(P.y); Psplat[2] = ssef(P.z); @@ -322,7 +322,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, tsplat = ssef(0.0f, 0.0f, -isect->t, -isect->t); gen_idirsplat_swap(pn, shuf_identity, shuf_swap, idir, idirsplat, shufflexyz); -#endif +# endif object = OBJECT_NONE; nodeAddr = traversalStack[stackPtr]; diff --git a/intern/cycles/kernel/geom/geom_bvh_volume_all.h b/intern/cycles/kernel/geom/geom_bvh_volume_all.h index 8f7e3adae51..6b0b20138da 100644 --- a/intern/cycles/kernel/geom/geom_bvh_volume_all.h +++ b/intern/cycles/kernel/geom/geom_bvh_volume_all.h @@ -229,12 +229,12 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, isect_array->t = isect_t; if(num_hits == max_hits) { #if BVH_FEATURE(BVH_INSTANCING) -#if BVH_FEATURE(BVH_MOTION) +# if BVH_FEATURE(BVH_MOTION) float t_fac = 1.0f / len(transform_direction(&ob_itfm, dir)); -#else +# else Transform itfm = object_fetch_transform(kg, object, OBJECT_INVERSE_TRANSFORM); float t_fac = 1.0f / len(transform_direction(&itfm, dir)); -#endif +# endif for(int i = 0; i < num_hits_in_instance; i++) { (isect_array-i-1)->t *= t_fac; } @@ -261,29 +261,29 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, /* Move on to next entry in intersections array. */ isect_array++; num_hits++; -#if BVH_FEATURE(BVH_INSTANCING) +# if BVH_FEATURE(BVH_INSTANCING) num_hits_in_instance++; -#endif +# endif isect_array->t = isect_t; if(num_hits == max_hits) { -#if BVH_FEATURE(BVH_INSTANCING) -# if BVH_FEATURE(BVH_MOTION) +# if BVH_FEATURE(BVH_INSTANCING) +# if BVH_FEATURE(BVH_MOTION) float t_fac = 1.0f / len(transform_direction(&ob_itfm, dir)); -# else +# else Transform itfm = object_fetch_transform(kg, object, OBJECT_INVERSE_TRANSFORM); float t_fac = 1.0f / len(transform_direction(&itfm, dir)); -#endif +# endif for(int i = 0; i < num_hits_in_instance; i++) { (isect_array-i-1)->t *= t_fac; } -#endif /* BVH_FEATURE(BVH_INSTANCING) */ +# endif /* BVH_FEATURE(BVH_INSTANCING) */ return num_hits; } } } break; } -#endif +#endif /* BVH_MOTION */ #if BVH_FEATURE(BVH_HAIR) case PRIMITIVE_CURVE: case PRIMITIVE_MOTION_CURVE: { @@ -304,29 +304,29 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, /* Move on to next entry in intersections array. */ isect_array++; num_hits++; -#if BVH_FEATURE(BVH_INSTANCING) +# if BVH_FEATURE(BVH_INSTANCING) num_hits_in_instance++; -#endif +# endif isect_array->t = isect_t; if(num_hits == max_hits) { -#if BVH_FEATURE(BVH_INSTANCING) -# if BVH_FEATURE(BVH_MOTION) +# if BVH_FEATURE(BVH_INSTANCING) +# if BVH_FEATURE(BVH_MOTION) float t_fac = 1.0f / len(transform_direction(&ob_itfm, dir)); -# else +# else Transform itfm = object_fetch_transform(kg, object, OBJECT_INVERSE_TRANSFORM); float t_fac = 1.0f / len(transform_direction(&itfm, dir)); -#endif +# endif for(int i = 0; i < num_hits_in_instance; i++) { (isect_array-i-1)->t *= t_fac; } -#endif /* BVH_FEATURE(BVH_INSTANCING) */ +# endif /* BVH_FEATURE(BVH_INSTANCING) */ return num_hits; } } } break; } -#endif +#endif /* BVH_HAIR */ default: { break; } @@ -340,17 +340,17 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, if(object_flag & SD_OBJECT_HAS_VOLUME) { -#if BVH_FEATURE(BVH_MOTION) +# if BVH_FEATURE(BVH_MOTION) bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect_t, &ob_itfm); -#else +# else bvh_instance_push(kg, object, ray, &P, &dir, &idir, &isect_t); -#endif +# endif triangle_intersect_precalc(dir, &isect_precalc); num_hits_in_instance = 0; isect_array->t = isect_t; -#if defined(__KERNEL_SSE2__) +# if defined(__KERNEL_SSE2__) Psplat[0] = ssef(P.x); Psplat[1] = ssef(P.y); Psplat[2] = ssef(P.z); @@ -358,7 +358,7 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, tsplat = ssef(0.0f, 0.0f, -isect_t, -isect_t); gen_idirsplat_swap(pn, shuf_identity, shuf_swap, idir, idirsplat, shufflexyz); -#endif +# endif ++stackPtr; kernel_assert(stackPtr < BVH_STACK_SIZE); @@ -383,11 +383,11 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, 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 triangle_intersect_precalc(dir, &isect_precalc); /* Scale isect->t to adjust for instancing. */ for(int i = 0; i < num_hits_in_instance; i++) { @@ -396,18 +396,18 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, } else { float ignore_t = FLT_MAX; -#if BVH_FEATURE(BVH_MOTION) +# if BVH_FEATURE(BVH_MOTION) bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, &ignore_t, &ob_itfm); -#else +# else bvh_instance_pop(kg, object, ray, &P, &dir, &idir, &ignore_t); -#endif +# endif triangle_intersect_precalc(dir, &isect_precalc); } isect_t = tmax; isect_array->t = isect_t; -#if defined(__KERNEL_SSE2__) +# if defined(__KERNEL_SSE2__) Psplat[0] = ssef(P.x); Psplat[1] = ssef(P.y); Psplat[2] = ssef(P.z); @@ -415,7 +415,7 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, tsplat = ssef(0.0f, 0.0f, -isect_t, -isect_t); gen_idirsplat_swap(pn, shuf_identity, shuf_swap, idir, idirsplat, shufflexyz); -#endif +# endif object = OBJECT_NONE; nodeAddr = traversalStack[stackPtr]; diff --git a/intern/cycles/kernel/geom/geom_curve.h b/intern/cycles/kernel/geom/geom_curve.h index 9653ad8f1bb..8894843997c 100644 --- a/intern/cycles/kernel/geom/geom_curve.h +++ b/intern/cycles/kernel/geom/geom_curve.h @@ -626,9 +626,9 @@ ccl_device_inline bool bvh_curve_intersect(KernelGlobals *kg, Intersection *isec { /* define few macros to minimize code duplication for SSE */ #ifndef __KERNEL_SSE2__ -#define len3_squared(x) len_squared(x) -#define len3(x) len(x) -#define dot3(x, y) dot(x, y) +# define len3_squared(x) len_squared(x) +# define len3(x) len(x) +# define dot3(x, y) dot(x, y) #endif int segment = PRIMITIVE_UNPACK_SEGMENT(type); @@ -850,10 +850,10 @@ ccl_device_inline bool bvh_curve_intersect(KernelGlobals *kg, Intersection *isec return false; #ifndef __KERNEL_SSE2__ -#undef len3_squared -#undef len3 -#undef dot3 -#endif +# undef len3_squared +# undef len3 +# undef dot3 +# endif } ccl_device_inline float3 curvetangent(float t, float3 p0, float3 p1, float3 p2, float3 p3) diff --git a/intern/cycles/kernel/geom/geom_motion_triangle.h b/intern/cycles/kernel/geom/geom_motion_triangle.h index 7f3562b4687..ffe55529110 100644 --- a/intern/cycles/kernel/geom/geom_motion_triangle.h +++ b/intern/cycles/kernel/geom/geom_motion_triangle.h @@ -133,11 +133,11 @@ ccl_device_inline float3 motion_triangle_refine(KernelGlobals *kg, ShaderData *s if(UNLIKELY(t == 0.0f)) { return P; } -#ifdef __OBJECT_MOTION__ +# ifdef __OBJECT_MOTION__ Transform tfm = ccl_fetch(sd, ob_itfm); -#else +# else Transform tfm = object_fetch_transform(kg, isect->object, OBJECT_INVERSE_TRANSFORM); -#endif +# endif P = transform_point(&tfm, P); D = transform_direction(&tfm, D*t); @@ -160,11 +160,11 @@ ccl_device_inline float3 motion_triangle_refine(KernelGlobals *kg, ShaderData *s P = P + D*rt; if(isect->object != OBJECT_NONE) { -#ifdef __OBJECT_MOTION__ +# ifdef __OBJECT_MOTION__ Transform tfm = ccl_fetch(sd, ob_tfm); -#else +# else Transform tfm = object_fetch_transform(kg, isect->object, OBJECT_TRANSFORM); -#endif +# endif P = transform_point(&tfm, P); } @@ -189,13 +189,13 @@ float3 motion_triangle_refine_subsurface(KernelGlobals *kg, ShaderData *sd, cons float3 D = ray->D; float t = isect->t; -#ifdef __INTERSECTION_REFINE__ +# ifdef __INTERSECTION_REFINE__ if(isect->object != OBJECT_NONE) { -#ifdef __OBJECT_MOTION__ +# ifdef __OBJECT_MOTION__ Transform tfm = ccl_fetch(sd, ob_itfm); -#else +# else Transform tfm = object_fetch_transform(kg, isect->object, OBJECT_INVERSE_TRANSFORM); -#endif +# endif P = transform_point(&tfm, P); D = transform_direction(&tfm, D); @@ -217,19 +217,19 @@ float3 motion_triangle_refine_subsurface(KernelGlobals *kg, ShaderData *sd, cons P = P + D*rt; if(isect->object != OBJECT_NONE) { -#ifdef __OBJECT_MOTION__ +# ifdef __OBJECT_MOTION__ Transform tfm = ccl_fetch(sd, ob_tfm); -#else +# else Transform tfm = object_fetch_transform(kg, isect->object, OBJECT_TRANSFORM); -#endif +# endif P = transform_point(&tfm, P); } return P; -#else +# else return P + D*t; -#endif +# endif } #endif diff --git a/intern/cycles/kernel/geom/geom_primitive.h b/intern/cycles/kernel/geom/geom_primitive.h index 30f12d32355..b1b1e919e00 100644 --- a/intern/cycles/kernel/geom/geom_primitive.h +++ b/intern/cycles/kernel/geom/geom_primitive.h @@ -109,11 +109,11 @@ ccl_device float3 primitive_tangent(KernelGlobals *kg, ShaderData *sd) { #ifdef __HAIR__ if(ccl_fetch(sd, type) & PRIMITIVE_ALL_CURVE) -#ifdef __DPDU__ +# ifdef __DPDU__ return normalize(ccl_fetch(sd, dPdu)); -#else +# else return make_float3(0.0f, 0.0f, 0.0f); -#endif +# endif #endif /* try to create spherical tangent from generated coordinates */ diff --git a/intern/cycles/kernel/geom/geom_qbvh_shadow.h b/intern/cycles/kernel/geom/geom_qbvh_shadow.h index 4564d5baf5e..edb5b5c78c3 100644 --- a/intern/cycles/kernel/geom/geom_qbvh_shadow.h +++ b/intern/cycles/kernel/geom/geom_qbvh_shadow.h @@ -316,11 +316,11 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, /* Instance push. */ object = kernel_tex_fetch(__prim_object, -primAddr-1); -#if BVH_FEATURE(BVH_MOTION) +# if BVH_FEATURE(BVH_MOTION) bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect_t, &ob_itfm); -#else +# else bvh_instance_push(kg, object, ray, &P, &dir, &idir, &isect_t); -#endif +# endif num_hits_in_instance = 0; isect_array->t = isect_t; @@ -330,12 +330,12 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, if(idir.z >= 0.0f) { near_z = 4; far_z = 5; } else { near_z = 5; far_z = 4; } tfar = ssef(isect_t); idir4 = sse3f(ssef(idir.x), ssef(idir.y), ssef(idir.z)); -#ifdef __KERNEL_AVX2__ +# ifdef __KERNEL_AVX2__ P_idir = P*idir; P_idir4 = sse3f(P_idir.x, P_idir.y, P_idir.z); -#else +# else org = sse3f(ssef(P.x), ssef(P.y), ssef(P.z)); -#endif +# endif triangle_intersect_precalc(dir, &isect_precalc); ++stackPtr; @@ -356,11 +356,11 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, 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++) @@ -369,11 +369,11 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, else { float ignore_t = FLT_MAX; -#if BVH_FEATURE(BVH_MOTION) +# if BVH_FEATURE(BVH_MOTION) bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, &ignore_t, &ob_itfm); -#else +# else bvh_instance_pop(kg, object, ray, &P, &dir, &idir, &ignore_t); -#endif +# endif } isect_t = tmax; @@ -384,12 +384,12 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, if(idir.z >= 0.0f) { near_z = 4; far_z = 5; } else { near_z = 5; far_z = 4; } tfar = ssef(tmax); idir4 = sse3f(ssef(idir.x), ssef(idir.y), ssef(idir.z)); -#ifdef __KERNEL_AVX2__ +# ifdef __KERNEL_AVX2__ P_idir = P*idir; P_idir4 = sse3f(P_idir.x, P_idir.y, P_idir.z); -#else +# else org = sse3f(ssef(P.x), ssef(P.y), ssef(P.z)); -#endif +# endif triangle_intersect_precalc(dir, &isect_precalc); object = OBJECT_NONE; diff --git a/intern/cycles/kernel/geom/geom_qbvh_traversal.h b/intern/cycles/kernel/geom/geom_qbvh_traversal.h index 4e1678665c0..ce3bbbdf957 100644 --- a/intern/cycles/kernel/geom/geom_qbvh_traversal.h +++ b/intern/cycles/kernel/geom/geom_qbvh_traversal.h @@ -134,11 +134,11 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, traverseChild = qbvh_node_intersect_robust(kg, tnear, tfar, -#ifdef __KERNEL_AVX2__ +# ifdef __KERNEL_AVX2__ P_idir4, -#else +# else org, -#endif +# endif idir4, near_x, near_y, near_z, far_x, far_y, far_z, @@ -147,7 +147,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, &dist); } else -#endif +#endif /* BVH_HAIR_MINIMUM_WIDTH */ { traverseChild = qbvh_node_intersect(kg, tnear, @@ -311,9 +311,9 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, #if BVH_FEATURE(BVH_MOTION) case PRIMITIVE_MOTION_TRIANGLE: { for(; primAddr < primAddr2; primAddr++) { -#if defined(__KERNEL_DEBUG__) +# if defined(__KERNEL_DEBUG__) isect->num_traversal_steps++; -#endif +# endif kernel_assert(kernel_tex_fetch(__prim_type, primAddr) == type); if(motion_triangle_intersect(kg, isect, P, dir, ray->time, visibility, object, primAddr)) { tfar = ssef(isect->t); @@ -329,9 +329,9 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, case PRIMITIVE_CURVE: case PRIMITIVE_MOTION_CURVE: { for(; primAddr < primAddr2; primAddr++) { -#if defined(__KERNEL_DEBUG__) +# if defined(__KERNEL_DEBUG__) isect->num_traversal_steps++; -#endif +# endif kernel_assert(kernel_tex_fetch(__prim_type, primAddr) == type); bool hit; if(kernel_data.curve.curveflags & CURVE_KN_INTERPOLATE) @@ -355,23 +355,23 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, /* Instance push. */ object = kernel_tex_fetch(__prim_object, -primAddr-1); -#if BVH_FEATURE(BVH_MOTION) +# if BVH_FEATURE(BVH_MOTION) qbvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect->t, &nodeDist, &ob_itfm); -#else +# else qbvh_instance_push(kg, object, ray, &P, &dir, &idir, &isect->t, &nodeDist); -#endif +# endif if(idir.x >= 0.0f) { near_x = 0; far_x = 1; } else { near_x = 1; far_x = 0; } if(idir.y >= 0.0f) { near_y = 2; far_y = 3; } else { near_y = 3; far_y = 2; } if(idir.z >= 0.0f) { near_z = 4; far_z = 5; } else { near_z = 5; far_z = 4; } tfar = ssef(isect->t); idir4 = sse3f(ssef(idir.x), ssef(idir.y), ssef(idir.z)); -#ifdef __KERNEL_AVX2__ +# ifdef __KERNEL_AVX2__ P_idir = P*idir; P_idir4 = sse3f(P_idir.x, P_idir.y, P_idir.z); -#else +# else org = sse3f(ssef(P.x), ssef(P.y), ssef(P.z)); -#endif +# endif triangle_intersect_precalc(dir, &isect_precalc); ++stackPtr; @@ -381,9 +381,9 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, nodeAddr = kernel_tex_fetch(__object_node, object); -#if defined(__KERNEL_DEBUG__) +# if defined(__KERNEL_DEBUG__) isect->num_traversed_instances++; -#endif +# endif } } #endif /* FEATURE(BVH_INSTANCING) */ @@ -394,23 +394,23 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, kernel_assert(object != OBJECT_NONE); /* Instance pop. */ -#if BVH_FEATURE(BVH_MOTION) +# if BVH_FEATURE(BVH_MOTION) bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, &isect->t, &ob_itfm); -#else +# else bvh_instance_pop(kg, object, ray, &P, &dir, &idir, &isect->t); -#endif +# endif if(idir.x >= 0.0f) { near_x = 0; far_x = 1; } else { near_x = 1; far_x = 0; } if(idir.y >= 0.0f) { near_y = 2; far_y = 3; } else { near_y = 3; far_y = 2; } if(idir.z >= 0.0f) { near_z = 4; far_z = 5; } else { near_z = 5; far_z = 4; } tfar = ssef(isect->t); idir4 = sse3f(ssef(idir.x), ssef(idir.y), ssef(idir.z)); -#ifdef __KERNEL_AVX2__ +# ifdef __KERNEL_AVX2__ P_idir = P*idir; P_idir4 = sse3f(P_idir.x, P_idir.y, P_idir.z); -#else +# else org = sse3f(ssef(P.x), ssef(P.y), ssef(P.z)); -#endif +# endif triangle_intersect_precalc(dir, &isect_precalc); object = OBJECT_NONE; diff --git a/intern/cycles/kernel/geom/geom_qbvh_volume.h b/intern/cycles/kernel/geom/geom_qbvh_volume.h index 40864471d13..696a48a7b3e 100644 --- a/intern/cycles/kernel/geom/geom_qbvh_volume.h +++ b/intern/cycles/kernel/geom/geom_qbvh_volume.h @@ -280,23 +280,23 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, if(object_flag & SD_OBJECT_HAS_VOLUME) { -#if BVH_FEATURE(BVH_MOTION) +# if BVH_FEATURE(BVH_MOTION) bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect->t, &ob_itfm); -#else +# else bvh_instance_push(kg, object, ray, &P, &dir, &idir, &isect->t); -#endif +# endif if(idir.x >= 0.0f) { near_x = 0; far_x = 1; } else { near_x = 1; far_x = 0; } if(idir.y >= 0.0f) { near_y = 2; far_y = 3; } else { near_y = 3; far_y = 2; } if(idir.z >= 0.0f) { near_z = 4; far_z = 5; } else { near_z = 5; far_z = 4; } tfar = ssef(isect->t); idir4 = sse3f(ssef(idir.x), ssef(idir.y), ssef(idir.z)); -#ifdef __KERNEL_AVX2__ +# ifdef __KERNEL_AVX2__ P_idir = P*idir; P_idir4 = sse3f(P_idir.x, P_idir.y, P_idir.z); -#else +# else org = sse3f(ssef(P.x), ssef(P.y), ssef(P.z)); -#endif +# endif triangle_intersect_precalc(dir, &isect_precalc); ++stackPtr; @@ -321,23 +321,23 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, kernel_assert(object != OBJECT_NONE); /* Instance pop. */ -#if BVH_FEATURE(BVH_MOTION) +# if BVH_FEATURE(BVH_MOTION) bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, &isect->t, &ob_itfm); -#else +# else bvh_instance_pop(kg, object, ray, &P, &dir, &idir, &isect->t); -#endif +# endif if(idir.x >= 0.0f) { near_x = 0; far_x = 1; } else { near_x = 1; far_x = 0; } if(idir.y >= 0.0f) { near_y = 2; far_y = 3; } else { near_y = 3; far_y = 2; } if(idir.z >= 0.0f) { near_z = 4; far_z = 5; } else { near_z = 5; far_z = 4; } tfar = ssef(isect->t); idir4 = sse3f(ssef(idir.x), ssef(idir.y), ssef(idir.z)); -#ifdef __KERNEL_AVX2__ +# ifdef __KERNEL_AVX2__ P_idir = P*idir; P_idir4 = sse3f(P_idir.x, P_idir.y, P_idir.z); -#else +# else org = sse3f(ssef(P.x), ssef(P.y), ssef(P.z)); -#endif +# endif triangle_intersect_precalc(dir, &isect_precalc); object = OBJECT_NONE; diff --git a/intern/cycles/kernel/geom/geom_qbvh_volume_all.h b/intern/cycles/kernel/geom/geom_qbvh_volume_all.h index 75e4c4e8d96..2cef0dcb1dc 100644 --- a/intern/cycles/kernel/geom/geom_qbvh_volume_all.h +++ b/intern/cycles/kernel/geom/geom_qbvh_volume_all.h @@ -246,12 +246,12 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, isect_array->t = isect_t; if(num_hits == max_hits) { #if BVH_FEATURE(BVH_INSTANCING) -#if BVH_FEATURE(BVH_MOTION) +# if BVH_FEATURE(BVH_MOTION) float t_fac = 1.0f / len(transform_direction(&ob_itfm, dir)); -#else +# else Transform itfm = object_fetch_transform(kg, object, OBJECT_INVERSE_TRANSFORM); float t_fac = 1.0f / len(transform_direction(&itfm, dir)); -#endif +# endif for(int i = 0; i < num_hits_in_instance; i++) { (isect_array-i-1)->t *= t_fac; } @@ -278,22 +278,22 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, /* Move on to next entry in intersections array. */ isect_array++; num_hits++; -#if BVH_FEATURE(BVH_INSTANCING) +# if BVH_FEATURE(BVH_INSTANCING) num_hits_in_instance++; -#endif +# endif isect_array->t = isect_t; if(num_hits == max_hits) { -#if BVH_FEATURE(BVH_INSTANCING) -# if BVH_FEATURE(BVH_MOTION) +# if BVH_FEATURE(BVH_INSTANCING) +# if BVH_FEATURE(BVH_MOTION) float t_fac = 1.0f / len(transform_direction(&ob_itfm, dir)); -# else +# else Transform itfm = object_fetch_transform(kg, object, OBJECT_INVERSE_TRANSFORM); float t_fac = 1.0f / len(transform_direction(&itfm, dir)); -#endif +# endif for(int i = 0; i < num_hits_in_instance; i++) { (isect_array-i-1)->t *= t_fac; } -#endif /* BVH_FEATURE(BVH_INSTANCING) */ +# endif /* BVH_FEATURE(BVH_INSTANCING) */ return num_hits; } } @@ -321,29 +321,29 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, /* Move on to next entry in intersections array. */ isect_array++; num_hits++; -#if BVH_FEATURE(BVH_INSTANCING) +# if BVH_FEATURE(BVH_INSTANCING) num_hits_in_instance++; -#endif +# endif isect_array->t = isect_t; if(num_hits == max_hits) { -#if BVH_FEATURE(BVH_INSTANCING) -# if BVH_FEATURE(BVH_MOTION) +# if BVH_FEATURE(BVH_INSTANCING) +# if BVH_FEATURE(BVH_MOTION) float t_fac = 1.0f / len(transform_direction(&ob_itfm, dir)); -# else +# else Transform itfm = object_fetch_transform(kg, object, OBJECT_INVERSE_TRANSFORM); float t_fac = 1.0f / len(transform_direction(&itfm, dir)); -#endif +# endif for(int i = 0; i < num_hits_in_instance; i++) { (isect_array-i-1)->t *= t_fac; } -#endif /* BVH_FEATURE(BVH_INSTANCING) */ +# endif /* BVH_FEATURE(BVH_INSTANCING) */ return num_hits; } } } break; } -#endif +#endif /* BVH_HAIR */ } } #if BVH_FEATURE(BVH_INSTANCING) @@ -354,23 +354,23 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, if(object_flag & SD_OBJECT_HAS_VOLUME) { -#if BVH_FEATURE(BVH_MOTION) +# if BVH_FEATURE(BVH_MOTION) bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect_t, &ob_itfm); -#else +# else bvh_instance_push(kg, object, ray, &P, &dir, &idir, &isect_t); -#endif +# endif if(idir.x >= 0.0f) { near_x = 0; far_x = 1; } else { near_x = 1; far_x = 0; } if(idir.y >= 0.0f) { near_y = 2; far_y = 3; } else { near_y = 3; far_y = 2; } if(idir.z >= 0.0f) { near_z = 4; far_z = 5; } else { near_z = 5; far_z = 4; } tfar = ssef(isect_t); idir4 = sse3f(ssef(idir.x), ssef(idir.y), ssef(idir.z)); -#ifdef __KERNEL_AVX2__ +# ifdef __KERNEL_AVX2__ P_idir = P*idir; P_idir4 = sse3f(P_idir.x, P_idir.y, P_idir.z); -#else +# else org = sse3f(ssef(P.x), ssef(P.y), ssef(P.z)); -#endif +# endif triangle_intersect_precalc(dir, &isect_precalc); num_hits_in_instance = 0; isect_array->t = isect_t; @@ -399,11 +399,11 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, /* Instance pop. */ 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 triangle_intersect_precalc(dir, &isect_precalc); /* Scale isect->t to adjust for instancing. */ for(int i = 0; i < num_hits_in_instance; i++) { @@ -412,11 +412,11 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, } else { float ignore_t = FLT_MAX; -#if BVH_FEATURE(BVH_MOTION) +# if BVH_FEATURE(BVH_MOTION) bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, &ignore_t, &ob_itfm); -#else +# else bvh_instance_pop(kg, object, ray, &P, &dir, &idir, &ignore_t); -#endif +# endif triangle_intersect_precalc(dir, &isect_precalc); } @@ -425,12 +425,12 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, if(idir.z >= 0.0f) { near_z = 4; far_z = 5; } else { near_z = 5; far_z = 4; } tfar = ssef(isect_t); idir4 = sse3f(ssef(idir.x), ssef(idir.y), ssef(idir.z)); -#ifdef __KERNEL_AVX2__ +# ifdef __KERNEL_AVX2__ P_idir = P*idir; P_idir4 = sse3f(P_idir.x, P_idir.y, P_idir.z); -#else +# else org = sse3f(ssef(P.x), ssef(P.y), ssef(P.z)); -#endif +# endif triangle_intersect_precalc(dir, &isect_precalc); isect_t = tmax; isect_array->t = isect_t; diff --git a/intern/cycles/kernel/geom/geom_triangle_intersect.h b/intern/cycles/kernel/geom/geom_triangle_intersect.h index df02d60f382..73bfe6beeb0 100644 --- a/intern/cycles/kernel/geom/geom_triangle_intersect.h +++ b/intern/cycles/kernel/geom/geom_triangle_intersect.h @@ -316,11 +316,11 @@ ccl_device_inline float3 triangle_refine(KernelGlobals *kg, if(UNLIKELY(t == 0.0f)) { return P; } -#ifdef __OBJECT_MOTION__ +# ifdef __OBJECT_MOTION__ Transform tfm = ccl_fetch(sd, ob_itfm); -#else +# else Transform tfm = object_fetch_transform(kg, isect->object, OBJECT_INVERSE_TRANSFORM); -#endif +# endif P = transform_point(&tfm, P); D = transform_direction(&tfm, D*t); @@ -342,11 +342,11 @@ ccl_device_inline float3 triangle_refine(KernelGlobals *kg, P = P + D*rt; if(isect->object != OBJECT_NONE) { -#ifdef __OBJECT_MOTION__ +# ifdef __OBJECT_MOTION__ Transform tfm = ccl_fetch(sd, ob_tfm); -#else +# else Transform tfm = object_fetch_transform(kg, isect->object, OBJECT_TRANSFORM); -#endif +# endif P = transform_point(&tfm, P); } |