Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/kernel_random.h
| Show First 20 Lines • Show All 294 Lines • ▼ Show 20 Lines | ccl_device_inline float path_branched_rng_1D_for_decision(KernelGlobals *kg, ccl_addr_space RNG *rng, const PathState *state, int branch, int num_branches, int dimension) | ||||
| return path_rng_1D(kg, rng, state->sample*num_branches + branch, state->num_samples*num_branches, rng_offset + dimension); | return path_rng_1D(kg, rng, state->sample*num_branches + branch, state->num_samples*num_branches, rng_offset + dimension); | ||||
| } | } | ||||
| ccl_device_inline void path_branched_rng_2D(KernelGlobals *kg, ccl_addr_space RNG *rng, const PathState *state, int branch, int num_branches, int dimension, float *fx, float *fy) | ccl_device_inline void path_branched_rng_2D(KernelGlobals *kg, ccl_addr_space RNG *rng, const PathState *state, int branch, int num_branches, int dimension, float *fx, float *fy) | ||||
| { | { | ||||
| path_rng_2D(kg, rng, state->sample*num_branches + branch, state->num_samples*num_branches, state->rng_offset + dimension, fx, fy); | path_rng_2D(kg, rng, state->sample*num_branches + branch, state->num_samples*num_branches, state->rng_offset + dimension, fx, fy); | ||||
| } | } | ||||
| /* Utitility functions to get light termination value, since it might not be needed in many cases. */ | |||||
| ccl_device_inline float path_state_rng_light_termination(KernelGlobals *kg, ccl_addr_space RNG *rng, const PathState *state) | |||||
| { | |||||
| if(kernel_data.integrator.light_inv_rr_threshold > 0.0f) { | |||||
| return path_state_rng_1D_for_decision(kg, rng, state, PRNG_LIGHT_TERMINATE); | |||||
| } | |||||
| return 0.0f; | |||||
| } | |||||
| ccl_device_inline float path_branched_rng_light_termination(KernelGlobals *kg, ccl_addr_space RNG *rng, const PathState *state, int branch, int num_branches) | |||||
| { | |||||
| if(kernel_data.integrator.light_inv_rr_threshold > 0.0f) { | |||||
| return path_branched_rng_1D_for_decision(kg, rng, state, branch, num_branches, PRNG_LIGHT_TERMINATE); | |||||
| } | |||||
| return 0.0f; | |||||
| } | |||||
| ccl_device_inline void path_state_branch(PathState *state, int branch, int num_branches) | ccl_device_inline void path_state_branch(PathState *state, int branch, int num_branches) | ||||
| { | { | ||||
| /* path is splitting into a branch, adjust so that each branch | /* path is splitting into a branch, adjust so that each branch | ||||
| * still gets a unique sample from the same sequence */ | * still gets a unique sample from the same sequence */ | ||||
| state->rng_offset += PRNG_BOUNCE_NUM; | state->rng_offset += PRNG_BOUNCE_NUM; | ||||
| state->sample = state->sample*num_branches + branch; | state->sample = state->sample*num_branches + branch; | ||||
| state->num_samples = state->num_samples*num_branches; | state->num_samples = state->num_samples*num_branches; | ||||
| } | } | ||||
| Show All 24 Lines | |||||