RavEngine
Loading...
Searching...
No Matches
PxWindowsAoS.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 PX_WINDOWS_AOS_H
30#define PX_WINDOWS_AOS_H
31
32// no includes here! this file should be included from PxAOS.h only!!!
33
34#if !COMPILE_VECTOR_INTRINSICS
35#error Vector intrinsics should not be included when using scalar implementation.
36#endif
37
38#if !PX_DOXYGEN
39namespace physx
40{
41#endif
42namespace aos
43{
44
45typedef __m128 FloatV;
46typedef __m128 Vec3V;
47typedef __m128 Vec4V;
48typedef __m128 BoolV;
49typedef __m128 VecU32V;
50typedef __m128 VecI32V;
51typedef __m128 VecU16V;
52typedef __m128 VecI16V;
53typedef __m128 QuatV;
54
55#define FloatVArg FloatV &
56#define Vec3VArg Vec3V &
57#define Vec4VArg Vec4V &
58#define BoolVArg BoolV &
59#define VecU32VArg VecU32V &
60#define VecI32VArg VecI32V &
61#define VecU16VArg VecU16V &
62#define VecI16VArg VecI16V &
63#define QuatVArg QuatV &
64
65// Optimization for situations in which you cross product multiple vectors with the same vector.
66// Avoids 2X shuffles per product
67struct VecCrossV
68{
69 Vec3V mL1;
70 Vec3V mR1;
71};
72
73struct VecShiftV
74{
75 VecI32V shift;
76};
77#define VecShiftVArg VecShiftV &
78
79PX_ALIGN_PREFIX(16)
80struct Mat33V
81{
82 Mat33V()
83 {
84 }
85 Mat33V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2) : col0(c0), col1(c1), col2(c2)
86 {
87 }
88 Vec3V PX_ALIGN(16, col0);
89 Vec3V PX_ALIGN(16, col1);
90 Vec3V PX_ALIGN(16, col2);
91} PX_ALIGN_SUFFIX(16);
92
93PX_ALIGN_PREFIX(16)
94struct Mat34V
95{
96 Mat34V()
97 {
98 }
99 Mat34V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2, const Vec3V& c3) : col0(c0), col1(c1), col2(c2), col3(c3)
100 {
101 }
102 Vec3V PX_ALIGN(16, col0);
103 Vec3V PX_ALIGN(16, col1);
104 Vec3V PX_ALIGN(16, col2);
105 Vec3V PX_ALIGN(16, col3);
106} PX_ALIGN_SUFFIX(16);
107
108PX_ALIGN_PREFIX(16)
109struct Mat43V
110{
111 Mat43V()
112 {
113 }
114 Mat43V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2) : col0(c0), col1(c1), col2(c2)
115 {
116 }
117 Vec4V PX_ALIGN(16, col0);
118 Vec4V PX_ALIGN(16, col1);
119 Vec4V PX_ALIGN(16, col2);
120} PX_ALIGN_SUFFIX(16);
121
122PX_ALIGN_PREFIX(16)
123struct Mat44V
124{
125 Mat44V()
126 {
127 }
128 Mat44V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2, const Vec4V& c3) : col0(c0), col1(c1), col2(c2), col3(c3)
129 {
130 }
131 Vec4V PX_ALIGN(16, col0);
132 Vec4V PX_ALIGN(16, col1);
133 Vec4V PX_ALIGN(16, col2);
134 Vec4V PX_ALIGN(16, col3);
135} PX_ALIGN_SUFFIX(16);
136
137} // namespace aos
138#if !PX_DOXYGEN
139} // namespace physx
140#endif
141
142#endif
143
#define PX_ALIGN(alignment, decl)
Definition PxPreprocessor.h:402
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39