Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ray_sse.h
Go to the documentation of this file.
1 /*
2  This file is part of Mitsuba, a physically based rendering system.
3 
4  Copyright (c) 2007-2014 by Wenzel Jakob and others.
5 
6  Mitsuba is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License Version 3
8  as published by the Free Software Foundation.
9 
10  Mitsuba is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #pragma once
20 #if !defined(__MITSUBA_CORE_RAY_SSE_H_)
21 #define __MITSUBA_CORE_RAY_SSE_H_
22 
23 #if !MTS_SSE
24 #error "This headers requires SSE support."
25 #endif
26 
27 #include <mitsuba/core/platform.h>
28 #include <mitsuba/core/sse.h>
29 #include <mitsuba/core/ray.h>
30 
32 
33 /** \brief SIMD quad-packed ray for coherent ray tracing */
34 struct RayPacket4 {
35  QuadVector o, d;
36  QuadVector dRcp;
37  uint8_t signs[4][4];
38 
39  inline RayPacket4() {
40  }
41 
42  inline bool load(const Ray *rays) {
43  for (int i=0; i<4; i++) {
44  for (int axis=0; axis<3; axis++) {
45  o[axis].f[i] = rays[i].o[axis];
46  d[axis].f[i] = rays[i].d[axis];
47  dRcp[axis].f[i] = rays[i].dRcp[axis];
48  signs[axis][i] = rays[i].d[axis] < 0 ? 1 : 0;
49  if (signs[axis][i] != signs[axis][0])
50  return false;
51  }
52  }
53  return true;
54  }
55 };
56 
57 struct RayInterval4 {
58  SSEVector mint;
59  SSEVector maxt;
60 
61  inline RayInterval4() {
62  mint = SSEConstants::eps;
63  maxt = SSEConstants::p_inf;
64  }
65 
66  inline RayInterval4(const Ray *rays) {
67  for (int i=0; i<4; i++) {
68  mint.f[i] = rays[i].mint;
69  maxt.f[i] = rays[i].maxt;
70  }
71  }
72 };
73 
74 struct Intersection4 {
75  SSEVector t;
76  SSEVector u;
77  SSEVector v;
78  SSEVector primIndex;
79  SSEVector shapeIndex;
80 
81  inline Intersection4() {
82  t = SSEConstants::p_inf;
83  u = SSEConstants::zero;
84  v = SSEConstants::zero;
85  primIndex = SSEConstants::ffffffff;
86  shapeIndex = SSEConstants::ffffffff;
87  }
88 };
89 
91 
92 #endif /* __MITSUBA_CORE_RAY_SSE_H_ */
RayInterval4(const Ray *rays)
Definition: ray_sse.h:66
SSEVector t
Definition: ray_sse.h:75
SSEVector u
Definition: ray_sse.h:76
Intersection4()
Definition: ray_sse.h:81
SSEVector mint
Definition: ray_sse.h:58
QuadVector dRcp
Definition: ray_sse.h:36
#define MTS_NAMESPACE_BEGIN
Definition: platform.h:137
SSEVector maxt
Definition: ray_sse.h:59
bool load(const Ray *rays)
Definition: ray_sse.h:42
Definition: ray_sse.h:57
SSEVector v
Definition: ray_sse.h:77
SIMD quad-packed ray for coherent ray tracing.
Definition: ray_sse.h:34
Definition: ray_sse.h:74
SSEVector shapeIndex
Definition: ray_sse.h:79
Definition: fwd.h:65
QuadVector o
Definition: ray_sse.h:35
SSEVector primIndex
Definition: ray_sse.h:78
RayPacket4()
Definition: ray_sse.h:39
#define MTS_NAMESPACE_END
Definition: platform.h:138
RayInterval4()
Definition: ray_sse.h:61