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:
authorSergey Sharybin <sergey.vfx@gmail.com>2015-12-30 15:54:02 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-12-30 15:54:02 +0300
commit2b5d60eb2deed64f234a9bafc70ed87d817bc8a9 (patch)
tree03f7b8b7c1504909565ce643a3c71f51b33d29de /intern/cycles/kernel/kernel.h
parentf320724195e3ec045781d5331955be866c821b4f (diff)
Cycles: Deduplicte CPU kernel declaration and definition code
Main goal is to make kernel signatures editing easier and less prone to the errors caused by missing function signature update or so. This will also make it easier to add new CPU architectures. Reviewers: juicyfruit, dingto, lukasstockner97, brecht Reviewed By: dingto, lukasstockner97, brecht Differential Revision: https://developer.blender.org/D1703
Diffstat (limited to 'intern/cycles/kernel/kernel.h')
-rw-r--r--intern/cycles/kernel/kernel.h74
1 files changed, 21 insertions, 53 deletions
diff --git a/intern/cycles/kernel/kernel.h b/intern/cycles/kernel/kernel.h
index b2596d10ee7..9279a94c13a 100644
--- a/intern/cycles/kernel/kernel.h
+++ b/intern/cycles/kernel/kernel.h
@@ -23,6 +23,10 @@
CCL_NAMESPACE_BEGIN
+#define KERNEL_NAME_JOIN(x, y, z) x ## _ ## y ## _ ## z
+#define KERNEL_NAME_EVAL(arch, name) KERNEL_NAME_JOIN(kernel, arch, name)
+#define KERNEL_FUNCTION_FULL_NAME(name) KERNEL_NAME_EVAL(KERNEL_ARCH, name)
+
struct KernelGlobals;
KernelGlobals *kernel_globals_create();
@@ -41,69 +45,33 @@ void kernel_tex_copy(KernelGlobals *kg,
InterpolationType interpolation=INTERPOLATION_LINEAR,
ExtensionType extension = EXTENSION_REPEAT);
-void kernel_cpu_path_trace(KernelGlobals *kg, float *buffer, unsigned int *rng_state,
- int sample, int x, int y, int offset, int stride);
-void kernel_cpu_convert_to_byte(KernelGlobals *kg, uchar4 *rgba, float *buffer,
- float sample_scale, int x, int y, int offset, int stride);
-void kernel_cpu_convert_to_half_float(KernelGlobals *kg, uchar4 *rgba, float *buffer,
- float sample_scale, int x, int y, int offset, int stride);
-void kernel_cpu_shader(KernelGlobals *kg, uint4 *input, float4 *output,
- int type, int i, int offset, int sample);
+#define KERNEL_ARCH cpu
+#include "kernels/cpu/kernel_cpu.h"
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_SSE2
-void kernel_cpu_sse2_path_trace(KernelGlobals *kg, float *buffer, unsigned int *rng_state,
- int sample, int x, int y, int offset, int stride);
-void kernel_cpu_sse2_convert_to_byte(KernelGlobals *kg, uchar4 *rgba, float *buffer,
- float sample_scale, int x, int y, int offset, int stride);
-void kernel_cpu_sse2_convert_to_half_float(KernelGlobals *kg, uchar4 *rgba, float *buffer,
- float sample_scale, int x, int y, int offset, int stride);
-void kernel_cpu_sse2_shader(KernelGlobals *kg, uint4 *input, float4 *output,
- int type, int i, int offset, int sample);
-#endif
+# define KERNEL_ARCH cpu_sse2
+# include "kernels/cpu/kernel_cpu.h"
+#endif /* WITH_CYCLES_OPTIMIZED_KERNEL_SSE2 */
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_SSE3
-void kernel_cpu_sse3_path_trace(KernelGlobals *kg, float *buffer, unsigned int *rng_state,
- int sample, int x, int y, int offset, int stride);
-void kernel_cpu_sse3_convert_to_byte(KernelGlobals *kg, uchar4 *rgba, float *buffer,
- float sample_scale, int x, int y, int offset, int stride);
-void kernel_cpu_sse3_convert_to_half_float(KernelGlobals *kg, uchar4 *rgba, float *buffer,
- float sample_scale, int x, int y, int offset, int stride);
-void kernel_cpu_sse3_shader(KernelGlobals *kg, uint4 *input, float4 *output,
- int type, int i, int offset, int sample);
-#endif
+# define KERNEL_ARCH cpu_sse3
+# include "kernels/cpu/kernel_cpu.h"
+#endif /* WITH_CYCLES_OPTIMIZED_KERNEL_SSE2 */
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_SSE41
-void kernel_cpu_sse41_path_trace(KernelGlobals *kg, float *buffer, unsigned int *rng_state,
- int sample, int x, int y, int offset, int stride);
-void kernel_cpu_sse41_convert_to_byte(KernelGlobals *kg, uchar4 *rgba, float *buffer,
- float sample_scale, int x, int y, int offset, int stride);
-void kernel_cpu_sse41_convert_to_half_float(KernelGlobals *kg, uchar4 *rgba, float *buffer,
- float sample_scale, int x, int y, int offset, int stride);
-void kernel_cpu_sse41_shader(KernelGlobals *kg, uint4 *input, float4 *output,
- int type, int i, int offset, int sample);
-#endif
+# define KERNEL_ARCH cpu_sse41
+# include "kernels/cpu/kernel_cpu.h"
+#endif /* WITH_CYCLES_OPTIMIZED_KERNEL_SSE41 */
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_AVX
-void kernel_cpu_avx_path_trace(KernelGlobals *kg, float *buffer, unsigned int *rng_state,
- int sample, int x, int y, int offset, int stride);
-void kernel_cpu_avx_convert_to_byte(KernelGlobals *kg, uchar4 *rgba, float *buffer,
- float sample_scale, int x, int y, int offset, int stride);
-void kernel_cpu_avx_convert_to_half_float(KernelGlobals *kg, uchar4 *rgba, float *buffer,
- float sample_scale, int x, int y, int offset, int stride);
-void kernel_cpu_avx_shader(KernelGlobals *kg, uint4 *input, float4 *output,
- int type, int i, int offset, int sample);
-#endif
+# define KERNEL_ARCH cpu_avx
+# include "kernels/cpu/kernel_cpu.h"
+#endif /* WITH_CYCLES_OPTIMIZED_KERNEL_AVX */
#ifdef WITH_CYCLES_OPTIMIZED_KERNEL_AVX2
-void kernel_cpu_avx2_path_trace(KernelGlobals *kg, float *buffer, unsigned int *rng_state,
- int sample, int x, int y, int offset, int stride);
-void kernel_cpu_avx2_convert_to_byte(KernelGlobals *kg, uchar4 *rgba, float *buffer,
- float sample_scale, int x, int y, int offset, int stride);
-void kernel_cpu_avx2_convert_to_half_float(KernelGlobals *kg, uchar4 *rgba, float *buffer,
- float sample_scale, int x, int y, int offset, int stride);
-void kernel_cpu_avx2_shader(KernelGlobals *kg, uint4 *input, float4 *output,
- int type, int i, int offset, int sample);
-#endif
+# define KERNEL_ARCH cpu_avx2
+# include "kernels/cpu/kernel_cpu.h"
+#endif /* WITH_CYCLES_OPTIMIZED_KERNEL_AVX2 */
CCL_NAMESPACE_END