summaryrefslogtreecommitdiff
path: root/thirdparty/embree-aarch64/kernels/geometry/primitive4.cpp
blob: f93574c9c8d02abfe324d7d853d3a6db8627d485 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
// Copyright 2009-2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0

#include "primitive.h"
#include "curveNv.h"
#include "curveNi.h"
#include "curveNi_mb.h"
#include "linei.h"
#include "triangle.h"
#include "trianglev.h"
#include "trianglev_mb.h"
#include "trianglei.h"
#include "quadv.h"
#include "quadi.h"
#include "subdivpatch1.h"
#include "object.h"
#include "instance.h"
#include "subgrid.h"

namespace embree
{
  /********************** Curve4v **************************/

  template<>
  const char* Curve4v::Type::name () const {
    return "curve4v";
  }

  template<>
  size_t Curve4v::Type::sizeActive(const char* This) const
  {
    if ((*This & Geometry::GType::GTY_BASIS_MASK) == Geometry::GType::GTY_BASIS_LINEAR)
      return ((Line4i*)This)->size();
    else
      return ((Curve4v*)This)->N;
  }

  template<>
  size_t Curve4v::Type::sizeTotal(const char* This) const
  {
    if ((*This & Geometry::GType::GTY_BASIS_MASK) == Geometry::GType::GTY_BASIS_LINEAR)
      return 4;
    else
      return ((Curve4v*)This)->N;
  }

  template<>
  size_t Curve4v::Type::getBytes(const char* This) const
  {
     if ((*This & Geometry::GType::GTY_BASIS_MASK) == Geometry::GType::GTY_BASIS_LINEAR)
      return Line4i::bytes(sizeActive(This));
     else
        return Curve4v::bytes(sizeActive(This));
  }

  /********************** Curve4i **************************/

  template<>
  const char* Curve4i::Type::name () const {
    return "curve4i";
  }

  template<>
  size_t Curve4i::Type::sizeActive(const char* This) const
  {
    if ((*This & Geometry::GType::GTY_BASIS_MASK) == Geometry::GType::GTY_BASIS_LINEAR)
      return ((Line4i*)This)->size();
    else
      return ((Curve4i*)This)->N;
  }

  template<>
  size_t Curve4i::Type::sizeTotal(const char* This) const
  {
    if ((*This & Geometry::GType::GTY_BASIS_MASK) == Geometry::GType::GTY_BASIS_LINEAR)
      return 4;
    else
      return ((Curve4i*)This)->N;
  }

  template<>
  size_t Curve4i::Type::getBytes(const char* This) const
  {
    if ((*This & Geometry::GType::GTY_BASIS_MASK) == Geometry::GType::GTY_BASIS_LINEAR)
      return Line4i::bytes(sizeActive(This));
    else
      return Curve4i::bytes(sizeActive(This));
  }

  /********************** Curve4iMB **************************/

  template<>
  const char* Curve4iMB::Type::name () const {
    return "curve4imb";
  }

  template<>
  size_t Curve4iMB::Type::sizeActive(const char* This) const
  {
    if ((*This & Geometry::GType::GTY_BASIS_MASK) == Geometry::GType::GTY_BASIS_LINEAR)
      return ((Line4i*)This)->size();
    else
      return ((Curve4iMB*)This)->N;
  }

  template<>
  size_t Curve4iMB::Type::sizeTotal(const char* This) const
  {
    if ((*This & Geometry::GType::GTY_BASIS_MASK) == Geometry::GType::GTY_BASIS_LINEAR)
      return 4;
    else
      return ((Curve4iMB*)This)->N;
  }

  template<>
  size_t Curve4iMB::Type::getBytes(const char* This) const
  {
    if ((*This & Geometry::GType::GTY_BASIS_MASK) == Geometry::GType::GTY_BASIS_LINEAR)
      return Line4i::bytes(sizeActive(This));
    else
      return Curve4iMB::bytes(sizeActive(This));
  }

  /********************** Line4i **************************/

  template<>
  const char* Line4i::Type::name () const {
    return "line4i";
  }

  template<>
  size_t Line4i::Type::sizeActive(const char* This) const {
    return ((Line4i*)This)->size();
  }

  template<>
  size_t Line4i::Type::sizeTotal(const char* This) const {
    return 4;
  }

  template<>
  size_t Line4i::Type::getBytes(const char* This) const {
    return sizeof(Line4i);
  }

  /********************** Triangle4 **************************/

  template<>
  const char* Triangle4::Type::name () const {
    return "triangle4";
  }

  template<>
  size_t Triangle4::Type::sizeActive(const char* This) const {
    return ((Triangle4*)This)->size();
  }

  template<>
  size_t Triangle4::Type::sizeTotal(const char* This) const {
    return 4;
  }

  template<>
  size_t Triangle4::Type::getBytes(const char* This) const {
    return sizeof(Triangle4);
  }

  /********************** Triangle4v **************************/

  template<>
  const char* Triangle4v::Type::name () const {
    return "triangle4v";
  }

  template<>
  size_t Triangle4v::Type::sizeActive(const char* This) const {
    return ((Triangle4v*)This)->size();
  }

  template<>
  size_t Triangle4v::Type::sizeTotal(const char* This) const {
    return 4;
  }

  template<>
  size_t Triangle4v::Type::getBytes(const char* This) const {
    return sizeof(Triangle4v);
  }

  /********************** Triangle4i **************************/

  template<>
  const char* Triangle4i::Type::name () const {
    return "triangle4i";
  }

  template<>
  size_t Triangle4i::Type::sizeActive(const char* This) const {
    return ((Triangle4i*)This)->size();
  }

  template<>
  size_t Triangle4i::Type::sizeTotal(const char* This) const {
    return 4;
  }

  template<>
  size_t Triangle4i::Type::getBytes(const char* This) const {
    return sizeof(Triangle4i);
  }

  /********************** Triangle4vMB **************************/

  template<>
  const char* Triangle4vMB::Type::name () const {
    return  "triangle4vmb";
  }

  template<>
  size_t Triangle4vMB::Type::sizeActive(const char* This) const {
    return ((Triangle4vMB*)This)->size();
  }

  template<>
  size_t Triangle4vMB::Type::sizeTotal(const char* This) const {
    return 4;
  }

  template<>
  size_t Triangle4vMB::Type::getBytes(const char* This) const {
    return sizeof(Triangle4vMB);
  }

  /********************** Quad4v **************************/

  template<>
  const char* Quad4v::Type::name () const {
    return "quad4v";
  }

  template<>
  size_t Quad4v::Type::sizeActive(const char* This) const {
    return ((Quad4v*)This)->size();
  }

  template<>
  size_t Quad4v::Type::sizeTotal(const char* This) const {
    return 4;
  }

  template<>
  size_t Quad4v::Type::getBytes(const char* This) const {
    return sizeof(Quad4v);
  }

  /********************** Quad4i **************************/

  template<>
  const char* Quad4i::Type::name () const {
    return "quad4i";
  }

  template<>
  size_t Quad4i::Type::sizeActive(const char* This) const {
    return ((Quad4i*)This)->size();
  }

  template<>
  size_t Quad4i::Type::sizeTotal(const char* This) const {
    return 4;
  }

  template<>
  size_t Quad4i::Type::getBytes(const char* This) const {
    return sizeof(Quad4i);
  }

  /********************** SubdivPatch1 **************************/

  const char* SubdivPatch1::Type::name () const {
    return "subdivpatch1";
  }

  size_t SubdivPatch1::Type::sizeActive(const char* This) const {
    return 1;
  }

  size_t SubdivPatch1::Type::sizeTotal(const char* This) const {
    return 1;
  }

  size_t SubdivPatch1::Type::getBytes(const char* This) const {
    return sizeof(SubdivPatch1);
  }

  SubdivPatch1::Type SubdivPatch1::type;

  /********************** Virtual Object **************************/

  const char* Object::Type::name () const {
    return "object";
  }

  size_t Object::Type::sizeActive(const char* This) const {
    return 1;
  }

  size_t Object::Type::sizeTotal(const char* This) const {
    return 1;
  }

  size_t Object::Type::getBytes(const char* This) const {
    return sizeof(Object);
  }

  Object::Type Object::type;

  /********************** Instance **************************/

  const char* InstancePrimitive::Type::name () const {
    return "instance";
  }

  size_t InstancePrimitive::Type::sizeActive(const char* This) const {
    return 1;
  }

  size_t InstancePrimitive::Type::sizeTotal(const char* This) const {
    return 1;
  }

  size_t InstancePrimitive::Type::getBytes(const char* This) const {
    return sizeof(InstancePrimitive);
  }

  InstancePrimitive::Type InstancePrimitive::type;

  /********************** SubGrid **************************/

  const char* SubGrid::Type::name () const {
    return "subgrid";
  }

  size_t SubGrid::Type::sizeActive(const char* This) const {
    return 1;
  }

  size_t SubGrid::Type::sizeTotal(const char* This) const {
    return 1;
  }

  size_t SubGrid::Type::getBytes(const char* This) const {
    return sizeof(SubGrid);
  }

  SubGrid::Type SubGrid::type;
  
  /********************** SubGridQBVH4 **************************/

  template<>
  const char* SubGridQBVH4::Type::name () const {
    return "SubGridQBVH4";
  }

  template<>
  size_t SubGridQBVH4::Type::sizeActive(const char* This) const {
    return 1;
  }

  template<>
  size_t SubGridQBVH4::Type::sizeTotal(const char* This) const {
    return 1;
  }

  template<>
  size_t SubGridQBVH4::Type::getBytes(const char* This) const {
    return sizeof(SubGridQBVH4);
  }
}