Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-06-07 12:57:57 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-06-07 12:57:57 +0300
commit16017178b24c9c84df5c1114fae8dce4796c6c26 (patch)
tree8c5e027f752d025d443d186488adfd20589d651b /intern/cycles/kernel
parent54f9cd52835bdd96cdd01cf643cfccf8a229c04b (diff)
Revert "Cycles: Cleanup: Don't use return on function returning void"
Not sure why exactly it is called a cleanup, the code was much more clear and robust against possible missing return statements which are MANDATORY. Missing return statement will: - Cause two different BVH traversals to be run. Not is happening currently, but if more BVH layouts are added, it will become a problem. - It is already causing assert() statements to fail, since functions are no longer returning when they are supposed to. If there is any measurable reason to keep this change, let me know. Otherwise just stick to reliable/tested/robust code. This reverts commit ba65f7093b39a8e5f1fb869cbc347fb810a05ab9.
Diffstat (limited to 'intern/cycles/kernel')
-rw-r--r--intern/cycles/kernel/bvh/bvh.h25
-rw-r--r--intern/cycles/kernel/bvh/bvh_local.h26
2 files changed, 24 insertions, 27 deletions
diff --git a/intern/cycles/kernel/bvh/bvh.h b/intern/cycles/kernel/bvh/bvh.h
index c0a5bb434ea..d3e0b25a200 100644
--- a/intern/cycles/kernel/bvh/bvh.h
+++ b/intern/cycles/kernel/bvh/bvh.h
@@ -212,21 +212,20 @@ ccl_device_intersect void scene_intersect_local(KernelGlobals *kg,
{
#ifdef __OBJECT_MOTION__
if(kernel_data.bvh.have_motion) {
- bvh_intersect_local_motion(kg,
- &ray,
- local_isect,
- local_object,
- lcg_state,
- max_hits);
- return;
+ return bvh_intersect_local_motion(kg,
+ &ray,
+ local_isect,
+ local_object,
+ lcg_state,
+ max_hits);
}
#endif /* __OBJECT_MOTION__ */
- bvh_intersect_local(kg,
- &ray,
- local_isect,
- local_object,
- lcg_state,
- max_hits);
+ return bvh_intersect_local(kg,
+ &ray,
+ local_isect,
+ local_object,
+ lcg_state,
+ max_hits);
}
#endif
diff --git a/intern/cycles/kernel/bvh/bvh_local.h b/intern/cycles/kernel/bvh/bvh_local.h
index 605d4166819..9292cc76a5c 100644
--- a/intern/cycles/kernel/bvh/bvh_local.h
+++ b/intern/cycles/kernel/bvh/bvh_local.h
@@ -246,22 +246,20 @@ ccl_device_inline void BVH_FUNCTION_NAME(KernelGlobals *kg,
switch(kernel_data.bvh.bvh_layout) {
#ifdef __QBVH__
case BVH_LAYOUT_BVH4:
- BVH_FUNCTION_FULL_NAME(QBVH)(kg,
- ray,
- local_isect,
- local_object,
- lcg_state,
- max_hits);
- break;
+ return BVH_FUNCTION_FULL_NAME(QBVH)(kg,
+ ray,
+ local_isect,
+ local_object,
+ lcg_state,
+ max_hits);
#endif
case BVH_LAYOUT_BVH2:
- BVH_FUNCTION_FULL_NAME(BVH)(kg,
- ray,
- local_isect,
- local_object,
- lcg_state,
- max_hits);
- break;
+ return BVH_FUNCTION_FULL_NAME(BVH)(kg,
+ ray,
+ local_isect,
+ local_object,
+ lcg_state,
+ max_hits);
}
kernel_assert(!"Should not happen");
}