Init
This commit is contained in:
47
physx/source/foundation/include/unix/PsUnixAoS.h
Normal file
47
physx/source/foundation/include/unix/PsUnixAoS.h
Normal file
@ -0,0 +1,47 @@
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef PSFOUNDATION_PSUNIXAOS_H
|
||||
#define PSFOUNDATION_PSUNIXAOS_H
|
||||
|
||||
// no includes here! this file should be included from PxcVecMath.h only!!!
|
||||
|
||||
#if !COMPILE_VECTOR_INTRINSICS
|
||||
#error Vector intrinsics should not be included when using scalar implementation.
|
||||
#endif
|
||||
|
||||
#if PX_INTEL_FAMILY
|
||||
#include "sse2/PsUnixSse2AoS.h"
|
||||
#elif PX_NEON
|
||||
#include "neon/PsUnixNeonAoS.h"
|
||||
#else
|
||||
#error No SIMD implementation for this unix platform.
|
||||
#endif
|
||||
|
||||
#endif // PSFOUNDATION_PSUNIXAOS_H
|
||||
68
physx/source/foundation/include/unix/PsUnixFPU.h
Normal file
68
physx/source/foundation/include/unix/PsUnixFPU.h
Normal file
@ -0,0 +1,68 @@
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef PSFOUNDATION_PSUNIXFPU_H
|
||||
#define PSFOUNDATION_PSUNIXFPU_H
|
||||
|
||||
#include "foundation/PxPreprocessor.h"
|
||||
|
||||
#if PX_LINUX || PX_PS4 || PX_OSX
|
||||
|
||||
#if PX_X86 || PX_X64
|
||||
#if PX_EMSCRIPTEN
|
||||
#include <emmintrin.h>
|
||||
#endif
|
||||
#include <xmmintrin.h>
|
||||
#elif PX_NEON
|
||||
#include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
PX_INLINE physx::shdfnd::SIMDGuard::SIMDGuard()
|
||||
{
|
||||
#if !PX_EMSCRIPTEN && (PX_X86 || PX_X64)
|
||||
mControlWord = _mm_getcsr();
|
||||
// set default (disable exceptions: _MM_MASK_MASK) and FTZ (_MM_FLUSH_ZERO_ON), DAZ (_MM_DENORMALS_ZERO_ON: (1<<6))
|
||||
_mm_setcsr(_MM_MASK_MASK | _MM_FLUSH_ZERO_ON | (1 << 6));
|
||||
#endif
|
||||
}
|
||||
|
||||
PX_INLINE physx::shdfnd::SIMDGuard::~SIMDGuard()
|
||||
{
|
||||
#if !PX_EMSCRIPTEN && (PX_X86 || PX_X64)
|
||||
// restore control word and clear exception flags
|
||||
// (setting exception state flags cause exceptions on the first following fp operation)
|
||||
_mm_setcsr(mControlWord & ~_MM_EXCEPT_MASK);
|
||||
#endif
|
||||
}
|
||||
|
||||
#else
|
||||
#error No SIMD implementation for this unix platform.
|
||||
#endif // PX_LINUX || PX_PS4 || PX_OSX
|
||||
|
||||
#endif // #ifndef PSFOUNDATION_PSUNIXFPU_H
|
||||
45
physx/source/foundation/include/unix/PsUnixInlineAoS.h
Normal file
45
physx/source/foundation/include/unix/PsUnixInlineAoS.h
Normal file
@ -0,0 +1,45 @@
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef PSFOUNDATION_PSUNIXINLINEAOS_H
|
||||
#define PSFOUNDATION_PSUNIXINLINEAOS_H
|
||||
|
||||
#if !COMPILE_VECTOR_INTRINSICS
|
||||
#error Vector intrinsics should not be included when using scalar implementation.
|
||||
#endif
|
||||
|
||||
#if PX_INTEL_FAMILY
|
||||
#include "sse2/PsUnixSse2InlineAoS.h"
|
||||
#elif PX_NEON
|
||||
#include "neon/PsUnixNeonInlineAoS.h"
|
||||
#else
|
||||
#error No SIMD implementation for this unix platform.
|
||||
#endif
|
||||
|
||||
#endif // PSFOUNDATION_PSUNIXINLINEAOS_H
|
||||
153
physx/source/foundation/include/unix/PsUnixIntrinsics.h
Normal file
153
physx/source/foundation/include/unix/PsUnixIntrinsics.h
Normal file
@ -0,0 +1,153 @@
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef PSFOUNDATION_PSUNIXINTRINSICS_H
|
||||
#define PSFOUNDATION_PSUNIXINTRINSICS_H
|
||||
|
||||
#include "Ps.h"
|
||||
#include "foundation/PxAssert.h"
|
||||
#include <math.h>
|
||||
|
||||
#if PX_ANDROID
|
||||
#include <signal.h> // for Ns::debugBreak() { raise(SIGTRAP); }
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#include <libkern/OSAtomic.h>
|
||||
#endif
|
||||
|
||||
// this file is for internal intrinsics - that is, intrinsics that are used in
|
||||
// cross platform code but do not appear in the API
|
||||
|
||||
#if !(PX_LINUX || PX_ANDROID || PX_PS4 || PX_APPLE_FAMILY)
|
||||
#error "This file should only be included by unix builds!!"
|
||||
#endif
|
||||
|
||||
namespace physx
|
||||
{
|
||||
namespace shdfnd
|
||||
{
|
||||
|
||||
PX_FORCE_INLINE void memoryBarrier()
|
||||
{
|
||||
__sync_synchronize();
|
||||
}
|
||||
|
||||
/*!
|
||||
Return the index of the highest set bit. Undefined for zero arg.
|
||||
*/
|
||||
PX_INLINE uint32_t highestSetBitUnsafe(uint32_t v)
|
||||
{
|
||||
|
||||
return 31 - __builtin_clz(v);
|
||||
}
|
||||
|
||||
/*!
|
||||
Return the index of the highest set bit. Undefined for zero arg.
|
||||
*/
|
||||
PX_INLINE int32_t lowestSetBitUnsafe(uint32_t v)
|
||||
{
|
||||
return __builtin_ctz(v);
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the index of the highest set bit. Returns 32 for v=0.
|
||||
*/
|
||||
PX_INLINE uint32_t countLeadingZeros(uint32_t v)
|
||||
{
|
||||
if(v)
|
||||
return __builtin_clz(v);
|
||||
else
|
||||
return 32;
|
||||
}
|
||||
|
||||
/*!
|
||||
Prefetch aligned 64B x86, 32b ARM around \c ptr+offset.
|
||||
*/
|
||||
PX_FORCE_INLINE void prefetchLine(const void* ptr, uint32_t offset = 0)
|
||||
{
|
||||
__builtin_prefetch(reinterpret_cast<const char* PX_RESTRICT>(ptr) + offset, 0, 3);
|
||||
}
|
||||
|
||||
/*!
|
||||
Prefetch \c count bytes starting at \c ptr.
|
||||
*/
|
||||
#if PX_ANDROID || PX_IOS
|
||||
PX_FORCE_INLINE void prefetch(const void* ptr, uint32_t count = 1)
|
||||
{
|
||||
const char* cp = static_cast<const char*>(ptr);
|
||||
size_t p = reinterpret_cast<size_t>(ptr);
|
||||
uint32_t startLine = uint32_t(p >> 5), endLine = uint32_t((p + count - 1) >> 5);
|
||||
uint32_t lines = endLine - startLine + 1;
|
||||
do
|
||||
{
|
||||
prefetchLine(cp);
|
||||
cp += 32;
|
||||
} while(--lines);
|
||||
}
|
||||
#else
|
||||
PX_FORCE_INLINE void prefetch(const void* ptr, uint32_t count = 1)
|
||||
{
|
||||
const char* cp = reinterpret_cast<const char*>(ptr);
|
||||
uint64_t p = size_t(ptr);
|
||||
uint64_t startLine = p >> 6, endLine = (p + count - 1) >> 6;
|
||||
uint64_t lines = endLine - startLine + 1;
|
||||
do
|
||||
{
|
||||
prefetchLine(cp);
|
||||
cp += 64;
|
||||
} while(--lines);
|
||||
}
|
||||
#endif
|
||||
|
||||
//! \brief platform-specific reciprocal
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE float recipFast(float a)
|
||||
{
|
||||
return 1.0f / a;
|
||||
}
|
||||
|
||||
//! \brief platform-specific fast reciprocal square root
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE float recipSqrtFast(float a)
|
||||
{
|
||||
return 1.0f / ::sqrtf(a);
|
||||
}
|
||||
|
||||
//! \brief platform-specific floor
|
||||
PX_CUDA_CALLABLE PX_FORCE_INLINE float floatFloor(float x)
|
||||
{
|
||||
return ::floorf(x);
|
||||
}
|
||||
|
||||
#define NS_EXPECT_TRUE(x) x
|
||||
#define NS_EXPECT_FALSE(x) x
|
||||
|
||||
} // namespace shdfnd
|
||||
} // namespace physx
|
||||
|
||||
#endif // #ifndef PSFOUNDATION_PSUNIXINTRINSICS_H
|
||||
98
physx/source/foundation/include/unix/PsUnixTrigConstants.h
Normal file
98
physx/source/foundation/include/unix/PsUnixTrigConstants.h
Normal file
@ -0,0 +1,98 @@
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef PSFOUNDATION_PSUNIXTRIGCONSTANTS_H
|
||||
#define PSFOUNDATION_PSUNIXTRIGCONSTANTS_H
|
||||
|
||||
#include "foundation/PxPreprocessor.h"
|
||||
|
||||
namespace physx
|
||||
{
|
||||
namespace shdfnd
|
||||
{
|
||||
namespace aos
|
||||
{
|
||||
|
||||
#if PX_UWP
|
||||
#define PX_GLOBALCONST extern const __declspec(selectany)
|
||||
#else
|
||||
#define PX_GLOBALCONST extern const __attribute__((weak))
|
||||
#endif
|
||||
|
||||
PX_ALIGN_PREFIX(16)
|
||||
struct PX_VECTORF32
|
||||
{
|
||||
float f[4];
|
||||
} PX_ALIGN_SUFFIX(16);
|
||||
|
||||
PX_GLOBALCONST PX_VECTORF32 g_PXSinCoefficients0 = { { 1.0f, -0.166666667f, 8.333333333e-3f, -1.984126984e-4f } };
|
||||
PX_GLOBALCONST PX_VECTORF32
|
||||
g_PXSinCoefficients1 = { { 2.755731922e-6f, -2.505210839e-8f, 1.605904384e-10f, -7.647163732e-13f } };
|
||||
PX_GLOBALCONST PX_VECTORF32
|
||||
g_PXSinCoefficients2 = { { 2.811457254e-15f, -8.220635247e-18f, 1.957294106e-20f, -3.868170171e-23f } };
|
||||
PX_GLOBALCONST PX_VECTORF32 g_PXCosCoefficients0 = { { 1.0f, -0.5f, 4.166666667e-2f, -1.388888889e-3f } };
|
||||
PX_GLOBALCONST PX_VECTORF32
|
||||
g_PXCosCoefficients1 = { { 2.480158730e-5f, -2.755731922e-7f, 2.087675699e-9f, -1.147074560e-11f } };
|
||||
PX_GLOBALCONST PX_VECTORF32
|
||||
g_PXCosCoefficients2 = { { 4.779477332e-14f, -1.561920697e-16f, 4.110317623e-19f, -8.896791392e-22f } };
|
||||
PX_GLOBALCONST PX_VECTORF32 g_PXTanCoefficients0 = { { 1.0f, 0.333333333f, 0.133333333f, 5.396825397e-2f } };
|
||||
PX_GLOBALCONST PX_VECTORF32
|
||||
g_PXTanCoefficients1 = { { 2.186948854e-2f, 8.863235530e-3f, 3.592128167e-3f, 1.455834485e-3f } };
|
||||
PX_GLOBALCONST PX_VECTORF32
|
||||
g_PXTanCoefficients2 = { { 5.900274264e-4f, 2.391290764e-4f, 9.691537707e-5f, 3.927832950e-5f } };
|
||||
PX_GLOBALCONST PX_VECTORF32
|
||||
g_PXASinCoefficients0 = { { -0.05806367563904f, -0.41861972469416f, 0.22480114791621f, 2.17337241360606f } };
|
||||
PX_GLOBALCONST PX_VECTORF32
|
||||
g_PXASinCoefficients1 = { { 0.61657275907170f, 4.29696498283455f, -1.18942822255452f, -6.53784832094831f } };
|
||||
PX_GLOBALCONST PX_VECTORF32
|
||||
g_PXASinCoefficients2 = { { -1.36926553863413f, -4.48179294237210f, 1.41810672941833f, 5.48179257935713f } };
|
||||
PX_GLOBALCONST PX_VECTORF32 g_PXATanCoefficients0 = { { 1.0f, 0.333333334f, 0.2f, 0.142857143f } };
|
||||
PX_GLOBALCONST PX_VECTORF32
|
||||
g_PXATanCoefficients1 = { { 1.111111111e-1f, 9.090909091e-2f, 7.692307692e-2f, 6.666666667e-2f } };
|
||||
PX_GLOBALCONST PX_VECTORF32
|
||||
g_PXATanCoefficients2 = { { 5.882352941e-2f, 5.263157895e-2f, 4.761904762e-2f, 4.347826087e-2f } };
|
||||
PX_GLOBALCONST PX_VECTORF32
|
||||
g_PXSinEstCoefficients = { { 1.0f, -1.66521856991541e-1f, 8.199913018755e-3f, -1.61475937228e-4f } };
|
||||
PX_GLOBALCONST PX_VECTORF32
|
||||
g_PXCosEstCoefficients = { { 1.0f, -4.95348008918096e-1f, 3.878259962881e-2f, -9.24587976263e-4f } };
|
||||
PX_GLOBALCONST PX_VECTORF32 g_PXTanEstCoefficients = { { 2.484f, -1.954923183e-1f, 2.467401101f, PxInvPi } };
|
||||
PX_GLOBALCONST PX_VECTORF32
|
||||
g_PXATanEstCoefficients = { { 7.689891418951e-1f, 1.104742493348f, 8.661844266006e-1f, PxPiDivTwo } };
|
||||
PX_GLOBALCONST PX_VECTORF32
|
||||
g_PXASinEstCoefficients = { { -1.36178272886711f, 2.37949493464538f, -8.08228565650486e-1f, 2.78440142746736e-1f } };
|
||||
PX_GLOBALCONST PX_VECTORF32 g_PXASinEstConstants = { { 1.00000011921f, PxPiDivTwo, 0.0f, 0.0f } };
|
||||
PX_GLOBALCONST PX_VECTORF32 g_PXPiConstants0 = { { PxPi, PxTwoPi, PxInvPi, PxInvTwoPi } };
|
||||
PX_GLOBALCONST PX_VECTORF32 g_PXReciprocalTwoPi = { { PxInvTwoPi, PxInvTwoPi, PxInvTwoPi, PxInvTwoPi } };
|
||||
PX_GLOBALCONST PX_VECTORF32 g_PXTwoPi = { { PxTwoPi, PxTwoPi, PxTwoPi, PxTwoPi } };
|
||||
|
||||
} // namespace aos
|
||||
} // namespace shdfnd
|
||||
} // namespace physx
|
||||
|
||||
#endif
|
||||
140
physx/source/foundation/include/unix/neon/PsUnixNeonAoS.h
Normal file
140
physx/source/foundation/include/unix/neon/PsUnixNeonAoS.h
Normal file
@ -0,0 +1,140 @@
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef PSFOUNDATION_PSUNIXNEONAOS_H
|
||||
#define PSFOUNDATION_PSUNIXNEONAOS_H
|
||||
|
||||
// no includes here! this file should be included from PxcVecMath.h only!!!
|
||||
|
||||
#if !COMPILE_VECTOR_INTRINSICS
|
||||
#error Vector intrinsics should not be included when using scalar implementation.
|
||||
#endif
|
||||
|
||||
// only ARM NEON compatible platforms should reach this
|
||||
#include <arm_neon.h>
|
||||
|
||||
namespace physx
|
||||
{
|
||||
namespace shdfnd
|
||||
{
|
||||
namespace aos
|
||||
{
|
||||
|
||||
typedef float32x2_t FloatV;
|
||||
typedef float32x4_t Vec3V;
|
||||
typedef float32x4_t Vec4V;
|
||||
typedef uint32x4_t BoolV;
|
||||
typedef float32x4_t QuatV;
|
||||
|
||||
typedef uint32x4_t VecU32V;
|
||||
typedef int32x4_t VecI32V;
|
||||
typedef uint16x8_t VecU16V;
|
||||
typedef int16x8_t VecI16V;
|
||||
typedef uint8x16_t VecU8V;
|
||||
|
||||
#define FloatVArg FloatV &
|
||||
#define Vec3VArg Vec3V &
|
||||
#define Vec4VArg Vec4V &
|
||||
#define BoolVArg BoolV &
|
||||
#define VecU32VArg VecU32V &
|
||||
#define VecI32VArg VecI32V &
|
||||
#define VecU16VArg VecU16V &
|
||||
#define VecI16VArg VecI16V &
|
||||
#define VecU8VArg VecU8V &
|
||||
#define QuatVArg QuatV &
|
||||
|
||||
// KS - TODO - make an actual VecCrossV type for NEON
|
||||
#define VecCrossV Vec3V
|
||||
|
||||
typedef VecI32V VecShiftV;
|
||||
#define VecShiftVArg VecShiftV &
|
||||
|
||||
PX_ALIGN_PREFIX(16)
|
||||
struct Mat33V
|
||||
{
|
||||
Mat33V()
|
||||
{
|
||||
}
|
||||
Mat33V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2) : col0(c0), col1(c1), col2(c2)
|
||||
{
|
||||
}
|
||||
Vec3V PX_ALIGN(16, col0);
|
||||
Vec3V PX_ALIGN(16, col1);
|
||||
Vec3V PX_ALIGN(16, col2);
|
||||
} PX_ALIGN_SUFFIX(16);
|
||||
|
||||
PX_ALIGN_PREFIX(16)
|
||||
struct Mat34V
|
||||
{
|
||||
Mat34V()
|
||||
{
|
||||
}
|
||||
Mat34V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2, const Vec3V& c3) : col0(c0), col1(c1), col2(c2), col3(c3)
|
||||
{
|
||||
}
|
||||
Vec3V PX_ALIGN(16, col0);
|
||||
Vec3V PX_ALIGN(16, col1);
|
||||
Vec3V PX_ALIGN(16, col2);
|
||||
Vec3V PX_ALIGN(16, col3);
|
||||
} PX_ALIGN_SUFFIX(16);
|
||||
|
||||
PX_ALIGN_PREFIX(16)
|
||||
struct Mat43V
|
||||
{
|
||||
Mat43V()
|
||||
{
|
||||
}
|
||||
Mat43V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2) : col0(c0), col1(c1), col2(c2)
|
||||
{
|
||||
}
|
||||
Vec4V PX_ALIGN(16, col0);
|
||||
Vec4V PX_ALIGN(16, col1);
|
||||
Vec4V PX_ALIGN(16, col2);
|
||||
} PX_ALIGN_SUFFIX(16);
|
||||
|
||||
PX_ALIGN_PREFIX(16)
|
||||
struct Mat44V
|
||||
{
|
||||
Mat44V()
|
||||
{
|
||||
}
|
||||
Mat44V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2, const Vec4V& c3) : col0(c0), col1(c1), col2(c2), col3(c3)
|
||||
{
|
||||
}
|
||||
Vec4V PX_ALIGN(16, col0);
|
||||
Vec4V PX_ALIGN(16, col1);
|
||||
Vec4V PX_ALIGN(16, col2);
|
||||
Vec4V PX_ALIGN(16, col3);
|
||||
} PX_ALIGN_SUFFIX(16);
|
||||
|
||||
} // namespace aos
|
||||
} // namespace shdfnd
|
||||
} // namespace physx
|
||||
|
||||
#endif // PSFOUNDATION_PSUNIXNEONAOS_H
|
||||
3682
physx/source/foundation/include/unix/neon/PsUnixNeonInlineAoS.h
Normal file
3682
physx/source/foundation/include/unix/neon/PsUnixNeonInlineAoS.h
Normal file
File diff suppressed because it is too large
Load Diff
191
physx/source/foundation/include/unix/sse2/PsUnixSse2AoS.h
Normal file
191
physx/source/foundation/include/unix/sse2/PsUnixSse2AoS.h
Normal file
@ -0,0 +1,191 @@
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
|
||||
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
|
||||
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
|
||||
|
||||
#ifndef PSFOUNDATION_PSUNIXSSE2AOS_H
|
||||
#define PSFOUNDATION_PSUNIXSSE2AOS_H
|
||||
|
||||
// no includes here! this file should be included from PxcVecMath.h only!!!
|
||||
|
||||
#if !COMPILE_VECTOR_INTRINSICS
|
||||
#error Vector intrinsics should not be included when using scalar implementation.
|
||||
#endif
|
||||
|
||||
namespace physx
|
||||
{
|
||||
namespace shdfnd
|
||||
{
|
||||
namespace aos
|
||||
{
|
||||
|
||||
#if PX_EMSCRIPTEN
|
||||
typedef int8_t __int8_t;
|
||||
typedef int16_t __int16_t;
|
||||
typedef int32_t __int32_t;
|
||||
typedef int64_t __int64_t;
|
||||
typedef uint16_t __uint16_t;
|
||||
typedef uint32_t __uint32_t;
|
||||
typedef uint64_t __uint64_t;
|
||||
#endif
|
||||
|
||||
typedef union UnionM128
|
||||
{
|
||||
UnionM128()
|
||||
{
|
||||
}
|
||||
UnionM128(__m128 in)
|
||||
{
|
||||
m128 = in;
|
||||
}
|
||||
|
||||
UnionM128(__m128i in)
|
||||
{
|
||||
m128i = in;
|
||||
}
|
||||
|
||||
operator __m128()
|
||||
{
|
||||
return m128;
|
||||
}
|
||||
|
||||
operator const __m128() const
|
||||
{
|
||||
return m128;
|
||||
}
|
||||
|
||||
float m128_f32[4];
|
||||
__int8_t m128_i8[16];
|
||||
__int16_t m128_i16[8];
|
||||
__int32_t m128_i32[4];
|
||||
__int64_t m128_i64[2];
|
||||
__uint16_t m128_u16[8];
|
||||
__uint32_t m128_u32[4];
|
||||
__uint64_t m128_u64[2];
|
||||
__m128 m128;
|
||||
__m128i m128i;
|
||||
} UnionM128;
|
||||
|
||||
typedef __m128 FloatV;
|
||||
typedef __m128 Vec3V;
|
||||
typedef __m128 Vec4V;
|
||||
typedef __m128 BoolV;
|
||||
typedef __m128 QuatV;
|
||||
typedef __m128i VecI32V;
|
||||
typedef UnionM128 VecU32V;
|
||||
typedef UnionM128 VecU16V;
|
||||
typedef UnionM128 VecI16V;
|
||||
typedef UnionM128 VecU8V;
|
||||
|
||||
#define FloatVArg FloatV &
|
||||
#define Vec3VArg Vec3V &
|
||||
#define Vec4VArg Vec4V &
|
||||
#define BoolVArg BoolV &
|
||||
#define VecU32VArg VecU32V &
|
||||
#define VecI32VArg VecI32V &
|
||||
#define VecU16VArg VecU16V &
|
||||
#define VecI16VArg VecI16V &
|
||||
#define VecU8VArg VecU8V &
|
||||
#define QuatVArg QuatV &
|
||||
|
||||
// Optimization for situations in which you cross product multiple vectors with the same vector.
|
||||
// Avoids 2X shuffles per product
|
||||
struct VecCrossV
|
||||
{
|
||||
Vec3V mL1;
|
||||
Vec3V mR1;
|
||||
};
|
||||
|
||||
struct VecShiftV
|
||||
{
|
||||
VecI32V shift;
|
||||
};
|
||||
#define VecShiftVArg VecShiftV &
|
||||
|
||||
PX_ALIGN_PREFIX(16)
|
||||
struct Mat33V
|
||||
{
|
||||
Mat33V()
|
||||
{
|
||||
}
|
||||
Mat33V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2) : col0(c0), col1(c1), col2(c2)
|
||||
{
|
||||
}
|
||||
Vec3V PX_ALIGN(16, col0);
|
||||
Vec3V PX_ALIGN(16, col1);
|
||||
Vec3V PX_ALIGN(16, col2);
|
||||
} PX_ALIGN_SUFFIX(16);
|
||||
|
||||
PX_ALIGN_PREFIX(16)
|
||||
struct Mat34V
|
||||
{
|
||||
Mat34V()
|
||||
{
|
||||
}
|
||||
Mat34V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2, const Vec3V& c3) : col0(c0), col1(c1), col2(c2), col3(c3)
|
||||
{
|
||||
}
|
||||
Vec3V PX_ALIGN(16, col0);
|
||||
Vec3V PX_ALIGN(16, col1);
|
||||
Vec3V PX_ALIGN(16, col2);
|
||||
Vec3V PX_ALIGN(16, col3);
|
||||
} PX_ALIGN_SUFFIX(16);
|
||||
|
||||
PX_ALIGN_PREFIX(16)
|
||||
struct Mat43V
|
||||
{
|
||||
Mat43V()
|
||||
{
|
||||
}
|
||||
Mat43V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2) : col0(c0), col1(c1), col2(c2)
|
||||
{
|
||||
}
|
||||
Vec4V PX_ALIGN(16, col0);
|
||||
Vec4V PX_ALIGN(16, col1);
|
||||
Vec4V PX_ALIGN(16, col2);
|
||||
} PX_ALIGN_SUFFIX(16);
|
||||
|
||||
PX_ALIGN_PREFIX(16)
|
||||
struct Mat44V
|
||||
{
|
||||
Mat44V()
|
||||
{
|
||||
}
|
||||
Mat44V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2, const Vec4V& c3) : col0(c0), col1(c1), col2(c2), col3(c3)
|
||||
{
|
||||
}
|
||||
Vec4V PX_ALIGN(16, col0);
|
||||
Vec4V PX_ALIGN(16, col1);
|
||||
Vec4V PX_ALIGN(16, col2);
|
||||
Vec4V PX_ALIGN(16, col3);
|
||||
} PX_ALIGN_SUFFIX(16);
|
||||
|
||||
} // namespace aos
|
||||
} // namespace shdfnd
|
||||
} // namespace physx
|
||||
|
||||
#endif // PSFOUNDATION_PSUNIXSSE2AOS_H
|
||||
3239
physx/source/foundation/include/unix/sse2/PsUnixSse2InlineAoS.h
Normal file
3239
physx/source/foundation/include/unix/sse2/PsUnixSse2InlineAoS.h
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user