Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2017-08-06 18:17:40 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2017-08-12 21:43:34 +0300
commit8f971083531c8f4bf2e6b3892e615d0616e152db (patch)
treec497b682830807ca544b1fd45f8b99ff67dec9c3
parent601f94a3c2024343c4c473c5cf079f6c02a2ab77 (diff)
Cycles: optimize CPU split kernel data init.
-rw-r--r--intern/cycles/kernel/split/kernel_data_init.h20
1 files changed, 16 insertions, 4 deletions
diff --git a/intern/cycles/kernel/split/kernel_data_init.h b/intern/cycles/kernel/split/kernel_data_init.h
index 6f3297de342..2c042dfde6f 100644
--- a/intern/cycles/kernel/split/kernel_data_init.h
+++ b/intern/cycles/kernel/split/kernel_data_init.h
@@ -124,14 +124,25 @@ void KERNEL_FUNCTION_FULL_NAME(data_init)(
/* 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;
- int pass = i % kernel_data.film.pass_stride;
+ int pass_stride = kernel_data.film.pass_stride;
+
+#ifdef __KERNEL_CPU__
+ for(int y = sy; y < sy + sh; y++) {
+ int index = offset + y * stride;
+ memset(buffer + (sx + index) * pass_stride, 0, sizeof(float) * pass_stride * sw);
+ for(int x = sx; x < sx + sw; x++) {
+ rng_state[index + x] = hash_int_2d(x, y);
+ }
+ }
+#else
+ parallel_for(kg, i, sw * sh * pass_stride) {
+ int pixel = i / pass_stride;
+ int pass = i % pass_stride;
int x = sx + pixel % sw;
int y = sy + pixel / sw;
- int index = (offset + x + y*stride) * kernel_data.film.pass_stride + pass;
+ int index = (offset + x + y*stride) * pass_stride + pass;
*(buffer + index) = 0.0f;
}
@@ -143,6 +154,7 @@ void KERNEL_FUNCTION_FULL_NAME(data_init)(
int index = (offset + x + y*stride);
*(rng_state + index) = hash_int_2d(x, y);
}
+#endif
}
#endif /* KERENL_STUB */