diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-01-03 05:48:48 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-01-03 21:57:38 +0400 |
commit | bb0a0315e28216e64190b3c6e5657438a28ad56d (patch) | |
tree | 02da099e09c58b6b3f8de559d9abe819fb3b9af3 /intern/cycles/kernel/kernel_path_state.h | |
parent | 57407d39b0230a1f1a137beaedb7a4771d8b8272 (diff) |
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.
Diffstat (limited to 'intern/cycles/kernel/kernel_path_state.h')
-rw-r--r-- | intern/cycles/kernel/kernel_path_state.h | 18 |
1 files changed, 18 insertions, 0 deletions
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) |