diff options
author | Thomas Dinges <blender@dingto.org> | 2014-08-14 17:52:19 +0400 |
---|---|---|
committer | Thomas Dinges <blender@dingto.org> | 2014-08-14 17:52:19 +0400 |
commit | 6e5d188d17f2a220cee7871e5ebb0bb53cf546fb (patch) | |
tree | 23af45dcd0161bc4eb5aece346f708aa4b6ddf3d /intern | |
parent | b42b0554eae0e89b737ec55d642d0fc831b954d1 (diff) |
Cycles: Avoid segment NULL check, we access it before this function already.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/kernel/kernel_path_volume.h | 54 |
1 files changed, 24 insertions, 30 deletions
diff --git a/intern/cycles/kernel/kernel_path_volume.h b/intern/cycles/kernel/kernel_path_volume.h index b4917f9a3ae..ea90a497d9c 100644 --- a/intern/cycles/kernel/kernel_path_volume.h +++ b/intern/cycles/kernel/kernel_path_volume.h @@ -139,19 +139,17 @@ ccl_device void kernel_branched_path_volume_connect_light(KernelGlobals *kg, RNG float3 tp = throughput; /* sample position on volume segment */ - if(segment) { - float rphase = path_branched_rng_1D_for_decision(kg, rng, state, j, num_samples, PRNG_PHASE); - float rscatter = path_branched_rng_1D_for_decision(kg, rng, state, j, num_samples, PRNG_SCATTER_DISTANCE); + float rphase = path_branched_rng_1D_for_decision(kg, rng, state, j, num_samples, PRNG_PHASE); + float rscatter = path_branched_rng_1D_for_decision(kg, rng, state, j, num_samples, PRNG_SCATTER_DISTANCE); - VolumeIntegrateResult result = kernel_volume_decoupled_scatter(kg, - state, ray, sd, &tp, rphase, rscatter, segment, (ls.t != FLT_MAX)? &ls.P: NULL, false); + VolumeIntegrateResult result = kernel_volume_decoupled_scatter(kg, + state, ray, sd, &tp, rphase, rscatter, segment, (ls.t != FLT_MAX)? &ls.P: NULL, false); - if(result != VOLUME_PATH_SCATTERED) - continue; + if(result != VOLUME_PATH_SCATTERED) + continue; - /* todo: split up light_sample so we don't have to call it again with new position */ - light_select(kg, i, light_u, light_v, sd->P, &ls); - } + /* todo: split up light_sample so we don't have to call it again with new position */ + light_select(kg, i, light_u, light_v, sd->P, &ls); if(ls.pdf == 0.0f) continue; @@ -192,19 +190,17 @@ ccl_device void kernel_branched_path_volume_connect_light(KernelGlobals *kg, RNG float3 tp = throughput; /* sample position on volume segment */ - if(segment) { - float rphase = path_branched_rng_1D_for_decision(kg, rng, state, j, num_samples, PRNG_PHASE); - float rscatter = path_branched_rng_1D_for_decision(kg, rng, state, j, num_samples, PRNG_SCATTER_DISTANCE); + float rphase = path_branched_rng_1D_for_decision(kg, rng, state, j, num_samples, PRNG_PHASE); + float rscatter = path_branched_rng_1D_for_decision(kg, rng, state, j, num_samples, PRNG_SCATTER_DISTANCE); - VolumeIntegrateResult result = kernel_volume_decoupled_scatter(kg, - state, ray, sd, &tp, rphase, rscatter, segment, (ls.t != FLT_MAX)? &ls.P: NULL, false); + VolumeIntegrateResult result = kernel_volume_decoupled_scatter(kg, + state, ray, sd, &tp, rphase, rscatter, segment, (ls.t != FLT_MAX)? &ls.P: NULL, false); - if(result != VOLUME_PATH_SCATTERED) - continue; + if(result != VOLUME_PATH_SCATTERED) + continue; - /* todo: split up light_sample so we don't have to call it again with new position */ - light_sample(kg, light_t, light_u, light_v, sd->time, sd->P, &ls); - } + /* todo: split up light_sample so we don't have to call it again with new position */ + light_sample(kg, light_t, light_u, light_v, sd->time, sd->P, &ls); if(ls.pdf == 0.0f) continue; @@ -233,19 +229,17 @@ ccl_device void kernel_branched_path_volume_connect_light(KernelGlobals *kg, RNG float3 tp = throughput; /* sample position on volume segment */ - if(segment) { - float rphase = path_state_rng_1D_for_decision(kg, rng, state, PRNG_PHASE); - float rscatter = path_state_rng_1D_for_decision(kg, rng, state, PRNG_SCATTER_DISTANCE); + float rphase = path_state_rng_1D_for_decision(kg, rng, state, PRNG_PHASE); + float rscatter = path_state_rng_1D_for_decision(kg, rng, state, PRNG_SCATTER_DISTANCE); - VolumeIntegrateResult result = kernel_volume_decoupled_scatter(kg, - state, ray, sd, &tp, rphase, rscatter, segment, (ls.t != FLT_MAX)? &ls.P: NULL, false); + VolumeIntegrateResult result = kernel_volume_decoupled_scatter(kg, + state, ray, sd, &tp, rphase, rscatter, segment, (ls.t != FLT_MAX)? &ls.P: NULL, false); - if(result != VOLUME_PATH_SCATTERED) - return; + if(result != VOLUME_PATH_SCATTERED) + return; - /* todo: split up light_sample so we don't have to call it again with new position */ - light_sample(kg, light_t, light_u, light_v, sd->time, sd->P, &ls); - } + /* todo: split up light_sample so we don't have to call it again with new position */ + light_sample(kg, light_t, light_u, light_v, sd->time, sd->P, &ls); if(ls.pdf == 0.0f) return; |