Init
This commit is contained in:
142
physx/source/foundation/include/windows/PsWindowsAoS.h
Normal file
142
physx/source/foundation/include/windows/PsWindowsAoS.h
Normal file
@ -0,0 +1,142 @@
|
||||
//
|
||||
// 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_PSWINDOWSAOS_H
|
||||
#define PSFOUNDATION_PSWINDOWSAOS_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
|
||||
{
|
||||
|
||||
typedef __m128 FloatV;
|
||||
typedef __m128 Vec3V;
|
||||
typedef __m128 Vec4V;
|
||||
typedef __m128 BoolV;
|
||||
typedef __m128 VecU32V;
|
||||
typedef __m128 VecI32V;
|
||||
typedef __m128 VecU16V;
|
||||
typedef __m128 VecI16V;
|
||||
typedef __m128 QuatV;
|
||||
|
||||
#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 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_PSWINDOWSAOS_H
|
||||
51
physx/source/foundation/include/windows/PsWindowsFPU.h
Normal file
51
physx/source/foundation/include/windows/PsWindowsFPU.h
Normal file
@ -0,0 +1,51 @@
|
||||
//
|
||||
// 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_PSWINDOWSFPU_H
|
||||
#define PSFOUNDATION_PSWINDOWSFPU_H
|
||||
|
||||
PX_INLINE physx::shdfnd::SIMDGuard::SIMDGuard()
|
||||
{
|
||||
#if !PX_ARM && !PX_A64
|
||||
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_ARM && !PX_A64
|
||||
// restore control word and clear any exception flags
|
||||
// (setting exception state flags cause exceptions on the first following fp operation)
|
||||
_mm_setcsr(mControlWord & ~_MM_EXCEPT_MASK);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // #ifndef PSFOUNDATION_PSWINDOWSFPU_H
|
||||
104
physx/source/foundation/include/windows/PsWindowsInclude.h
Normal file
104
physx/source/foundation/include/windows/PsWindowsInclude.h
Normal file
@ -0,0 +1,104 @@
|
||||
//
|
||||
// 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_PSWINDOWSINCLUDE_H
|
||||
#define PSFOUNDATION_PSWINDOWSINCLUDE_H
|
||||
|
||||
#include "Ps.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#error "This file should only be included by Windows builds!!"
|
||||
#endif
|
||||
|
||||
#ifdef _WINDOWS_ // windows already included
|
||||
#error "Only include windows.h through this file!!"
|
||||
#endif
|
||||
|
||||
// We only support >= Windows XP, and we need this for critical section and
|
||||
// Setting this hides some important APIs (e.g. LoadPackagedLibrary), so don't do it
|
||||
#if !PX_UWP
|
||||
#define _WIN32_WINNT 0x0501
|
||||
#else
|
||||
#define _WIN32_WINNT 0x0602
|
||||
#endif
|
||||
|
||||
// turn off as much as we can for windows. All we really need is the thread functions(critical sections/Interlocked*
|
||||
// etc)
|
||||
#define NOGDICAPMASKS
|
||||
#define NOVIRTUALKEYCODES
|
||||
#define NOWINMESSAGES
|
||||
#define NOWINSTYLES
|
||||
#define NOSYSMETRICS
|
||||
#define NOMENUS
|
||||
#define NOICONS
|
||||
#define NOKEYSTATES
|
||||
#define NOSYSCOMMANDS
|
||||
#define NORASTEROPS
|
||||
#define NOSHOWWINDOW
|
||||
#define NOATOM
|
||||
#define NOCLIPBOARD
|
||||
#define NOCOLOR
|
||||
#define NOCTLMGR
|
||||
#define NODRAWTEXT
|
||||
#define NOGDI
|
||||
#define NOMB
|
||||
#define NOMEMMGR
|
||||
#define NOMETAFILE
|
||||
#define NOMINMAX
|
||||
#define NOOPENFILE
|
||||
#define NOSCROLL
|
||||
#define NOSERVICE
|
||||
#define NOSOUND
|
||||
#define NOTEXTMETRIC
|
||||
#define NOWH
|
||||
#define NOWINOFFSETS
|
||||
#define NOCOMM
|
||||
#define NOKANJI
|
||||
#define NOHELP
|
||||
#define NOPROFILER
|
||||
#define NODEFERWINDOWPOS
|
||||
#define NOMCX
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
// We need a slightly wider API surface for e.g. MultiByteToWideChar
|
||||
#if !PX_UWP
|
||||
#define NOUSER
|
||||
#define NONLS
|
||||
#define NOMSG
|
||||
#endif
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4668) //'symbol' is not defined as a preprocessor macro, replacing with '0' for 'directives'
|
||||
#include <windows.h>
|
||||
#pragma warning(pop)
|
||||
|
||||
#if PX_SSE2
|
||||
#include <xmmintrin.h>
|
||||
#endif
|
||||
|
||||
#endif // #ifndef PSFOUNDATION_PSWINDOWSINCLUDE_H
|
||||
3132
physx/source/foundation/include/windows/PsWindowsInlineAoS.h
Normal file
3132
physx/source/foundation/include/windows/PsWindowsInlineAoS.h
Normal file
File diff suppressed because it is too large
Load Diff
193
physx/source/foundation/include/windows/PsWindowsIntrinsics.h
Normal file
193
physx/source/foundation/include/windows/PsWindowsIntrinsics.h
Normal file
@ -0,0 +1,193 @@
|
||||
//
|
||||
// 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_PSWINDOWSINTRINSICS_H
|
||||
#define PSFOUNDATION_PSWINDOWSINTRINSICS_H
|
||||
|
||||
#include "Ps.h"
|
||||
#include "foundation/PxAssert.h"
|
||||
|
||||
// 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_WINDOWS_FAMILY
|
||||
#error "This file should only be included by Windows builds!!"
|
||||
#endif
|
||||
|
||||
#pragma warning(push)
|
||||
//'symbol' is not defined as a preprocessor macro, replacing with '0' for 'directives'
|
||||
#pragma warning(disable : 4668)
|
||||
#if PX_VC == 10
|
||||
#pragma warning(disable : 4987) // nonstandard extension used: 'throw (...)'
|
||||
#endif
|
||||
#include <intrin.h>
|
||||
#pragma warning(pop)
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4985) // 'symbol name': attributes not present on previous declaration
|
||||
#include <math.h>
|
||||
#pragma warning(pop)
|
||||
|
||||
#include <float.h>
|
||||
// do not include for ARM target
|
||||
#if !PX_ARM && !PX_A64
|
||||
#include <mmintrin.h>
|
||||
#endif
|
||||
|
||||
#pragma intrinsic(_BitScanForward)
|
||||
#pragma intrinsic(_BitScanReverse)
|
||||
|
||||
namespace physx
|
||||
{
|
||||
namespace shdfnd
|
||||
{
|
||||
|
||||
/*
|
||||
* Implements a memory barrier
|
||||
*/
|
||||
PX_FORCE_INLINE void memoryBarrier()
|
||||
{
|
||||
_ReadWriteBarrier();
|
||||
/* long Barrier;
|
||||
__asm {
|
||||
xchg Barrier, eax
|
||||
}*/
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the index of the highest set bit. Not valid for zero arg.
|
||||
*/
|
||||
PX_FORCE_INLINE uint32_t highestSetBitUnsafe(uint32_t v)
|
||||
{
|
||||
unsigned long retval;
|
||||
_BitScanReverse(&retval, v);
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the index of the highest set bit. Undefined for zero arg.
|
||||
*/
|
||||
PX_FORCE_INLINE uint32_t lowestSetBitUnsafe(uint32_t v)
|
||||
{
|
||||
unsigned long retval;
|
||||
_BitScanForward(&retval, v);
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the number of leading zeros in v. Returns 32 for v=0.
|
||||
*/
|
||||
PX_FORCE_INLINE uint32_t countLeadingZeros(uint32_t v)
|
||||
{
|
||||
if(v)
|
||||
{
|
||||
unsigned long bsr = (unsigned long)-1;
|
||||
_BitScanReverse(&bsr, v);
|
||||
return 31 - bsr;
|
||||
}
|
||||
else
|
||||
return 32;
|
||||
}
|
||||
|
||||
/*!
|
||||
Prefetch aligned cache size around \c ptr+offset.
|
||||
*/
|
||||
#if !PX_ARM && !PX_A64
|
||||
PX_FORCE_INLINE void prefetchLine(const void* ptr, uint32_t offset = 0)
|
||||
{
|
||||
// cache line on X86/X64 is 64-bytes so a 128-byte prefetch would require 2 prefetches.
|
||||
// However, we can only dispatch a limited number of prefetch instructions so we opt to prefetch just 1 cache line
|
||||
/*_mm_prefetch(((const char*)ptr + offset), _MM_HINT_T0);*/
|
||||
// We get slightly better performance prefetching to non-temporal addresses instead of all cache levels
|
||||
_mm_prefetch(((const char*)ptr + offset), _MM_HINT_NTA);
|
||||
}
|
||||
#else
|
||||
PX_FORCE_INLINE void prefetchLine(const void* ptr, uint32_t offset = 0)
|
||||
{
|
||||
// arm does have 32b cache line size
|
||||
__prefetch(((const char*)ptr + offset));
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
Prefetch \c count bytes starting at \c ptr.
|
||||
*/
|
||||
#if !PX_ARM
|
||||
PX_FORCE_INLINE void prefetch(const void* ptr, uint32_t count = 1)
|
||||
{
|
||||
const char* cp = (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);
|
||||
}
|
||||
#else
|
||||
PX_FORCE_INLINE void prefetch(const void* ptr, uint32_t count = 1)
|
||||
{
|
||||
const char* cp = (char*)ptr;
|
||||
uint32_t p = size_t(ptr);
|
||||
uint32_t startLine = p >> 5, endLine = (p + count - 1) >> 5;
|
||||
uint32_t lines = endLine - startLine + 1;
|
||||
do
|
||||
{
|
||||
prefetchLine(cp);
|
||||
cp += 32;
|
||||
} 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_PSWINDOWSINTRINSICS_H
|
||||
@ -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_PSWINDOWSTRIGCONSTANTS_H
|
||||
#define PSFOUNDATION_PSWINDOWSTRIGCONSTANTS_H
|
||||
|
||||
namespace physx
|
||||
{
|
||||
namespace shdfnd
|
||||
{
|
||||
namespace aos
|
||||
{
|
||||
|
||||
#define PX_GLOBALCONST extern const __declspec(selectany)
|
||||
|
||||
__declspec(align(16)) struct PX_VECTORF32
|
||||
{
|
||||
float f[4];
|
||||
};
|
||||
|
||||
//#define PX_PI 3.141592654f
|
||||
//#define PX_2PI 6.283185307f
|
||||
//#define PX_1DIVPI 0.318309886f
|
||||
//#define PX_1DIV2PI 0.159154943f
|
||||
//#define PX_PIDIV2 1.570796327f
|
||||
//#define PX_PIDIV4 0.785398163f
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user