From bb0a0315e28216e64190b3c6e5657438a28ad56d Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 3 Jan 2014 02:48:48 +0100 Subject: Code refactor: move random number and MIS variables into PathState. This makes it easier to pass this state around, and wraps some common RNG dimension computations in utility functions. --- intern/cycles/kernel/kernel_path_state.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'intern/cycles/kernel/kernel_path_state.h') diff --git a/intern/cycles/kernel/kernel_path_state.h b/intern/cycles/kernel/kernel_path_state.h index 3e0ad81c187..fe4d38b10d6 100644 --- a/intern/cycles/kernel/kernel_path_state.h +++ b/intern/cycles/kernel/kernel_path_state.h @@ -19,12 +19,27 @@ CCL_NAMESPACE_BEGIN ccl_device_inline void path_state_init(KernelGlobals *kg, PathState *state, RNG *rng, int sample) { state->flag = PATH_RAY_CAMERA|PATH_RAY_SINGULAR|PATH_RAY_MIS_SKIP; + + state->rng_offset = PRNG_BASE_NUM; + state->sample = sample; +#ifdef __CMJ__ + state->num_samples = kernel_data.integrator.aa_samples; +#else + state->num_samples = 0; +#endif + state->bounce = 0; state->diffuse_bounce = 0; state->glossy_bounce = 0; state->transmission_bounce = 0; state->transparent_bounce = 0; + state->min_ray_pdf = FLT_MAX; + state->ray_pdf = 0.0f; +#ifdef __LAMP_MIS__ + state->ray_t = 0.0f; +#endif + #ifdef __VOLUME__ if(kernel_data.integrator.use_volumes) { /* initialize volume stack with volume we are inside of */ @@ -88,6 +103,9 @@ ccl_device_inline void path_state_next(KernelGlobals *kg, PathState *state, int state->flag |= PATH_RAY_GLOSSY|PATH_RAY_SINGULAR|PATH_RAY_MIS_SKIP; state->flag &= ~PATH_RAY_DIFFUSE; } + + /* random number generator next bounce */ + state->rng_offset += PRNG_BOUNCE_NUM; } ccl_device_inline uint path_state_ray_visibility(KernelGlobals *kg, PathState *state) -- cgit v1.2.3