diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-05-21 13:48:50 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-05-21 14:12:50 +0300 |
commit | 329f7046011fa23387649d68d5d2b26629f1d32d (patch) | |
tree | f9449d5342d8fa809f89527a411f89ea77dca78f /intern/cycles/kernel | |
parent | e37c4e5819aec1f853fdd71cf60004aa2363f7d9 (diff) |
Cycles: Move utility atomics function to util_atomic.h
No functional changes, just better to keep all atomic function in a single place,
they might become handy later.
Diffstat (limited to 'intern/cycles/kernel')
-rw-r--r-- | intern/cycles/kernel/CMakeLists.txt | 1 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_split.h | 23 |
2 files changed, 2 insertions, 22 deletions
diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt index 13eb5ca1e71..3e16c4b5fd9 100644 --- a/intern/cycles/kernel/CMakeLists.txt +++ b/intern/cycles/kernel/CMakeLists.txt @@ -154,6 +154,7 @@ set(SRC_GEOM_HEADERS ) set(SRC_UTIL_HEADERS + ../util/util_atomic.h ../util/util_color.h ../util/util_half.h ../util/util_math.h diff --git a/intern/cycles/kernel/kernel_split.h b/intern/cycles/kernel/kernel_split.h index eb386c2e5a7..52baf689305 100644 --- a/intern/cycles/kernel/kernel_split.h +++ b/intern/cycles/kernel/kernel_split.h @@ -22,28 +22,7 @@ #include "kernel_types.h" #include "kernel_globals.h" -/* atomic_add_float function should be defined prior to its usage in kernel_passes.h */ -#if defined(__SPLIT_KERNEL__) && defined(__WORK_STEALING__) -/* Utility functions for float atomics */ -/* float atomics impl credits : http://suhorukov.blogspot.in/2011/12/opencl-11-atomic-operations-on-floating.html */ -ccl_device_inline void atomic_add_float(volatile ccl_global float *source, const float operand) { - union { - unsigned int intVal; - float floatVal; - - } newVal; - union { - unsigned int intVal; - float floatVal; - - } prevVal; - do { - prevVal.floatVal = *source; - newVal.floatVal = prevVal.floatVal + operand; - - } while (atomic_cmpxchg((volatile ccl_global unsigned int *)source, prevVal.intVal, newVal.intVal) != prevVal.intVal); -} -#endif // __SPLIT_KERNEL__ && __WORK_STEALING__ +#include "util_atomic.h" #ifdef __OSL__ #include "osl_shader.h" |