Blender V5.0
kernel/device/cpu/kernel.cpp
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5/* CPU kernel entry points */
6
7/* On x86-64, our minimum is SSE4.2, so avoid the extra kernel and compile this
8 * one with SSE4.2 intrinsics.
9 */
10#if defined(__x86_64__) || defined(_M_X64)
11# define __KERNEL_SSE__
12# define __KERNEL_SSE2__
13# define __KERNEL_SSE3__
14# define __KERNEL_SSSE3__
15# define __KERNEL_SSE42__
16#endif
17
18/* When building kernel for native machine detect kernel features from the flags
19 * set by compiler.
20 */
21#ifdef WITH_KERNEL_NATIVE
22# ifdef __SSE4_2__
23# ifndef __KERNEL_SSE42__
24# define __KERNEL_SSE42__
25# endif
26# endif
27# ifdef __AVX__
28# ifndef __KERNEL_SSE__
29# define __KERNEL_SSE__
30# endif
31# define __KERNEL_AVX__
32# endif
33# ifdef __AVX2__
34# ifndef __KERNEL_SSE__
35# define __KERNEL_SSE__
36# endif
37# define __KERNEL_AVX2__
38# endif
39#endif
40
41/* quiet unused define warnings */
42#if defined(__KERNEL_SSE2__)
43/* do nothing */
44#endif
45
47
49#define KERNEL_ARCH cpu
51
53
54/* Memory Copy */
55
56void kernel_const_copy(KernelGlobalsCPU *kg, const char *name, void *host, size_t /*unused*/)
57{
58 if (strcmp(name, "data") == 0) {
59 kg->data = *(KernelData *)host;
60 }
61 else {
62 assert(0);
63 }
64}
65
67 const char *name,
68 void *mem,
69 const size_t size)
70{
71 if (false) {
72 }
73
74#define KERNEL_DATA_ARRAY(type, tname) \
75 else if (strcmp(name, #tname) == 0) { \
76 kg->tname.data = (type *)mem; \
77 kg->tname.width = size; \
78 }
79#include "kernel/data_arrays.h"
80 else {
81 assert(0);
82 }
83}
84
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
#define CCL_NAMESPACE_END
#define assert(assertion)
CCL_NAMESPACE_BEGIN void kernel_const_copy(KernelGlobalsCPU *kg, const char *name, void *host, size_t)
void kernel_global_memory_copy(KernelGlobalsCPU *kg, const char *name, void *mem, const size_t size)
const char * name
CCL_NAMESPACE_END KernelData data