Blender  V2.93
bvh_types.h
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 #ifndef __BVH_TYPES__
18 #define __BVH_TYPES__
19 
21 
22 /* Don't inline intersect functions on GPU, this is faster */
23 #ifdef __KERNEL_GPU__
24 # define ccl_device_intersect ccl_device_forceinline
25 #else
26 # define ccl_device_intersect ccl_device_inline
27 #endif
28 
29 /* bottom-most stack entry, indicating the end of traversal */
30 #define ENTRYPOINT_SENTINEL 0x76543210
31 
32 /* 64 object BVH + 64 mesh BVH + 64 object node splitting */
33 #define BVH_STACK_SIZE 192
34 /* BVH intersection function variations */
35 
36 #define BVH_MOTION 1
37 #define BVH_HAIR 2
38 
39 #define BVH_NAME_JOIN(x, y) x##_##y
40 #define BVH_NAME_EVAL(x, y) BVH_NAME_JOIN(x, y)
41 #define BVH_FUNCTION_FULL_NAME(prefix) BVH_NAME_EVAL(prefix, BVH_FUNCTION_NAME)
42 
43 #define BVH_FEATURE(f) (((BVH_FUNCTION_FEATURES) & (f)) != 0)
44 
45 /* Debugging helpers. */
46 #ifdef __KERNEL_DEBUG__
47 # define BVH_DEBUG_INIT() \
48  do { \
49  isect->num_traversed_nodes = 0; \
50  isect->num_traversed_instances = 0; \
51  isect->num_intersections = 0; \
52  } while (0)
53 # define BVH_DEBUG_NEXT_NODE() \
54  do { \
55  ++isect->num_traversed_nodes; \
56  } while (0)
57 # define BVH_DEBUG_NEXT_INTERSECTION() \
58  do { \
59  ++isect->num_intersections; \
60  } while (0)
61 # define BVH_DEBUG_NEXT_INSTANCE() \
62  do { \
63  ++isect->num_traversed_instances; \
64  } while (0)
65 #else /* __KERNEL_DEBUG__ */
66 # define BVH_DEBUG_INIT()
67 # define BVH_DEBUG_NEXT_NODE()
68 # define BVH_DEBUG_NEXT_INTERSECTION()
69 # define BVH_DEBUG_NEXT_INSTANCE()
70 #endif /* __KERNEL_DEBUG__ */
71 
73 
74 #endif /* __BVH_TYPES__ */
#define CCL_NAMESPACE_END