E:/p4/sw/physx/PxShared/1.0/trunk/src/foundation/include/PsFPU.h
Go to the documentation of this file.00001 // This code contains NVIDIA Confidential Information and is disclosed to you 00002 // under a form of NVIDIA software license agreement provided separately to you. 00003 // 00004 // Notice 00005 // NVIDIA Corporation and its licensors retain all intellectual property and 00006 // proprietary rights in and to this software and related documentation and 00007 // any modifications thereto. Any use, reproduction, disclosure, or 00008 // distribution of this software and related documentation without an express 00009 // license agreement from NVIDIA Corporation is strictly prohibited. 00010 // 00011 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES 00012 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO 00013 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, 00014 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. 00015 // 00016 // Information and code furnished is believed to be accurate and reliable. 00017 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such 00018 // information or for any infringement of patents or other rights of third parties that may 00019 // result from its use. No license is granted by implication or otherwise under any patent 00020 // or patent rights of NVIDIA Corporation. Details are subject to change without notice. 00021 // This code supersedes and replaces all information previously supplied. 00022 // NVIDIA Corporation products are not authorized for use as critical 00023 // components in life support devices or systems without express written approval of 00024 // NVIDIA Corporation. 00025 // 00026 // Copyright (c) 2008-2014 NVIDIA Corporation. All rights reserved. 00027 // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. 00028 // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. 00029 00030 #ifndef PSFOUNDATION_PSFPU_H 00031 #define PSFOUNDATION_PSFPU_H 00032 00033 #include "Ps.h" 00034 #include "PsIntrinsics.h" 00035 00036 #define PX_IR(x) ((uint32_t&)(x)) 00037 #define PX_SIR(x) ((int32_t&)(x)) 00038 #define PX_FR(x) ((float&)(x)) 00039 00040 // signed integer representation of a floating-point value. 00041 00042 // Floating-point representation of a integer value. 00043 00044 #define PX_SIGN_BITMASK 0x80000000 00045 00046 #define PX_FPU_GUARD shdfnd::FPUGuard scopedFpGuard; 00047 #define PX_SIMD_GUARD shdfnd::SIMDGuard scopedFpGuard; 00048 00049 #define PX_SUPPORT_GUARDS (PX_WINDOWS_FAMILY || PX_XBOXONE || PX_LINUX || PX_PS4 || PX_OSX) 00050 00051 namespace physx 00052 { 00053 namespace shdfnd 00054 { 00055 // sets the default SDK state for scalar and SIMD units 00056 class PX_FOUNDATION_API FPUGuard 00057 { 00058 public: 00059 FPUGuard(); // set fpu control word for PhysX 00060 ~FPUGuard(); // restore fpu control word 00061 private: 00062 uint32_t mControlWords[8]; 00063 }; 00064 00065 // sets default SDK state for simd unit only, lighter weight than FPUGuard 00066 class SIMDGuard 00067 { 00068 public: 00069 PX_INLINE SIMDGuard(); // set simd control word for PhysX 00070 PX_INLINE ~SIMDGuard(); // restore simd control word 00071 private: 00072 #if PX_SUPPORT_GUARDS 00073 uint32_t mControlWord; 00074 #endif 00075 }; 00076 00080 PX_FOUNDATION_API void enableFPExceptions(); 00081 00085 PX_FOUNDATION_API void disableFPExceptions(); 00086 00087 } // namespace shdfnd 00088 } // namespace physx 00089 00090 #if PX_WINDOWS_FAMILY || PX_XBOXONE 00091 #include "windows/PsWindowsFPU.h" 00092 #elif PX_LINUX || PX_PS4 || PX_OSX 00093 #include "unix/PsUnixFPU.h" 00094 #else 00095 PX_INLINE physx::shdfnd::SIMDGuard::SIMDGuard() 00096 { 00097 } 00098 PX_INLINE physx::shdfnd::SIMDGuard::~SIMDGuard() 00099 { 00100 } 00101 #endif 00102 00103 #endif // #ifndef PSFOUNDATION_PSFPU_H
Generated on Tue Jul 28 14:21:55 2015 for NVIDIA(R) PsFoundation Reference by
![doxygen](doxygen.png)