[Bf-blender-cvs] [303bc3dc96] temp_cycles_split_kernel: Cycles: Initialize rng_state for split kernel

Mai Lavelle noreply at git.blender.org
Tue Mar 7 12:02:58 CET 2017


Commit: 303bc3dc9653b8cba7edcd2e17e90c68fbf5aa34
Author: Mai Lavelle
Date:   Fri Mar 3 04:07:26 2017 -0500
Branches: temp_cycles_split_kernel
https://developer.blender.org/rB303bc3dc9653b8cba7edcd2e17e90c68fbf5aa34

Cycles: Initialize rng_state for split kernel

Because the split kernel can render multiple samples in parallel it is
necessary to have everything initialized before rendering of any samples
begins. The code that normally handles initialization of
`rng_state` (`kernel_path_trace_setup()`) only does so for the first sample,
which was causing artifacts in the split kernel due to uninitialized
`rng_state` for some samples.

Note that because the split kernel can render samples in parallel this
means that the split kernel is incompatible with the LCG.

===================================================================

M	intern/cycles/kernel/split/kernel_data_init.h

===================================================================

diff --git a/intern/cycles/kernel/split/kernel_data_init.h b/intern/cycles/kernel/split/kernel_data_init.h
index c22703e5ab..785103a79a 100644
--- a/intern/cycles/kernel/split/kernel_data_init.h
+++ b/intern/cycles/kernel/split/kernel_data_init.h
@@ -126,7 +126,7 @@ void KERNEL_FUNCTION_FULL_NAME(data_init)(
 		*use_queues_flag = 0;
 	}
 
-	/* zero the tiles pixels if this is the first sample */
+	/* zero the tiles pixels and initialize rng_state if this is the first sample */
 	if(start_sample == 0) {
 		parallel_for(kg, i, sw * sh * kernel_data.film.pass_stride) {
 			int pixel = i / kernel_data.film.pass_stride;
@@ -139,6 +139,14 @@ void KERNEL_FUNCTION_FULL_NAME(data_init)(
 
 			*(buffer + index) = 0.0f;
 		}
+
+		parallel_for(kg, i, sw * sh) {
+			int x = sx + i % sw;
+			int y = sy + i / sw;
+
+			int index = (offset + x + y*stride);
+			*(rng_state + index) = hash_int_2d(x, y);
+		}
 	}
 }




More information about the Bf-blender-cvs mailing list