Blender  V2.93
kernel.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2013 Blender Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /* CPU kernel entry points */
18 
19 /* On x86-64, we can assume SSE2, so avoid the extra kernel and compile this
20  * one with SSE2 intrinsics.
21  */
22 #if defined(__x86_64__) || defined(_M_X64)
23 # define __KERNEL_SSE2__
24 #endif
25 
26 /* When building kernel for native machine detect kernel features from the flags
27  * set by compiler.
28  */
29 #ifdef WITH_KERNEL_NATIVE
30 # ifdef __SSE2__
31 # ifndef __KERNEL_SSE2__
32 # define __KERNEL_SSE2__
33 # endif
34 # endif
35 # ifdef __SSE3__
36 # define __KERNEL_SSE3__
37 # endif
38 # ifdef __SSSE3__
39 # define __KERNEL_SSSE3__
40 # endif
41 # ifdef __SSE4_1__
42 # define __KERNEL_SSE41__
43 # endif
44 # ifdef __AVX__
45 # define __KERNEL_SSE__
46 # define __KERNEL_AVX__
47 # endif
48 # ifdef __AVX2__
49 # define __KERNEL_SSE__
50 # define __KERNEL_AVX2__
51 # endif
52 #endif
53 
54 /* quiet unused define warnings */
55 #if defined(__KERNEL_SSE2__)
56 /* do nothing */
57 #endif
58 
59 #include "kernel/kernel.h"
60 #define KERNEL_ARCH cpu
62 
64 
65 /* Memory Copy */
66 
67 void kernel_const_copy(KernelGlobals *kg, const char *name, void *host, size_t)
68 {
69  if (strcmp(name, "__data") == 0) {
70  kg->__data = *(KernelData *)host;
71  }
72  else {
73  assert(0);
74  }
75 }
76 
77 void kernel_global_memory_copy(KernelGlobals *kg, const char *name, void *mem, size_t size)
78 {
79  if (0) {
80  }
81 
82 #define KERNEL_TEX(type, tname) \
83  else if (strcmp(name, #tname) == 0) \
84  { \
85  kg->tname.data = (type *)mem; \
86  kg->tname.width = size; \
87  }
88 #include "kernel/kernel_textures.h"
89  else {
90  assert(0);
91  }
92 }
93 
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
void kernel_global_memory_copy(KernelGlobals *kg, const char *name, void *mem, size_t size)
Definition: kernel.cpp:77
CCL_NAMESPACE_BEGIN void kernel_const_copy(KernelGlobals *kg, const char *name, void *host, size_t)
Definition: kernel.cpp:67
#define CCL_NAMESPACE_END