Cycles: Avoid segment NULL check, we access it before this function already.
This commit is contained in:
@@ -139,19 +139,17 @@ ccl_device void kernel_branched_path_volume_connect_light(KernelGlobals *kg, RNG
|
|||||||
float3 tp = throughput;
|
float3 tp = throughput;
|
||||||
|
|
||||||
/* sample position on volume segment */
|
/* sample position on volume segment */
|
||||||
if(segment) {
|
float rphase = path_branched_rng_1D_for_decision(kg, rng, state, j, num_samples, PRNG_PHASE);
|
||||||
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 rscatter = path_branched_rng_1D_for_decision(kg, rng, state, j, num_samples, PRNG_SCATTER_DISTANCE);
|
|
||||||
|
|
||||||
VolumeIntegrateResult result = kernel_volume_decoupled_scatter(kg,
|
VolumeIntegrateResult result = kernel_volume_decoupled_scatter(kg,
|
||||||
state, ray, sd, &tp, rphase, rscatter, segment, (ls.t != FLT_MAX)? &ls.P: NULL, false);
|
state, ray, sd, &tp, rphase, rscatter, segment, (ls.t != FLT_MAX)? &ls.P: NULL, false);
|
||||||
|
|
||||||
if(result != VOLUME_PATH_SCATTERED)
|
if(result != VOLUME_PATH_SCATTERED)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* todo: split up light_sample so we don't have to call it again with new position */
|
/* 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);
|
light_select(kg, i, light_u, light_v, sd->P, &ls);
|
||||||
}
|
|
||||||
|
|
||||||
if(ls.pdf == 0.0f)
|
if(ls.pdf == 0.0f)
|
||||||
continue;
|
continue;
|
||||||
@@ -192,19 +190,17 @@ ccl_device void kernel_branched_path_volume_connect_light(KernelGlobals *kg, RNG
|
|||||||
float3 tp = throughput;
|
float3 tp = throughput;
|
||||||
|
|
||||||
/* sample position on volume segment */
|
/* sample position on volume segment */
|
||||||
if(segment) {
|
float rphase = path_branched_rng_1D_for_decision(kg, rng, state, j, num_samples, PRNG_PHASE);
|
||||||
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 rscatter = path_branched_rng_1D_for_decision(kg, rng, state, j, num_samples, PRNG_SCATTER_DISTANCE);
|
|
||||||
|
|
||||||
VolumeIntegrateResult result = kernel_volume_decoupled_scatter(kg,
|
VolumeIntegrateResult result = kernel_volume_decoupled_scatter(kg,
|
||||||
state, ray, sd, &tp, rphase, rscatter, segment, (ls.t != FLT_MAX)? &ls.P: NULL, false);
|
state, ray, sd, &tp, rphase, rscatter, segment, (ls.t != FLT_MAX)? &ls.P: NULL, false);
|
||||||
|
|
||||||
if(result != VOLUME_PATH_SCATTERED)
|
if(result != VOLUME_PATH_SCATTERED)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* todo: split up light_sample so we don't have to call it again with new position */
|
/* 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);
|
light_sample(kg, light_t, light_u, light_v, sd->time, sd->P, &ls);
|
||||||
}
|
|
||||||
|
|
||||||
if(ls.pdf == 0.0f)
|
if(ls.pdf == 0.0f)
|
||||||
continue;
|
continue;
|
||||||
@@ -233,19 +229,17 @@ ccl_device void kernel_branched_path_volume_connect_light(KernelGlobals *kg, RNG
|
|||||||
float3 tp = throughput;
|
float3 tp = throughput;
|
||||||
|
|
||||||
/* sample position on volume segment */
|
/* sample position on volume segment */
|
||||||
if(segment) {
|
float rphase = path_state_rng_1D_for_decision(kg, rng, state, PRNG_PHASE);
|
||||||
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 rscatter = path_state_rng_1D_for_decision(kg, rng, state, PRNG_SCATTER_DISTANCE);
|
|
||||||
|
|
||||||
VolumeIntegrateResult result = kernel_volume_decoupled_scatter(kg,
|
VolumeIntegrateResult result = kernel_volume_decoupled_scatter(kg,
|
||||||
state, ray, sd, &tp, rphase, rscatter, segment, (ls.t != FLT_MAX)? &ls.P: NULL, false);
|
state, ray, sd, &tp, rphase, rscatter, segment, (ls.t != FLT_MAX)? &ls.P: NULL, false);
|
||||||
|
|
||||||
if(result != VOLUME_PATH_SCATTERED)
|
if(result != VOLUME_PATH_SCATTERED)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* todo: split up light_sample so we don't have to call it again with new position */
|
/* 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);
|
light_sample(kg, light_t, light_u, light_v, sd->time, sd->P, &ls);
|
||||||
}
|
|
||||||
|
|
||||||
if(ls.pdf == 0.0f)
|
if(ls.pdf == 0.0f)
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user