Code refactor: remove unnecessary RNG offset in branched path code.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Thu, 8 Feb 2018 12:58:02 +0000 (13:58 +0100)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Thu, 8 Feb 2018 15:56:11 +0000 (16:56 +0100)
This is only needed for SSS which bounces to a different shading point.

intern/cycles/kernel/kernel_path_branched.h
intern/cycles/kernel/kernel_path_state.h
intern/cycles/kernel/split/kernel_subsurface_scatter.h

index fe2a7d179a447c8f8e7df853394e05bfdc11c90d..70d0292c5a5c25c9b39d8f637993e5a7be031ae1 100644 (file)
@@ -372,6 +372,7 @@ ccl_device void kernel_branched_path_subsurface_scatter(KernelGlobals *kg,
                                PathState hit_state = *state;
 
                                path_state_branch(&hit_state, j, num_samples);
+                               hit_state.rng_offset += PRNG_BOUNCE_NUM;
 
 #ifdef __VOLUME__
                                if(need_update_volume_stack) {
index 2ae866bb051996b6b9c1ccb946793e48e606bc5e..a16c20cbee6a7b9e3fb10fa6d380f7ca132d7e8f 100644 (file)
@@ -231,8 +231,6 @@ ccl_device_inline void path_state_branch(ccl_addr_space PathState *state,
                                          int branch,
                                          int num_branches)
 {
-       state->rng_offset += PRNG_BOUNCE_NUM;
-
        if(num_branches > 1) {
                /* Path is splitting into a branch, adjust so that each branch
                 * still gets a unique sample from the same sequence. */
index 38dd1dc5654f7b214133590bd6ad27a60a29f9f0..993e8d4d477182ce5d088ce2064607aa271a8b72 100644 (file)
@@ -117,6 +117,7 @@ ccl_device_noinline bool kernel_split_branched_path_subsurface_indirect_light_it
                                *hit_state = branched_state->path_state;
 
                                path_state_branch(hit_state, j, num_samples);
+                               hit_state->rng_offset += PRNG_BOUNCE_NUM;
 
 #ifdef __VOLUME__
                                if(need_update_volume_stack) {