PhysX SDK 3.2 API Reference: PxPreprocessor.h Source File

PhysX SDK 3.2 API

PxPreprocessor.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-2012 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 
00031 #ifndef PX_FOUNDATION_PX_PREPROCESSOR_H
00032 #define PX_FOUNDATION_PX_PREPROCESSOR_H
00033 
00034 #include <stddef.h>
00051 #ifdef _MSC_VER 
00052 #   define PX_VC
00053 #   if _MSC_VER >= 1600
00054 #       define PX_VC10
00055 #   elif _MSC_VER >= 1500
00056 #       define PX_VC9
00057 #   elif _MSC_VER >= 1400
00058 #       define PX_VC8
00059 #   elif _MSC_VER >= 1300
00060 #       define PX_VC7
00061 #   else
00062 #       define PX_VC6
00063 #   endif
00064 #elif __GNUC__ || __SNC__
00065 #   define PX_GNUC
00066 #elif defined(__MWERKS__)
00067 #   define  PX_CW
00068 #else
00069 #   error "Unknown compiler"
00070 #endif
00071 
00072 
00076 #ifdef PX_VC
00077 #   ifdef _M_IX86
00078 #       define PX_X86
00079 #       define PX_WINDOWS
00080 #   elif defined(_M_X64)
00081 #       define PX_X64
00082 #       define PX_WINDOWS
00083 #   elif defined(_M_PPC)
00084 #       define PX_PPC
00085 #       define PX_X360
00086 #       define PX_VMX
00087 #   elif defined(_M_ARM)
00088 #       define PX_ARM
00089 #       define PX_WIN8ARM
00090 #   else
00091 #       error "Unknown platform"
00092 #   endif
00093 #elif defined PX_GNUC
00094 #   ifdef __CELLOS_LV2__
00095 #   define PX_PS3
00096 #       define PX_VMX
00097 #   elif defined(__arm__)
00098 #   define PX_ARM
00099 #       if defined(__SNC__)
00100 #           define PX_PSP2
00101 #       endif
00102 #   elif defined(__i386__)
00103 #       define PX_X86
00104 #       define PX_VMX
00105 #   elif defined(__x86_64__)
00106 #       define PX_X64
00107 #   elif defined(__ppc__)
00108 #       define PX_PPC
00109 #   elif defined(__ppc64__)
00110 #       define PX_PPC
00111 #   define PX_PPC64
00112 #   else
00113 #   error "Unknown platform"
00114 #   endif
00115 #   if defined(ANDROID)
00116 #       define PX_ANDROID
00117 #   elif defined(__linux__)
00118 #       define PX_LINUX
00119 #   elif defined(__APPLE__)
00120 #       define PX_APPLE
00121 #       if defined(__arm__)
00122 #           define PX_APPLE_IOS
00123 #       endif
00124 #   elif defined(__CYGWIN__)
00125 #       define PX_CYGWIN
00126 #       define PX_LINUX
00127 #   endif
00128 #elif defined PX_CW
00129 #   if defined(__PPCGEKKO__)
00130 #       if defined(RVL)
00131 #           define PX_WII
00132 #       else
00133 #           define PX_GC
00134 #       endif
00135 #   else
00136 #       error "Unknown platform"
00137 #   endif
00138 #endif
00139 
00140 
00144 #ifndef PX_C_EXPORT
00145     #define PX_C_EXPORT extern "C"
00146 #endif
00147 
00157 #if (defined(PX_WINDOWS) || defined(PX_WIN8ARM) ) && !defined(__CUDACC__)
00158     #if defined PX_FOUNDATION_EXPORTS
00159         #define PX_FOUNDATION_API __declspec(dllexport)
00160     #elif defined PX_FOUNDATION_NO_EXPORTS
00161         #define PX_FOUNDATION_API
00162     #else
00163         #define PX_FOUNDATION_API __declspec(dllimport)
00164     #endif
00165 #else
00166     #define PX_FOUNDATION_API 
00167 #endif
00168 
00172 #ifndef PX_CALL_CONV
00173 #   if defined PX_WINDOWS
00174 #       define PX_CALL_CONV __cdecl
00175 #   else
00176 #       define PX_CALL_CONV
00177 #   endif
00178 #endif
00179 
00183 #if defined(PX_VC)
00184 #   define PX_PUSH_PACK_DEFAULT __pragma( pack(push, 8) )
00185 #   define PX_POP_PACK          __pragma( pack(pop) )
00186 #elif defined(PX_GNUC) && !defined(__SPU__)
00187 #   define PX_PUSH_PACK_DEFAULT _Pragma("pack(push, 8)")
00188 #   define PX_POP_PACK          _Pragma("pack(pop)")
00189 #else
00190 #   define PX_PUSH_PACK_DEFAULT
00191 #   define PX_POP_PACK
00192 #endif
00193 
00197 #if defined(PX_WINDOWS) || defined(PX_X360) || defined(PX_WIN8ARM)
00198 #   define PX_INLINE inline
00199 #   pragma inline_depth( 255 )
00200 #else
00201 #   define PX_INLINE inline
00202 #endif
00203 
00207 #if defined(PX_VC)
00208     #define PX_FORCE_INLINE __forceinline
00209 #elif defined(PX_LINUX) // Workaround; Fedora Core 3 do not agree with force inline and PxcPool
00210     #define PX_FORCE_INLINE inline
00211 #elif defined(PX_GNUC)
00212     #define PX_FORCE_INLINE inline __attribute__((always_inline))
00213 #else
00214     #define PX_FORCE_INLINE inline
00215 #endif
00216 
00220 #if defined PX_WINDOWS
00221 #   define PX_NOINLINE __declspec(noinline)
00222 #elif defined(PX_GNUC)
00223 #   define PX_NOINLINE __attribute__ ((noinline))
00224 #else
00225 #   define PX_NOINLINE 
00226 #endif
00227 
00228 
00230 #if __CUDACC__
00231 #   define PX_RESTRICT __restrict__
00232 #elif defined(PX_GNUC) || defined(PX_VC)
00233 #   define PX_RESTRICT __restrict
00234 #elif defined(PX_CW) && __STDC_VERSION__ >= 199901L
00235 #   define PX_RESTRICT restrict
00236 #else
00237 #   define PX_RESTRICT
00238 #endif
00239 
00240 #if defined(PX_WINDOWS) || defined(PX_X360) || defined(PX_WIN8ARM)
00241 #define PX_NOALIAS __declspec(noalias)
00242 #else
00243 #define PX_NOALIAS
00244 #endif
00245 
00246 
00258 #ifndef PX_ALIGN
00259     #if defined(PX_VC)
00260         #define PX_ALIGN(alignment, decl) __declspec(align(alignment)) decl
00261         #define PX_ALIGN_PREFIX(alignment) __declspec(align(alignment))
00262         #define PX_ALIGN_SUFFIX(alignment)
00263     #elif defined(PX_GNUC)
00264         #define PX_ALIGN(alignment, decl) decl __attribute__ ((aligned(alignment)))
00265         #define PX_ALIGN_PREFIX(alignment)
00266         #define PX_ALIGN_SUFFIX(alignment) __attribute__ ((aligned(alignment)))
00267     #elif defined(PX_CW)
00268         #define PX_ALIGN(alignment, decl) decl __attribute__ ((aligned(alignment)))
00269         #define PX_ALIGN_PREFIX(alignment)
00270         #define PX_ALIGN_SUFFIX(alignment) __attribute__ ((aligned(alignment)))
00271     #else
00272         #define PX_ALIGN(alignment, decl)
00273         #define PX_ALIGN_PREFIX(alignment)
00274         #define PX_ALIGN_SUFFIX(alignment)
00275     #endif
00276 #endif
00277 
00281 #if 0 // set to 1 to create warnings for deprecated functions
00282 #   define PX_DEPRECATED __declspec(deprecated)
00283 #else 
00284 #   define PX_DEPRECATED
00285 #endif
00286 
00287 // VC6 no '__FUNCTION__' workaround
00288 #if defined PX_VC6 && !defined __FUNCTION__
00289 #   define __FUNCTION__ "Undefined"
00290 #endif
00291 
00296 // static assert
00297 #define PX_COMPILE_TIME_ASSERT(exp) typedef char PxCompileTimeAssert_Dummy[(exp) ? 1 : -1]
00298 
00299 #ifdef PX_GNUC
00300 #define PX_OFFSET_OF(X, Y) __builtin_offsetof(X, Y)
00301 #else
00302 #define PX_OFFSET_OF(X, Y) offsetof(X, Y)
00303 #endif
00304 
00305 // avoid unreferenced parameter warning (why not just disable it?)
00306 // PT: or why not just omit the parameter's name from the declaration????
00307 #define PX_FORCE_PARAMETER_REFERENCE(_P) (void)(_P);
00308 #define PX_UNUSED(_P) PX_FORCE_PARAMETER_REFERENCE(_P)
00309 
00310 // check that exactly one of NDEBUG and _DEBUG is defined
00311 #if !(defined NDEBUG ^ defined _DEBUG)
00312     #error Exactly one of NDEBUG and _DEBUG needs to be defined by preprocessor
00313 #endif
00314 
00315 // make sure PX_CHECKED is defined in all _DEBUG configurations as well
00316 #if !defined(PX_CHECKED) && _DEBUG
00317 #define PX_CHECKED
00318 #endif
00319 
00320 #ifdef __CUDACC__
00321 #define PX_CUDA_CALLABLE __host__ __device__
00322 #else
00323 #define PX_CUDA_CALLABLE
00324 #endif
00325 
00326     // Ensure that the application hasn't tweaked the pack value to less than 8, which would break
00327     // matching between the API headers and the binaries
00328     // This assert works on win32/win64/360/ps3, but may need further specialization on other platforms.
00329     // Some GCC compilers need the compiler flag -malign-double to be set.
00330 
00331 struct PxPackValidation { char _; long long a; };
00332 
00333 #if !defined(PX_APPLE_IOS)
00334 PX_COMPILE_TIME_ASSERT(PX_OFFSET_OF(PxPackValidation, a) == 8);
00335 #endif
00336 
00337 // use in a cpp file to suppress LNK4221
00338 #if defined(PX_VC)
00339 #define PX_DUMMY_SYMBOL namespace { char PxDummySymbol; } 
00340 #else
00341 #define PX_DUMMY_SYMBOL
00342 #endif
00343 
00345 #endif // PX_FOUNDATION_PX_PREPROCESSOR_H


Copyright © 2008-2012 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com