1// Copyright 2009-2021 Intel Corporation
2// SPDX-License-Identifier: Apache-2.0
3
4#include "../common/isa.h" // to define EMBREE_TARGET_SIMD8
5
6#if defined (EMBREE_TARGET_SIMD8)
7
8#include "bvh8_factory.h"
9#include "../bvh/bvh.h"
10
11#include "../geometry/curveNv.h"
12#include "../geometry/curveNi.h"
13#include "../geometry/curveNi_mb.h"
14#include "../geometry/linei.h"
15#include "../geometry/triangle.h"
16#include "../geometry/trianglev.h"
17#include "../geometry/trianglev_mb.h"
18#include "../geometry/trianglei.h"
19#include "../geometry/quadv.h"
20#include "../geometry/quadi.h"
21#include "../geometry/subdivpatch1.h"
22#include "../geometry/object.h"
23#include "../geometry/instance.h"
24#include "../geometry/subgrid.h"
25#include "../common/accelinstance.h"
26
27namespace embree
28{
29 DECLARE_SYMBOL2(Accel::Collider,BVH8ColliderUserGeom);
30
31 DECLARE_ISA_FUNCTION(VirtualCurveIntersector*,VirtualCurveIntersector8v,void);
32 DECLARE_ISA_FUNCTION(VirtualCurveIntersector*,VirtualCurveIntersector8iMB,void);
33
34 DECLARE_SYMBOL2(Accel::Intersector1,BVH8OBBVirtualCurveIntersector1);
35 DECLARE_SYMBOL2(Accel::Intersector1,BVH8OBBVirtualCurveIntersector1MB);
36 DECLARE_SYMBOL2(Accel::Intersector1,BVH8OBBVirtualCurveIntersectorRobust1);
37 DECLARE_SYMBOL2(Accel::Intersector1,BVH8OBBVirtualCurveIntersectorRobust1MB);
38
39 DECLARE_SYMBOL2(Accel::Intersector1,BVH8Triangle4Intersector1Moeller);
40 DECLARE_SYMBOL2(Accel::Intersector1,BVH8Triangle4iIntersector1Moeller);
41 DECLARE_SYMBOL2(Accel::Intersector1,BVH8Triangle4vIntersector1Pluecker);
42 DECLARE_SYMBOL2(Accel::Intersector1,BVH8Triangle4iIntersector1Pluecker);
43
44 DECLARE_SYMBOL2(Accel::Intersector1,BVH8Triangle4vIntersector1Woop);
45
46 DECLARE_SYMBOL2(Accel::Intersector1,BVH8Triangle4vMBIntersector1Moeller);
47 DECLARE_SYMBOL2(Accel::Intersector1,BVH8Triangle4iMBIntersector1Moeller);
48 DECLARE_SYMBOL2(Accel::Intersector1,BVH8Triangle4vMBIntersector1Pluecker);
49 DECLARE_SYMBOL2(Accel::Intersector1,BVH8Triangle4iMBIntersector1Pluecker);
50
51 DECLARE_SYMBOL2(Accel::Intersector1,BVH8Quad4vIntersector1Moeller);
52 DECLARE_SYMBOL2(Accel::Intersector1,BVH8Quad4iIntersector1Moeller);
53 DECLARE_SYMBOL2(Accel::Intersector1,BVH8Quad4vIntersector1Pluecker);
54 DECLARE_SYMBOL2(Accel::Intersector1,BVH8Quad4iIntersector1Pluecker);
55
56 DECLARE_SYMBOL2(Accel::Intersector1,BVH8Quad4iMBIntersector1Moeller);
57 DECLARE_SYMBOL2(Accel::Intersector1,BVH8Quad4iMBIntersector1Pluecker);
58
59 DECLARE_SYMBOL2(Accel::Intersector1,QBVH8Triangle4iIntersector1Pluecker);
60 DECLARE_SYMBOL2(Accel::Intersector1,QBVH8Triangle4Intersector1Moeller);
61 DECLARE_SYMBOL2(Accel::Intersector1,QBVH8Quad4iIntersector1Pluecker);
62
63 DECLARE_SYMBOL2(Accel::Intersector1,BVH8VirtualIntersector1);
64 DECLARE_SYMBOL2(Accel::Intersector1,BVH8VirtualMBIntersector1);
65
66 DECLARE_SYMBOL2(Accel::Intersector1,BVH8InstanceIntersector1);
67 DECLARE_SYMBOL2(Accel::Intersector1,BVH8InstanceMBIntersector1);
68
69 DECLARE_SYMBOL2(Accel::Intersector1,BVH8GridIntersector1Moeller);
70 DECLARE_SYMBOL2(Accel::Intersector1,BVH8GridMBIntersector1Moeller);
71 DECLARE_SYMBOL2(Accel::Intersector1,BVH8GridIntersector1Pluecker);
72
73 DECLARE_SYMBOL2(Accel::Intersector4,BVH8OBBVirtualCurveIntersector4Hybrid);
74 DECLARE_SYMBOL2(Accel::Intersector4,BVH8OBBVirtualCurveIntersector4HybridMB);
75 DECLARE_SYMBOL2(Accel::Intersector4,BVH8OBBVirtualCurveIntersectorRobust4Hybrid);
76 DECLARE_SYMBOL2(Accel::Intersector4,BVH8OBBVirtualCurveIntersectorRobust4HybridMB);
77
78 DECLARE_SYMBOL2(Accel::Intersector4,BVH8Triangle4Intersector4HybridMoeller);
79 DECLARE_SYMBOL2(Accel::Intersector4,BVH8Triangle4Intersector4HybridMoellerNoFilter);
80 DECLARE_SYMBOL2(Accel::Intersector4,BVH8Triangle4iIntersector4HybridMoeller);
81 DECLARE_SYMBOL2(Accel::Intersector4,BVH8Triangle4vIntersector4HybridPluecker);
82 DECLARE_SYMBOL2(Accel::Intersector4,BVH8Triangle4iIntersector4HybridPluecker);
83
84 DECLARE_SYMBOL2(Accel::Intersector4,BVH8Triangle4vMBIntersector4HybridMoeller);
85 DECLARE_SYMBOL2(Accel::Intersector4,BVH8Triangle4iMBIntersector4HybridMoeller);
86 DECLARE_SYMBOL2(Accel::Intersector4,BVH8Triangle4vMBIntersector4HybridPluecker);
87 DECLARE_SYMBOL2(Accel::Intersector4,BVH8Triangle4iMBIntersector4HybridPluecker);
88
89 DECLARE_SYMBOL2(Accel::Intersector4,BVH8Quad4vIntersector4HybridMoeller);
90 DECLARE_SYMBOL2(Accel::Intersector4,BVH8Quad4vIntersector4HybridMoellerNoFilter);
91 DECLARE_SYMBOL2(Accel::Intersector4,BVH8Quad4iIntersector4HybridMoeller);
92 DECLARE_SYMBOL2(Accel::Intersector4,BVH8Quad4vIntersector4HybridPluecker);
93 DECLARE_SYMBOL2(Accel::Intersector4,BVH8Quad4iIntersector4HybridPluecker);
94
95 DECLARE_SYMBOL2(Accel::Intersector4,BVH8Quad4iMBIntersector4HybridMoeller);
96 DECLARE_SYMBOL2(Accel::Intersector4,BVH8Quad4iMBIntersector4HybridPluecker);
97
98 DECLARE_SYMBOL2(Accel::Intersector4,BVH8VirtualIntersector4Chunk);
99 DECLARE_SYMBOL2(Accel::Intersector4,BVH8VirtualMBIntersector4Chunk);
100
101 DECLARE_SYMBOL2(Accel::Intersector4,BVH8InstanceIntersector4Chunk);
102 DECLARE_SYMBOL2(Accel::Intersector4,BVH8InstanceMBIntersector4Chunk);
103
104 DECLARE_SYMBOL2(Accel::Intersector4,BVH8GridIntersector4HybridMoeller);
105 DECLARE_SYMBOL2(Accel::Intersector4,BVH8GridIntersector4HybridPluecker);
106
107 DECLARE_SYMBOL2(Accel::Intersector8,BVH8OBBVirtualCurveIntersector8Hybrid);
108 DECLARE_SYMBOL2(Accel::Intersector8,BVH8OBBVirtualCurveIntersector8HybridMB);
109 DECLARE_SYMBOL2(Accel::Intersector8,BVH8OBBVirtualCurveIntersectorRobust8Hybrid);
110 DECLARE_SYMBOL2(Accel::Intersector8,BVH8OBBVirtualCurveIntersectorRobust8HybridMB);
111
112 DECLARE_SYMBOL2(Accel::Intersector8,BVH8Triangle4Intersector8HybridMoeller);
113 DECLARE_SYMBOL2(Accel::Intersector8,BVH8Triangle4Intersector8HybridMoellerNoFilter);
114 DECLARE_SYMBOL2(Accel::Intersector8,BVH8Triangle4iIntersector8HybridMoeller);
115 DECLARE_SYMBOL2(Accel::Intersector8,BVH8Triangle4vIntersector8HybridPluecker);
116 DECLARE_SYMBOL2(Accel::Intersector8,BVH8Triangle4iIntersector8HybridPluecker);
117
118 DECLARE_SYMBOL2(Accel::Intersector8,BVH8Triangle4vMBIntersector8HybridMoeller);
119 DECLARE_SYMBOL2(Accel::Intersector8,BVH8Triangle4iMBIntersector8HybridMoeller);
120 DECLARE_SYMBOL2(Accel::Intersector8,BVH8Triangle4vMBIntersector8HybridPluecker);
121 DECLARE_SYMBOL2(Accel::Intersector8,BVH8Triangle4iMBIntersector8HybridPluecker);
122
123 DECLARE_SYMBOL2(Accel::Intersector8,BVH8Quad4vIntersector8HybridMoeller);
124 DECLARE_SYMBOL2(Accel::Intersector8,BVH8Quad4vIntersector8HybridMoellerNoFilter);
125 DECLARE_SYMBOL2(Accel::Intersector8,BVH8Quad4iIntersector8HybridMoeller);
126 DECLARE_SYMBOL2(Accel::Intersector8,BVH8Quad4vIntersector8HybridPluecker);
127 DECLARE_SYMBOL2(Accel::Intersector8,BVH8Quad4iIntersector8HybridPluecker);
128
129 DECLARE_SYMBOL2(Accel::Intersector8,BVH8Quad4iMBIntersector8HybridMoeller);
130 DECLARE_SYMBOL2(Accel::Intersector8,BVH8Quad4iMBIntersector8HybridPluecker);
131
132 DECLARE_SYMBOL2(Accel::Intersector8,BVH8VirtualIntersector8Chunk);
133 DECLARE_SYMBOL2(Accel::Intersector8,BVH8VirtualMBIntersector8Chunk);
134
135 DECLARE_SYMBOL2(Accel::Intersector8,BVH8InstanceIntersector8Chunk);
136 DECLARE_SYMBOL2(Accel::Intersector8,BVH8InstanceMBIntersector8Chunk);
137
138 DECLARE_SYMBOL2(Accel::Intersector8,BVH8GridIntersector8HybridMoeller);
139 DECLARE_SYMBOL2(Accel::Intersector8,BVH8GridIntersector8HybridPluecker);
140
141 DECLARE_SYMBOL2(Accel::Intersector16,BVH8OBBVirtualCurveIntersector16Hybrid);
142 DECLARE_SYMBOL2(Accel::Intersector16,BVH8OBBVirtualCurveIntersector16HybridMB);
143 DECLARE_SYMBOL2(Accel::Intersector16,BVH8OBBVirtualCurveIntersectorRobust16Hybrid);
144 DECLARE_SYMBOL2(Accel::Intersector16,BVH8OBBVirtualCurveIntersectorRobust16HybridMB);
145
146 DECLARE_SYMBOL2(Accel::Intersector16,BVH8Triangle4Intersector16HybridMoeller);
147 DECLARE_SYMBOL2(Accel::Intersector16,BVH8Triangle4Intersector16HybridMoellerNoFilter);
148 DECLARE_SYMBOL2(Accel::Intersector16,BVH8Triangle4iIntersector16HybridMoeller);
149 DECLARE_SYMBOL2(Accel::Intersector16,BVH8Triangle4vIntersector16HybridPluecker);
150 DECLARE_SYMBOL2(Accel::Intersector16,BVH8Triangle4iIntersector16HybridPluecker);
151
152 DECLARE_SYMBOL2(Accel::Intersector16,BVH8Triangle4vMBIntersector16HybridMoeller);
153 DECLARE_SYMBOL2(Accel::Intersector16,BVH8Triangle4iMBIntersector16HybridMoeller);
154 DECLARE_SYMBOL2(Accel::Intersector16,BVH8Triangle4vMBIntersector16HybridPluecker);
155 DECLARE_SYMBOL2(Accel::Intersector16,BVH8Triangle4iMBIntersector16HybridPluecker);
156
157 DECLARE_SYMBOL2(Accel::Intersector16,BVH8Quad4vIntersector16HybridMoeller);
158 DECLARE_SYMBOL2(Accel::Intersector16,BVH8Quad4vIntersector16HybridMoellerNoFilter);
159 DECLARE_SYMBOL2(Accel::Intersector16,BVH8Quad4iIntersector16HybridMoeller);
160 DECLARE_SYMBOL2(Accel::Intersector16,BVH8Quad4vIntersector16HybridPluecker);
161 DECLARE_SYMBOL2(Accel::Intersector16,BVH8Quad4iIntersector16HybridPluecker);
162
163 DECLARE_SYMBOL2(Accel::Intersector16,BVH8Quad4iMBIntersector16HybridMoeller);
164 DECLARE_SYMBOL2(Accel::Intersector16,BVH8Quad4iMBIntersector16HybridPluecker);
165
166 DECLARE_SYMBOL2(Accel::Intersector16,BVH8VirtualIntersector16Chunk);
167 DECLARE_SYMBOL2(Accel::Intersector16,BVH8VirtualMBIntersector16Chunk);
168
169 DECLARE_SYMBOL2(Accel::Intersector16,BVH8InstanceIntersector16Chunk);
170 DECLARE_SYMBOL2(Accel::Intersector16,BVH8InstanceMBIntersector16Chunk);
171
172 DECLARE_SYMBOL2(Accel::Intersector16,BVH8GridIntersector16HybridMoeller);
173 DECLARE_SYMBOL2(Accel::Intersector16,BVH8GridIntersector16HybridPluecker);
174
175 DECLARE_SYMBOL2(Accel::IntersectorN,BVH8IntersectorStreamPacketFallback);
176
177 DECLARE_SYMBOL2(Accel::IntersectorN,BVH8Triangle4IntersectorStreamMoeller);
178 DECLARE_SYMBOL2(Accel::IntersectorN,BVH8Triangle4IntersectorStreamMoellerNoFilter);
179 DECLARE_SYMBOL2(Accel::IntersectorN,BVH8Triangle4iIntersectorStreamMoeller);
180 DECLARE_SYMBOL2(Accel::IntersectorN,BVH8Triangle4vIntersectorStreamPluecker);
181 DECLARE_SYMBOL2(Accel::IntersectorN,BVH8Triangle4iIntersectorStreamPluecker);
182
183 DECLARE_SYMBOL2(Accel::IntersectorN,BVH8Quad4vIntersectorStreamMoeller);
184 DECLARE_SYMBOL2(Accel::IntersectorN,BVH8Quad4vIntersectorStreamMoellerNoFilter);
185 DECLARE_SYMBOL2(Accel::IntersectorN,BVH8Quad4iIntersectorStreamMoeller);
186 DECLARE_SYMBOL2(Accel::IntersectorN,BVH8Quad4vIntersectorStreamPluecker);
187 DECLARE_SYMBOL2(Accel::IntersectorN,BVH8Quad4iIntersectorStreamPluecker);
188
189 DECLARE_SYMBOL2(Accel::IntersectorN,BVH8VirtualIntersectorStream);
190
191 DECLARE_SYMBOL2(Accel::IntersectorN,BVH8InstanceIntersectorStream);
192
193 DECLARE_ISA_FUNCTION(Builder*,BVH8Curve8vBuilder_OBB_New,void* COMMA Scene* COMMA size_t);
194 DECLARE_ISA_FUNCTION(Builder*,BVH8OBBCurve8iMBBuilder_OBB,void* COMMA Scene* COMMA size_t);
195
196 DECLARE_ISA_FUNCTION(Builder*,BVH8Triangle4SceneBuilderSAH,void* COMMA Scene* COMMA size_t);
197 DECLARE_ISA_FUNCTION(Builder*,BVH8Triangle4vSceneBuilderSAH,void* COMMA Scene* COMMA size_t);
198 DECLARE_ISA_FUNCTION(Builder*,BVH8Triangle4iSceneBuilderSAH,void* COMMA Scene* COMMA size_t);
199 DECLARE_ISA_FUNCTION(Builder*,BVH8Triangle4iMBSceneBuilderSAH,void* COMMA Scene* COMMA size_t);
200 DECLARE_ISA_FUNCTION(Builder*,BVH8Triangle4vMBSceneBuilderSAH,void* COMMA Scene* COMMA size_t);
201 DECLARE_ISA_FUNCTION(Builder*,BVH8QuantizedTriangle4iSceneBuilderSAH,void* COMMA Scene* COMMA size_t);
202 DECLARE_ISA_FUNCTION(Builder*,BVH8QuantizedTriangle4SceneBuilderSAH,void* COMMA Scene* COMMA size_t);
203
204 DECLARE_ISA_FUNCTION(Builder*,BVH8Quad4vSceneBuilderSAH,void* COMMA Scene* COMMA size_t);
205 DECLARE_ISA_FUNCTION(Builder*,BVH8Quad4iSceneBuilderSAH,void* COMMA Scene* COMMA size_t);
206 DECLARE_ISA_FUNCTION(Builder*,BVH8Quad4iMBSceneBuilderSAH,void* COMMA Scene* COMMA size_t);
207 DECLARE_ISA_FUNCTION(Builder*,BVH8QuantizedQuad4iSceneBuilderSAH,void* COMMA Scene* COMMA size_t);
208
209 DECLARE_ISA_FUNCTION(Builder*,BVH8VirtualSceneBuilderSAH,void* COMMA Scene* COMMA size_t);
210 DECLARE_ISA_FUNCTION(Builder*,BVH8VirtualMBSceneBuilderSAH,void* COMMA Scene* COMMA size_t);
211
212 DECLARE_ISA_FUNCTION(Builder*,BVH8InstanceSceneBuilderSAH,void* COMMA Scene* COMMA Geometry::GTypeMask);
213 DECLARE_ISA_FUNCTION(Builder*,BVH8InstanceMBSceneBuilderSAH,void* COMMA Scene* COMMA Geometry::GTypeMask);
214
215 DECLARE_ISA_FUNCTION(Builder*,BVH8Triangle4SceneBuilderFastSpatialSAH,void* COMMA Scene* COMMA size_t);
216 DECLARE_ISA_FUNCTION(Builder*,BVH8Triangle4vSceneBuilderFastSpatialSAH,void* COMMA Scene* COMMA size_t);
217 DECLARE_ISA_FUNCTION(Builder*,BVH8Quad4vSceneBuilderFastSpatialSAH,void* COMMA Scene* COMMA size_t);
218 DECLARE_ISA_FUNCTION(Builder*,BVH8GridSceneBuilderSAH,void* COMMA Scene* COMMA size_t);
219 DECLARE_ISA_FUNCTION(Builder*,BVH8GridMBSceneBuilderSAH,void* COMMA Scene* COMMA size_t);
220
221 DECLARE_ISA_FUNCTION(Builder*,BVH8BuilderTwoLevelTriangle4MeshSAH,void* COMMA Scene* COMMA bool);
222 DECLARE_ISA_FUNCTION(Builder*,BVH8BuilderTwoLevelTriangle4vMeshSAH,void* COMMA Scene* COMMA bool);
223 DECLARE_ISA_FUNCTION(Builder*,BVH8BuilderTwoLevelTriangle4iMeshSAH,void* COMMA Scene* COMMA bool);
224 DECLARE_ISA_FUNCTION(Builder*,BVH8BuilderTwoLevelQuadMeshSAH,void* COMMA Scene* COMMA bool);
225 DECLARE_ISA_FUNCTION(Builder*,BVH8BuilderTwoLevelVirtualSAH,void* COMMA Scene* COMMA bool);
226 DECLARE_ISA_FUNCTION(Builder*,BVH8BuilderTwoLevelInstanceSAH,void* COMMA Scene* COMMA Geometry::GTypeMask COMMA bool);
227
228 BVH8Factory::BVH8Factory(int bfeatures, int ifeatures)
229 {
230 SELECT_SYMBOL_INIT_AVX(ifeatures,BVH8ColliderUserGeom);
231
232 selectBuilders(bfeatures);
233 selectIntersectors(ifeatures);
234 }
235
236 void BVH8Factory::selectBuilders(int features)
237 {
238 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_INIT_AVX(features,BVH8Curve8vBuilder_OBB_New));
239 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_INIT_AVX(features,BVH8OBBCurve8iMBBuilder_OBB));
240
241 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX(features,BVH8Triangle4SceneBuilderSAH));
242 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX(features,BVH8Triangle4vSceneBuilderSAH));
243 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX(features,BVH8Triangle4iSceneBuilderSAH));
244 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX(features,BVH8Triangle4iMBSceneBuilderSAH));
245 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX(features,BVH8Triangle4vMBSceneBuilderSAH));
246 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX(features,BVH8QuantizedTriangle4iSceneBuilderSAH));
247 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX(features,BVH8QuantizedTriangle4SceneBuilderSAH));
248
249 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX(features,BVH8Quad4vSceneBuilderSAH));
250 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX(features,BVH8Quad4iSceneBuilderSAH));
251 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX(features,BVH8Quad4iMBSceneBuilderSAH));
252 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX(features,BVH8QuantizedQuad4iSceneBuilderSAH));
253
254 IF_ENABLED_USER(SELECT_SYMBOL_INIT_AVX(features,BVH8VirtualSceneBuilderSAH));
255 IF_ENABLED_USER(SELECT_SYMBOL_INIT_AVX(features,BVH8VirtualMBSceneBuilderSAH));
256
257 IF_ENABLED_INSTANCE(SELECT_SYMBOL_INIT_AVX(features,BVH8InstanceSceneBuilderSAH));
258 IF_ENABLED_INSTANCE(SELECT_SYMBOL_INIT_AVX(features,BVH8InstanceMBSceneBuilderSAH));
259
260 IF_ENABLED_GRIDS(SELECT_SYMBOL_INIT_AVX(features,BVH8GridSceneBuilderSAH));
261 IF_ENABLED_GRIDS(SELECT_SYMBOL_INIT_AVX(features,BVH8GridMBSceneBuilderSAH));
262
263 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX(features,BVH8Triangle4SceneBuilderFastSpatialSAH));
264 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX(features,BVH8Triangle4vSceneBuilderFastSpatialSAH));
265 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX(features,BVH8Quad4vSceneBuilderFastSpatialSAH));
266
267 IF_ENABLED_TRIS (SELECT_SYMBOL_INIT_AVX(features,BVH8BuilderTwoLevelTriangle4MeshSAH));
268 IF_ENABLED_TRIS (SELECT_SYMBOL_INIT_AVX(features,BVH8BuilderTwoLevelTriangle4vMeshSAH));
269 IF_ENABLED_TRIS (SELECT_SYMBOL_INIT_AVX(features,BVH8BuilderTwoLevelTriangle4iMeshSAH));
270 IF_ENABLED_QUADS (SELECT_SYMBOL_INIT_AVX(features,BVH8BuilderTwoLevelQuadMeshSAH));
271 IF_ENABLED_USER (SELECT_SYMBOL_INIT_AVX(features,BVH8BuilderTwoLevelVirtualSAH));
272 IF_ENABLED_INSTANCE (SELECT_SYMBOL_INIT_AVX(features,BVH8BuilderTwoLevelInstanceSAH));
273 }
274
275 void BVH8Factory::selectIntersectors(int features)
276 {
277 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,VirtualCurveIntersector8v));
278 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,VirtualCurveIntersector8iMB));
279
280 /* select intersectors1 */
281 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8OBBVirtualCurveIntersector1));
282 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8OBBVirtualCurveIntersector1MB));
283 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8OBBVirtualCurveIntersectorRobust1));
284 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8OBBVirtualCurveIntersectorRobust1MB));
285
286 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Triangle4Intersector1Moeller));
287 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Triangle4iIntersector1Moeller));
288 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Triangle4vIntersector1Pluecker));
289 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Triangle4iIntersector1Pluecker));
290
291 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Triangle4vIntersector1Woop));
292
293 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Triangle4vMBIntersector1Moeller));
294 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Triangle4iMBIntersector1Moeller));
295 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Triangle4vMBIntersector1Pluecker));
296 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Triangle4iMBIntersector1Pluecker));
297
298 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Quad4vIntersector1Moeller));
299 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Quad4iIntersector1Moeller));
300 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Quad4vIntersector1Pluecker));
301 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Quad4iIntersector1Pluecker));
302
303 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Quad4iMBIntersector1Moeller));
304 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Quad4iMBIntersector1Pluecker));
305
306 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,QBVH8Triangle4iIntersector1Pluecker));
307 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,QBVH8Triangle4Intersector1Moeller));
308 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,QBVH8Quad4iIntersector1Pluecker));
309
310 IF_ENABLED_USER(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8VirtualIntersector1));
311 IF_ENABLED_USER(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8VirtualMBIntersector1));
312
313 IF_ENABLED_INSTANCE(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8InstanceIntersector1));
314 IF_ENABLED_INSTANCE(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8InstanceMBIntersector1));
315
316 IF_ENABLED_GRIDS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8GridIntersector1Moeller));
317 IF_ENABLED_GRIDS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8GridMBIntersector1Moeller))
318 IF_ENABLED_GRIDS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8GridIntersector1Pluecker));
319
320#if defined (EMBREE_RAY_PACKETS)
321
322 /* select intersectors4 */
323 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8OBBVirtualCurveIntersector4Hybrid));
324 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8OBBVirtualCurveIntersector4HybridMB));
325 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8OBBVirtualCurveIntersectorRobust4Hybrid));
326 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8OBBVirtualCurveIntersectorRobust4HybridMB));
327
328 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Triangle4Intersector4HybridMoeller));
329 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Triangle4Intersector4HybridMoellerNoFilter));
330 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Triangle4iIntersector4HybridMoeller));
331 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Triangle4vIntersector4HybridPluecker));
332 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Triangle4iIntersector4HybridPluecker));
333
334 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Triangle4vMBIntersector4HybridMoeller));
335 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Triangle4iMBIntersector4HybridMoeller));
336 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Triangle4vMBIntersector4HybridPluecker));
337 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Triangle4iMBIntersector4HybridPluecker));
338
339 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Quad4vIntersector4HybridMoeller));
340 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Quad4vIntersector4HybridMoellerNoFilter));
341 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Quad4iIntersector4HybridMoeller));
342 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Quad4vIntersector4HybridPluecker));
343 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Quad4iIntersector4HybridPluecker));
344
345 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX_AVX2(features,BVH8Quad4iMBIntersector4HybridMoeller));
346 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX_AVX2(features,BVH8Quad4iMBIntersector4HybridPluecker));
347
348 IF_ENABLED_USER(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8VirtualIntersector4Chunk));
349 IF_ENABLED_USER(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8VirtualMBIntersector4Chunk));
350
351 IF_ENABLED_INSTANCE(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8InstanceIntersector4Chunk));
352 IF_ENABLED_INSTANCE(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8InstanceMBIntersector4Chunk));
353
354 IF_ENABLED_GRIDS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8GridIntersector4HybridMoeller));
355 IF_ENABLED_GRIDS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8GridIntersector4HybridPluecker));
356
357 /* select intersectors8 */
358 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8OBBVirtualCurveIntersector8Hybrid));
359 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8OBBVirtualCurveIntersector8HybridMB));
360 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8OBBVirtualCurveIntersectorRobust8Hybrid));
361 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8OBBVirtualCurveIntersectorRobust8HybridMB));
362
363 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Triangle4Intersector8HybridMoeller));
364 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Triangle4Intersector8HybridMoellerNoFilter));
365 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Triangle4iIntersector8HybridMoeller));
366 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Triangle4vIntersector8HybridPluecker));
367 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Triangle4iIntersector8HybridPluecker));
368
369 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Triangle4vMBIntersector8HybridMoeller));
370 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Triangle4iMBIntersector8HybridMoeller));
371 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Triangle4vMBIntersector8HybridPluecker));
372 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Triangle4iMBIntersector8HybridPluecker));
373
374 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Quad4vIntersector8HybridMoeller));
375 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Quad4vIntersector8HybridMoellerNoFilter));
376 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Quad4iIntersector8HybridMoeller));
377 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Quad4vIntersector8HybridPluecker));
378 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Quad4iIntersector8HybridPluecker));
379
380 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX_AVX2(features,BVH8Quad4iMBIntersector8HybridMoeller));
381 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX_AVX2(features,BVH8Quad4iMBIntersector8HybridPluecker));
382
383 IF_ENABLED_USER(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8VirtualIntersector8Chunk));
384 IF_ENABLED_USER(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8VirtualMBIntersector8Chunk));
385
386 IF_ENABLED_INSTANCE(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8InstanceIntersector8Chunk));
387 IF_ENABLED_INSTANCE(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8InstanceMBIntersector8Chunk));
388
389 IF_ENABLED_GRIDS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8GridIntersector8HybridMoeller));
390 IF_ENABLED_GRIDS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8GridIntersector8HybridPluecker));
391
392 /* select intersectors16 */
393 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_INIT_AVX512(features,BVH8OBBVirtualCurveIntersector16Hybrid));
394 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_INIT_AVX512(features,BVH8OBBVirtualCurveIntersector16HybridMB));
395 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_INIT_AVX512(features,BVH8OBBVirtualCurveIntersectorRobust16Hybrid));
396 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_INIT_AVX512(features,BVH8OBBVirtualCurveIntersectorRobust16HybridMB));
397
398 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX512(features,BVH8Triangle4Intersector16HybridMoeller));
399 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX512(features,BVH8Triangle4Intersector16HybridMoellerNoFilter));
400 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX512(features,BVH8Triangle4iIntersector16HybridMoeller));
401 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX512(features,BVH8Triangle4vIntersector16HybridPluecker));
402 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX512(features,BVH8Triangle4iIntersector16HybridPluecker));
403
404 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX512(features,BVH8Triangle4vMBIntersector16HybridMoeller));
405 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX512(features,BVH8Triangle4iMBIntersector16HybridMoeller));
406 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX512(features,BVH8Triangle4vMBIntersector16HybridPluecker));
407 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX512(features,BVH8Triangle4iMBIntersector16HybridPluecker));
408
409 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX512(features,BVH8Quad4vIntersector16HybridMoeller));
410 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX512(features,BVH8Quad4vIntersector16HybridMoellerNoFilter));
411 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX512(features,BVH8Quad4iIntersector16HybridMoeller));
412 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX512(features,BVH8Quad4vIntersector16HybridPluecker));
413 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX512(features,BVH8Quad4iIntersector16HybridPluecker));
414
415 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX512(features,BVH8Quad4iMBIntersector16HybridMoeller));
416 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX512(features,BVH8Quad4iMBIntersector16HybridPluecker));
417
418 IF_ENABLED_USER(SELECT_SYMBOL_INIT_AVX512(features,BVH8VirtualIntersector16Chunk));
419 IF_ENABLED_USER(SELECT_SYMBOL_INIT_AVX512(features,BVH8VirtualMBIntersector16Chunk));
420
421 IF_ENABLED_INSTANCE(SELECT_SYMBOL_INIT_AVX512(features,BVH8InstanceIntersector16Chunk));
422 IF_ENABLED_INSTANCE(SELECT_SYMBOL_INIT_AVX512(features,BVH8InstanceMBIntersector16Chunk));
423
424 IF_ENABLED_GRIDS(SELECT_SYMBOL_INIT_AVX512(features,BVH8GridIntersector16HybridMoeller));
425 IF_ENABLED_GRIDS(SELECT_SYMBOL_INIT_AVX512(features,BVH8GridIntersector16HybridPluecker));
426
427 /* select stream intersectors */
428
429 SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8IntersectorStreamPacketFallback);
430
431 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Triangle4IntersectorStreamMoeller));
432 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Triangle4IntersectorStreamMoellerNoFilter));
433 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Triangle4iIntersectorStreamMoeller));
434 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Triangle4vIntersectorStreamPluecker));
435 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Triangle4iIntersectorStreamPluecker));
436
437 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Quad4vIntersectorStreamMoeller));
438 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Quad4vIntersectorStreamMoellerNoFilter));
439 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Quad4iIntersectorStreamMoeller));
440 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Quad4vIntersectorStreamPluecker));
441 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8Quad4iIntersectorStreamPluecker));
442
443 IF_ENABLED_USER(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8VirtualIntersectorStream));
444
445 IF_ENABLED_INSTANCE(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH8InstanceIntersectorStream));
446
447#endif
448 }
449
450 Accel::Intersectors BVH8Factory::BVH8OBBVirtualCurveIntersectors(BVH8* bvh, VirtualCurveIntersector* leafIntersector, IntersectVariant ivariant)
451 {
452 switch (ivariant) {
453 case IntersectVariant::FAST:
454 {
455 Accel::Intersectors intersectors;
456 intersectors.ptr = bvh;
457 intersectors.leafIntersector = leafIntersector;
458 intersectors.intersector1 = BVH8OBBVirtualCurveIntersector1();
459#if defined (EMBREE_RAY_PACKETS)
460 intersectors.intersector4 = BVH8OBBVirtualCurveIntersector4Hybrid();
461 intersectors.intersector8 = BVH8OBBVirtualCurveIntersector8Hybrid();
462 intersectors.intersector16 = BVH8OBBVirtualCurveIntersector16Hybrid();
463 intersectors.intersectorN = BVH8IntersectorStreamPacketFallback();
464#endif
465 return intersectors;
466 }
467 case IntersectVariant::ROBUST:
468 {
469 Accel::Intersectors intersectors;
470 intersectors.ptr = bvh;
471 intersectors.leafIntersector = leafIntersector;
472 intersectors.intersector1 = BVH8OBBVirtualCurveIntersectorRobust1();
473#if defined (EMBREE_RAY_PACKETS)
474 intersectors.intersector4 = BVH8OBBVirtualCurveIntersectorRobust4Hybrid();
475 intersectors.intersector8 = BVH8OBBVirtualCurveIntersectorRobust8Hybrid();
476 intersectors.intersector16 = BVH8OBBVirtualCurveIntersectorRobust16Hybrid();
477 intersectors.intersectorN = BVH8IntersectorStreamPacketFallback();
478#endif
479 return intersectors;
480 }
481 default: assert(false);
482 }
483 return Accel::Intersectors();
484 }
485
486 Accel::Intersectors BVH8Factory::BVH8OBBVirtualCurveIntersectorsMB(BVH8* bvh, VirtualCurveIntersector* leafIntersector, IntersectVariant ivariant)
487 {
488 switch (ivariant) {
489 case IntersectVariant::FAST:
490 {
491 Accel::Intersectors intersectors;
492 intersectors.ptr = bvh;
493 intersectors.leafIntersector = leafIntersector;
494 intersectors.intersector1 = BVH8OBBVirtualCurveIntersector1MB();
495#if defined (EMBREE_RAY_PACKETS)
496 intersectors.intersector4 = BVH8OBBVirtualCurveIntersector4HybridMB();
497 intersectors.intersector8 = BVH8OBBVirtualCurveIntersector8HybridMB();
498 intersectors.intersector16 = BVH8OBBVirtualCurveIntersector16HybridMB();
499 intersectors.intersectorN = BVH8IntersectorStreamPacketFallback();
500#endif
501 return intersectors;
502 }
503 case IntersectVariant::ROBUST:
504 {
505 Accel::Intersectors intersectors;
506 intersectors.ptr = bvh;
507 intersectors.leafIntersector = leafIntersector;
508 intersectors.intersector1 = BVH8OBBVirtualCurveIntersectorRobust1MB();
509#if defined (EMBREE_RAY_PACKETS)
510 intersectors.intersector4 = BVH8OBBVirtualCurveIntersectorRobust4HybridMB();
511 intersectors.intersector8 = BVH8OBBVirtualCurveIntersectorRobust8HybridMB();
512 intersectors.intersector16 = BVH8OBBVirtualCurveIntersectorRobust16HybridMB();
513 intersectors.intersectorN = BVH8IntersectorStreamPacketFallback();
514#endif
515 return intersectors;
516 }
517 default: assert(false);
518 }
519 return Accel::Intersectors();
520 }
521
522 Accel::Intersectors BVH8Factory::BVH8Triangle4Intersectors(BVH8* bvh, IntersectVariant ivariant)
523 {
524 assert(ivariant == IntersectVariant::FAST);
525 Accel::Intersectors intersectors;
526 intersectors.ptr = bvh;
527 intersectors.intersector1 = BVH8Triangle4Intersector1Moeller();
528#if defined (EMBREE_RAY_PACKETS)
529 intersectors.intersector4_filter = BVH8Triangle4Intersector4HybridMoeller();
530 intersectors.intersector4_nofilter = BVH8Triangle4Intersector4HybridMoellerNoFilter();
531 intersectors.intersector8_filter = BVH8Triangle4Intersector8HybridMoeller();
532 intersectors.intersector8_nofilter = BVH8Triangle4Intersector8HybridMoellerNoFilter();
533 intersectors.intersector16_filter = BVH8Triangle4Intersector16HybridMoeller();
534 intersectors.intersector16_nofilter = BVH8Triangle4Intersector16HybridMoellerNoFilter();
535 intersectors.intersectorN_filter = BVH8Triangle4IntersectorStreamMoeller();
536 intersectors.intersectorN_nofilter = BVH8Triangle4IntersectorStreamMoellerNoFilter();
537#endif
538 return intersectors;
539 }
540
541 Accel::Intersectors BVH8Factory::BVH8Triangle4vIntersectors(BVH8* bvh, IntersectVariant ivariant)
542 {
543 Accel::Intersectors intersectors;
544 intersectors.ptr = bvh;
545#define ENABLE_WOOP_TEST 0
546#if ENABLE_WOOP_TEST == 0
547 //assert(ivariant == IntersectVariant::ROBUST);
548 intersectors.intersector1 = BVH8Triangle4vIntersector1Pluecker();
549#else
550 intersectors.intersector1 = BVH8Triangle4vIntersector1Woop();
551#endif
552
553#if defined (EMBREE_RAY_PACKETS)
554 intersectors.intersector4 = BVH8Triangle4vIntersector4HybridPluecker();
555 intersectors.intersector8 = BVH8Triangle4vIntersector8HybridPluecker();
556 intersectors.intersector16 = BVH8Triangle4vIntersector16HybridPluecker();
557 intersectors.intersectorN = BVH8Triangle4vIntersectorStreamPluecker();
558#endif
559 return intersectors;
560 }
561
562 Accel::Intersectors BVH8Factory::BVH8Triangle4iIntersectors(BVH8* bvh, IntersectVariant ivariant)
563 {
564 switch (ivariant) {
565 case IntersectVariant::FAST:
566 {
567 Accel::Intersectors intersectors;
568 intersectors.ptr = bvh;
569 intersectors.intersector1 = BVH8Triangle4iIntersector1Moeller();
570#if defined (EMBREE_RAY_PACKETS)
571 intersectors.intersector4 = BVH8Triangle4iIntersector4HybridMoeller();
572 intersectors.intersector8 = BVH8Triangle4iIntersector8HybridMoeller();
573 intersectors.intersector16 = BVH8Triangle4iIntersector16HybridMoeller();
574 intersectors.intersectorN = BVH8Triangle4iIntersectorStreamMoeller();
575#endif
576 return intersectors;
577 }
578 case IntersectVariant::ROBUST:
579 {
580 Accel::Intersectors intersectors;
581 intersectors.ptr = bvh;
582 intersectors.intersector1 = BVH8Triangle4iIntersector1Pluecker();
583#if defined (EMBREE_RAY_PACKETS)
584 intersectors.intersector4 = BVH8Triangle4iIntersector4HybridPluecker();
585 intersectors.intersector8 = BVH8Triangle4iIntersector8HybridPluecker();
586 intersectors.intersector16 = BVH8Triangle4iIntersector16HybridPluecker();
587 intersectors.intersectorN = BVH8Triangle4iIntersectorStreamPluecker();
588#endif
589 return intersectors;
590 }
591 }
592 return Accel::Intersectors();
593 }
594
595 Accel::Intersectors BVH8Factory::BVH8Triangle4vMBIntersectors(BVH8* bvh, IntersectVariant ivariant)
596 {
597 switch (ivariant) {
598 case IntersectVariant::FAST:
599 {
600 Accel::Intersectors intersectors;
601 intersectors.ptr = bvh;
602 intersectors.intersector1 = BVH8Triangle4vMBIntersector1Moeller();
603#if defined (EMBREE_RAY_PACKETS)
604 intersectors.intersector4 = BVH8Triangle4vMBIntersector4HybridMoeller();
605 intersectors.intersector8 = BVH8Triangle4vMBIntersector8HybridMoeller();
606 intersectors.intersector16 = BVH8Triangle4vMBIntersector16HybridMoeller();
607 intersectors.intersectorN = BVH8IntersectorStreamPacketFallback();
608#endif
609 return intersectors;
610 }
611 case IntersectVariant::ROBUST:
612 {
613 Accel::Intersectors intersectors;
614 intersectors.ptr = bvh;
615 intersectors.intersector1 = BVH8Triangle4vMBIntersector1Pluecker();
616#if defined (EMBREE_RAY_PACKETS)
617 intersectors.intersector4 = BVH8Triangle4vMBIntersector4HybridPluecker();
618 intersectors.intersector8 = BVH8Triangle4vMBIntersector8HybridPluecker();
619 intersectors.intersector16 = BVH8Triangle4vMBIntersector16HybridPluecker();
620 intersectors.intersectorN = BVH8IntersectorStreamPacketFallback();
621#endif
622 return intersectors;
623 }
624 }
625 return Accel::Intersectors();
626 }
627
628 Accel::Intersectors BVH8Factory::BVH8Triangle4iMBIntersectors(BVH8* bvh, IntersectVariant ivariant)
629 {
630 switch (ivariant) {
631 case IntersectVariant::FAST:
632 {
633 Accel::Intersectors intersectors;
634 intersectors.ptr = bvh;
635 intersectors.intersector1 = BVH8Triangle4iMBIntersector1Moeller();
636#if defined (EMBREE_RAY_PACKETS)
637 intersectors.intersector4 = BVH8Triangle4iMBIntersector4HybridMoeller();
638 intersectors.intersector8 = BVH8Triangle4iMBIntersector8HybridMoeller();
639 intersectors.intersector16 = BVH8Triangle4iMBIntersector16HybridMoeller();
640 intersectors.intersectorN = BVH8IntersectorStreamPacketFallback();
641#endif
642 return intersectors;
643 }
644 case IntersectVariant::ROBUST:
645 {
646 Accel::Intersectors intersectors;
647 intersectors.ptr = bvh;
648 intersectors.intersector1 = BVH8Triangle4iMBIntersector1Pluecker();
649#if defined (EMBREE_RAY_PACKETS)
650 intersectors.intersector4 = BVH8Triangle4iMBIntersector4HybridPluecker();
651 intersectors.intersector8 = BVH8Triangle4iMBIntersector8HybridPluecker();
652 intersectors.intersector16 = BVH8Triangle4iMBIntersector16HybridPluecker();
653 intersectors.intersectorN = BVH8IntersectorStreamPacketFallback();
654#endif
655 return intersectors;
656 }
657 }
658 return Accel::Intersectors();
659 }
660
661 Accel::Intersectors BVH8Factory::BVH8Quad4vIntersectors(BVH8* bvh, IntersectVariant ivariant)
662 {
663 switch (ivariant) {
664 case IntersectVariant::FAST:
665 {
666 Accel::Intersectors intersectors;
667 intersectors.ptr = bvh;
668 intersectors.intersector1 = BVH8Quad4vIntersector1Moeller();
669#if defined (EMBREE_RAY_PACKETS)
670 intersectors.intersector4_filter = BVH8Quad4vIntersector4HybridMoeller();
671 intersectors.intersector4_nofilter = BVH8Quad4vIntersector4HybridMoellerNoFilter();
672 intersectors.intersector8_filter = BVH8Quad4vIntersector8HybridMoeller();
673 intersectors.intersector8_nofilter = BVH8Quad4vIntersector8HybridMoellerNoFilter();
674 intersectors.intersector16_filter = BVH8Quad4vIntersector16HybridMoeller();
675 intersectors.intersector16_nofilter = BVH8Quad4vIntersector16HybridMoellerNoFilter();
676 intersectors.intersectorN_filter = BVH8Quad4vIntersectorStreamMoeller();
677 intersectors.intersectorN_nofilter = BVH8Quad4vIntersectorStreamMoellerNoFilter();
678#endif
679 return intersectors;
680 }
681 case IntersectVariant::ROBUST:
682 {
683 Accel::Intersectors intersectors;
684 intersectors.ptr = bvh;
685 intersectors.intersector1 = BVH8Quad4vIntersector1Pluecker();
686#if defined (EMBREE_RAY_PACKETS)
687 intersectors.intersector4 = BVH8Quad4vIntersector4HybridPluecker();
688 intersectors.intersector8 = BVH8Quad4vIntersector8HybridPluecker();
689 intersectors.intersector16 = BVH8Quad4vIntersector16HybridPluecker();
690 intersectors.intersectorN = BVH8Quad4vIntersectorStreamPluecker();
691#endif
692 return intersectors;
693 }
694 }
695 return Accel::Intersectors();
696 }
697
698 Accel::Intersectors BVH8Factory::BVH8Quad4iIntersectors(BVH8* bvh, IntersectVariant ivariant)
699 {
700 switch (ivariant) {
701 case IntersectVariant::FAST:
702 {
703 Accel::Intersectors intersectors;
704 intersectors.ptr = bvh;
705 intersectors.intersector1 = BVH8Quad4iIntersector1Moeller();
706#if defined (EMBREE_RAY_PACKETS)
707 intersectors.intersector4 = BVH8Quad4iIntersector4HybridMoeller();
708 intersectors.intersector8 = BVH8Quad4iIntersector8HybridMoeller();
709 intersectors.intersector16 = BVH8Quad4iIntersector16HybridMoeller();
710 intersectors.intersectorN = BVH8Quad4iIntersectorStreamMoeller();
711#endif
712 return intersectors;
713 }
714 case IntersectVariant::ROBUST:
715 {
716 Accel::Intersectors intersectors;
717 intersectors.ptr = bvh;
718 intersectors.intersector1 = BVH8Quad4iIntersector1Pluecker();
719#if defined (EMBREE_RAY_PACKETS)
720 intersectors.intersector4 = BVH8Quad4iIntersector4HybridPluecker();
721 intersectors.intersector8 = BVH8Quad4iIntersector8HybridPluecker();
722 intersectors.intersector16 = BVH8Quad4iIntersector16HybridPluecker();
723 intersectors.intersectorN = BVH8Quad4iIntersectorStreamPluecker();
724#endif
725 return intersectors;
726 }
727 }
728 return Accel::Intersectors();
729 }
730
731 Accel::Intersectors BVH8Factory::BVH8Quad4iMBIntersectors(BVH8* bvh, IntersectVariant ivariant)
732 {
733 switch (ivariant) {
734 case IntersectVariant::FAST:
735 {
736 Accel::Intersectors intersectors;
737 intersectors.ptr = bvh;
738 intersectors.intersector1 = BVH8Quad4iMBIntersector1Moeller();
739#if defined (EMBREE_RAY_PACKETS)
740 intersectors.intersector4 = BVH8Quad4iMBIntersector4HybridMoeller();
741 intersectors.intersector8 = BVH8Quad4iMBIntersector8HybridMoeller();
742 intersectors.intersector16 = BVH8Quad4iMBIntersector16HybridMoeller();
743 intersectors.intersectorN = BVH8IntersectorStreamPacketFallback();
744#endif
745 return intersectors;
746 }
747 case IntersectVariant::ROBUST:
748 {
749 Accel::Intersectors intersectors;
750 intersectors.ptr = bvh;
751 intersectors.intersector1 = BVH8Quad4iMBIntersector1Pluecker();
752#if defined (EMBREE_RAY_PACKETS)
753 intersectors.intersector4 = BVH8Quad4iMBIntersector4HybridPluecker();
754 intersectors.intersector8 = BVH8Quad4iMBIntersector8HybridPluecker();
755 intersectors.intersector16 = BVH8Quad4iMBIntersector16HybridPluecker();
756 intersectors.intersectorN = BVH8IntersectorStreamPacketFallback();
757#endif
758 return intersectors;
759 }
760 }
761 return Accel::Intersectors();
762 }
763
764 Accel::Intersectors BVH8Factory::QBVH8Triangle4iIntersectors(BVH8* bvh)
765 {
766 Accel::Intersectors intersectors;
767 intersectors.ptr = bvh;
768 intersectors.intersector1 = QBVH8Triangle4iIntersector1Pluecker();
769 return intersectors;
770 }
771
772 Accel::Intersectors BVH8Factory::QBVH8Triangle4Intersectors(BVH8* bvh)
773 {
774 Accel::Intersectors intersectors;
775 intersectors.ptr = bvh;
776 intersectors.intersector1 = QBVH8Triangle4Intersector1Moeller();
777 return intersectors;
778 }
779
780 Accel::Intersectors BVH8Factory::QBVH8Quad4iIntersectors(BVH8* bvh)
781 {
782 Accel::Intersectors intersectors;
783 intersectors.ptr = bvh;
784 intersectors.intersector1 = QBVH8Quad4iIntersector1Pluecker();
785 return intersectors;
786 }
787
788 Accel::Intersectors BVH8Factory::BVH8UserGeometryIntersectors(BVH8* bvh)
789 {
790 Accel::Intersectors intersectors;
791 intersectors.ptr = bvh;
792 intersectors.intersector1 = BVH8VirtualIntersector1();
793#if defined (EMBREE_RAY_PACKETS)
794 intersectors.intersector4 = BVH8VirtualIntersector4Chunk();
795 intersectors.intersector8 = BVH8VirtualIntersector8Chunk();
796 intersectors.intersector16 = BVH8VirtualIntersector16Chunk();
797 intersectors.intersectorN = BVH8VirtualIntersectorStream();
798#endif
799 intersectors.collider = BVH8ColliderUserGeom();
800 return intersectors;
801 }
802
803 Accel::Intersectors BVH8Factory::BVH8UserGeometryMBIntersectors(BVH8* bvh)
804 {
805 Accel::Intersectors intersectors;
806 intersectors.ptr = bvh;
807 intersectors.intersector1 = BVH8VirtualMBIntersector1();
808#if defined (EMBREE_RAY_PACKETS)
809 intersectors.intersector4 = BVH8VirtualMBIntersector4Chunk();
810 intersectors.intersector8 = BVH8VirtualMBIntersector8Chunk();
811 intersectors.intersector16 = BVH8VirtualMBIntersector16Chunk();
812 intersectors.intersectorN = BVH8IntersectorStreamPacketFallback();
813#endif
814 return intersectors;
815 }
816
817 Accel::Intersectors BVH8Factory::BVH8InstanceIntersectors(BVH8* bvh)
818 {
819 Accel::Intersectors intersectors;
820 intersectors.ptr = bvh;
821 intersectors.intersector1 = BVH8InstanceIntersector1();
822#if defined (EMBREE_RAY_PACKETS)
823 intersectors.intersector4 = BVH8InstanceIntersector4Chunk();
824 intersectors.intersector8 = BVH8InstanceIntersector8Chunk();
825 intersectors.intersector16 = BVH8InstanceIntersector16Chunk();
826 intersectors.intersectorN = BVH8InstanceIntersectorStream();
827#endif
828 return intersectors;
829 }
830
831 Accel::Intersectors BVH8Factory::BVH8InstanceMBIntersectors(BVH8* bvh)
832 {
833 Accel::Intersectors intersectors;
834 intersectors.ptr = bvh;
835 intersectors.intersector1 = BVH8InstanceMBIntersector1();
836#if defined (EMBREE_RAY_PACKETS)
837 intersectors.intersector4 = BVH8InstanceMBIntersector4Chunk();
838 intersectors.intersector8 = BVH8InstanceMBIntersector8Chunk();
839 intersectors.intersector16 = BVH8InstanceMBIntersector16Chunk();
840 intersectors.intersectorN = BVH8IntersectorStreamPacketFallback();
841#endif
842 return intersectors;
843 }
844
845 Accel* BVH8Factory::BVH8OBBVirtualCurve8v(Scene* scene, IntersectVariant ivariant)
846 {
847 BVH8* accel = new BVH8(Curve8v::type,scene);
848 Accel::Intersectors intersectors = BVH8OBBVirtualCurveIntersectors(accel,VirtualCurveIntersector8v(),ivariant);
849 Builder* builder = BVH8Curve8vBuilder_OBB_New(accel,scene,0);
850 return new AccelInstance(accel,builder,intersectors);
851 }
852
853 Accel* BVH8Factory::BVH8OBBVirtualCurve8iMB(Scene* scene, IntersectVariant ivariant)
854 {
855 BVH8* accel = new BVH8(Curve8iMB::type,scene);
856 Accel::Intersectors intersectors = BVH8OBBVirtualCurveIntersectorsMB(accel,VirtualCurveIntersector8iMB(),ivariant);
857 Builder* builder = BVH8OBBCurve8iMBBuilder_OBB(accel,scene,0);
858 return new AccelInstance(accel,builder,intersectors);
859 }
860
861 Accel* BVH8Factory::BVH8Triangle4(Scene* scene, BuildVariant bvariant, IntersectVariant ivariant)
862 {
863 BVH8* accel = new BVH8(Triangle4::type,scene);
864 Accel::Intersectors intersectors= BVH8Triangle4Intersectors(accel,ivariant);
865 Builder* builder = nullptr;
866 if (scene->device->tri_builder == "default") {
867 switch (bvariant) {
868 case BuildVariant::STATIC : builder = BVH8Triangle4SceneBuilderSAH(accel,scene,0); break;
869 case BuildVariant::DYNAMIC : builder = BVH8BuilderTwoLevelTriangle4MeshSAH(accel,scene,false); break;
870 case BuildVariant::HIGH_QUALITY: builder = BVH8Triangle4SceneBuilderFastSpatialSAH(accel,scene,0); break;
871 }
872 }
873 else if (scene->device->tri_builder == "sah" ) builder = BVH8Triangle4SceneBuilderSAH(accel,scene,0);
874 else if (scene->device->tri_builder == "sah_fast_spatial") builder = BVH8Triangle4SceneBuilderFastSpatialSAH(accel,scene,0);
875 else if (scene->device->tri_builder == "sah_presplit") builder = BVH8Triangle4SceneBuilderSAH(accel,scene,MODE_HIGH_QUALITY);
876 else if (scene->device->tri_builder == "dynamic" ) builder = BVH8BuilderTwoLevelTriangle4MeshSAH(accel,scene,false);
877 else if (scene->device->tri_builder == "morton" ) builder = BVH8BuilderTwoLevelTriangle4MeshSAH(accel,scene,true);
878 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown builder "+scene->device->tri_builder+" for BVH8<Triangle4>");
879
880 return new AccelInstance(accel,builder,intersectors);
881 }
882
883 Accel* BVH8Factory::BVH8Triangle4v(Scene* scene, BuildVariant bvariant, IntersectVariant ivariant)
884 {
885 BVH8* accel = new BVH8(Triangle4v::type,scene);
886 Accel::Intersectors intersectors= BVH8Triangle4vIntersectors(accel,ivariant);
887 Builder* builder = nullptr;
888 if (scene->device->tri_builder == "default") {
889 switch (bvariant) {
890 case BuildVariant::STATIC : builder = BVH8Triangle4vSceneBuilderSAH(accel,scene,0); break;
891 case BuildVariant::DYNAMIC : builder = BVH8BuilderTwoLevelTriangle4vMeshSAH(accel,scene,false); break;
892 case BuildVariant::HIGH_QUALITY: builder = BVH8Triangle4vSceneBuilderFastSpatialSAH(accel,scene,0); break;
893 }
894 }
895 else if (scene->device->tri_builder == "sah_fast_spatial") builder = BVH8Triangle4SceneBuilderFastSpatialSAH(accel,scene,0);
896 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown builder "+scene->device->tri_builder+" for BVH8<Triangle4v>");
897 return new AccelInstance(accel,builder,intersectors);
898 }
899
900 Accel* BVH8Factory::BVH8Triangle4i(Scene* scene, BuildVariant bvariant, IntersectVariant ivariant)
901 {
902 BVH8* accel = new BVH8(Triangle4i::type,scene);
903 Accel::Intersectors intersectors = BVH8Triangle4iIntersectors(accel,ivariant);
904
905 Builder* builder = nullptr;
906 if (scene->device->tri_builder == "default") {
907 switch (bvariant) {
908 case BuildVariant::STATIC : builder = BVH8Triangle4iSceneBuilderSAH(accel,scene,0); break;
909 case BuildVariant::DYNAMIC : builder = BVH8BuilderTwoLevelTriangle4iMeshSAH(accel,scene,false); break;
910 case BuildVariant::HIGH_QUALITY: assert(false); break; // FIXME: implement
911 }
912 }
913 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown builder "+scene->device->tri_builder+" for BVH8<Triangle4i>");
914
915 return new AccelInstance(accel,builder,intersectors);
916 }
917
918 Accel* BVH8Factory::BVH8Triangle4iMB(Scene* scene, BuildVariant bvariant, IntersectVariant ivariant)
919 {
920 BVH8* accel = new BVH8(Triangle4i::type,scene);
921 Accel::Intersectors intersectors = BVH8Triangle4iMBIntersectors(accel,ivariant);
922
923 Builder* builder = nullptr;
924 if (scene->device->tri_builder_mb == "default") { // FIXME: implement
925 switch (bvariant) {
926 case BuildVariant::STATIC : builder = BVH8Triangle4iMBSceneBuilderSAH(accel,scene,0); break;
927 case BuildVariant::DYNAMIC : assert(false); break; // FIXME: implement
928 case BuildVariant::HIGH_QUALITY: assert(false); break;
929 }
930 }
931 else if (scene->device->tri_builder_mb == "internal_time_splits") builder = BVH8Triangle4iMBSceneBuilderSAH(accel,scene,0);
932 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown builder "+scene->device->tri_builder_mb+" for BVH8<Triangle4iMB>");
933
934 return new AccelInstance(accel,builder,intersectors);
935 }
936
937 Accel* BVH8Factory::BVH8Triangle4vMB(Scene* scene, BuildVariant bvariant, IntersectVariant ivariant)
938 {
939 BVH8* accel = new BVH8(Triangle4vMB::type,scene);
940 Accel::Intersectors intersectors= BVH8Triangle4vMBIntersectors(accel,ivariant);
941
942 Builder* builder = nullptr;
943 if (scene->device->tri_builder_mb == "default") {
944 switch (bvariant) {
945 case BuildVariant::STATIC : builder = BVH8Triangle4vMBSceneBuilderSAH(accel,scene,0); break;
946 case BuildVariant::DYNAMIC : assert(false); break; // FIXME: implement
947 case BuildVariant::HIGH_QUALITY: assert(false); break;
948 }
949 }
950 else if (scene->device->tri_builder_mb == "internal_time_splits") builder = BVH8Triangle4vMBSceneBuilderSAH(accel,scene,0);
951 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown builder "+scene->device->tri_builder_mb+" for BVH8<Triangle4vMB>");
952
953 return new AccelInstance(accel,builder,intersectors);
954 }
955
956 Accel* BVH8Factory::BVH8QuantizedTriangle4i(Scene* scene)
957 {
958 BVH8* accel = new BVH8(Triangle4i::type,scene);
959 Accel::Intersectors intersectors = QBVH8Triangle4iIntersectors(accel);
960 Builder* builder = BVH8QuantizedTriangle4iSceneBuilderSAH(accel,scene,0);
961 return new AccelInstance(accel,builder,intersectors);
962 }
963
964 Accel* BVH8Factory::BVH8QuantizedTriangle4(Scene* scene)
965 {
966 BVH8* accel = new BVH8(Triangle4::type,scene);
967 Accel::Intersectors intersectors = QBVH8Triangle4Intersectors(accel);
968 Builder* builder = BVH8QuantizedTriangle4SceneBuilderSAH(accel,scene,0);
969 return new AccelInstance(accel,builder,intersectors);
970 }
971
972 Accel* BVH8Factory::BVH8Quad4v(Scene* scene, BuildVariant bvariant, IntersectVariant ivariant)
973 {
974 BVH8* accel = new BVH8(Quad4v::type,scene);
975 Accel::Intersectors intersectors = BVH8Quad4vIntersectors(accel,ivariant);
976
977 Builder* builder = nullptr;
978 if (scene->device->quad_builder == "default") {
979 switch (bvariant) {
980 case BuildVariant::STATIC : builder = BVH8Quad4vSceneBuilderSAH(accel,scene,0); break;
981 case BuildVariant::DYNAMIC : builder = BVH8BuilderTwoLevelQuadMeshSAH(accel,scene,false); break;
982 case BuildVariant::HIGH_QUALITY: builder = BVH8Quad4vSceneBuilderFastSpatialSAH(accel,scene,0); break;
983 }
984 }
985 else if (scene->device->quad_builder == "dynamic" ) builder = BVH8BuilderTwoLevelQuadMeshSAH(accel,scene,false);
986 else if (scene->device->quad_builder == "morton" ) builder = BVH8BuilderTwoLevelQuadMeshSAH(accel,scene,true);
987 else if (scene->device->quad_builder == "sah_fast_spatial" ) builder = BVH8Quad4vSceneBuilderFastSpatialSAH(accel,scene,0);
988 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown builder "+scene->device->quad_builder+" for BVH8<Quad4v>");
989
990 return new AccelInstance(accel,builder,intersectors);
991 }
992
993 Accel* BVH8Factory::BVH8Quad4i(Scene* scene, BuildVariant bvariant, IntersectVariant ivariant)
994 {
995 BVH8* accel = new BVH8(Quad4i::type,scene);
996 Accel::Intersectors intersectors = BVH8Quad4iIntersectors(accel,ivariant);
997
998 Builder* builder = nullptr;
999 if (scene->device->quad_builder == "default") {
1000 switch (bvariant) {
1001 case BuildVariant::STATIC : builder = BVH8Quad4iSceneBuilderSAH(accel,scene,0); break;
1002 case BuildVariant::DYNAMIC : assert(false); break; // FIXME: implement
1003 case BuildVariant::HIGH_QUALITY: assert(false); break; // FIXME: implement
1004 }
1005 }
1006 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown builder "+scene->device->quad_builder+" for BVH8<Quad4i>");
1007
1008 return new AccelInstance(accel,builder,intersectors);
1009 }
1010
1011 Accel* BVH8Factory::BVH8Quad4iMB(Scene* scene, BuildVariant bvariant, IntersectVariant ivariant)
1012 {
1013 BVH8* accel = new BVH8(Quad4i::type,scene);
1014 Accel::Intersectors intersectors = BVH8Quad4iMBIntersectors(accel,ivariant);
1015
1016 Builder* builder = nullptr;
1017 if (scene->device->quad_builder_mb == "default") {
1018 switch (bvariant) {
1019 case BuildVariant::STATIC : builder = BVH8Quad4iMBSceneBuilderSAH(accel,scene,0); break;
1020 case BuildVariant::DYNAMIC : assert(false); break; // FIXME: implement
1021 case BuildVariant::HIGH_QUALITY: assert(false); break;
1022 }
1023 }
1024 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown builder "+scene->device->quad_builder_mb+" for BVH8<Quad4i>");
1025
1026 return new AccelInstance(accel,builder,intersectors);
1027 }
1028
1029 Accel* BVH8Factory::BVH8QuantizedQuad4i(Scene* scene)
1030 {
1031 BVH8* accel = new BVH8(Quad4i::type,scene);
1032 Accel::Intersectors intersectors = QBVH8Quad4iIntersectors(accel);
1033 Builder* builder = nullptr;
1034 if (scene->device->quad_builder == "default" ) builder = BVH8QuantizedQuad4iSceneBuilderSAH(accel,scene,0);
1035 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown builder "+scene->device->quad_builder+" for QBVH8<Quad4i>");
1036 return new AccelInstance(accel,builder,intersectors);
1037 }
1038
1039 Accel* BVH8Factory::BVH8UserGeometry(Scene* scene, BuildVariant bvariant)
1040 {
1041 BVH8* accel = new BVH8(Object::type,scene);
1042 Accel::Intersectors intersectors = BVH8UserGeometryIntersectors(accel);
1043
1044 Builder* builder = nullptr;
1045 if (scene->device->object_builder == "default") {
1046 switch (bvariant) {
1047 case BuildVariant::STATIC : builder = BVH8VirtualSceneBuilderSAH(accel,scene,0); break;
1048 case BuildVariant::DYNAMIC : builder = BVH8BuilderTwoLevelVirtualSAH(accel,scene,false); break;
1049 case BuildVariant::HIGH_QUALITY: assert(false); break;
1050 }
1051 }
1052 else if (scene->device->object_builder == "sah") builder = BVH8VirtualSceneBuilderSAH(accel,scene,0);
1053 else if (scene->device->object_builder == "dynamic") builder = BVH8BuilderTwoLevelVirtualSAH(accel,scene,false);
1054 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown builder "+scene->device->object_builder+" for BVH8<Object>");
1055
1056 return new AccelInstance(accel,builder,intersectors);
1057 }
1058
1059 Accel* BVH8Factory::BVH8UserGeometryMB(Scene* scene)
1060 {
1061 BVH8* accel = new BVH8(Object::type,scene);
1062 Accel::Intersectors intersectors = BVH8UserGeometryMBIntersectors(accel);
1063 Builder* builder = BVH8VirtualMBSceneBuilderSAH(accel,scene,0);
1064 return new AccelInstance(accel,builder,intersectors);
1065 }
1066
1067 Accel* BVH8Factory::BVH8Instance(Scene* scene, bool isExpensive, BuildVariant bvariant)
1068 {
1069 BVH8* accel = new BVH8(InstancePrimitive::type,scene);
1070 Accel::Intersectors intersectors = BVH8InstanceIntersectors(accel);
1071 auto gtype = isExpensive ? Geometry::MTY_INSTANCE_EXPENSIVE : Geometry::MTY_INSTANCE;
1072 // Builder* builder = BVH8InstanceSceneBuilderSAH(accel,scene,gtype);
1073
1074 Builder* builder = nullptr;
1075 if (scene->device->object_builder == "default") {
1076 switch (bvariant) {
1077 case BuildVariant::STATIC : builder = BVH8InstanceSceneBuilderSAH(accel,scene,gtype);; break;
1078 case BuildVariant::DYNAMIC : builder = BVH8BuilderTwoLevelInstanceSAH(accel,scene,gtype,false); break;
1079 case BuildVariant::HIGH_QUALITY: assert(false); break;
1080 }
1081 }
1082 else if (scene->device->object_builder == "sah") builder = BVH8InstanceSceneBuilderSAH(accel,scene,gtype);
1083 else if (scene->device->object_builder == "dynamic") builder = BVH8BuilderTwoLevelInstanceSAH(accel,scene,gtype,false);
1084 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown builder "+scene->device->object_builder+" for BVH8<Object>");
1085
1086 return new AccelInstance(accel,builder,intersectors);
1087 }
1088
1089 Accel* BVH8Factory::BVH8InstanceMB(Scene* scene, bool isExpensive)
1090 {
1091 BVH8* accel = new BVH8(InstancePrimitive::type,scene);
1092 Accel::Intersectors intersectors = BVH8InstanceMBIntersectors(accel);
1093 auto gtype = isExpensive ? Geometry::MTY_INSTANCE_EXPENSIVE : Geometry::MTY_INSTANCE;
1094 Builder* builder = BVH8InstanceMBSceneBuilderSAH(accel,scene,gtype);
1095 return new AccelInstance(accel,builder,intersectors);
1096 }
1097
1098 Accel::Intersectors BVH8Factory::BVH8GridIntersectors(BVH8* bvh, IntersectVariant ivariant)
1099 {
1100 Accel::Intersectors intersectors;
1101 intersectors.ptr = bvh;
1102 if (ivariant == IntersectVariant::FAST)
1103 {
1104 intersectors.intersector1 = BVH8GridIntersector1Moeller();
1105#if defined (EMBREE_RAY_PACKETS)
1106 intersectors.intersector4 = BVH8GridIntersector4HybridMoeller();
1107 intersectors.intersector8 = BVH8GridIntersector8HybridMoeller();
1108 intersectors.intersector16 = BVH8GridIntersector16HybridMoeller();
1109 intersectors.intersectorN = BVH8IntersectorStreamPacketFallback();
1110#endif
1111 }
1112 else /* if (ivariant == IntersectVariant::ROBUST) */
1113 {
1114 intersectors.intersector1 = BVH8GridIntersector1Pluecker();
1115#if defined (EMBREE_RAY_PACKETS)
1116 intersectors.intersector4 = BVH8GridIntersector4HybridPluecker();
1117 intersectors.intersector8 = BVH8GridIntersector8HybridPluecker();
1118 intersectors.intersector16 = BVH8GridIntersector16HybridPluecker();
1119 intersectors.intersectorN = BVH8IntersectorStreamPacketFallback();
1120#endif
1121 }
1122 return intersectors;
1123 }
1124
1125 Accel::Intersectors BVH8Factory::BVH8GridMBIntersectors(BVH8* bvh, IntersectVariant ivariant)
1126 {
1127 Accel::Intersectors intersectors;
1128 intersectors.ptr = bvh;
1129 intersectors.intersector1 = BVH8GridMBIntersector1Moeller();
1130#if defined (EMBREE_RAY_PACKETS)
1131 intersectors.intersector4 = nullptr;
1132 intersectors.intersector8 = nullptr;
1133 intersectors.intersector16 = nullptr;
1134 intersectors.intersectorN = nullptr;
1135#endif
1136 return intersectors;
1137 }
1138
1139 Accel* BVH8Factory::BVH8Grid(Scene* scene, BuildVariant bvariant, IntersectVariant ivariant)
1140 {
1141 BVH8* accel = new BVH8(SubGridQBVH8::type,scene);
1142 Accel::Intersectors intersectors = BVH8GridIntersectors(accel,ivariant);
1143 Builder* builder = nullptr;
1144 if (scene->device->grid_builder == "default") {
1145 builder = BVH8GridSceneBuilderSAH(accel,scene,0);
1146 }
1147 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown builder "+scene->device->object_builder+" for BVH4<GridMesh>");
1148
1149 return new AccelInstance(accel,builder,intersectors);
1150 }
1151
1152 Accel* BVH8Factory::BVH8GridMB(Scene* scene, BuildVariant bvariant, IntersectVariant ivariant)
1153 {
1154 BVH8* accel = new BVH8(SubGridQBVH8::type,scene);
1155 Accel::Intersectors intersectors = BVH8GridMBIntersectors(accel,ivariant);
1156 Builder* builder = nullptr;
1157 if (scene->device->grid_builder_mb == "default") {
1158 builder = BVH8GridMBSceneBuilderSAH(accel,scene,0);
1159 }
1160 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown builder "+scene->device->object_builder+" for BVH8MB<GridMesh>");
1161 return new AccelInstance(accel,builder,intersectors);
1162 }
1163}
1164
1165#endif
1166

source code of qtquick3d/src/3rdparty/embree/kernels/bvh/bvh8_factory.cpp