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 ba65f7093b.
This commit is contained in:
Sergey Sharybin
2018-06-07 11:57:57 +02:00
parent 54f9cd5283
commit 16017178b2
2 changed files with 24 additions and 27 deletions

View File

@@ -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

View File

@@ -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");
}