[Bf-blender-cvs] [6e5d188] master: Cycles: Avoid segment NULL check, we access it before this function already.
Thomas Dinges
noreply at git.blender.org
Thu Aug 14 15:55:10 CEST 2014
Commit: 6e5d188d17f2a220cee7871e5ebb0bb53cf546fb
Author: Thomas Dinges
Date: Thu Aug 14 15:52:19 2014 +0200
Branches: master
https://developer.blender.org/rB6e5d188d17f2a220cee7871e5ebb0bb53cf546fb
Cycles: Avoid segment NULL check, we access it before this function already.
===================================================================
M intern/cycles/kernel/kernel_path_volume.h
===================================================================
diff --git a/intern/cycles/kernel/kernel_path_volume.h b/intern/cycles/kernel/kernel_path_volume.h
index b4917f9..ea90a49 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;
More information about the Bf-blender-cvs
mailing list