Cycles: Avoid segment NULL check, we access it before this function already.

This commit is contained in:
Thomas Dinges 2014-08-14 15:52:19 +02:00
parent b42b0554ea
commit 6e5d188d17
1 changed files with 24 additions and 30 deletions

View File

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