diff options
author | Thomas Dinges <blender@dingto.org> | 2015-06-16 00:50:29 +0300 |
---|---|---|
committer | Thomas Dinges <blender@dingto.org> | 2015-06-16 00:50:29 +0300 |
commit | 53e3e4633244facb76740a58f1b2b9b6c1e2a00d (patch) | |
tree | c156a1a74a0614ccd5fd0a0a7607db210af49606 /intern/cycles/kernel/kernel_path_branched.h | |
parent | 888ed6b7f15bf30f978fabc134e1d35cf9fcee38 (diff) |
Cycles / Branched Path: Some simplifications for main loop.
The main loop only handles transparent intersections from the camera ray.
Therefore we can simplify some things.
* Avoid PATH_RAY_CAMERA check, this is always true.
* Avoid path_state_next() call, we can just set transparent flag and increase transparent bounces. This way we avoid the function call and some branching.
Also remove debug num_ray_bounces++, this is incorrect here as no indirect bounce happens here.
Should be no functional changes.
Diffstat (limited to 'intern/cycles/kernel/kernel_path_branched.h')
-rw-r--r-- | intern/cycles/kernel/kernel_path_branched.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/intern/cycles/kernel/kernel_path_branched.h b/intern/cycles/kernel/kernel_path_branched.h index 3fa38a60dd6..431ee785e95 100644 --- a/intern/cycles/kernel/kernel_path_branched.h +++ b/intern/cycles/kernel/kernel_path_branched.h @@ -197,6 +197,10 @@ ccl_device float4 kernel_branched_path_integrate(KernelGlobals *kg, RNG *rng, in debug_data_init(&debug_data); #endif + /* Main Loop + * Here we only handle transparency intersections from the camera ray. + * Indirect bounces are handled in kernel_branched_path_surface_indirect_light(). + */ for(;;) { /* intersect scene */ Intersection isect; @@ -207,7 +211,7 @@ ccl_device float4 kernel_branched_path_integrate(KernelGlobals *kg, RNG *rng, in uint lcg_state = 0; if(kernel_data.bvh.have_curves) { - if((kernel_data.cam.resolution == 1) && (state.flag & PATH_RAY_CAMERA)) { + if(kernel_data.cam.resolution == 1) { float3 pixdiff = ray.dD.dx + ray.dD.dy; /*pixdiff = pixdiff - dot(pixdiff, ray.D)*ray.D;*/ difl = kernel_data.curve.minimum_width * len(pixdiff) * 0.5f; @@ -223,11 +227,8 @@ ccl_device float4 kernel_branched_path_integrate(KernelGlobals *kg, RNG *rng, in #endif #ifdef __KERNEL_DEBUG__ - if(state.flag & PATH_RAY_CAMERA) { - debug_data.num_bvh_traversal_steps += isect.num_traversal_steps; - debug_data.num_bvh_traversed_instances += isect.num_traversed_instances; - } - debug_data.num_ray_bounces++; + debug_data.num_bvh_traversal_steps += isect.num_traversal_steps; + debug_data.num_bvh_traversed_instances += isect.num_traversed_instances; #endif #ifdef __VOLUME__ @@ -464,7 +465,10 @@ ccl_device float4 kernel_branched_path_integrate(KernelGlobals *kg, RNG *rng, in break; } - path_state_next(kg, &state, LABEL_TRANSPARENT); + /* Update Path State */ + state.flag |= PATH_RAY_TRANSPARENT; + state.transparent_bounce++; + ray.P = ray_offset(sd.P, -sd.Ng); ray.t -= sd.ray_length; /* clipping works through transparent */ |