RavEngine
Loading...
Searching...
No Matches
PxUnixNeonAoS.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_PXUNIXNEONAOS_H
30#define PXFOUNDATION_PXUNIXNEONAOS_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
38// only ARM NEON compatible platforms should reach this
39#include <arm_neon.h>
40
41namespace physx
42{
43namespace aos
44{
45
46typedef float32x2_t FloatV;
47typedef float32x4_t Vec3V;
48typedef float32x4_t Vec4V;
49typedef uint32x4_t BoolV;
50typedef float32x4_t QuatV;
51
52typedef uint32x4_t VecU32V;
53typedef int32x4_t VecI32V;
54typedef uint16x8_t VecU16V;
55typedef int16x8_t VecI16V;
56typedef uint8x16_t VecU8V;
57
58#define FloatVArg FloatV &
59#define Vec3VArg Vec3V &
60#define Vec4VArg Vec4V &
61#define BoolVArg BoolV &
62#define VecU32VArg VecU32V &
63#define VecI32VArg VecI32V &
64#define VecU16VArg VecU16V &
65#define VecI16VArg VecI16V &
66#define VecU8VArg VecU8V &
67#define QuatVArg QuatV &
68
69// KS - TODO - make an actual VecCrossV type for NEON
70#define VecCrossV Vec3V
71
72typedef VecI32V VecShiftV;
73#define VecShiftVArg VecShiftV &
74
75PX_ALIGN_PREFIX(16)
76struct Mat33V
77{
78 Mat33V()
79 {
80 }
81 Mat33V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2) : col0(c0), col1(c1), col2(c2)
82 {
83 }
84 Vec3V PX_ALIGN(16, col0);
85 Vec3V PX_ALIGN(16, col1);
86 Vec3V PX_ALIGN(16, col2);
87} PX_ALIGN_SUFFIX(16);
88
89PX_ALIGN_PREFIX(16)
90struct Mat34V
91{
92 Mat34V()
93 {
94 }
95 Mat34V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2, const Vec3V& c3) : col0(c0), col1(c1), col2(c2), col3(c3)
96 {
97 }
98 Vec3V PX_ALIGN(16, col0);
99 Vec3V PX_ALIGN(16, col1);
100 Vec3V PX_ALIGN(16, col2);
101 Vec3V PX_ALIGN(16, col3);
102} PX_ALIGN_SUFFIX(16);
103
104PX_ALIGN_PREFIX(16)
105struct Mat43V
106{
107 Mat43V()
108 {
109 }
110 Mat43V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2) : col0(c0), col1(c1), col2(c2)
111 {
112 }
113 Vec4V PX_ALIGN(16, col0);
114 Vec4V PX_ALIGN(16, col1);
115 Vec4V PX_ALIGN(16, col2);
116} PX_ALIGN_SUFFIX(16);
117
118PX_ALIGN_PREFIX(16)
119struct Mat44V
120{
121 Mat44V()
122 {
123 }
124 Mat44V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2, const Vec4V& c3) : col0(c0), col1(c1), col2(c2), col3(c3)
125 {
126 }
127 Vec4V PX_ALIGN(16, col0);
128 Vec4V PX_ALIGN(16, col1);
129 Vec4V PX_ALIGN(16, col2);
130 Vec4V PX_ALIGN(16, col3);
131} PX_ALIGN_SUFFIX(16);
132
133} // namespace aos
134} // namespace physx
135
136#endif // PXFOUNDATION_PXUNIXNEONAOS_H
#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