1// Copyright 2009-2021 Intel Corporation
2// SPDX-License-Identifier: Apache-2.0
3
4#include "bvh4_factory.h"
5#include "../bvh/bvh.h"
6
7#include "../geometry/curveNv.h"
8#include "../geometry/curveNi.h"
9#include "../geometry/curveNi_mb.h"
10#include "../geometry/linei.h"
11#include "../geometry/triangle.h"
12#include "../geometry/trianglev.h"
13#include "../geometry/trianglev_mb.h"
14#include "../geometry/trianglei.h"
15#include "../geometry/quadv.h"
16#include "../geometry/quadi.h"
17#include "../geometry/subdivpatch1.h"
18#include "../geometry/object.h"
19#include "../geometry/instance.h"
20#include "../geometry/subgrid.h"
21#include "../common/accelinstance.h"
22
23namespace embree
24{
25 DECLARE_SYMBOL2(Accel::Collider,BVH4ColliderUserGeom);
26
27 DECLARE_ISA_FUNCTION(VirtualCurveIntersector*,VirtualCurveIntersector4i,void);
28 DECLARE_ISA_FUNCTION(VirtualCurveIntersector*,VirtualCurveIntersector8i,void);
29 DECLARE_ISA_FUNCTION(VirtualCurveIntersector*,VirtualCurveIntersector4v,void);
30 DECLARE_ISA_FUNCTION(VirtualCurveIntersector*,VirtualCurveIntersector8v,void);
31 DECLARE_ISA_FUNCTION(VirtualCurveIntersector*,VirtualCurveIntersector4iMB,void);
32 DECLARE_ISA_FUNCTION(VirtualCurveIntersector*,VirtualCurveIntersector8iMB,void);
33
34 DECLARE_SYMBOL2(Accel::Intersector1,BVH4OBBVirtualCurveIntersector1);
35 DECLARE_SYMBOL2(Accel::Intersector1,BVH4OBBVirtualCurveIntersector1MB);
36 DECLARE_SYMBOL2(Accel::Intersector1,BVH4OBBVirtualCurveIntersectorRobust1);
37 DECLARE_SYMBOL2(Accel::Intersector1,BVH4OBBVirtualCurveIntersectorRobust1MB);
38
39 DECLARE_SYMBOL2(Accel::Intersector1,BVH4Triangle4Intersector1Moeller);
40 DECLARE_SYMBOL2(Accel::Intersector1,BVH4Triangle4iIntersector1Moeller);
41 DECLARE_SYMBOL2(Accel::Intersector1,BVH4Triangle4vIntersector1Pluecker);
42 DECLARE_SYMBOL2(Accel::Intersector1,BVH4Triangle4iIntersector1Pluecker);
43
44 DECLARE_SYMBOL2(Accel::Intersector1,BVH4Triangle4vMBIntersector1Moeller);
45 DECLARE_SYMBOL2(Accel::Intersector1,BVH4Triangle4iMBIntersector1Moeller);
46 DECLARE_SYMBOL2(Accel::Intersector1,BVH4Triangle4vMBIntersector1Pluecker);
47 DECLARE_SYMBOL2(Accel::Intersector1,BVH4Triangle4iMBIntersector1Pluecker);
48
49 DECLARE_SYMBOL2(Accel::Intersector1,BVH4Quad4vIntersector1Moeller);
50 DECLARE_SYMBOL2(Accel::Intersector1,BVH4Quad4iIntersector1Moeller);
51 DECLARE_SYMBOL2(Accel::Intersector1,BVH4Quad4vIntersector1Pluecker);
52 DECLARE_SYMBOL2(Accel::Intersector1,BVH4Quad4iIntersector1Pluecker);
53
54 DECLARE_SYMBOL2(Accel::Intersector1,BVH4Quad4iMBIntersector1Moeller);
55 DECLARE_SYMBOL2(Accel::Intersector1,BVH4Quad4iMBIntersector1Pluecker);
56
57 DECLARE_SYMBOL2(Accel::Intersector1,QBVH4Triangle4iIntersector1Pluecker);
58 DECLARE_SYMBOL2(Accel::Intersector1,QBVH4Quad4iIntersector1Pluecker);
59
60 DECLARE_SYMBOL2(Accel::Intersector1,BVH4SubdivPatch1Intersector1);
61 DECLARE_SYMBOL2(Accel::Intersector1,BVH4SubdivPatch1MBIntersector1);
62
63 DECLARE_SYMBOL2(Accel::Intersector1,BVH4VirtualIntersector1);
64 DECLARE_SYMBOL2(Accel::Intersector1,BVH4VirtualMBIntersector1);
65
66 DECLARE_SYMBOL2(Accel::Intersector1,BVH4InstanceIntersector1);
67 DECLARE_SYMBOL2(Accel::Intersector1,BVH4InstanceMBIntersector1);
68
69 DECLARE_SYMBOL2(Accel::Intersector1,BVH4GridIntersector1Moeller);
70 DECLARE_SYMBOL2(Accel::Intersector1,BVH4GridMBIntersector1Moeller);
71 DECLARE_SYMBOL2(Accel::Intersector1,BVH4GridIntersector1Pluecker);
72
73 DECLARE_SYMBOL2(Accel::Intersector4,BVH4OBBVirtualCurveIntersector4Hybrid);
74 DECLARE_SYMBOL2(Accel::Intersector4,BVH4OBBVirtualCurveIntersector4HybridMB);
75 DECLARE_SYMBOL2(Accel::Intersector4,BVH4OBBVirtualCurveIntersectorRobust4Hybrid);
76 DECLARE_SYMBOL2(Accel::Intersector4,BVH4OBBVirtualCurveIntersectorRobust4HybridMB);
77
78 DECLARE_SYMBOL2(Accel::Intersector4,BVH4Triangle4Intersector4HybridMoeller);
79 DECLARE_SYMBOL2(Accel::Intersector4,BVH4Triangle4Intersector4HybridMoellerNoFilter);
80 DECLARE_SYMBOL2(Accel::Intersector4,BVH4Triangle4iIntersector4HybridMoeller);
81 DECLARE_SYMBOL2(Accel::Intersector4,BVH4Triangle4vIntersector4HybridPluecker);
82 DECLARE_SYMBOL2(Accel::Intersector4,BVH4Triangle4iIntersector4HybridPluecker);
83
84 DECLARE_SYMBOL2(Accel::Intersector4,BVH4Triangle4vMBIntersector4HybridMoeller);
85 DECLARE_SYMBOL2(Accel::Intersector4,BVH4Triangle4iMBIntersector4HybridMoeller);
86 DECLARE_SYMBOL2(Accel::Intersector4,BVH4Triangle4vMBIntersector4HybridPluecker);
87 DECLARE_SYMBOL2(Accel::Intersector4,BVH4Triangle4iMBIntersector4HybridPluecker);
88
89 DECLARE_SYMBOL2(Accel::Intersector4,BVH4Quad4vIntersector4HybridMoeller);
90 DECLARE_SYMBOL2(Accel::Intersector4,BVH4Quad4vIntersector4HybridMoellerNoFilter);
91 DECLARE_SYMBOL2(Accel::Intersector4,BVH4Quad4iIntersector4HybridMoeller);
92 DECLARE_SYMBOL2(Accel::Intersector4,BVH4Quad4vIntersector4HybridPluecker);
93 DECLARE_SYMBOL2(Accel::Intersector4,BVH4Quad4iIntersector4HybridPluecker);
94
95 DECLARE_SYMBOL2(Accel::Intersector4,BVH4Quad4iMBIntersector4HybridMoeller);
96 DECLARE_SYMBOL2(Accel::Intersector4,BVH4Quad4iMBIntersector4HybridPluecker);
97
98 DECLARE_SYMBOL2(Accel::Intersector4,BVH4SubdivPatch1Intersector4);
99 DECLARE_SYMBOL2(Accel::Intersector4,BVH4SubdivPatch1MBIntersector4);
100
101 DECLARE_SYMBOL2(Accel::Intersector4,BVH4VirtualIntersector4Chunk);
102 DECLARE_SYMBOL2(Accel::Intersector4,BVH4VirtualMBIntersector4Chunk);
103
104 DECLARE_SYMBOL2(Accel::Intersector4,BVH4InstanceIntersector4Chunk);
105 DECLARE_SYMBOL2(Accel::Intersector4,BVH4InstanceMBIntersector4Chunk);
106
107 DECLARE_SYMBOL2(Accel::Intersector4,BVH4GridIntersector4HybridMoeller);
108 DECLARE_SYMBOL2(Accel::Intersector4,BVH4GridMBIntersector4HybridMoeller);
109 DECLARE_SYMBOL2(Accel::Intersector4,BVH4GridIntersector4HybridPluecker);
110
111 DECLARE_SYMBOL2(Accel::Intersector8,BVH4OBBVirtualCurveIntersector8Hybrid);
112 DECLARE_SYMBOL2(Accel::Intersector8,BVH4OBBVirtualCurveIntersector8HybridMB);
113 DECLARE_SYMBOL2(Accel::Intersector8,BVH4OBBVirtualCurveIntersectorRobust8Hybrid);
114 DECLARE_SYMBOL2(Accel::Intersector8,BVH4OBBVirtualCurveIntersectorRobust8HybridMB);
115
116 DECLARE_SYMBOL2(Accel::Intersector8,BVH4Triangle4Intersector8HybridMoeller);
117 DECLARE_SYMBOL2(Accel::Intersector8,BVH4Triangle4Intersector8HybridMoellerNoFilter);
118 DECLARE_SYMBOL2(Accel::Intersector8,BVH4Triangle4iIntersector8HybridMoeller);
119 DECLARE_SYMBOL2(Accel::Intersector8,BVH4Triangle4vIntersector8HybridPluecker);
120 DECLARE_SYMBOL2(Accel::Intersector8,BVH4Triangle4iIntersector8HybridPluecker);
121
122 DECLARE_SYMBOL2(Accel::Intersector8,BVH4Triangle4vMBIntersector8HybridMoeller);
123 DECLARE_SYMBOL2(Accel::Intersector8,BVH4Triangle4iMBIntersector8HybridMoeller);
124 DECLARE_SYMBOL2(Accel::Intersector8,BVH4Triangle4vMBIntersector8HybridPluecker);
125 DECLARE_SYMBOL2(Accel::Intersector8,BVH4Triangle4iMBIntersector8HybridPluecker);
126
127 DECLARE_SYMBOL2(Accel::Intersector8,BVH4Quad4vIntersector8HybridMoeller);
128 DECLARE_SYMBOL2(Accel::Intersector8,BVH4Quad4vIntersector8HybridMoellerNoFilter);
129 DECLARE_SYMBOL2(Accel::Intersector8,BVH4Quad4iIntersector8HybridMoeller);
130 DECLARE_SYMBOL2(Accel::Intersector8,BVH4Quad4vIntersector8HybridPluecker);
131 DECLARE_SYMBOL2(Accel::Intersector8,BVH4Quad4iIntersector8HybridPluecker);
132
133 DECLARE_SYMBOL2(Accel::Intersector8,BVH4Quad4iMBIntersector8HybridMoeller);
134 DECLARE_SYMBOL2(Accel::Intersector8,BVH4Quad4iMBIntersector8HybridPluecker);
135
136 DECLARE_SYMBOL2(Accel::Intersector8,BVH4SubdivPatch1Intersector8);
137 DECLARE_SYMBOL2(Accel::Intersector8,BVH4SubdivPatch1MBIntersector8);
138
139 DECLARE_SYMBOL2(Accel::Intersector8,BVH4VirtualIntersector8Chunk);
140 DECLARE_SYMBOL2(Accel::Intersector8,BVH4VirtualMBIntersector8Chunk);
141
142 DECLARE_SYMBOL2(Accel::Intersector8,BVH4InstanceIntersector8Chunk);
143 DECLARE_SYMBOL2(Accel::Intersector8,BVH4InstanceMBIntersector8Chunk);
144
145 DECLARE_SYMBOL2(Accel::Intersector8,BVH4GridIntersector8HybridMoeller);
146 DECLARE_SYMBOL2(Accel::Intersector8,BVH4GridMBIntersector8HybridMoeller);
147 DECLARE_SYMBOL2(Accel::Intersector8,BVH4GridIntersector8HybridPluecker);
148
149 DECLARE_SYMBOL2(Accel::Intersector16,BVH4OBBVirtualCurveIntersector16Hybrid);
150 DECLARE_SYMBOL2(Accel::Intersector16,BVH4OBBVirtualCurveIntersector16HybridMB);
151 DECLARE_SYMBOL2(Accel::Intersector16,BVH4OBBVirtualCurveIntersectorRobust16Hybrid);
152 DECLARE_SYMBOL2(Accel::Intersector16,BVH4OBBVirtualCurveIntersectorRobust16HybridMB);
153
154 DECLARE_SYMBOL2(Accel::Intersector16,BVH4Triangle4Intersector16HybridMoeller);
155 DECLARE_SYMBOL2(Accel::Intersector16,BVH4Triangle4Intersector16HybridMoellerNoFilter);
156 DECLARE_SYMBOL2(Accel::Intersector16,BVH4Triangle4iIntersector16HybridMoeller);
157 DECLARE_SYMBOL2(Accel::Intersector16,BVH4Triangle4vIntersector16HybridPluecker);
158 DECLARE_SYMBOL2(Accel::Intersector16,BVH4Triangle4iIntersector16HybridPluecker);
159
160 DECLARE_SYMBOL2(Accel::Intersector16,BVH4Triangle4vMBIntersector16HybridMoeller);
161 DECLARE_SYMBOL2(Accel::Intersector16,BVH4Triangle4iMBIntersector16HybridMoeller);
162 DECLARE_SYMBOL2(Accel::Intersector16,BVH4Triangle4vMBIntersector16HybridPluecker);
163 DECLARE_SYMBOL2(Accel::Intersector16,BVH4Triangle4iMBIntersector16HybridPluecker);
164
165 DECLARE_SYMBOL2(Accel::Intersector16,BVH4Quad4vIntersector16HybridMoeller);
166 DECLARE_SYMBOL2(Accel::Intersector16,BVH4Quad4vIntersector16HybridMoellerNoFilter);
167 DECLARE_SYMBOL2(Accel::Intersector16,BVH4Quad4iIntersector16HybridMoeller);
168 DECLARE_SYMBOL2(Accel::Intersector16,BVH4Quad4vIntersector16HybridPluecker);
169 DECLARE_SYMBOL2(Accel::Intersector16,BVH4Quad4iIntersector16HybridPluecker);
170
171 DECLARE_SYMBOL2(Accel::Intersector16,BVH4Quad4iMBIntersector16HybridMoeller);
172 DECLARE_SYMBOL2(Accel::Intersector16,BVH4Quad4iMBIntersector16HybridPluecker);
173
174 DECLARE_SYMBOL2(Accel::Intersector16,BVH4SubdivPatch1Intersector16);
175 DECLARE_SYMBOL2(Accel::Intersector16,BVH4SubdivPatch1MBIntersector16);
176
177 DECLARE_SYMBOL2(Accel::Intersector16,BVH4VirtualIntersector16Chunk);
178 DECLARE_SYMBOL2(Accel::Intersector16,BVH4VirtualMBIntersector16Chunk);
179
180 DECLARE_SYMBOL2(Accel::Intersector16,BVH4InstanceIntersector16Chunk);
181 DECLARE_SYMBOL2(Accel::Intersector16,BVH4InstanceMBIntersector16Chunk);
182
183 DECLARE_SYMBOL2(Accel::Intersector16,BVH4GridIntersector16HybridMoeller);
184 DECLARE_SYMBOL2(Accel::Intersector16,BVH4GridMBIntersector16HybridMoeller);
185 DECLARE_SYMBOL2(Accel::Intersector16,BVH4GridIntersector16HybridPluecker);
186
187 DECLARE_SYMBOL2(Accel::IntersectorN,BVH4IntersectorStreamPacketFallback);
188
189 DECLARE_SYMBOL2(Accel::IntersectorN,BVH4Triangle4IntersectorStreamMoeller);
190 DECLARE_SYMBOL2(Accel::IntersectorN,BVH4Triangle4IntersectorStreamMoellerNoFilter);
191 DECLARE_SYMBOL2(Accel::IntersectorN,BVH4Triangle4iIntersectorStreamMoeller);
192 DECLARE_SYMBOL2(Accel::IntersectorN,BVH4Triangle4vIntersectorStreamPluecker);
193 DECLARE_SYMBOL2(Accel::IntersectorN,BVH4Triangle4iIntersectorStreamPluecker);
194
195 DECLARE_SYMBOL2(Accel::IntersectorN,BVH4Quad4vIntersectorStreamMoeller);
196 DECLARE_SYMBOL2(Accel::IntersectorN,BVH4Quad4vIntersectorStreamMoellerNoFilter);
197 DECLARE_SYMBOL2(Accel::IntersectorN,BVH4Quad4iIntersectorStreamMoeller);
198 DECLARE_SYMBOL2(Accel::IntersectorN,BVH4Quad4vIntersectorStreamPluecker);
199 DECLARE_SYMBOL2(Accel::IntersectorN,BVH4Quad4iIntersectorStreamPluecker);
200
201 DECLARE_SYMBOL2(Accel::IntersectorN,BVH4VirtualIntersectorStream);
202 DECLARE_SYMBOL2(Accel::IntersectorN,BVH4InstanceIntersectorStream);
203
204 DECLARE_ISA_FUNCTION(Builder*,BVH4BuilderTwoLevelTriangle4MeshSAH,void* COMMA Scene* COMMA bool);
205 DECLARE_ISA_FUNCTION(Builder*,BVH4BuilderTwoLevelTriangle4vMeshSAH,void* COMMA Scene* COMMA bool);
206 DECLARE_ISA_FUNCTION(Builder*,BVH4BuilderTwoLevelTriangle4iMeshSAH,void* COMMA Scene* COMMA bool);
207 DECLARE_ISA_FUNCTION(Builder*,BVH4BuilderTwoLevelQuadMeshSAH,void* COMMA Scene* COMMA bool);
208 DECLARE_ISA_FUNCTION(Builder*,BVH4BuilderTwoLevelVirtualSAH,void* COMMA Scene* COMMA bool);
209 DECLARE_ISA_FUNCTION(Builder*,BVH4BuilderTwoLevelInstanceSAH,void* COMMA Scene* COMMA Geometry::GTypeMask COMMA bool);
210
211 DECLARE_ISA_FUNCTION(Builder*,BVH4Curve4vBuilder_OBB_New,void* COMMA Scene* COMMA size_t);
212 DECLARE_ISA_FUNCTION(Builder*,BVH4Curve4iBuilder_OBB_New,void* COMMA Scene* COMMA size_t);
213 DECLARE_ISA_FUNCTION(Builder*,BVH4OBBCurve4iMBBuilder_OBB,void* COMMA Scene* COMMA size_t);
214 DECLARE_ISA_FUNCTION(Builder*,BVH4Curve8iBuilder_OBB_New,void* COMMA Scene* COMMA size_t);
215 DECLARE_ISA_FUNCTION(Builder*,BVH4OBBCurve8iMBBuilder_OBB,void* COMMA Scene* COMMA size_t);
216
217 DECLARE_ISA_FUNCTION(Builder*,BVH4Triangle4SceneBuilderSAH,void* COMMA Scene* COMMA size_t);
218 DECLARE_ISA_FUNCTION(Builder*,BVH4Triangle4vSceneBuilderSAH,void* COMMA Scene* COMMA size_t);
219 DECLARE_ISA_FUNCTION(Builder*,BVH4Triangle4iSceneBuilderSAH,void* COMMA Scene* COMMA size_t);
220 DECLARE_ISA_FUNCTION(Builder*,BVH4Triangle4iMBSceneBuilderSAH,void* COMMA Scene* COMMA size_t);
221 DECLARE_ISA_FUNCTION(Builder*,BVH4Triangle4vMBSceneBuilderSAH,void* COMMA Scene* COMMA size_t);
222 DECLARE_ISA_FUNCTION(Builder*,BVH4QuantizedTriangle4iSceneBuilderSAH,void* COMMA Scene* COMMA size_t);
223
224 DECLARE_ISA_FUNCTION(Builder*,BVH4Quad4vSceneBuilderSAH,void* COMMA Scene* COMMA size_t);
225 DECLARE_ISA_FUNCTION(Builder*,BVH4Quad4iSceneBuilderSAH,void* COMMA Scene* COMMA size_t);
226 DECLARE_ISA_FUNCTION(Builder*,BVH4Quad4iMBSceneBuilderSAH,void* COMMA Scene* COMMA size_t);
227 DECLARE_ISA_FUNCTION(Builder*,BVH4QuantizedQuad4iSceneBuilderSAH,void* COMMA Scene* COMMA size_t);
228
229 DECLARE_ISA_FUNCTION(Builder*,BVH4Triangle4SceneBuilderFastSpatialSAH,void* COMMA Scene* COMMA size_t);
230 DECLARE_ISA_FUNCTION(Builder*,BVH4Triangle4vSceneBuilderFastSpatialSAH,void* COMMA Scene* COMMA size_t);
231 DECLARE_ISA_FUNCTION(Builder*,BVH4Triangle4iSceneBuilderFastSpatialSAH,void* COMMA Scene* COMMA size_t);
232
233 DECLARE_ISA_FUNCTION(Builder*,BVH4Quad4vSceneBuilderFastSpatialSAH,void* COMMA Scene* COMMA size_t);
234
235 DECLARE_ISA_FUNCTION(Builder*,BVH4VirtualSceneBuilderSAH,void* COMMA Scene* COMMA size_t);
236 DECLARE_ISA_FUNCTION(Builder*,BVH4VirtualMBSceneBuilderSAH,void* COMMA Scene* COMMA size_t);
237
238 DECLARE_ISA_FUNCTION(Builder*,BVH4InstanceSceneBuilderSAH,void* COMMA Scene* COMMA Geometry::GTypeMask);
239 DECLARE_ISA_FUNCTION(Builder*,BVH4InstanceMBSceneBuilderSAH,void* COMMA Scene* COMMA Geometry::GTypeMask);
240
241 DECLARE_ISA_FUNCTION(Builder*,BVH4GridSceneBuilderSAH,void* COMMA Scene* COMMA size_t);
242 DECLARE_ISA_FUNCTION(Builder*,BVH4GridMBSceneBuilderSAH,void* COMMA Scene* COMMA size_t);
243
244 DECLARE_ISA_FUNCTION(Builder*,BVH4SubdivPatch1BuilderSAH,void* COMMA Scene* COMMA size_t);
245 DECLARE_ISA_FUNCTION(Builder*,BVH4SubdivPatch1MBBuilderSAH,void* COMMA Scene* COMMA size_t);
246
247 DECLARE_ISA_FUNCTION(Builder*,BVH4Triangle4MeshRefitSAH,void* COMMA TriangleMesh* COMMA unsigned int COMMA size_t);
248 DECLARE_ISA_FUNCTION(Builder*,BVH4Triangle4vMeshRefitSAH,void* COMMA TriangleMesh* COMMA unsigned int COMMA size_t);
249 DECLARE_ISA_FUNCTION(Builder*,BVH4Triangle4iMeshRefitSAH,void* COMMA TriangleMesh* COMMA unsigned int COMMA size_t);
250 DECLARE_ISA_FUNCTION(Builder*,BVH4Quad4vMeshRefitSAH,void* COMMA QuadMesh* COMMA unsigned int COMMA size_t);
251 DECLARE_ISA_FUNCTION(Builder*,BVH4VirtualMeshRefitSAH,void* COMMA UserGeometry* COMMA unsigned int COMMA size_t);
252
253 BVH4Factory::BVH4Factory(int bfeatures, int ifeatures)
254 {
255 SELECT_SYMBOL_DEFAULT_AVX_AVX2(ifeatures,BVH4ColliderUserGeom);
256
257 selectBuilders(bfeatures);
258 selectIntersectors(ifeatures);
259 }
260
261 void BVH4Factory::selectBuilders(int features)
262 {
263 IF_ENABLED_TRIS (SELECT_SYMBOL_DEFAULT_AVX(features,BVH4BuilderTwoLevelTriangle4MeshSAH));
264 IF_ENABLED_TRIS (SELECT_SYMBOL_DEFAULT_AVX(features,BVH4BuilderTwoLevelTriangle4iMeshSAH));
265 IF_ENABLED_TRIS (SELECT_SYMBOL_DEFAULT_AVX(features,BVH4BuilderTwoLevelTriangle4vMeshSAH));
266 IF_ENABLED_QUADS (SELECT_SYMBOL_DEFAULT_AVX(features,BVH4BuilderTwoLevelQuadMeshSAH));
267 IF_ENABLED_USER (SELECT_SYMBOL_DEFAULT_AVX(features,BVH4BuilderTwoLevelVirtualSAH));
268 IF_ENABLED_INSTANCE (SELECT_SYMBOL_DEFAULT_AVX(features,BVH4BuilderTwoLevelInstanceSAH));
269
270 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_DEFAULT_AVX(features,BVH4Curve4vBuilder_OBB_New));
271 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_DEFAULT_AVX(features,BVH4Curve4iBuilder_OBB_New));
272 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_DEFAULT_AVX(features,BVH4OBBCurve4iMBBuilder_OBB));
273 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_INIT_AVX(features,BVH4Curve8iBuilder_OBB_New));
274 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_INIT_AVX(features,BVH4OBBCurve8iMBBuilder_OBB));
275
276 IF_ENABLED_TRIS(SELECT_SYMBOL_DEFAULT_AVX(features,BVH4Triangle4SceneBuilderSAH));
277 IF_ENABLED_TRIS(SELECT_SYMBOL_DEFAULT_AVX(features,BVH4Triangle4vSceneBuilderSAH));
278 IF_ENABLED_TRIS(SELECT_SYMBOL_DEFAULT_AVX(features,BVH4Triangle4iSceneBuilderSAH));
279 IF_ENABLED_TRIS(SELECT_SYMBOL_DEFAULT_AVX(features,BVH4Triangle4iMBSceneBuilderSAH));
280 IF_ENABLED_TRIS(SELECT_SYMBOL_DEFAULT_AVX(features,BVH4Triangle4vMBSceneBuilderSAH));
281 IF_ENABLED_TRIS(SELECT_SYMBOL_DEFAULT_AVX(features,BVH4QuantizedTriangle4iSceneBuilderSAH));
282
283 IF_ENABLED_QUADS(SELECT_SYMBOL_DEFAULT_AVX(features,BVH4Quad4vSceneBuilderSAH));
284 IF_ENABLED_QUADS(SELECT_SYMBOL_DEFAULT_AVX(features,BVH4Quad4iSceneBuilderSAH));
285 IF_ENABLED_QUADS(SELECT_SYMBOL_DEFAULT_AVX(features,BVH4Quad4iMBSceneBuilderSAH));
286 IF_ENABLED_QUADS(SELECT_SYMBOL_DEFAULT_AVX(features,BVH4QuantizedQuad4iSceneBuilderSAH));
287
288 IF_ENABLED_TRIS(SELECT_SYMBOL_DEFAULT_AVX(features,BVH4Triangle4SceneBuilderFastSpatialSAH));
289 IF_ENABLED_TRIS(SELECT_SYMBOL_DEFAULT_AVX(features,BVH4Triangle4vSceneBuilderFastSpatialSAH));
290 IF_ENABLED_TRIS(SELECT_SYMBOL_DEFAULT_AVX(features,BVH4Triangle4iSceneBuilderFastSpatialSAH));
291
292 IF_ENABLED_QUADS(SELECT_SYMBOL_DEFAULT_AVX(features,BVH4Quad4vSceneBuilderFastSpatialSAH));
293
294 IF_ENABLED_USER(SELECT_SYMBOL_DEFAULT_AVX(features,BVH4VirtualSceneBuilderSAH));
295 IF_ENABLED_USER(SELECT_SYMBOL_DEFAULT_AVX(features,BVH4VirtualMBSceneBuilderSAH));
296
297 IF_ENABLED_INSTANCE(SELECT_SYMBOL_DEFAULT_AVX(features,BVH4InstanceSceneBuilderSAH));
298 IF_ENABLED_INSTANCE(SELECT_SYMBOL_DEFAULT_AVX(features,BVH4InstanceMBSceneBuilderSAH));
299
300 IF_ENABLED_GRIDS(SELECT_SYMBOL_DEFAULT_AVX(features,BVH4GridSceneBuilderSAH));
301 IF_ENABLED_GRIDS(SELECT_SYMBOL_DEFAULT_AVX(features,BVH4GridMBSceneBuilderSAH));
302
303 IF_ENABLED_SUBDIV(SELECT_SYMBOL_DEFAULT_AVX(features,BVH4SubdivPatch1BuilderSAH));
304 IF_ENABLED_SUBDIV(SELECT_SYMBOL_DEFAULT_AVX(features,BVH4SubdivPatch1MBBuilderSAH));
305 }
306
307 void BVH4Factory::selectIntersectors(int features)
308 {
309 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_DEFAULT_AVX_AVX2_AVX512(features,VirtualCurveIntersector4i));
310 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,VirtualCurveIntersector8i));
311 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_DEFAULT_AVX_AVX2_AVX512(features,VirtualCurveIntersector4v));
312 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,VirtualCurveIntersector8v));
313 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_DEFAULT_AVX_AVX2_AVX512(features,VirtualCurveIntersector4iMB));
314 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,VirtualCurveIntersector8iMB));
315
316 /* select intersectors1 */
317 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_DEFAULT_AVX_AVX2_AVX512(features,BVH4OBBVirtualCurveIntersector1));
318 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_DEFAULT_AVX_AVX2_AVX512(features,BVH4OBBVirtualCurveIntersector1MB));
319 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_DEFAULT_AVX_AVX2_AVX512(features,BVH4OBBVirtualCurveIntersectorRobust1));
320 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_DEFAULT_AVX_AVX2_AVX512(features,BVH4OBBVirtualCurveIntersectorRobust1MB));
321
322 IF_ENABLED_TRIS(SELECT_SYMBOL_DEFAULT_AVX_AVX2_AVX512(features,BVH4Triangle4Intersector1Moeller));
323 IF_ENABLED_TRIS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX512(features,BVH4Triangle4iIntersector1Moeller));
324 IF_ENABLED_TRIS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX512(features,BVH4Triangle4vIntersector1Pluecker));
325 IF_ENABLED_TRIS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX512(features,BVH4Triangle4iIntersector1Pluecker));
326
327 IF_ENABLED_TRIS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Triangle4vMBIntersector1Moeller));
328 IF_ENABLED_TRIS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Triangle4iMBIntersector1Moeller));
329 IF_ENABLED_TRIS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Triangle4vMBIntersector1Pluecker));
330 IF_ENABLED_TRIS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Triangle4iMBIntersector1Pluecker));
331
332 IF_ENABLED_QUADS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Quad4vIntersector1Moeller));
333 IF_ENABLED_QUADS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Quad4iIntersector1Moeller));
334 IF_ENABLED_QUADS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Quad4vIntersector1Pluecker));
335 IF_ENABLED_QUADS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Quad4iIntersector1Pluecker));
336
337 IF_ENABLED_QUADS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Quad4iMBIntersector1Pluecker));
338 IF_ENABLED_QUADS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Quad4iMBIntersector1Moeller));
339
340 IF_ENABLED_TRIS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX512(features,QBVH4Triangle4iIntersector1Pluecker));
341 IF_ENABLED_QUADS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX512(features,QBVH4Quad4iIntersector1Pluecker));
342
343 IF_ENABLED_SUBDIV(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4SubdivPatch1Intersector1));
344 IF_ENABLED_SUBDIV(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4SubdivPatch1MBIntersector1));
345
346 IF_ENABLED_USER(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4VirtualIntersector1));
347 IF_ENABLED_USER(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4VirtualMBIntersector1));
348
349 IF_ENABLED_INSTANCE(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4InstanceIntersector1));
350 IF_ENABLED_INSTANCE(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4InstanceMBIntersector1));
351
352 IF_ENABLED_GRIDS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4GridIntersector1Moeller));
353 IF_ENABLED_GRIDS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4GridMBIntersector1Moeller))
354 IF_ENABLED_GRIDS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4GridIntersector1Pluecker));
355
356#if defined (EMBREE_RAY_PACKETS)
357
358 /* select intersectors4 */
359 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_DEFAULT_AVX_AVX2_AVX512(features,BVH4OBBVirtualCurveIntersector4Hybrid));
360 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_DEFAULT_AVX_AVX2_AVX512(features,BVH4OBBVirtualCurveIntersector4HybridMB));
361 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_DEFAULT_AVX_AVX2_AVX512(features,BVH4OBBVirtualCurveIntersectorRobust4Hybrid));
362 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_DEFAULT_AVX_AVX2_AVX512(features,BVH4OBBVirtualCurveIntersectorRobust4HybridMB));
363
364 IF_ENABLED_TRIS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Triangle4Intersector4HybridMoeller));
365 IF_ENABLED_TRIS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Triangle4Intersector4HybridMoellerNoFilter));
366 IF_ENABLED_TRIS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Triangle4iIntersector4HybridMoeller));
367 IF_ENABLED_TRIS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Triangle4vIntersector4HybridPluecker));
368 IF_ENABLED_TRIS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Triangle4iIntersector4HybridPluecker));
369
370 IF_ENABLED_TRIS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Triangle4vMBIntersector4HybridMoeller));
371 IF_ENABLED_TRIS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Triangle4iMBIntersector4HybridMoeller));
372 IF_ENABLED_TRIS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Triangle4vMBIntersector4HybridPluecker));
373 IF_ENABLED_TRIS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Triangle4iMBIntersector4HybridPluecker));
374
375 IF_ENABLED_QUADS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Quad4vIntersector4HybridMoeller));
376 IF_ENABLED_QUADS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Quad4vIntersector4HybridMoellerNoFilter));
377 IF_ENABLED_QUADS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Quad4iIntersector4HybridMoeller));
378 IF_ENABLED_QUADS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Quad4vIntersector4HybridPluecker));
379 IF_ENABLED_QUADS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Quad4iIntersector4HybridPluecker));
380
381 IF_ENABLED_QUADS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Quad4iMBIntersector4HybridMoeller));
382 IF_ENABLED_QUADS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Quad4iMBIntersector4HybridPluecker));
383
384 IF_ENABLED_SUBDIV(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4SubdivPatch1Intersector4));
385 IF_ENABLED_SUBDIV(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4SubdivPatch1MBIntersector4));
386
387 IF_ENABLED_USER(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4VirtualIntersector4Chunk));
388 IF_ENABLED_USER(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4VirtualMBIntersector4Chunk));
389
390 IF_ENABLED_INSTANCE(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4InstanceIntersector4Chunk));
391 IF_ENABLED_INSTANCE(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4InstanceMBIntersector4Chunk));
392
393 IF_ENABLED_QUADS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Quad4vIntersector4HybridMoeller));
394
395 IF_ENABLED_GRIDS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4GridIntersector4HybridMoeller));
396 IF_ENABLED_GRIDS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4GridMBIntersector4HybridMoeller));
397 IF_ENABLED_GRIDS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4GridIntersector4HybridPluecker));
398
399 /* select intersectors8 */
400 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH4OBBVirtualCurveIntersector8Hybrid));
401 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH4OBBVirtualCurveIntersector8HybridMB));
402 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH4OBBVirtualCurveIntersectorRobust8Hybrid));
403 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH4OBBVirtualCurveIntersectorRobust8HybridMB));
404
405 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH4Triangle4Intersector8HybridMoeller));
406 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH4Triangle4Intersector8HybridMoellerNoFilter));
407 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH4Triangle4iIntersector8HybridMoeller));
408 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH4Triangle4vIntersector8HybridPluecker));
409 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH4Triangle4iIntersector8HybridPluecker));
410
411 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH4Triangle4vMBIntersector8HybridMoeller));
412 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH4Triangle4iMBIntersector8HybridMoeller));
413 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH4Triangle4vMBIntersector8HybridPluecker));
414 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH4Triangle4iMBIntersector8HybridPluecker));
415
416 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH4Quad4vIntersector8HybridMoeller));
417 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH4Quad4vIntersector8HybridMoellerNoFilter));
418 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH4Quad4iIntersector8HybridMoeller));
419 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH4Quad4vIntersector8HybridPluecker));
420 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH4Quad4iIntersector8HybridPluecker));
421
422 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH4Quad4iMBIntersector8HybridMoeller));
423 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH4Quad4iMBIntersector8HybridPluecker));
424
425 IF_ENABLED_SUBDIV(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH4SubdivPatch1Intersector8));
426 IF_ENABLED_SUBDIV(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH4SubdivPatch1MBIntersector8));
427
428 IF_ENABLED_USER(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH4VirtualIntersector8Chunk));
429 IF_ENABLED_USER(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH4VirtualMBIntersector8Chunk));
430
431 IF_ENABLED_INSTANCE(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH4InstanceIntersector8Chunk));
432 IF_ENABLED_INSTANCE(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH4InstanceMBIntersector8Chunk));
433
434 IF_ENABLED_GRIDS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH4GridIntersector8HybridMoeller));
435 IF_ENABLED_GRIDS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH4GridMBIntersector8HybridMoeller));
436 IF_ENABLED_GRIDS(SELECT_SYMBOL_INIT_AVX_AVX2_AVX512(features,BVH4GridIntersector8HybridPluecker));
437
438 /* select intersectors16 */
439 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_INIT_AVX512(features,BVH4OBBVirtualCurveIntersector16Hybrid));
440 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_INIT_AVX512(features,BVH4OBBVirtualCurveIntersector16HybridMB));
441 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_INIT_AVX512(features,BVH4OBBVirtualCurveIntersectorRobust16Hybrid));
442 IF_ENABLED_CURVES_OR_POINTS(SELECT_SYMBOL_INIT_AVX512(features,BVH4OBBVirtualCurveIntersectorRobust16HybridMB));
443
444 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX512(features,BVH4Triangle4Intersector16HybridMoeller));
445 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX512(features,BVH4Triangle4Intersector16HybridMoellerNoFilter));
446 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX512(features,BVH4Triangle4iIntersector16HybridMoeller));
447 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX512(features,BVH4Triangle4vIntersector16HybridPluecker));
448 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX512(features,BVH4Triangle4iIntersector16HybridPluecker));
449
450 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX512(features,BVH4Triangle4vMBIntersector16HybridMoeller));
451 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX512(features,BVH4Triangle4iMBIntersector16HybridMoeller));
452 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX512(features,BVH4Triangle4vMBIntersector16HybridPluecker));
453 IF_ENABLED_TRIS(SELECT_SYMBOL_INIT_AVX512(features,BVH4Triangle4iMBIntersector16HybridPluecker));
454
455 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX512(features,BVH4Quad4vIntersector16HybridMoeller));
456 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX512(features,BVH4Quad4vIntersector16HybridMoellerNoFilter));
457 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX512(features,BVH4Quad4iIntersector16HybridMoeller));
458 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX512(features,BVH4Quad4vIntersector16HybridPluecker));
459 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX512(features,BVH4Quad4iIntersector16HybridPluecker));
460
461 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX512(features,BVH4Quad4iMBIntersector16HybridMoeller));
462 IF_ENABLED_QUADS(SELECT_SYMBOL_INIT_AVX512(features,BVH4Quad4iMBIntersector16HybridPluecker));
463
464 IF_ENABLED_SUBDIV(SELECT_SYMBOL_INIT_AVX512(features,BVH4SubdivPatch1Intersector16));
465 IF_ENABLED_SUBDIV(SELECT_SYMBOL_INIT_AVX512(features,BVH4SubdivPatch1MBIntersector16));
466
467 IF_ENABLED_USER(SELECT_SYMBOL_INIT_AVX512(features,BVH4VirtualIntersector16Chunk));
468 IF_ENABLED_USER(SELECT_SYMBOL_INIT_AVX512(features,BVH4VirtualMBIntersector16Chunk));
469
470 IF_ENABLED_INSTANCE(SELECT_SYMBOL_INIT_AVX512(features,BVH4InstanceIntersector16Chunk));
471 IF_ENABLED_INSTANCE(SELECT_SYMBOL_INIT_AVX512(features,BVH4InstanceMBIntersector16Chunk));
472
473 IF_ENABLED_GRIDS(SELECT_SYMBOL_INIT_AVX512(features,BVH4GridIntersector16HybridMoeller));
474 IF_ENABLED_GRIDS(SELECT_SYMBOL_INIT_AVX512(features,BVH4GridMBIntersector16HybridMoeller));
475 IF_ENABLED_GRIDS(SELECT_SYMBOL_INIT_AVX512(features,BVH4GridIntersector16HybridPluecker));
476
477 /* select stream intersectors */
478 SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4IntersectorStreamPacketFallback);
479
480 IF_ENABLED_TRIS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Triangle4IntersectorStreamMoeller));
481 IF_ENABLED_TRIS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Triangle4IntersectorStreamMoellerNoFilter));
482 IF_ENABLED_TRIS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Triangle4iIntersectorStreamMoeller));
483 IF_ENABLED_TRIS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Triangle4vIntersectorStreamPluecker));
484 IF_ENABLED_TRIS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Triangle4iIntersectorStreamPluecker));
485
486 IF_ENABLED_QUADS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Quad4vIntersectorStreamMoeller));
487 IF_ENABLED_QUADS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Quad4vIntersectorStreamMoellerNoFilter));
488 IF_ENABLED_QUADS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Quad4iIntersectorStreamMoeller));
489 IF_ENABLED_QUADS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Quad4vIntersectorStreamPluecker));
490 IF_ENABLED_QUADS(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4Quad4iIntersectorStreamPluecker));
491
492 IF_ENABLED_USER(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4VirtualIntersectorStream));
493
494 IF_ENABLED_INSTANCE(SELECT_SYMBOL_DEFAULT_SSE42_AVX_AVX2_AVX512(features,BVH4InstanceIntersectorStream));
495
496#endif
497 }
498
499 Accel::Intersectors BVH4Factory::BVH4OBBVirtualCurveIntersectors(BVH4* bvh, VirtualCurveIntersector* leafIntersector, IntersectVariant ivariant)
500 {
501 switch (ivariant) {
502 case IntersectVariant::FAST:
503 {
504 Accel::Intersectors intersectors;
505 intersectors.ptr = bvh;
506 intersectors.leafIntersector = leafIntersector;
507 intersectors.intersector1 = BVH4OBBVirtualCurveIntersector1();
508#if defined (EMBREE_RAY_PACKETS)
509 intersectors.intersector4 = BVH4OBBVirtualCurveIntersector4Hybrid();
510 intersectors.intersector8 = BVH4OBBVirtualCurveIntersector8Hybrid();
511 intersectors.intersector16 = BVH4OBBVirtualCurveIntersector16Hybrid();
512 intersectors.intersectorN = BVH4IntersectorStreamPacketFallback();
513#endif
514 return intersectors;
515 }
516 case IntersectVariant::ROBUST:
517 {
518 Accel::Intersectors intersectors;
519 intersectors.ptr = bvh;
520 intersectors.leafIntersector = leafIntersector;
521 intersectors.intersector1 = BVH4OBBVirtualCurveIntersectorRobust1();
522#if defined (EMBREE_RAY_PACKETS)
523 intersectors.intersector4 = BVH4OBBVirtualCurveIntersectorRobust4Hybrid();
524 intersectors.intersector8 = BVH4OBBVirtualCurveIntersectorRobust8Hybrid();
525 intersectors.intersector16 = BVH4OBBVirtualCurveIntersectorRobust16Hybrid();
526 intersectors.intersectorN = BVH4IntersectorStreamPacketFallback();
527#endif
528 return intersectors;
529 }
530 default: assert(false);
531 }
532 return Accel::Intersectors();
533 }
534
535 Accel::Intersectors BVH4Factory::BVH4OBBVirtualCurveIntersectorsMB(BVH4* bvh, VirtualCurveIntersector* leafIntersector, IntersectVariant ivariant)
536 {
537 switch (ivariant) {
538 case IntersectVariant::FAST:
539 {
540 Accel::Intersectors intersectors;
541 intersectors.ptr = bvh;
542 intersectors.leafIntersector = leafIntersector;
543 intersectors.intersector1 = BVH4OBBVirtualCurveIntersector1MB();
544#if defined (EMBREE_RAY_PACKETS)
545 intersectors.intersector4 = BVH4OBBVirtualCurveIntersector4HybridMB();
546 intersectors.intersector8 = BVH4OBBVirtualCurveIntersector8HybridMB();
547 intersectors.intersector16 = BVH4OBBVirtualCurveIntersector16HybridMB();
548 intersectors.intersectorN = BVH4IntersectorStreamPacketFallback();
549#endif
550 return intersectors;
551 }
552 case IntersectVariant::ROBUST:
553 {
554 Accel::Intersectors intersectors;
555 intersectors.ptr = bvh;
556 intersectors.leafIntersector = leafIntersector;
557 intersectors.intersector1 = BVH4OBBVirtualCurveIntersectorRobust1MB();
558#if defined (EMBREE_RAY_PACKETS)
559 intersectors.intersector4 = BVH4OBBVirtualCurveIntersectorRobust4HybridMB();
560 intersectors.intersector8 = BVH4OBBVirtualCurveIntersectorRobust8HybridMB();
561 intersectors.intersector16 = BVH4OBBVirtualCurveIntersectorRobust16HybridMB();
562 intersectors.intersectorN = BVH4IntersectorStreamPacketFallback();
563#endif
564 return intersectors;
565 }
566 default: assert(false);
567 }
568 return Accel::Intersectors();
569 }
570
571 Accel::Intersectors BVH4Factory::BVH4Triangle4Intersectors(BVH4* bvh, IntersectVariant ivariant)
572 {
573 assert(ivariant == IntersectVariant::FAST);
574 Accel::Intersectors intersectors;
575 intersectors.ptr = bvh;
576 intersectors.intersector1 = BVH4Triangle4Intersector1Moeller();
577#if defined (EMBREE_RAY_PACKETS)
578 intersectors.intersector4_filter = BVH4Triangle4Intersector4HybridMoeller();
579 intersectors.intersector4_nofilter = BVH4Triangle4Intersector4HybridMoellerNoFilter();
580 intersectors.intersector8_filter = BVH4Triangle4Intersector8HybridMoeller();
581 intersectors.intersector8_nofilter = BVH4Triangle4Intersector8HybridMoellerNoFilter();
582 intersectors.intersector16_filter = BVH4Triangle4Intersector16HybridMoeller();
583 intersectors.intersector16_nofilter = BVH4Triangle4Intersector16HybridMoellerNoFilter();
584 intersectors.intersectorN_filter = BVH4Triangle4IntersectorStreamMoeller();
585 intersectors.intersectorN_nofilter = BVH4Triangle4IntersectorStreamMoellerNoFilter();
586#endif
587 return intersectors;
588 }
589
590 Accel::Intersectors BVH4Factory::BVH4Triangle4vIntersectors(BVH4* bvh, IntersectVariant ivariant)
591 {
592 assert(ivariant == IntersectVariant::ROBUST);
593 Accel::Intersectors intersectors;
594 intersectors.ptr = bvh;
595 intersectors.intersector1 = BVH4Triangle4vIntersector1Pluecker();
596#if defined (EMBREE_RAY_PACKETS)
597 intersectors.intersector4 = BVH4Triangle4vIntersector4HybridPluecker();
598 intersectors.intersector8 = BVH4Triangle4vIntersector8HybridPluecker();
599 intersectors.intersector16 = BVH4Triangle4vIntersector16HybridPluecker();
600 intersectors.intersectorN = BVH4Triangle4vIntersectorStreamPluecker();
601#endif
602 return intersectors;
603 }
604
605 Accel::Intersectors BVH4Factory::BVH4Triangle4iIntersectors(BVH4* bvh, IntersectVariant ivariant)
606 {
607 switch (ivariant) {
608 case IntersectVariant::FAST:
609 {
610 Accel::Intersectors intersectors;
611 intersectors.ptr = bvh;
612 intersectors.intersector1 = BVH4Triangle4iIntersector1Moeller();
613#if defined (EMBREE_RAY_PACKETS)
614 intersectors.intersector4 = BVH4Triangle4iIntersector4HybridMoeller();
615 intersectors.intersector8 = BVH4Triangle4iIntersector8HybridMoeller();
616 intersectors.intersector16 = BVH4Triangle4iIntersector16HybridMoeller();
617 intersectors.intersectorN = BVH4Triangle4iIntersectorStreamMoeller();
618#endif
619 return intersectors;
620 }
621 case IntersectVariant::ROBUST:
622 {
623 Accel::Intersectors intersectors;
624 intersectors.ptr = bvh;
625 intersectors.intersector1 = BVH4Triangle4iIntersector1Pluecker();
626#if defined (EMBREE_RAY_PACKETS)
627 intersectors.intersector4 = BVH4Triangle4iIntersector4HybridPluecker();
628 intersectors.intersector8 = BVH4Triangle4iIntersector8HybridPluecker();
629 intersectors.intersector16 = BVH4Triangle4iIntersector16HybridPluecker();
630 intersectors.intersectorN = BVH4Triangle4iIntersectorStreamPluecker();
631#endif
632 return intersectors;
633 }
634 }
635 return Accel::Intersectors();
636 }
637
638 Accel::Intersectors BVH4Factory::BVH4Triangle4vMBIntersectors(BVH4* bvh, IntersectVariant ivariant)
639 {
640 switch (ivariant) {
641 case IntersectVariant::FAST:
642 {
643 Accel::Intersectors intersectors;
644 intersectors.ptr = bvh;
645 intersectors.intersector1 = BVH4Triangle4vMBIntersector1Moeller();
646#if defined (EMBREE_RAY_PACKETS)
647 intersectors.intersector4 = BVH4Triangle4vMBIntersector4HybridMoeller();
648 intersectors.intersector8 = BVH4Triangle4vMBIntersector8HybridMoeller();
649 intersectors.intersector16 = BVH4Triangle4vMBIntersector16HybridMoeller();
650 intersectors.intersectorN = BVH4IntersectorStreamPacketFallback();
651#endif
652 return intersectors;
653 }
654 case IntersectVariant::ROBUST:
655 {
656 Accel::Intersectors intersectors;
657 intersectors.ptr = bvh;
658 intersectors.intersector1 = BVH4Triangle4vMBIntersector1Pluecker();
659#if defined (EMBREE_RAY_PACKETS)
660 intersectors.intersector4 = BVH4Triangle4vMBIntersector4HybridPluecker();
661 intersectors.intersector8 = BVH4Triangle4vMBIntersector8HybridPluecker();
662 intersectors.intersector16 = BVH4Triangle4vMBIntersector16HybridPluecker();
663 intersectors.intersectorN = BVH4IntersectorStreamPacketFallback();
664#endif
665 return intersectors;
666 }
667 }
668 return Accel::Intersectors();
669 }
670
671 Accel::Intersectors BVH4Factory::BVH4Triangle4iMBIntersectors(BVH4* bvh, IntersectVariant ivariant)
672 {
673 switch (ivariant) {
674 case IntersectVariant::FAST:
675 {
676 Accel::Intersectors intersectors;
677 intersectors.ptr = bvh;
678 intersectors.intersector1 = BVH4Triangle4iMBIntersector1Moeller();
679#if defined (EMBREE_RAY_PACKETS)
680 intersectors.intersector4 = BVH4Triangle4iMBIntersector4HybridMoeller();
681 intersectors.intersector8 = BVH4Triangle4iMBIntersector8HybridMoeller();
682 intersectors.intersector16 = BVH4Triangle4iMBIntersector16HybridMoeller();
683 intersectors.intersectorN = BVH4IntersectorStreamPacketFallback();
684#endif
685 return intersectors;
686 }
687 case IntersectVariant::ROBUST:
688 {
689 Accel::Intersectors intersectors;
690 intersectors.ptr = bvh;
691 intersectors.intersector1 = BVH4Triangle4iMBIntersector1Pluecker();
692#if defined (EMBREE_RAY_PACKETS)
693 intersectors.intersector4 = BVH4Triangle4iMBIntersector4HybridPluecker();
694 intersectors.intersector8 = BVH4Triangle4iMBIntersector8HybridPluecker();
695 intersectors.intersector16 = BVH4Triangle4iMBIntersector16HybridPluecker();
696 intersectors.intersectorN = BVH4IntersectorStreamPacketFallback();
697#endif
698 return intersectors;
699 }
700 }
701 return Accel::Intersectors();
702 }
703
704 Accel::Intersectors BVH4Factory::BVH4Quad4vIntersectors(BVH4* bvh, IntersectVariant ivariant)
705 {
706 switch (ivariant) {
707 case IntersectVariant::FAST:
708 {
709 Accel::Intersectors intersectors;
710 intersectors.ptr = bvh;
711 intersectors.intersector1 = BVH4Quad4vIntersector1Moeller();
712#if defined (EMBREE_RAY_PACKETS)
713 intersectors.intersector4_filter = BVH4Quad4vIntersector4HybridMoeller();
714 intersectors.intersector4_nofilter = BVH4Quad4vIntersector4HybridMoellerNoFilter();
715 intersectors.intersector8_filter = BVH4Quad4vIntersector8HybridMoeller();
716 intersectors.intersector8_nofilter = BVH4Quad4vIntersector8HybridMoellerNoFilter();
717 intersectors.intersector16_filter = BVH4Quad4vIntersector16HybridMoeller();
718 intersectors.intersector16_nofilter = BVH4Quad4vIntersector16HybridMoellerNoFilter();
719 intersectors.intersectorN_filter = BVH4Quad4vIntersectorStreamMoeller();
720 intersectors.intersectorN_nofilter = BVH4Quad4vIntersectorStreamMoellerNoFilter();
721#endif
722 return intersectors;
723 }
724 case IntersectVariant::ROBUST:
725 {
726 Accel::Intersectors intersectors;
727 intersectors.ptr = bvh;
728 intersectors.intersector1 = BVH4Quad4vIntersector1Pluecker();
729#if defined (EMBREE_RAY_PACKETS)
730 intersectors.intersector4 = BVH4Quad4vIntersector4HybridPluecker();
731 intersectors.intersector8 = BVH4Quad4vIntersector8HybridPluecker();
732 intersectors.intersector16 = BVH4Quad4vIntersector16HybridPluecker();
733 intersectors.intersectorN = BVH4Quad4vIntersectorStreamPluecker();
734#endif
735 return intersectors;
736 }
737 }
738 return Accel::Intersectors();
739 }
740
741 Accel::Intersectors BVH4Factory::BVH4Quad4iIntersectors(BVH4* bvh, IntersectVariant ivariant)
742 {
743 switch (ivariant) {
744 case IntersectVariant::FAST:
745 {
746 Accel::Intersectors intersectors;
747 intersectors.ptr = bvh;
748 intersectors.intersector1 = BVH4Quad4iIntersector1Moeller();
749#if defined (EMBREE_RAY_PACKETS)
750 intersectors.intersector4 = BVH4Quad4iIntersector4HybridMoeller();
751 intersectors.intersector8 = BVH4Quad4iIntersector8HybridMoeller();
752 intersectors.intersector16= BVH4Quad4iIntersector16HybridMoeller();
753 intersectors.intersectorN = BVH4Quad4iIntersectorStreamMoeller();
754#endif
755 return intersectors;
756 }
757 case IntersectVariant::ROBUST:
758 {
759 Accel::Intersectors intersectors;
760 intersectors.ptr = bvh;
761 intersectors.intersector1 = BVH4Quad4iIntersector1Pluecker();
762#if defined (EMBREE_RAY_PACKETS)
763 intersectors.intersector4 = BVH4Quad4iIntersector4HybridPluecker();
764 intersectors.intersector8 = BVH4Quad4iIntersector8HybridPluecker();
765 intersectors.intersector16= BVH4Quad4iIntersector16HybridPluecker();
766 intersectors.intersectorN = BVH4Quad4iIntersectorStreamPluecker();
767#endif
768 return intersectors;
769 }
770 }
771 return Accel::Intersectors();
772 }
773
774 Accel::Intersectors BVH4Factory::BVH4Quad4iMBIntersectors(BVH4* bvh, IntersectVariant ivariant)
775 {
776 switch (ivariant) {
777 case IntersectVariant::FAST:
778 {
779 Accel::Intersectors intersectors;
780 intersectors.ptr = bvh;
781 intersectors.intersector1 = BVH4Quad4iMBIntersector1Moeller();
782#if defined (EMBREE_RAY_PACKETS)
783 intersectors.intersector4 = BVH4Quad4iMBIntersector4HybridMoeller();
784 intersectors.intersector8 = BVH4Quad4iMBIntersector8HybridMoeller();
785 intersectors.intersector16= BVH4Quad4iMBIntersector16HybridMoeller();
786 intersectors.intersectorN = BVH4IntersectorStreamPacketFallback();
787#endif
788 return intersectors;
789 }
790 case IntersectVariant::ROBUST:
791 {
792 Accel::Intersectors intersectors;
793 intersectors.ptr = bvh;
794 intersectors.intersector1 = BVH4Quad4iMBIntersector1Pluecker();
795#if defined (EMBREE_RAY_PACKETS)
796 intersectors.intersector4 = BVH4Quad4iMBIntersector4HybridPluecker();
797 intersectors.intersector8 = BVH4Quad4iMBIntersector8HybridPluecker();
798 intersectors.intersector16= BVH4Quad4iMBIntersector16HybridPluecker();
799 intersectors.intersectorN = BVH4IntersectorStreamPacketFallback();
800#endif
801 return intersectors;
802 }
803 }
804 return Accel::Intersectors();
805 }
806
807 Accel::Intersectors BVH4Factory::QBVH4Triangle4iIntersectors(BVH4* bvh)
808 {
809 Accel::Intersectors intersectors;
810 intersectors.ptr = bvh;
811 intersectors.intersector1 = QBVH4Triangle4iIntersector1Pluecker();
812 return intersectors;
813 }
814
815 Accel::Intersectors BVH4Factory::QBVH4Quad4iIntersectors(BVH4* bvh)
816 {
817 Accel::Intersectors intersectors;
818 intersectors.ptr = bvh;
819 intersectors.intersector1 = QBVH4Quad4iIntersector1Pluecker();
820 return intersectors;
821 }
822
823 Accel::Intersectors BVH4Factory::BVH4UserGeometryIntersectors(BVH4* bvh)
824 {
825 Accel::Intersectors intersectors;
826 intersectors.ptr = bvh;
827 intersectors.intersector1 = BVH4VirtualIntersector1();
828#if defined (EMBREE_RAY_PACKETS)
829 intersectors.intersector4 = BVH4VirtualIntersector4Chunk();
830 intersectors.intersector8 = BVH4VirtualIntersector8Chunk();
831 intersectors.intersector16 = BVH4VirtualIntersector16Chunk();
832 intersectors.intersectorN = BVH4VirtualIntersectorStream();
833#endif
834 intersectors.collider = BVH4ColliderUserGeom();
835 return intersectors;
836 }
837
838 Accel::Intersectors BVH4Factory::BVH4UserGeometryMBIntersectors(BVH4* bvh)
839 {
840 Accel::Intersectors intersectors;
841 intersectors.ptr = bvh;
842 intersectors.intersector1 = BVH4VirtualMBIntersector1();
843#if defined (EMBREE_RAY_PACKETS)
844 intersectors.intersector4 = BVH4VirtualMBIntersector4Chunk();
845 intersectors.intersector8 = BVH4VirtualMBIntersector8Chunk();
846 intersectors.intersector16 = BVH4VirtualMBIntersector16Chunk();
847 intersectors.intersectorN = BVH4IntersectorStreamPacketFallback();
848#endif
849 return intersectors;
850 }
851
852 Accel::Intersectors BVH4Factory::BVH4InstanceIntersectors(BVH4* bvh)
853 {
854 Accel::Intersectors intersectors;
855 intersectors.ptr = bvh;
856 intersectors.intersector1 = BVH4InstanceIntersector1();
857#if defined (EMBREE_RAY_PACKETS)
858 intersectors.intersector4 = BVH4InstanceIntersector4Chunk();
859 intersectors.intersector8 = BVH4InstanceIntersector8Chunk();
860 intersectors.intersector16 = BVH4InstanceIntersector16Chunk();
861 intersectors.intersectorN = BVH4InstanceIntersectorStream();
862#endif
863 return intersectors;
864 }
865
866 Accel::Intersectors BVH4Factory::BVH4InstanceMBIntersectors(BVH4* bvh)
867 {
868 Accel::Intersectors intersectors;
869 intersectors.ptr = bvh;
870 intersectors.intersector1 = BVH4InstanceMBIntersector1();
871#if defined (EMBREE_RAY_PACKETS)
872 intersectors.intersector4 = BVH4InstanceMBIntersector4Chunk();
873 intersectors.intersector8 = BVH4InstanceMBIntersector8Chunk();
874 intersectors.intersector16 = BVH4InstanceMBIntersector16Chunk();
875 intersectors.intersectorN = BVH4IntersectorStreamPacketFallback();
876#endif
877 return intersectors;
878 }
879
880 Accel::Intersectors BVH4Factory::BVH4SubdivPatch1Intersectors(BVH4* bvh)
881 {
882 Accel::Intersectors intersectors;
883 intersectors.ptr = bvh;
884 intersectors.intersector1 = BVH4SubdivPatch1Intersector1();
885#if defined (EMBREE_RAY_PACKETS)
886 intersectors.intersector4 = BVH4SubdivPatch1Intersector4();
887 intersectors.intersector8 = BVH4SubdivPatch1Intersector8();
888 intersectors.intersector16 = BVH4SubdivPatch1Intersector16();
889 intersectors.intersectorN = BVH4IntersectorStreamPacketFallback();
890#endif
891 return intersectors;
892 }
893
894 Accel::Intersectors BVH4Factory::BVH4SubdivPatch1MBIntersectors(BVH4* bvh)
895 {
896 Accel::Intersectors intersectors;
897 intersectors.ptr = bvh;
898 intersectors.intersector1 = BVH4SubdivPatch1MBIntersector1();
899#if defined (EMBREE_RAY_PACKETS)
900 intersectors.intersector4 = BVH4SubdivPatch1MBIntersector4();
901 intersectors.intersector8 = BVH4SubdivPatch1MBIntersector8();
902 intersectors.intersector16 = BVH4SubdivPatch1MBIntersector16();
903 intersectors.intersectorN = BVH4IntersectorStreamPacketFallback();
904#endif
905 return intersectors;
906 }
907
908 Accel* BVH4Factory::BVH4OBBVirtualCurve4i(Scene* scene, IntersectVariant ivariant)
909 {
910 BVH4* accel = new BVH4(Curve4i::type,scene);
911 Accel::Intersectors intersectors = BVH4OBBVirtualCurveIntersectors(accel,VirtualCurveIntersector4i(),ivariant);
912
913 Builder* builder = nullptr;
914 if (scene->device->hair_builder == "default" ) builder = BVH4Curve4iBuilder_OBB_New(accel,scene,0);
915 else if (scene->device->hair_builder == "sah" ) builder = BVH4Curve4iBuilder_OBB_New(accel,scene,0);
916 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown builder "+scene->device->hair_builder+" for BVH4OBB<VirtualCurve4i>");
917
918 return new AccelInstance(accel,builder,intersectors);
919 }
920
921#if defined(EMBREE_TARGET_SIMD8)
922 Accel* BVH4Factory::BVH4OBBVirtualCurve8i(Scene* scene, IntersectVariant ivariant)
923 {
924 BVH4* accel = new BVH4(Curve8i::type,scene);
925 Accel::Intersectors intersectors = BVH4OBBVirtualCurveIntersectors(accel,VirtualCurveIntersector8i(),ivariant);
926
927 Builder* builder = nullptr;
928 if (scene->device->hair_builder == "default" ) builder = BVH4Curve8iBuilder_OBB_New(accel,scene,0);
929 else if (scene->device->hair_builder == "sah" ) builder = BVH4Curve8iBuilder_OBB_New(accel,scene,0);
930 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown builder "+scene->device->hair_builder+" for BVH4OBB<VirtualCurve8i>");
931
932 return new AccelInstance(accel,builder,intersectors);
933 }
934#endif
935
936 Accel* BVH4Factory::BVH4OBBVirtualCurve4v(Scene* scene, IntersectVariant ivariant)
937 {
938 BVH4* accel = new BVH4(Curve4v::type,scene);
939 Accel::Intersectors intersectors = BVH4OBBVirtualCurveIntersectors(accel,VirtualCurveIntersector4v(),ivariant);
940
941 Builder* builder = nullptr;
942 if (scene->device->hair_builder == "default" ) builder = BVH4Curve4vBuilder_OBB_New(accel,scene,0);
943 else if (scene->device->hair_builder == "sah" ) builder = BVH4Curve4vBuilder_OBB_New(accel,scene,0);
944 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown builder "+scene->device->hair_builder+" for BVH4OBB<VirtualCurve4v>");
945
946 return new AccelInstance(accel,builder,intersectors);
947 }
948
949 Accel* BVH4Factory::BVH4OBBVirtualCurve4iMB(Scene* scene, IntersectVariant ivariant)
950 {
951 BVH4* accel = new BVH4(Curve4iMB::type,scene);
952 Accel::Intersectors intersectors = BVH4OBBVirtualCurveIntersectorsMB(accel,VirtualCurveIntersector4iMB(),ivariant);
953
954 Builder* builder = nullptr;
955 if (scene->device->hair_builder == "default" ) builder = BVH4OBBCurve4iMBBuilder_OBB(accel,scene,0);
956 else if (scene->device->hair_builder == "sah" ) builder = BVH4OBBCurve4iMBBuilder_OBB(accel,scene,0);
957 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown builder "+scene->device->hair_builder+" for BVH4OBB<VirtualCurve4iMB>");
958
959 return new AccelInstance(accel,builder,intersectors);
960 }
961
962#if defined(EMBREE_TARGET_SIMD8)
963 Accel* BVH4Factory::BVH4OBBVirtualCurve8iMB(Scene* scene, IntersectVariant ivariant)
964 {
965 BVH4* accel = new BVH4(Curve8iMB::type,scene);
966 Accel::Intersectors intersectors = BVH4OBBVirtualCurveIntersectorsMB(accel,VirtualCurveIntersector8iMB(), ivariant);
967
968 Builder* builder = nullptr;
969 if (scene->device->hair_builder == "default" ) builder = BVH4OBBCurve8iMBBuilder_OBB(accel,scene,0);
970 else if (scene->device->hair_builder == "sah" ) builder = BVH4OBBCurve8iMBBuilder_OBB(accel,scene,0);
971 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown builder "+scene->device->hair_builder+" for BVH4OBB<VirtualCurve8iMB>");
972
973 return new AccelInstance(accel,builder,intersectors);
974 }
975#endif
976
977 Accel* BVH4Factory::BVH4Triangle4(Scene* scene, BuildVariant bvariant, IntersectVariant ivariant)
978 {
979 BVH4* accel = new BVH4(Triangle4::type,scene);
980
981 Accel::Intersectors intersectors;
982 if (scene->device->tri_traverser == "default") intersectors = BVH4Triangle4Intersectors(accel,ivariant);
983 else if (scene->device->tri_traverser == "fast" ) intersectors = BVH4Triangle4Intersectors(accel,IntersectVariant::FAST);
984 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown traverser "+scene->device->tri_traverser+" for BVH4<Triangle4>");
985
986 Builder* builder = nullptr;
987 if (scene->device->tri_builder == "default") {
988 switch (bvariant) {
989 case BuildVariant::STATIC : builder = BVH4Triangle4SceneBuilderSAH(accel,scene,0); break;
990 case BuildVariant::DYNAMIC : builder = BVH4BuilderTwoLevelTriangle4MeshSAH(accel,scene,false); break;
991 case BuildVariant::HIGH_QUALITY: builder = BVH4Triangle4SceneBuilderFastSpatialSAH(accel,scene,0); break;
992 }
993 }
994 else if (scene->device->tri_builder == "sah" ) builder = BVH4Triangle4SceneBuilderSAH(accel,scene,0);
995 else if (scene->device->tri_builder == "sah_fast_spatial" ) builder = BVH4Triangle4SceneBuilderFastSpatialSAH(accel,scene,0);
996 else if (scene->device->tri_builder == "sah_presplit") builder = BVH4Triangle4SceneBuilderSAH(accel,scene,MODE_HIGH_QUALITY);
997 else if (scene->device->tri_builder == "dynamic" ) builder = BVH4BuilderTwoLevelTriangle4MeshSAH(accel,scene,false);
998 else if (scene->device->tri_builder == "morton" ) builder = BVH4BuilderTwoLevelTriangle4MeshSAH(accel,scene,true);
999 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown builder "+scene->device->tri_builder+" for BVH4<Triangle4>");
1000
1001 return new AccelInstance(accel,builder,intersectors);
1002 }
1003
1004 Accel* BVH4Factory::BVH4Triangle4v(Scene* scene, BuildVariant bvariant, IntersectVariant ivariant)
1005 {
1006 BVH4* accel = new BVH4(Triangle4v::type,scene);
1007
1008 Accel::Intersectors intersectors;
1009 if (scene->device->tri_traverser == "default") intersectors = BVH4Triangle4vIntersectors(accel,ivariant);
1010 else if (scene->device->tri_traverser == "fast" ) intersectors = BVH4Triangle4vIntersectors(accel,IntersectVariant::FAST);
1011 else if (scene->device->tri_traverser == "robust" ) intersectors = BVH4Triangle4vIntersectors(accel,IntersectVariant::ROBUST);
1012 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown traverser "+scene->device->tri_traverser+" for BVH4<Triangle4>");
1013
1014 Builder* builder = nullptr;
1015 if (scene->device->tri_builder == "default") {
1016 switch (bvariant) {
1017 case BuildVariant::STATIC : builder = BVH4Triangle4vSceneBuilderSAH(accel,scene,0); break;
1018 case BuildVariant::DYNAMIC : builder = BVH4BuilderTwoLevelTriangle4vMeshSAH(accel,scene,false); break;
1019 case BuildVariant::HIGH_QUALITY: builder = BVH4Triangle4vSceneBuilderFastSpatialSAH(accel,scene,0); break;
1020 }
1021 }
1022 else if (scene->device->tri_builder == "sah" ) builder = BVH4Triangle4vSceneBuilderSAH(accel,scene,0);
1023 else if (scene->device->tri_builder == "sah_fast_spatial" ) builder = BVH4Triangle4vSceneBuilderFastSpatialSAH(accel,scene,0);
1024 else if (scene->device->tri_builder == "sah_presplit") builder = BVH4Triangle4vSceneBuilderSAH(accel,scene,MODE_HIGH_QUALITY);
1025 else if (scene->device->tri_builder == "dynamic" ) builder = BVH4BuilderTwoLevelTriangle4vMeshSAH(accel,scene,false);
1026 else if (scene->device->tri_builder == "morton" ) builder = BVH4BuilderTwoLevelTriangle4vMeshSAH(accel,scene,true);
1027 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown builder "+scene->device->tri_builder+" for BVH4<Triangle4v>");
1028
1029 return new AccelInstance(accel,builder,intersectors);
1030 }
1031
1032 Accel* BVH4Factory::BVH4Triangle4i(Scene* scene, BuildVariant bvariant, IntersectVariant ivariant)
1033 {
1034 BVH4* accel = new BVH4(Triangle4i::type,scene);
1035
1036 Accel::Intersectors intersectors;
1037 if (scene->device->tri_traverser == "default") intersectors = BVH4Triangle4iIntersectors(accel,ivariant);
1038 else if (scene->device->tri_traverser == "fast" ) intersectors = BVH4Triangle4iIntersectors(accel,IntersectVariant::FAST);
1039 else if (scene->device->tri_traverser == "robust" ) intersectors = BVH4Triangle4iIntersectors(accel,IntersectVariant::ROBUST);
1040 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown traverser "+scene->device->tri_traverser+" for BVH4<Triangle4i>");
1041
1042 Builder* builder = nullptr;
1043 if (scene->device->tri_builder == "default" ) {
1044 switch (bvariant) {
1045 case BuildVariant::STATIC : builder = BVH4Triangle4iSceneBuilderSAH(accel,scene,0); break;
1046 case BuildVariant::DYNAMIC : builder = BVH4BuilderTwoLevelTriangle4iMeshSAH(accel,scene,false); break;
1047 case BuildVariant::HIGH_QUALITY: builder = BVH4Triangle4iSceneBuilderFastSpatialSAH(accel,scene,0); break;
1048 }
1049 }
1050 else if (scene->device->tri_builder == "sah" ) builder = BVH4Triangle4iSceneBuilderSAH(accel,scene,0);
1051 else if (scene->device->tri_builder == "sah_fast_spatial" ) builder = BVH4Triangle4iSceneBuilderFastSpatialSAH(accel,scene,0);
1052 else if (scene->device->tri_builder == "sah_presplit") builder = BVH4Triangle4iSceneBuilderSAH(accel,scene,MODE_HIGH_QUALITY);
1053 else if (scene->device->tri_builder == "dynamic" ) builder = BVH4BuilderTwoLevelTriangle4iMeshSAH(accel,scene,false);
1054 else if (scene->device->tri_builder == "morton" ) builder = BVH4BuilderTwoLevelTriangle4iMeshSAH(accel,scene,true);
1055 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown builder "+scene->device->tri_builder+" for BVH4<Triangle4i>");
1056
1057 return new AccelInstance(accel,builder,intersectors);
1058 }
1059
1060 Accel* BVH4Factory::BVH4Triangle4iMB(Scene* scene, BuildVariant bvariant, IntersectVariant ivariant)
1061 {
1062 BVH4* accel = new BVH4(Triangle4i::type,scene);
1063
1064 Accel::Intersectors intersectors;
1065 if (scene->device->tri_traverser_mb == "default") intersectors = BVH4Triangle4iMBIntersectors(accel,ivariant);
1066 else if (scene->device->tri_traverser_mb == "fast" ) intersectors = BVH4Triangle4iMBIntersectors(accel,IntersectVariant::FAST);
1067 else if (scene->device->tri_traverser_mb == "robust" ) intersectors = BVH4Triangle4iMBIntersectors(accel,IntersectVariant::ROBUST);
1068 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown traverser "+scene->device->tri_traverser_mb+" for BVH4<Triangle4iMB>");
1069
1070 Builder* builder = nullptr;
1071 if (scene->device->tri_builder_mb == "default") {
1072 switch (bvariant) {
1073 case BuildVariant::STATIC : builder = BVH4Triangle4iMBSceneBuilderSAH(accel,scene,0); break;
1074 case BuildVariant::DYNAMIC : assert(false); break; // FIXME: implement
1075 case BuildVariant::HIGH_QUALITY: assert(false); break;
1076 }
1077 }
1078 else if (scene->device->tri_builder_mb == "internal_time_splits") builder = BVH4Triangle4iMBSceneBuilderSAH(accel,scene,0);
1079 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown builder "+scene->device->tri_builder_mb+" for BVH4<Triangle4iMB>");
1080
1081 return new AccelInstance(accel,builder,intersectors);
1082 }
1083
1084 Accel* BVH4Factory::BVH4Triangle4vMB(Scene* scene, BuildVariant bvariant, IntersectVariant ivariant)
1085 {
1086 BVH4* accel = new BVH4(Triangle4vMB::type,scene);
1087
1088 Accel::Intersectors intersectors;
1089 if (scene->device->tri_traverser_mb == "default") intersectors = BVH4Triangle4vMBIntersectors(accel,ivariant);
1090 else if (scene->device->tri_traverser_mb == "fast" ) intersectors = BVH4Triangle4vMBIntersectors(accel,IntersectVariant::FAST);
1091 else if (scene->device->tri_traverser_mb == "robust" ) intersectors = BVH4Triangle4vMBIntersectors(accel,IntersectVariant::ROBUST);
1092 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown traverser "+scene->device->tri_traverser_mb+" for BVH4<Triangle4vMB>");
1093
1094 Builder* builder = nullptr;
1095 if (scene->device->tri_builder_mb == "default") {
1096 switch (bvariant) {
1097 case BuildVariant::STATIC : builder = BVH4Triangle4vMBSceneBuilderSAH(accel,scene,0); break;
1098 case BuildVariant::DYNAMIC : assert(false); break; // FIXME: implement
1099 case BuildVariant::HIGH_QUALITY: assert(false); break;
1100 }
1101 }
1102 else if (scene->device->tri_builder_mb == "internal_time_splits") builder = BVH4Triangle4vMBSceneBuilderSAH(accel,scene,0);
1103 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown builder "+scene->device->tri_builder_mb+" for BVH4<Triangle4vMB>");
1104
1105 return new AccelInstance(accel,builder,intersectors);
1106 }
1107
1108 Accel* BVH4Factory::BVH4Quad4v(Scene* scene, BuildVariant bvariant, IntersectVariant ivariant)
1109 {
1110 BVH4* accel = new BVH4(Quad4v::type,scene);
1111 Accel::Intersectors intersectors = BVH4Quad4vIntersectors(accel,ivariant);
1112
1113 Builder* builder = nullptr;
1114 if (scene->device->quad_builder == "default") {
1115 switch (bvariant) {
1116 case BuildVariant::STATIC : builder = BVH4Quad4vSceneBuilderSAH(accel,scene,0); break;
1117 case BuildVariant::DYNAMIC : builder = BVH4BuilderTwoLevelQuadMeshSAH(accel,scene,false); break;
1118 case BuildVariant::HIGH_QUALITY: builder = BVH4Quad4vSceneBuilderFastSpatialSAH(accel,scene,0); break;
1119 }
1120 }
1121 else if (scene->device->quad_builder == "sah" ) builder = BVH4Quad4vSceneBuilderSAH(accel,scene,0);
1122 else if (scene->device->quad_builder == "sah_fast_spatial" ) builder = BVH4Quad4vSceneBuilderFastSpatialSAH(accel,scene,0);
1123 else if (scene->device->quad_builder == "dynamic" ) builder = BVH4BuilderTwoLevelQuadMeshSAH(accel,scene,false);
1124 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown builder "+scene->device->quad_builder+" for BVH4<Quad4v>");
1125
1126 return new AccelInstance(accel,builder,intersectors);
1127 }
1128
1129 Accel* BVH4Factory::BVH4Quad4i(Scene* scene, BuildVariant bvariant, IntersectVariant ivariant)
1130 {
1131 BVH4* accel = new BVH4(Quad4i::type,scene);
1132 Accel::Intersectors intersectors = BVH4Quad4iIntersectors(accel,ivariant);
1133
1134 Builder* builder = nullptr;
1135 if (scene->device->quad_builder == "default") {
1136 switch (bvariant) {
1137 case BuildVariant::STATIC : builder = BVH4Quad4iSceneBuilderSAH(accel,scene,0); break;
1138 case BuildVariant::DYNAMIC : assert(false); break; // FIXME: implement
1139 case BuildVariant::HIGH_QUALITY: assert(false); break; // FIXME: implement
1140 }
1141 }
1142 else if (scene->device->quad_builder == "sah") builder = BVH4Quad4iSceneBuilderSAH(accel,scene,0);
1143 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown builder "+scene->device->quad_builder+" for BVH4<Quad4i>");
1144
1145 return new AccelInstance(accel,builder,intersectors);
1146 }
1147
1148 Accel* BVH4Factory::BVH4Quad4iMB(Scene* scene, BuildVariant bvariant, IntersectVariant ivariant)
1149 {
1150 BVH4* accel = new BVH4(Quad4i::type,scene);
1151 Accel::Intersectors intersectors = BVH4Quad4iMBIntersectors(accel,ivariant);
1152
1153 Builder* builder = nullptr;
1154 if (scene->device->quad_builder_mb == "default") {
1155 switch (bvariant) {
1156 case BuildVariant::STATIC : builder = BVH4Quad4iMBSceneBuilderSAH(accel,scene,0); break;
1157 case BuildVariant::DYNAMIC : assert(false); break; // FIXME: implement
1158 case BuildVariant::HIGH_QUALITY: assert(false); break;
1159 }
1160 }
1161 else if (scene->device->quad_builder_mb == "sah") builder = BVH4Quad4iMBSceneBuilderSAH(accel,scene,0);
1162 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown builder "+scene->device->quad_builder_mb+" for BVH4<Quad4iMB>");
1163
1164 return new AccelInstance(accel,builder,intersectors);
1165 }
1166
1167 Accel* BVH4Factory::BVH4QuantizedQuad4i(Scene* scene)
1168 {
1169 BVH4* accel = new BVH4(Quad4i::type,scene);
1170 Builder* builder = BVH4QuantizedQuad4iSceneBuilderSAH(accel,scene,0);
1171 Accel::Intersectors intersectors = QBVH4Quad4iIntersectors(accel);
1172 return new AccelInstance(accel,builder,intersectors);
1173 }
1174
1175 Accel* BVH4Factory::BVH4QuantizedTriangle4i(Scene* scene)
1176 {
1177 BVH4* accel = new BVH4(Triangle4i::type,scene);
1178 Builder* builder = BVH4QuantizedTriangle4iSceneBuilderSAH(accel,scene,0);
1179 Accel::Intersectors intersectors = QBVH4Triangle4iIntersectors(accel);
1180 return new AccelInstance(accel,builder,intersectors);
1181 }
1182
1183 Accel* BVH4Factory::BVH4SubdivPatch1(Scene* scene)
1184 {
1185 BVH4* accel = new BVH4(SubdivPatch1::type,scene);
1186 Accel::Intersectors intersectors = BVH4SubdivPatch1Intersectors(accel);
1187 Builder* builder = BVH4SubdivPatch1BuilderSAH(accel,scene,0);
1188 return new AccelInstance(accel,builder,intersectors);
1189 }
1190
1191 Accel* BVH4Factory::BVH4SubdivPatch1MB(Scene* scene)
1192 {
1193 BVH4* accel = new BVH4(SubdivPatch1::type,scene);
1194 Accel::Intersectors intersectors = BVH4SubdivPatch1MBIntersectors(accel);
1195 Builder* builder = BVH4SubdivPatch1MBBuilderSAH(accel,scene,0);
1196 return new AccelInstance(accel,builder,intersectors);
1197 }
1198
1199 Accel* BVH4Factory::BVH4UserGeometry(Scene* scene, BuildVariant bvariant)
1200 {
1201 BVH4* accel = new BVH4(Object::type,scene);
1202 Accel::Intersectors intersectors = BVH4UserGeometryIntersectors(accel);
1203
1204 Builder* builder = nullptr;
1205 if (scene->device->object_builder == "default") {
1206 switch (bvariant) {
1207 case BuildVariant::STATIC : builder = BVH4VirtualSceneBuilderSAH(accel,scene,0); break;
1208 case BuildVariant::DYNAMIC : builder = BVH4BuilderTwoLevelVirtualSAH(accel,scene,false); break;
1209 case BuildVariant::HIGH_QUALITY: assert(false); break;
1210 }
1211 }
1212 else if (scene->device->object_builder == "sah") builder = BVH4VirtualSceneBuilderSAH(accel,scene,0);
1213 else if (scene->device->object_builder == "dynamic") builder = BVH4BuilderTwoLevelVirtualSAH(accel,scene,false);
1214 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown builder "+scene->device->object_builder+" for BVH4<Object>");
1215
1216 return new AccelInstance(accel,builder,intersectors);
1217 }
1218
1219 Accel* BVH4Factory::BVH4UserGeometryMB(Scene* scene)
1220 {
1221 BVH4* accel = new BVH4(Object::type,scene);
1222 Accel::Intersectors intersectors = BVH4UserGeometryMBIntersectors(accel);
1223 Builder* builder = BVH4VirtualMBSceneBuilderSAH(accel,scene,0);
1224 return new AccelInstance(accel,builder,intersectors);
1225 }
1226
1227 Accel* BVH4Factory::BVH4Instance(Scene* scene, bool isExpensive, BuildVariant bvariant)
1228 {
1229 BVH4* accel = new BVH4(InstancePrimitive::type,scene);
1230 Accel::Intersectors intersectors = BVH4InstanceIntersectors(accel);
1231 auto gtype = isExpensive ? Geometry::MTY_INSTANCE_EXPENSIVE : Geometry::MTY_INSTANCE_CHEAP;
1232 // Builder* builder = BVH4InstanceSceneBuilderSAH(accel,scene,gtype);
1233
1234 Builder* builder = nullptr;
1235 if (scene->device->object_builder == "default") {
1236 switch (bvariant) {
1237 case BuildVariant::STATIC : builder = BVH4InstanceSceneBuilderSAH(accel,scene,gtype); break;
1238 case BuildVariant::DYNAMIC : builder = BVH4BuilderTwoLevelInstanceSAH(accel,scene,gtype,false); break;
1239 case BuildVariant::HIGH_QUALITY: assert(false); break;
1240 }
1241 }
1242 else if (scene->device->object_builder == "sah") builder = BVH4InstanceSceneBuilderSAH(accel,scene,gtype);
1243 else if (scene->device->object_builder == "dynamic") builder = BVH4BuilderTwoLevelInstanceSAH(accel,scene,gtype,false);
1244 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown builder "+scene->device->object_builder+" for BVH4<Object>");
1245
1246 return new AccelInstance(accel,builder,intersectors);
1247 }
1248
1249 Accel* BVH4Factory::BVH4InstanceMB(Scene* scene, bool isExpensive)
1250 {
1251 BVH4* accel = new BVH4(InstancePrimitive::type,scene);
1252 Accel::Intersectors intersectors = BVH4InstanceMBIntersectors(accel);
1253 auto gtype = isExpensive ? Geometry::MTY_INSTANCE_EXPENSIVE : Geometry::MTY_INSTANCE_CHEAP;
1254 Builder* builder = BVH4InstanceMBSceneBuilderSAH(accel,scene,gtype);
1255 return new AccelInstance(accel,builder,intersectors);
1256 }
1257
1258 Accel::Intersectors BVH4Factory::BVH4GridIntersectors(BVH4* bvh, IntersectVariant ivariant)
1259 {
1260 Accel::Intersectors intersectors;
1261 intersectors.ptr = bvh;
1262 if (ivariant == IntersectVariant::FAST)
1263 {
1264 intersectors.intersector1 = BVH4GridIntersector1Moeller();
1265#if defined (EMBREE_RAY_PACKETS)
1266 intersectors.intersector4 = BVH4GridIntersector4HybridMoeller();
1267 intersectors.intersector8 = BVH4GridIntersector8HybridMoeller();
1268 intersectors.intersector16 = BVH4GridIntersector16HybridMoeller();
1269 intersectors.intersectorN = BVH4IntersectorStreamPacketFallback();
1270#endif
1271 }
1272 else /* if (ivariant == IntersectVariant::ROBUST) */
1273 {
1274 intersectors.intersector1 = BVH4GridIntersector1Pluecker();
1275#if defined (EMBREE_RAY_PACKETS)
1276 intersectors.intersector4 = BVH4GridIntersector4HybridPluecker();
1277 intersectors.intersector8 = BVH4GridIntersector8HybridPluecker();
1278 intersectors.intersector16 = BVH4GridIntersector16HybridPluecker();
1279 intersectors.intersectorN = BVH4IntersectorStreamPacketFallback();
1280#endif
1281 }
1282 return intersectors;
1283 }
1284
1285 Accel::Intersectors BVH4Factory::BVH4GridMBIntersectors(BVH4* bvh, IntersectVariant ivariant)
1286 {
1287 Accel::Intersectors intersectors;
1288 intersectors.ptr = bvh;
1289 intersectors.intersector1 = BVH4GridMBIntersector1Moeller();
1290#if defined (EMBREE_RAY_PACKETS)
1291 intersectors.intersector4 = BVH4GridMBIntersector4HybridMoeller();
1292 intersectors.intersector8 = BVH4GridMBIntersector8HybridMoeller();
1293 intersectors.intersector16 = BVH4GridMBIntersector16HybridMoeller();
1294 intersectors.intersectorN = BVH4IntersectorStreamPacketFallback();
1295#endif
1296 return intersectors;
1297 }
1298
1299 Accel* BVH4Factory::BVH4Grid(Scene* scene, BuildVariant bvariant, IntersectVariant ivariant)
1300 {
1301 BVH4* accel = new BVH4(SubGridQBVH4::type,scene);
1302 Accel::Intersectors intersectors = BVH4GridIntersectors(accel,ivariant);
1303
1304 Builder* builder = nullptr;
1305 if (scene->device->object_builder == "default") {
1306 builder = BVH4GridSceneBuilderSAH(accel,scene,0);
1307 }
1308 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown builder "+scene->device->grid_builder+" for BVH4<GridMesh>");
1309
1310 return new AccelInstance(accel,builder,intersectors);
1311 }
1312
1313 Accel* BVH4Factory::BVH4GridMB(Scene* scene, BuildVariant bvariant, IntersectVariant ivariant)
1314 {
1315 BVH4* accel = new BVH4(SubGridQBVH4::type,scene);
1316 Accel::Intersectors intersectors = BVH4GridMBIntersectors(accel,ivariant);
1317 Builder* builder = nullptr;
1318 if (scene->device->object_builder == "default") {
1319 builder = BVH4GridMBSceneBuilderSAH(accel,scene,0);
1320 }
1321 else throw_RTCError(RTC_ERROR_INVALID_ARGUMENT,"unknown builder "+scene->device->grid_builder+" for BVH4MB<GridMesh>");
1322 return new AccelInstance(accel,builder,intersectors);
1323 }
1324
1325}
1326