RavEngine
Loading...
Searching...
No Matches
PxUnixSse2AoS.h
1// Redistribution and use in source and binary forms, with or without
2// modification, are permitted provided that the following conditions
3// are met:
4// * Redistributions of source code must retain the above copyright
5// notice, this list of conditions and the following disclaimer.
6// * Redistributions in binary form must reproduce the above copyright
7// notice, this list of conditions and the following disclaimer in the
8// documentation and/or other materials provided with the distribution.
9// * Neither the name of NVIDIA CORPORATION nor the names of its
10// contributors may be used to endorse or promote products derived
11// from this software without specific prior written permission.
12//
13// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
14// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24//
25// Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved.
26// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
27// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
28
29#ifndef PXFOUNDATION_PXUNIXSSE2AOS_H
30#define PXFOUNDATION_PXUNIXSSE2AOS_H
31
32// no includes here! this file should be included from PxcVecMath.h only!!!
33
34#if !COMPILE_VECTOR_INTRINSICS
35#error Vector intrinsics should not be included when using scalar implementation.
36#endif
37
38namespace physx
39{
40namespace aos
41{
42
43#if PX_EMSCRIPTEN
44typedef int8_t __int8_t;
45typedef int16_t __int16_t;
46typedef int32_t __int32_t;
47typedef int64_t __int64_t;
48typedef uint16_t __uint16_t;
49typedef uint32_t __uint32_t;
50typedef uint64_t __uint64_t;
51#endif
52
53typedef union UnionM128
54{
55 UnionM128()
56 {
57 }
58 UnionM128(__m128 in)
59 {
60 m128 = in;
61 }
62
63 UnionM128(__m128i in)
64 {
65 m128i = in;
66 }
67
68 operator __m128()
69 {
70 return m128;
71 }
72
73 operator const __m128() const
74 {
75 return m128;
76 }
77
78 float m128_f32[4];
79 __int8_t m128_i8[16];
80 __int16_t m128_i16[8];
81 __int32_t m128_i32[4];
82 __int64_t m128_i64[2];
83 __uint16_t m128_u16[8];
84 __uint32_t m128_u32[4];
85 __uint64_t m128_u64[2];
86 __m128 m128;
87 __m128i m128i;
88} UnionM128;
89
90typedef __m128 FloatV;
91typedef __m128 Vec3V;
92typedef __m128 Vec4V;
93typedef __m128 BoolV;
94typedef __m128 QuatV;
95typedef __m128i VecI32V;
96typedef UnionM128 VecU32V;
97typedef UnionM128 VecU16V;
98typedef UnionM128 VecI16V;
99typedef UnionM128 VecU8V;
100
101#define FloatVArg FloatV &
102#define Vec3VArg Vec3V &
103#define Vec4VArg Vec4V &
104#define BoolVArg BoolV &
105#define VecU32VArg VecU32V &
106#define VecI32VArg VecI32V &
107#define VecU16VArg VecU16V &
108#define VecI16VArg VecI16V &
109#define VecU8VArg VecU8V &
110#define QuatVArg QuatV &
111
112// Optimization for situations in which you cross product multiple vectors with the same vector.
113// Avoids 2X shuffles per product
115{
116 Vec3V mL1;
117 Vec3V mR1;
118};
119
121{
122 VecI32V shift;
123};
124#define VecShiftVArg VecShiftV &
125
126PX_ALIGN_PREFIX(16)
127struct Mat33V
128{
129 Mat33V()
130 {
131 }
132 Mat33V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2) : col0(c0), col1(c1), col2(c2)
133 {
134 }
135 Vec3V PX_ALIGN(16, col0);
136 Vec3V PX_ALIGN(16, col1);
137 Vec3V PX_ALIGN(16, col2);
138} PX_ALIGN_SUFFIX(16);
139
140PX_ALIGN_PREFIX(16)
141struct Mat34V
142{
143 Mat34V()
144 {
145 }
146 Mat34V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2, const Vec3V& c3) : col0(c0), col1(c1), col2(c2), col3(c3)
147 {
148 }
149 Vec3V PX_ALIGN(16, col0);
150 Vec3V PX_ALIGN(16, col1);
151 Vec3V PX_ALIGN(16, col2);
152 Vec3V PX_ALIGN(16, col3);
153} PX_ALIGN_SUFFIX(16);
154
155PX_ALIGN_PREFIX(16)
156struct Mat43V
157{
158 Mat43V()
159 {
160 }
161 Mat43V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2) : col0(c0), col1(c1), col2(c2)
162 {
163 }
164 Vec4V PX_ALIGN(16, col0);
165 Vec4V PX_ALIGN(16, col1);
166 Vec4V PX_ALIGN(16, col2);
167} PX_ALIGN_SUFFIX(16);
168
169PX_ALIGN_PREFIX(16)
170struct Mat44V
171{
172 Mat44V()
173 {
174 }
175 Mat44V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2, const Vec4V& c3) : col0(c0), col1(c1), col2(c2), col3(c3)
176 {
177 }
178 Vec4V PX_ALIGN(16, col0);
179 Vec4V PX_ALIGN(16, col1);
180 Vec4V PX_ALIGN(16, col2);
181 Vec4V PX_ALIGN(16, col3);
182} PX_ALIGN_SUFFIX(16);
183
184} // namespace aos
185} // namespace physx
186
187#endif // PXFOUNDATION_PXUNIXSSE2AOS_H
#define PX_ALIGN(alignment, decl)
Definition PxPreprocessor.h:402
uint64 uint64_t
Definition fwd.hpp:145
int8 int8_t
Definition fwd.hpp:43
int64 int64_t
Definition fwd.hpp:85
uint32 uint32_t
Definition fwd.hpp:131
int32 int32_t
Definition fwd.hpp:71
uint16 uint16_t
Definition fwd.hpp:117
int16 int16_t
Definition fwd.hpp:57
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
Definition PxVecMathAoSScalar.h:90
Definition PxVecMathAoSScalar.h:52
Definition PxVecMathAoSScalar.h:101
Definition PxVecMathAoSScalar.h:77
Definition PxVecMathAoSScalar.h:65
Definition PxUnixSse2AoS.h:115
Definition PxVecMathAoSScalar.h:188
Definition PxVecMathAoSScalar.h:172
Definition PxUnixSse2AoS.h:121
Definition PxVecMathAoSScalar.h:208
Definition PxVecMathAoSScalar.h:156
Definition PxUnixSse2AoS.h:54