diff options
Diffstat (limited to 'PxShared/include')
46 files changed, 795 insertions, 3935 deletions
diff --git a/PxShared/include/cudamanager/PxCudaContextManager.h b/PxShared/include/cudamanager/PxCudaContextManager.h deleted file mode 100644 index aca1112..0000000 --- a/PxShared/include/cudamanager/PxCudaContextManager.h +++ /dev/null @@ -1,425 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - - -#ifndef PXCUDACONTEXTMANAGER_PXCUDACONTEXTMANAGER_H -#define PXCUDACONTEXTMANAGER_PXCUDACONTEXTMANAGER_H - -#include "foundation/PxPreprocessor.h" - -#if PX_SUPPORT_GPU_PHYSX - -#include "foundation/PxSimpleTypes.h" -#include "foundation/PxErrorCallback.h" -#include "foundation/PxFlags.h" -#include "task/PxTaskDefine.h" -#include "cudamanager/PxCudaMemoryManager.h" - -/* Forward decl to avoid inclusion of cuda.h */ -typedef struct CUctx_st *CUcontext; -typedef struct CUgraphicsResource_st *CUgraphicsResource; -typedef int CUdevice; - -namespace physx -{ - -class PxGpuDispatcher; - - -/** \brief Possible graphic/CUDA interoperability modes for context */ -struct PxCudaInteropMode -{ - /** - * \brief Possible graphic/CUDA interoperability modes for context - */ - enum Enum - { - NO_INTEROP = 0, - D3D10_INTEROP, - D3D11_INTEROP, - OGL_INTEROP, - - COUNT - }; -}; - -struct PxCudaInteropRegisterFlag -{ - enum Enum - { - eNONE = 0x00, - eREAD_ONLY = 0x01, - eWRITE_DISCARD = 0x02, - eSURFACE_LDST = 0x04, - eTEXTURE_GATHER = 0x08 - }; -}; - -/** -\brief collection of set bits defined in NxCudaInteropRegisterFlag. - -@see NxCudaInteropRegisterFlag -*/ -typedef PxFlags<PxCudaInteropRegisterFlag::Enum, uint32_t> PxCudaInteropRegisterFlags; -PX_FLAGS_OPERATORS(PxCudaInteropRegisterFlag::Enum, uint32_t) - -//! \brief Descriptor used to create a PxCudaContextManager -class PxCudaContextManagerDesc -{ -public: - /** - * \brief The CUDA context to manage - * - * If left NULL, the PxCudaContextManager will create a new context. If - * graphicsDevice is also not NULL, this new CUDA context will be bound to - * that graphics device, enabling the use of CUDA/Graphics interop features. - * - * If ctx is not NULL, the specified context must be applied to the thread - * that is allocating the PxCudaContextManager at creation time (aka, it - * cannot be popped). The PxCudaContextManager will take ownership of the - * context until the manager is released. All access to the context must be - * gated by lock acquisition. - * - * If the user provides a context for the PxCudaContextManager, the context - * _must_ have either been created on the GPU ordinal returned by - * PxGetSuggestedCudaDeviceOrdinal() or on your graphics device. - * - * It is perfectly acceptable to allocate device or host pinned memory from - * the context outside the scope of the PxCudaMemoryManager, so long as you - * manage its eventual cleanup. - */ - CUcontext *ctx; - - /** - * \brief D3D device pointer or OpenGl context handle - * - * Only applicable when ctx is NULL, thus forcing a new context to be - * created. In that case, the created context will be bound to this - * graphics device. - */ - void *graphicsDevice; - -#if PX_SUPPORT_GPU_PHYSX - /** - * \brief Application-specific GUID - * - * If your application employs PhysX modules that use CUDA you need to use a GUID - * so that patches for new architectures can be released for your game.You can obtain a GUID for your - * application from Nvidia. - */ - const char* appGUID; -#endif - /** - * \brief The CUDA/Graphics interop mode of this context - * - * If ctx is NULL, this value describes the nature of the graphicsDevice - * pointer provided by the user. Else it describes the nature of the - * context provided by the user. - */ - PxCudaInteropMode::Enum interopMode; - - - /** - * \brief Size of persistent memory - * - * This memory is allocated up front and stays allocated until the - * PxCudaContextManager is released. Size is in bytes, has to be power of two - * and bigger than the page size. Set to 0 to only use dynamic pages. - * - * Note: On Vista O/S and above, there is a per-memory allocation overhead - * to every CUDA work submission, so we recommend that you carefully tune - * this initial base memory size to closely approximate the amount of - * memory your application will consume. - - Note: This is currently not used by PxSceneFlag::eENABLE_GPU_DYNAMICS. Memory allocation properties are configured - for GPU rigid bodies using PxSceneDesc::gpuDynamicsConfig. - */ - uint32_t memoryBaseSize[PxCudaBufferMemorySpace::COUNT]; - - /** - * \brief Size of memory pages - * - * The memory manager will dynamically grow and shrink in blocks multiple of - * this page size. Size has to be power of two and bigger than 0. - - Note: This is currently not used by PxSceneFlag::eENABLE_GPU_DYNAMICS. Memory allocation properties are configured - for GPU rigid bodies using PxSceneDesc::gpuDynamicsConfig. - */ - uint32_t memoryPageSize[PxCudaBufferMemorySpace::COUNT]; - - /** - * \brief Maximum size of memory that the memory manager will allocate - - Note: This is currently not used by PxSceneFlag::eENABLE_GPU_DYNAMICS. Memory allocation properties are configured - for GPU rigid bodies using PxSceneDesc::gpuDynamicsConfig. - */ - uint32_t maxMemorySize[PxCudaBufferMemorySpace::COUNT]; - - PX_INLINE PxCudaContextManagerDesc() - { - ctx = NULL; - interopMode = PxCudaInteropMode::NO_INTEROP; - graphicsDevice = 0; -#if PX_SUPPORT_GPU_PHYSX - appGUID = NULL; -#endif - for(uint32_t i = 0; i < PxCudaBufferMemorySpace::COUNT; i++) - { - memoryBaseSize[i] = 0; - memoryPageSize[i] = 2 * 1024*1024; - maxMemorySize[i] = UINT32_MAX; - } - } -}; - - -/** - * \brief Manages memory, thread locks, and task scheduling for a CUDA context - * - * A PxCudaContextManager manages access to a single CUDA context, allowing it to - * be shared between multiple scenes. Memory allocations are dynamic: starting - * with an initial heap size and growing on demand by a configurable page size. - * The context must be acquired from the manager before using any CUDA APIs. - * - * The PxCudaContextManager is based on the CUDA driver API and explictly does not - * support the CUDA runtime API (aka, CUDART). - * - * To enable CUDA use by an APEX scene, a PxCudaContextManager must be created - * (supplying your own CUDA context, or allowing a new context to be allocated - * for you), the PxGpuDispatcher for that context is retrieved via the - * getGpuDispatcher() method, and this is assigned to the TaskManager that is - * given to the scene via its NxApexSceneDesc. - */ -class PxCudaContextManager -{ -public: - /** - * \brief Acquire the CUDA context for the current thread - * - * Acquisitions are allowed to be recursive within a single thread. - * You can acquire the context multiple times so long as you release - * it the same count. - * - * The context must be acquired before using most CUDA functions. - * - * It is not necessary to acquire the CUDA context inside GpuTask - * launch functions, because the PxGpuDispatcher will have already - * acquired the context for its worker thread. However it is not - * harmfull to (re)acquire the context in code that is shared between - * GpuTasks and non-task functions. - */ - virtual void acquireContext() = 0; - - /** - * \brief Release the CUDA context from the current thread - * - * The CUDA context should be released as soon as practically - * possible, to allow other CPU threads (including the - * PxGpuDispatcher) to work efficiently. - */ - virtual void releaseContext() = 0; - - /** - * \brief Return the CUcontext - */ - virtual CUcontext getContext() = 0; - - /** - * \brief Return the PxCudaMemoryManager instance associated with this - * CUDA context - * Note: This is currently not used by PxSceneFlag::eENABLE_GPU_DYNAMICS. Memory allocation properties are configured - * for GPU rigid bodies using PxSceneDesc::gpuDynamicsConfig. - */ - virtual PxCudaMemoryManager *getMemoryManager() = 0; - - /** - * \brief Return the PxGpuDispatcher instance associated with this - * CUDA context - */ - virtual class physx::PxGpuDispatcher *getGpuDispatcher() = 0; - - /** - * \brief Context manager has a valid CUDA context - * - * This method should be called after creating a PxCudaContextManager, - * especially if the manager was responsible for allocating its own - * CUDA context (desc.ctx == NULL). If it returns false, there is - * no point in assigning this manager's PxGpuDispatcher to a - * TaskManager as it will be unable to execute GpuTasks. - */ - virtual bool contextIsValid() const = 0; - - /* Query CUDA context and device properties, without acquiring context */ - - virtual bool supportsArchSM10() const = 0; //!< G80 - virtual bool supportsArchSM11() const = 0; //!< G92 - virtual bool supportsArchSM12() const = 0; //!< GT200 - virtual bool supportsArchSM13() const = 0; //!< GT260 - virtual bool supportsArchSM20() const = 0; //!< GF100 - virtual bool supportsArchSM30() const = 0; //!< GK100 - virtual bool supportsArchSM35() const = 0; //!< GK110 - virtual bool supportsArchSM50() const = 0; //!< GM100 - virtual bool supportsArchSM52() const = 0; //!< GM200 - virtual bool supportsArchSM60() const = 0; //!< GP100 - virtual bool isIntegrated() const = 0; //!< true if GPU is an integrated (MCP) part - virtual bool canMapHostMemory() const = 0; //!< true if GPU map host memory to GPU (0-copy) - virtual int getDriverVersion() const = 0; //!< returns cached value of cuGetDriverVersion() - virtual size_t getDeviceTotalMemBytes() const = 0; //!< returns cached value of device memory size - virtual int getMultiprocessorCount() const = 0; //!< returns cache value of SM unit count - virtual unsigned int getClockRate() const = 0; //!< returns cached value of SM clock frequency - virtual int getSharedMemPerBlock() const = 0; //!< returns total amount of shared memory available per block in bytes - virtual int getSharedMemPerMultiprocessor() const = 0; //!< returns total amount of shared memory available per multiprocessor in bytes - virtual unsigned int getMaxThreadsPerBlock() const = 0; //!< returns the maximum number of threads per block - virtual const char *getDeviceName() const = 0; //!< returns device name retrieved from driver - virtual CUdevice getDevice() const = 0; //!< returns device handle retrieved from driver - virtual PxCudaInteropMode::Enum getInteropMode() const = 0; //!< interop mode the context was created with - - virtual void setUsingConcurrentStreams(bool) = 0; //!< turn on/off using concurrent streams for GPU work - virtual bool getUsingConcurrentStreams() const = 0; //!< true if GPU work can run in concurrent streams - /* End query methods that don't require context to be acquired */ - - /** - * \brief Register a rendering resource with CUDA - * - * This function is called to register render resources (allocated - * from OpenGL) with CUDA so that the memory may be shared - * between the two systems. This is only required for render - * resources that are designed for interop use. In APEX, each - * render resource descriptor that could support interop has a - * 'registerInCUDA' boolean variable. - * - * The function must be called again any time your graphics device - * is reset, to re-register the resource. - * - * Returns true if the registration succeeded. A registered - * resource must be unregistered before it can be released. - * - * \param resource [OUT] the handle to the resource that can be used with CUDA - * \param buffer [IN] GLuint buffer index to be mapped to cuda - * \param flags [IN] cuda interop registration flags - */ - virtual bool registerResourceInCudaGL(CUgraphicsResource &resource, uint32_t buffer, PxCudaInteropRegisterFlags flags = PxCudaInteropRegisterFlags()) = 0; - - /** - * \brief Register a rendering resource with CUDA - * - * This function is called to register render resources (allocated - * from Direct3D) with CUDA so that the memory may be shared - * between the two systems. This is only required for render - * resources that are designed for interop use. In APEX, each - * render resource descriptor that could support interop has a - * 'registerInCUDA' boolean variable. - * - * The function must be called again any time your graphics device - * is reset, to re-register the resource. - * - * Returns true if the registration succeeded. A registered - * resource must be unregistered before it can be released. - * - * \param resource [OUT] the handle to the resource that can be used with CUDA - * \param resourcePointer [IN] A pointer to either IDirect3DResource9, or ID3D10Device, or ID3D11Resource to be registered. - * \param flags [IN] cuda interop registration flags - */ - virtual bool registerResourceInCudaD3D(CUgraphicsResource &resource, void *resourcePointer, PxCudaInteropRegisterFlags flags = PxCudaInteropRegisterFlags()) = 0; - - /** - * \brief Unregister a rendering resource with CUDA - * - * If a render resource was successfully registered with CUDA using - * the registerResourceInCuda***() methods, this function must be called - * to unregister the resource before the it can be released. - */ - virtual bool unregisterResourceInCuda(CUgraphicsResource resource) = 0; - - /** - * \brief Determine if the user has configured a dedicated PhysX GPU in the NV Control Panel - * \note If using CUDA Interop, this will always return false - * \returns 1 if there is a dedicated GPU - * 0 if there is NOT a dedicated GPU - * -1 if the routine is not implemented - */ - virtual int usingDedicatedGPU() const = 0; - - /** - * \brief Release the PxCudaContextManager - * - * When the manager instance is released, it also releases its - * PxGpuDispatcher instance and PxCudaMemoryManager. Before the memory - * manager is released, it frees all allocated memory pages. If the - * PxCudaContextManager created the CUDA context it was responsible - * for, it also frees that context. - * - * Do not release the PxCudaContextManager if there are any scenes - * using its PxGpuDispatcher. Those scenes must be released first - * since there is no safe way to remove a PxGpuDispatcher from a - * TaskManager once the TaskManager has been given to a scene. - * - */ - virtual void release() = 0; - -protected: - - /** - * \brief protected destructor, use release() method - */ - virtual ~PxCudaContextManager() {} -}; - -/** - * \brief Convenience class for holding CUDA lock within a scope - */ -class PxScopedCudaLock -{ -public: - /** - * \brief ScopedCudaLock constructor - */ - PxScopedCudaLock(PxCudaContextManager& ctx) : mCtx(&ctx) - { - mCtx->acquireContext(); - } - - /** - * \brief ScopedCudaLock destructor - */ - ~PxScopedCudaLock() - { - mCtx->releaseContext(); - } - -protected: - - /** - * \brief CUDA context manager pointer (initialized in the constructor) - */ - PxCudaContextManager* mCtx; -}; - -} // end physx namespace - -#endif // PX_SUPPORT_GPU_PHYSX -#endif // PXCUDACONTEXTMANAGER_PXCUDACONTEXTMANAGER_H diff --git a/PxShared/include/cudamanager/PxCudaMemoryManager.h b/PxShared/include/cudamanager/PxCudaMemoryManager.h deleted file mode 100644 index c89b20d..0000000 --- a/PxShared/include/cudamanager/PxCudaMemoryManager.h +++ /dev/null @@ -1,281 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXCUDACONTEXTMANAGER_PXCUDAMEMORYMANAGER_H -#define PXCUDACONTEXTMANAGER_PXCUDAMEMORYMANAGER_H - -#include "foundation/PxPreprocessor.h" - -#if PX_SUPPORT_GPU_PHYSX - -#include "task/PxTaskDefine.h" - -// some macros to keep the source code more readable -#define PX_ALLOC_INFO(name, ID) __FILE__, __LINE__, name, physx::PxAllocId::ID -#define PX_ALLOC_INFO_PARAMS_DECL(p0, p1, p2, p3) const char* file = p0, int line = p1, const char* allocName = p2, physx::PxAllocId::Enum allocId = physx::PxAllocId::p3 -#define PX_ALLOC_INFO_PARAMS_DEF() const char* file, int line, const char* allocName, physx::PxAllocId::Enum allocId -#define PX_ALLOC_INFO_PARAMS_INPUT() file, line, allocName, allocId -#define PX_ALLOC_INFO_PARAMS_INPUT_INFO(info) info.getFileName(), info.getLine(), info.getAllocName(), info.getAllocId() - -#ifndef NULL // don't want to include <string.h> -#define NULL 0 -#endif - -namespace physx -{ - -PX_PUSH_PACK_DEFAULT - -/** \brief ID of the Feature which owns/allocated memory from the heap - * - * Maximum of 64k IDs allowed. - */ -struct PxAllocId -{ - /** - * \brief ID of the Feature which owns/allocated memory from the heap - */ - enum Enum - { - UNASSIGNED, //!< default - APEX, //!< APEX stuff not further classified - PARTICLES, //!< all particle related - GPU_UTIL, //!< e.g. RadixSort (used in SPH and deformable self collision) - CLOTH, //!< all cloth related - NUM_IDS //!< number of IDs, be aware that ApexHeapStats contains PxAllocIdStats[NUM_IDS] - }; -}; - -/// \brief memory type managed by a heap -struct PxCudaBufferMemorySpace -{ - /** - * \brief memory type managed by a heap - */ - enum Enum - { - T_GPU, - T_PINNED_HOST, - T_WRITE_COMBINED, - T_HOST, - COUNT - }; -}; - -/// \brief class to track allocation statistics, see PxgMirrored -class PxAllocInfo -{ -public: - /** - * \brief AllocInfo default constructor - */ - PxAllocInfo() {} - - /** - * \brief AllocInfo constructor that initializes all of the members - */ - PxAllocInfo(const char* file, int line, const char* allocName, PxAllocId::Enum allocId) - : mFileName(file) - , mLine(line) - , mAllocName(allocName) - , mAllocId(allocId) - {} - - /// \brief get the allocation file name - inline const char* getFileName() const - { - return mFileName; - } - - /// \brief get the allocation line - inline int getLine() const - { - return mLine; - } - - /// \brief get the allocation name - inline const char* getAllocName() const - { - return mAllocName; - } - - /// \brief get the allocation ID - inline PxAllocId::Enum getAllocId() const - { - return mAllocId; - } - -private: - const char* mFileName; - int mLine; - const char* mAllocName; - PxAllocId::Enum mAllocId; -}; - -/// \brief statistics collected per AllocationId by HeapManager. -struct PxAllocIdStats -{ - size_t size; //!< currently allocated memory by this ID - size_t maxSize; //!< max allocated memory by this ID - size_t elements; //!< number of current allocations by this ID - size_t maxElements; //!< max number of allocations by this ID -}; - -class PxCudaMemoryManager; -typedef size_t PxCudaBufferPtr; - -/// \brief Hint flag to tell how the buffer will be used -struct PxCudaBufferFlags -{ -/// \brief Enumerations for the hint flag to tell how the buffer will be used - enum Enum - { - F_READ = (1 << 0), - F_WRITE = (1 << 1), - F_READ_WRITE = F_READ | F_WRITE - }; -}; - - -/// \brief Memory statistics struct returned by CudaMemMgr::getStats() -struct PxCudaMemoryManagerStats -{ - - size_t heapSize; //!< Size of all pages allocated for this memory type (allocated + free). - size_t totalAllocated; //!< Size occupied by the current allocations. - size_t maxAllocated; //!< High water mark of allocations since the SDK was created. - PxAllocIdStats allocIdStats[PxAllocId::NUM_IDS]; //!< Stats for each allocation ID, see PxAllocIdStats -}; - - -/// \brief Buffer type: made of hint flags and the memory space (Device Memory, Pinned Host Memory, ...) -struct PxCudaBufferType -{ - /// \brief PxCudaBufferType copy constructor - PX_INLINE PxCudaBufferType(const PxCudaBufferType& t) - : memorySpace(t.memorySpace) - , flags(t.flags) - {} - - /// \brief PxCudaBufferType constructor to explicitely assign members - PX_INLINE PxCudaBufferType(PxCudaBufferMemorySpace::Enum _memSpace, PxCudaBufferFlags::Enum _flags) - : memorySpace(_memSpace) - , flags(_flags) - {} - - PxCudaBufferMemorySpace::Enum memorySpace; //!< specifies which memory space for the buffer - PxCudaBufferFlags::Enum flags; //!< specifies the usage flags for the buffer -}; - - -/// \brief Buffer which keeps informations about allocated piece of memory. -class PxCudaBuffer -{ -public: - /// Retrieves the manager over which the buffer was allocated. - virtual PxCudaMemoryManager* getCudaMemoryManager() const = 0; - - /// Releases the buffer and the memory it used, returns true if successful. - virtual bool free() = 0; - - /// Realloc memory. Use to shrink or resize the allocated chunk of memory of this buffer. - /// Returns true if successful. Fails if the operation would change the address and need a memcopy. - /// In that case the user has to allocate, copy and free the memory with separate steps. - /// Realloc to size 0 always returns false and doesn't change the state. - virtual bool realloc(size_t size, PX_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED)) = 0; - - /// Returns the type of the allocated memory. - virtual const PxCudaBufferType& getType() const = 0; - - /// Returns the pointer to the allocated memory. - virtual PxCudaBufferPtr getPtr() const = 0; - - /// Returns the size of the allocated memory. - virtual size_t getSize() const = 0; - -protected: - /// \brief protected destructor - virtual ~PxCudaBuffer() {} -}; - - -/// \brief Allocator class for different kinds of CUDA related memory. -class PxCudaMemoryManager -{ -public: - /// Allocate memory of given type and size. Returns a CudaBuffer if successful. Returns NULL if failed. - virtual PxCudaBuffer* alloc(const PxCudaBufferType& type, size_t size, PX_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED)) = 0; - - /// Basic heap allocator without PxCudaBuffer - virtual PxCudaBufferPtr alloc(PxCudaBufferMemorySpace::Enum memorySpace, size_t size, PX_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED)) = 0; - - /// Basic heap deallocator without PxCudaBuffer - virtual bool free(PxCudaBufferMemorySpace::Enum memorySpace, PxCudaBufferPtr addr) = 0; - - /// Basic heap realloc without PxCudaBuffer - virtual bool realloc(PxCudaBufferMemorySpace::Enum memorySpace, PxCudaBufferPtr addr, size_t size, PX_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED)) = 0; - - /// Retrieve stats for the memory of given type. See PxCudaMemoryManagerStats. - virtual void getStats(const PxCudaBufferType& type, PxCudaMemoryManagerStats& outStats) = 0; - - /// Ensure that a given amount of free memory is available. Triggers CUDA allocations in size of (2^n * pageSize) if necessary. - /// Returns false if page allocations failed. - virtual bool reserve(const PxCudaBufferType& type, size_t size) = 0; - - /// Set the page size. The managed memory grows by blocks 2^n * pageSize. Page allocations trigger CUDA driver allocations, - /// so the page size should be reasonably big. Returns false if input size was invalid, i.e. not power of two. - /// Default is 2 MB. - virtual bool setPageSize(const PxCudaBufferType& type, size_t size) = 0; - - /// Set the upper limit until which pages of a given memory type can be allocated. - /// Reducing the max when it is already hit does not shrink the memory until it is deallocated by releasing the buffers which own the memory. - virtual bool setMaxMemorySize(const PxCudaBufferType& type, size_t size) = 0; - - /// Returns the base size. The base memory block stays persistently allocated over the SDKs life time. - virtual size_t getBaseSize(const PxCudaBufferType& type) = 0; - - /// Returns the currently set page size. The memory grows and shrinks in blocks of size (2^n pageSize) - virtual size_t getPageSize(const PxCudaBufferType& type) = 0; - - /// Returns the upper limit until which the manager is allowed to allocate additional pages from the CUDA driver. - virtual size_t getMaxMemorySize(const PxCudaBufferType& type) = 0; - - /// Get device mapped pinned host mem ptr. Operation only valid for memory space PxCudaBufferMemorySpace::T_PINNED_HOST. - virtual PxCudaBufferPtr getMappedPinnedPtr(PxCudaBufferPtr hostPtr) = 0; - -protected: - /// \brief protected destructor - virtual ~PxCudaMemoryManager() {} -}; - -PX_POP_PACK - - -} // end physx namespace - -#endif // PX_SUPPORT_GPU_PHYSX -#endif // PXCUDACONTEXTMANAGER_PXCUDAMEMORYMANAGER_H diff --git a/PxShared/include/cudamanager/PxGpuCopyDesc.h b/PxShared/include/cudamanager/PxGpuCopyDesc.h deleted file mode 100644 index c6c240f..0000000 --- a/PxShared/include/cudamanager/PxGpuCopyDesc.h +++ /dev/null @@ -1,86 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXCUDACONTEXTMANAGER_PXGPUCOPYDESC_H -#define PXCUDACONTEXTMANAGER_PXGPUCOPYDESC_H - -#include "foundation/PxPreprocessor.h" - -#if PX_SUPPORT_GPU_PHYSX - -#include "task/PxTaskDefine.h" - -namespace physx -{ - -PX_PUSH_PACK_DEFAULT - -/** - * \brief Input descriptor for the GpuDispatcher's built-in copy kernel - * - * All host memory involved in copy transactions must be page-locked. - * If more than one descriptor is passed to the copy kernel in one launch, - * the descriptors themselves must be in page-locked memory. - */ -struct PxGpuCopyDesc -{ - /** - * \brief Input descriptor for the GpuDispatcher's built-in copy kernel - */ - enum CopyType - { - HostToDevice, - DeviceToHost, - DeviceToDevice, - DeviceMemset32 - }; - - size_t dest; //!< the destination - size_t source; //!< the source (32bit value when type == DeviceMemset) - size_t bytes; //!< the size in bytes - CopyType type; //!< the memory transaction type - - /** - * \brief Copy is optimally performed as 64bit words, requires 64bit alignment. But it can - * gracefully degrade to 32bit copies if necessary - */ - PX_INLINE bool isValid() - { - bool ok = true; - ok &= ((dest & 0x3) == 0); - ok &= ((type == DeviceMemset32) || (source & 0x3) == 0); - ok &= ((bytes & 0x3) == 0); - return ok; - } -}; - -PX_POP_PACK - -} // end physx namespace - -#endif // PX_SUPPORT_GPU_PHYSX -#endif // PXCUDACONTEXTMANAGER_PXGPUCOPYDESC_H diff --git a/PxShared/include/cudamanager/PxGpuCopyDescQueue.h b/PxShared/include/cudamanager/PxGpuCopyDescQueue.h deleted file mode 100644 index 4b6d58e..0000000 --- a/PxShared/include/cudamanager/PxGpuCopyDescQueue.h +++ /dev/null @@ -1,149 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXCUDACONTEXTMANAGER_PXGPUCOPYDESCQUEUE_H -#define PXCUDACONTEXTMANAGER_PXGPUCOPYDESCQUEUE_H - -#include "foundation/PxPreprocessor.h" - -#if PX_SUPPORT_GPU_PHYSX - -#include "foundation/PxAssert.h" -#include "task/PxTaskDefine.h" -#include "task/PxGpuDispatcher.h" -#include "cudamanager/PxGpuCopyDesc.h" -#include "cudamanager/PxCudaContextManager.h" - -/* forward decl to avoid including <cuda.h> */ -typedef struct CUstream_st* CUstream; - -namespace physx -{ - -PX_PUSH_PACK_DEFAULT - -/// \brief Container class for queueing PxGpuCopyDesc instances in pinned (non-pageable) CPU memory -class PxGpuCopyDescQueue -{ -public: - /// \brief PxGpuCopyDescQueue constructor - PxGpuCopyDescQueue(PxGpuDispatcher& d) - : mDispatcher(d) - , mBuffer(0) - , mStream(0) - , mReserved(0) - , mOccupancy(0) - , mFlushed(0) - { - } - - /// \brief PxGpuCopyDescQueue destructor - ~PxGpuCopyDescQueue() - { - if (mBuffer) - { - mDispatcher.getCudaContextManager()->getMemoryManager()->free(PxCudaBufferMemorySpace::T_PINNED_HOST, (size_t) mBuffer); - } - } - - /// \brief Reset the enqueued copy descriptor list - /// - /// Must be called at least once before any copies are enqueued, and each time the launched - /// copies are known to have been completed. The recommended use case is to call this at the - /// start of each simulation step. - void reset(CUstream stream, uint32_t reserveSize) - { - if (reserveSize > mReserved) - { - if (mBuffer) - { - mDispatcher.getCudaContextManager()->getMemoryManager()->free( - PxCudaBufferMemorySpace::T_PINNED_HOST, - (size_t) mBuffer); - mReserved = 0; - } - mBuffer = (PxGpuCopyDesc*) mDispatcher.getCudaContextManager()->getMemoryManager()->alloc( - PxCudaBufferMemorySpace::T_PINNED_HOST, - reserveSize * sizeof(PxGpuCopyDesc), - PX_ALLOC_INFO("PxGpuCopyDescQueue", GPU_UTIL)); - if (mBuffer) - { - mReserved = reserveSize; - } - } - - mOccupancy = 0; - mFlushed = 0; - mStream = stream; - } - - /// \brief Enqueue the specified copy descriptor, or launch immediately if no room is available - void enqueue(PxGpuCopyDesc& desc) - { - PX_ASSERT(desc.isValid()); - if (desc.bytes == 0) - { - return; - } - - if (mOccupancy < mReserved) - { - mBuffer[ mOccupancy++ ] = desc; - } - else - { - mDispatcher.launchCopyKernel(&desc, 1, mStream); - } - } - - /// \brief Launch all copies queued since the last flush or reset - void flushEnqueued() - { - if (mOccupancy > mFlushed) - { - mDispatcher.launchCopyKernel(mBuffer + mFlushed, mOccupancy - mFlushed, mStream); - mFlushed = mOccupancy; - } - } - -private: - PxGpuDispatcher& mDispatcher; - PxGpuCopyDesc* mBuffer; - CUstream mStream; - uint32_t mReserved; - uint32_t mOccupancy; - uint32_t mFlushed; - - void operator=(const PxGpuCopyDescQueue&); // prevent a warning... -}; - -PX_POP_PACK - -} // end physx namespace - -#endif // PX_SUPPORT_GPU_PHYSX -#endif // PXCUDACONTEXTMANAGER_PXGPUCOPYDESCQUEUE_H diff --git a/PxShared/include/filebuf/PxFileBuf.h b/PxShared/include/filebuf/PxFileBuf.h deleted file mode 100644 index 48f8b5d..0000000 --- a/PxShared/include/filebuf/PxFileBuf.h +++ /dev/null @@ -1,337 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 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 PSFILEBUFFER_PXFILEBUF_H -#define PSFILEBUFFER_PXFILEBUF_H - -/** \addtogroup foundation - @{ -*/ - -#if !PX_DOXYGEN -namespace physx -{ - -namespace general_PxIOStream2 -{ -#endif - -PX_PUSH_PACK_DEFAULT - -/** -\brief Callback class for data serialization. - -The user needs to supply an PxFileBuf implementation to a number of methods to allow the SDK to read or write -chunks of binary data. This allows flexibility for the source/destination of the data. For example the PxFileBuf -could store data in a file, memory buffer or custom file format. - -\note It is the users responsibility to ensure that the data is written to the appropriate offset. - -*/ -class PxFileBuf -{ -public: - - enum EndianMode - { - ENDIAN_NONE = 0, // do no conversion for endian mode - ENDIAN_BIG = 1, // always read/write data as natively big endian (Power PC, etc.) - ENDIAN_LITTLE = 2 // always read/write data as natively little endian (Intel, etc.) Default Behavior! - }; - - PxFileBuf(EndianMode mode=ENDIAN_LITTLE) - { - setEndianMode(mode); - } - - virtual ~PxFileBuf(void) - { - - } - - /** - \brief Declares a constant to seek to the end of the stream. - * - * Does not support streams longer than 32 bits - */ - static const uint32_t STREAM_SEEK_END=0xFFFFFFFF; - - enum OpenMode - { - OPEN_FILE_NOT_FOUND, - OPEN_READ_ONLY, // open file buffer stream for read only access - OPEN_WRITE_ONLY, // open file buffer stream for write only access - OPEN_READ_WRITE_NEW, // open a new file for both read/write access - OPEN_READ_WRITE_EXISTING // open an existing file for both read/write access - }; - - virtual OpenMode getOpenMode(void) const = 0; - - bool isOpen(void) const - { - return getOpenMode()!=OPEN_FILE_NOT_FOUND; - } - - enum SeekType - { - SEEKABLE_NO = 0, - SEEKABLE_READ = 0x1, - SEEKABLE_WRITE = 0x2, - SEEKABLE_READWRITE = 0x3 - }; - - virtual SeekType isSeekable(void) const = 0; - - void setEndianMode(EndianMode e) - { - mEndianMode = e; - if ( (e==ENDIAN_BIG && !isBigEndian() ) || - (e==ENDIAN_LITTLE && isBigEndian() ) ) - { - mEndianSwap = true; - } - else - { - mEndianSwap = false; - } - } - - EndianMode getEndianMode(void) const - { - return mEndianMode; - } - - virtual uint32_t getFileLength(void) const = 0; - - /** - \brief Seeks the stream to a particular location for reading - * - * If the location passed exceeds the length of the stream, then it will seek to the end. - * Returns the location it ended up at (useful if you seek to the end) to get the file position - */ - virtual uint32_t seekRead(uint32_t loc) = 0; - - /** - \brief Seeks the stream to a particular location for writing - * - * If the location passed exceeds the length of the stream, then it will seek to the end. - * Returns the location it ended up at (useful if you seek to the end) to get the file position - */ - virtual uint32_t seekWrite(uint32_t loc) = 0; - - /** - \brief Reads from the stream into a buffer. - - \param[out] mem The buffer to read the stream into. - \param[in] len The number of bytes to stream into the buffer - - \return Returns the actual number of bytes read. If not equal to the length requested, then reached end of stream. - */ - virtual uint32_t read(void *mem,uint32_t len) = 0; - - - /** - \brief Reads from the stream into a buffer but does not advance the read location. - - \param[out] mem The buffer to read the stream into. - \param[in] len The number of bytes to stream into the buffer - - \return Returns the actual number of bytes read. If not equal to the length requested, then reached end of stream. - */ - virtual uint32_t peek(void *mem,uint32_t len) = 0; - - /** - \brief Writes a buffer of memory to the stream - - \param[in] mem The address of a buffer of memory to send to the stream. - \param[in] len The number of bytes to send to the stream. - - \return Returns the actual number of bytes sent to the stream. If not equal to the length specific, then the stream is full or unable to write for some reason. - */ - virtual uint32_t write(const void *mem,uint32_t len) = 0; - - /** - \brief Reports the current stream location read aqccess. - - \return Returns the current stream read location. - */ - virtual uint32_t tellRead(void) const = 0; - - /** - \brief Reports the current stream location for write access. - - \return Returns the current stream write location. - */ - virtual uint32_t tellWrite(void) const = 0; - - /** - \brief Causes any temporarily cached data to be flushed to the stream. - */ - virtual void flush(void) = 0; - - /** - \brief Close the stream. - */ - virtual void close(void) {} - - void release(void) - { - delete this; - } - - static PX_INLINE bool isBigEndian() - { - int32_t i = 1; - return *(reinterpret_cast<char*>(&i))==0; - } - - PX_INLINE void swap2Bytes(void* _data) const - { - char *data = static_cast<char *>(_data); - char one_byte; - one_byte = data[0]; data[0] = data[1]; data[1] = one_byte; - } - - PX_INLINE void swap4Bytes(void* _data) const - { - char *data = static_cast<char *>(_data); - char one_byte; - one_byte = data[0]; data[0] = data[3]; data[3] = one_byte; - one_byte = data[1]; data[1] = data[2]; data[2] = one_byte; - } - - PX_INLINE void swap8Bytes(void *_data) const - { - char *data = static_cast<char *>(_data); - char one_byte; - one_byte = data[0]; data[0] = data[7]; data[7] = one_byte; - one_byte = data[1]; data[1] = data[6]; data[6] = one_byte; - one_byte = data[2]; data[2] = data[5]; data[5] = one_byte; - one_byte = data[3]; data[3] = data[4]; data[4] = one_byte; - } - - - PX_INLINE void storeDword(uint32_t v) - { - if ( mEndianSwap ) - swap4Bytes(&v); - - write(&v,sizeof(v)); - } - - PX_INLINE void storeFloat(float v) - { - if ( mEndianSwap ) - swap4Bytes(&v); - write(&v,sizeof(v)); - } - - PX_INLINE void storeDouble(double v) - { - if ( mEndianSwap ) - swap8Bytes(&v); - write(&v,sizeof(v)); - } - - PX_INLINE void storeByte(uint8_t b) - { - write(&b,sizeof(b)); - } - - PX_INLINE void storeWord(uint16_t w) - { - if ( mEndianSwap ) - swap2Bytes(&w); - write(&w,sizeof(w)); - } - - uint8_t readByte(void) - { - uint8_t v=0; - read(&v,sizeof(v)); - return v; - } - - uint16_t readWord(void) - { - uint16_t v=0; - read(&v,sizeof(v)); - if ( mEndianSwap ) - swap2Bytes(&v); - return v; - } - - uint32_t readDword(void) - { - uint32_t v=0; - read(&v,sizeof(v)); - if ( mEndianSwap ) - swap4Bytes(&v); - return v; - } - - float readFloat(void) - { - float v=0; - read(&v,sizeof(v)); - if ( mEndianSwap ) - swap4Bytes(&v); - return v; - } - - double readDouble(void) - { - double v=0; - read(&v,sizeof(v)); - if ( mEndianSwap ) - swap8Bytes(&v); - return v; - } - -private: - bool mEndianSwap; // whether or not the endian should be swapped on the current platform - EndianMode mEndianMode; // the current endian mode behavior for the stream -}; - -PX_POP_PACK - -#if !PX_DOXYGEN -} // end of namespace - -using namespace general_PxIOStream2; - -namespace general_PxIOStream = general_PxIOStream2; - -} // end of namespace -#endif - -/** @} */ - -#endif // PSFILEBUFFER_PXFILEBUF_H diff --git a/PxShared/include/foundation/Px.h b/PxShared/include/foundation/Px.h index 1b6b3f6..e4e5341 100644 --- a/PxShared/include/foundation/Px.h +++ b/PxShared/include/foundation/Px.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// 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. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// 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. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. diff --git a/PxShared/include/foundation/PxAllocatorCallback.h b/PxShared/include/foundation/PxAllocatorCallback.h index 7545b60..4e9487d 100644 --- a/PxShared/include/foundation/PxAllocatorCallback.h +++ b/PxShared/include/foundation/PxAllocatorCallback.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// 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. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// 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. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. diff --git a/PxShared/include/foundation/PxAssert.h b/PxShared/include/foundation/PxAssert.h deleted file mode 100644 index c422c27..0000000 --- a/PxShared/include/foundation/PxAssert.h +++ /dev/null @@ -1,95 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 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 PXFOUNDATION_PXASSERT_H -#define PXFOUNDATION_PXASSERT_H - -/** \addtogroup foundation -@{ */ - -#include "foundation/Px.h" - -#if !PX_DOXYGEN -namespace physx -{ -#endif - -/* Base class to handle assert failures */ -class PxAssertHandler -{ - public: - virtual ~PxAssertHandler() - { - } - virtual void operator()(const char* exp, const char* file, int line, bool& ignore) = 0; -}; - -PX_FOUNDATION_API PxAssertHandler& PxGetAssertHandler(); -PX_FOUNDATION_API void PxSetAssertHandler(PxAssertHandler& handler); - -#if !PX_DOXYGEN -} // namespace physx -#endif - -#if !PX_ENABLE_ASSERTS -#define PX_ASSERT(exp) ((void)0) -#define PX_ALWAYS_ASSERT_MESSAGE(exp) ((void)0) -#define PX_ASSERT_WITH_MESSAGE(condition, message) ((void)0) -#else -#if PX_VC -#define PX_CODE_ANALYSIS_ASSUME(exp) \ - __analysis_assume(!!(exp)) // This macro will be used to get rid of analysis warning messages if a PX_ASSERT is used -// to "guard" illegal mem access, for example. -#else -#define PX_CODE_ANALYSIS_ASSUME(exp) -#endif -#define PX_ASSERT(exp) \ - { \ - static bool _ignore = false; \ - ((void)((!!(exp)) || (!_ignore && (physx::PxGetAssertHandler()(#exp, __FILE__, __LINE__, _ignore), false)))); \ - PX_CODE_ANALYSIS_ASSUME(exp); \ - } -#define PX_ALWAYS_ASSERT_MESSAGE(exp) \ - { \ - static bool _ignore = false; \ - if(!_ignore) \ - physx::PxGetAssertHandler()(exp, __FILE__, __LINE__, _ignore); \ - } -#define PX_ASSERT_WITH_MESSAGE(exp, message) \ - { \ - static bool _ignore = false; \ - ((void)((!!(exp)) || (!_ignore && (physx::PxGetAssertHandler()(message, __FILE__, __LINE__, _ignore), false)))); \ - PX_CODE_ANALYSIS_ASSUME(exp); \ - } -#endif - -#define PX_ALWAYS_ASSERT() PX_ASSERT(0) - -/** @} */ -#endif // #ifndef PXFOUNDATION_PXASSERT_H diff --git a/PxShared/include/foundation/PxBitAndData.h b/PxShared/include/foundation/PxBitAndData.h index 685c1a2..e569299 100644 --- a/PxShared/include/foundation/PxBitAndData.h +++ b/PxShared/include/foundation/PxBitAndData.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// 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. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// 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. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. diff --git a/PxShared/include/foundation/PxBounds3.h b/PxShared/include/foundation/PxBounds3.h index 38d7282..ef8ead2 100644 --- a/PxShared/include/foundation/PxBounds3.h +++ b/PxShared/include/foundation/PxBounds3.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// 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. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// 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. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. @@ -321,40 +321,40 @@ PX_CUDA_CALLABLE PX_FORCE_INLINE void PxBounds3::setMaximal() PX_CUDA_CALLABLE PX_FORCE_INLINE void PxBounds3::include(const PxVec3& v) { - PX_ASSERT(isValid()); + PX_SHARED_ASSERT(isValid()); minimum = minimum.minimum(v); maximum = maximum.maximum(v); } PX_CUDA_CALLABLE PX_FORCE_INLINE void PxBounds3::include(const PxBounds3& b) { - PX_ASSERT(isValid()); + PX_SHARED_ASSERT(isValid()); minimum = minimum.minimum(b.minimum); maximum = maximum.maximum(b.maximum); } PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxBounds3::isEmpty() const { - PX_ASSERT(isValid()); + PX_SHARED_ASSERT(isValid()); return minimum.x > maximum.x; } PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxBounds3::intersects(const PxBounds3& b) const { - PX_ASSERT(isValid() && b.isValid()); + PX_SHARED_ASSERT(isValid() && b.isValid()); return !(b.minimum.x > maximum.x || minimum.x > b.maximum.x || b.minimum.y > maximum.y || minimum.y > b.maximum.y || b.minimum.z > maximum.z || minimum.z > b.maximum.z); } PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxBounds3::intersects1D(const PxBounds3& a, uint32_t axis) const { - PX_ASSERT(isValid() && a.isValid()); + PX_SHARED_ASSERT(isValid() && a.isValid()); return maximum[axis] >= a.minimum[axis] && a.maximum[axis] >= minimum[axis]; } PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxBounds3::contains(const PxVec3& v) const { - PX_ASSERT(isValid()); + PX_SHARED_ASSERT(isValid()); return !(v.x < minimum.x || v.x > maximum.x || v.y < minimum.y || v.y > maximum.y || v.z < minimum.z || v.z > maximum.z); @@ -362,7 +362,7 @@ PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxBounds3::contains(const PxVec3& v) const PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxBounds3::isInside(const PxBounds3& box) const { - PX_ASSERT(isValid() && box.isValid()); + PX_SHARED_ASSERT(isValid() && box.isValid()); if(box.minimum.x > minimum.x) return false; if(box.minimum.y > minimum.y) @@ -380,57 +380,57 @@ PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxBounds3::isInside(const PxBounds3& box) PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 PxBounds3::getCenter() const { - PX_ASSERT(isValid()); + PX_SHARED_ASSERT(isValid()); return (minimum + maximum) * 0.5f; } PX_CUDA_CALLABLE PX_FORCE_INLINE float PxBounds3::getCenter(uint32_t axis) const { - PX_ASSERT(isValid()); + PX_SHARED_ASSERT(isValid()); return (minimum[axis] + maximum[axis]) * 0.5f; } PX_CUDA_CALLABLE PX_FORCE_INLINE float PxBounds3::getExtents(uint32_t axis) const { - PX_ASSERT(isValid()); + PX_SHARED_ASSERT(isValid()); return (maximum[axis] - minimum[axis]) * 0.5f; } PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 PxBounds3::getDimensions() const { - PX_ASSERT(isValid()); + PX_SHARED_ASSERT(isValid()); return maximum - minimum; } PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 PxBounds3::getExtents() const { - PX_ASSERT(isValid()); + PX_SHARED_ASSERT(isValid()); return getDimensions() * 0.5f; } PX_CUDA_CALLABLE PX_FORCE_INLINE void PxBounds3::scaleSafe(float scale) { - PX_ASSERT(isValid()); + PX_SHARED_ASSERT(isValid()); if(!isEmpty()) scaleFast(scale); } PX_CUDA_CALLABLE PX_FORCE_INLINE void PxBounds3::scaleFast(float scale) { - PX_ASSERT(isValid()); + PX_SHARED_ASSERT(isValid()); *this = centerExtents(getCenter(), getExtents() * scale); } PX_CUDA_CALLABLE PX_FORCE_INLINE void PxBounds3::fattenSafe(float distance) { - PX_ASSERT(isValid()); + PX_SHARED_ASSERT(isValid()); if(!isEmpty()) fattenFast(distance); } PX_CUDA_CALLABLE PX_FORCE_INLINE void PxBounds3::fattenFast(float distance) { - PX_ASSERT(isValid()); + PX_SHARED_ASSERT(isValid()); minimum.x -= distance; minimum.y -= distance; minimum.z -= distance; @@ -442,25 +442,25 @@ PX_CUDA_CALLABLE PX_FORCE_INLINE void PxBounds3::fattenFast(float distance) PX_CUDA_CALLABLE PX_INLINE PxBounds3 PxBounds3::transformSafe(const PxMat33& matrix, const PxBounds3& bounds) { - PX_ASSERT(bounds.isValid()); + PX_SHARED_ASSERT(bounds.isValid()); return !bounds.isEmpty() ? transformFast(matrix, bounds) : bounds; } PX_CUDA_CALLABLE PX_INLINE PxBounds3 PxBounds3::transformFast(const PxMat33& matrix, const PxBounds3& bounds) { - PX_ASSERT(bounds.isValid()); + PX_SHARED_ASSERT(bounds.isValid()); return PxBounds3::basisExtent(matrix * bounds.getCenter(), matrix, bounds.getExtents()); } PX_CUDA_CALLABLE PX_INLINE PxBounds3 PxBounds3::transformSafe(const PxTransform& transform, const PxBounds3& bounds) { - PX_ASSERT(bounds.isValid()); + PX_SHARED_ASSERT(bounds.isValid()); return !bounds.isEmpty() ? transformFast(transform, bounds) : bounds; } PX_CUDA_CALLABLE PX_INLINE PxBounds3 PxBounds3::transformFast(const PxTransform& transform, const PxBounds3& bounds) { - PX_ASSERT(bounds.isValid()); + PX_SHARED_ASSERT(bounds.isValid()); return PxBounds3::basisExtent(transform.transform(bounds.getCenter()), PxMat33(transform.q), bounds.getExtents()); } diff --git a/PxShared/include/foundation/PxErrorCallback.h b/PxShared/include/foundation/PxErrorCallback.h index 8b63374..c0517db 100644 --- a/PxShared/include/foundation/PxErrorCallback.h +++ b/PxShared/include/foundation/PxErrorCallback.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// 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. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// 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. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. diff --git a/PxShared/include/foundation/PxErrors.h b/PxShared/include/foundation/PxErrors.h index fb341bb..cf86d3b 100644 --- a/PxShared/include/foundation/PxErrors.h +++ b/PxShared/include/foundation/PxErrors.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// 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. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// 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. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. diff --git a/PxShared/include/foundation/PxFlags.h b/PxShared/include/foundation/PxFlags.h index 1aec096..85dce4e 100644 --- a/PxShared/include/foundation/PxFlags.h +++ b/PxShared/include/foundation/PxFlags.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// 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. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// 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. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. @@ -130,20 +130,22 @@ class PxFlags storagetype mBits; }; +#if !PX_DOXYGEN + #define PX_FLAGS_OPERATORS(enumtype, storagetype) \ - PX_INLINE PxFlags<enumtype, storagetype> operator|(enumtype a, enumtype b) \ + PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype> operator|(enumtype a, enumtype b) \ { \ PxFlags<enumtype, storagetype> r(a); \ r |= b; \ return r; \ } \ - PX_INLINE PxFlags<enumtype, storagetype> operator&(enumtype a, enumtype b) \ + PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype> operator&(enumtype a, enumtype b) \ { \ PxFlags<enumtype, storagetype> r(a); \ r &= b; \ return r; \ } \ - PX_INLINE PxFlags<enumtype, storagetype> operator~(enumtype a) \ + PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype> operator~(enumtype a) \ { \ return ~PxFlags<enumtype, storagetype>(a); \ } @@ -153,95 +155,95 @@ class PxFlags PX_FLAGS_OPERATORS(x::Enum, y) template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>::PxFlags(void) +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>::PxFlags(void) { mBits = 0; } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>::PxFlags(enumtype e) +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>::PxFlags(enumtype e) { mBits = static_cast<storagetype>(e); } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>::PxFlags(const PxFlags<enumtype, storagetype>& f) +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>::PxFlags(const PxFlags<enumtype, storagetype>& f) { mBits = f.mBits; } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>::PxFlags(storagetype b) +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>::PxFlags(storagetype b) { mBits = b; } template <typename enumtype, typename storagetype> -PX_INLINE bool PxFlags<enumtype, storagetype>::isSet(enumtype e) const +PX_CUDA_CALLABLE PX_INLINE bool PxFlags<enumtype, storagetype>::isSet(enumtype e) const { return (mBits & static_cast<storagetype>(e)) == static_cast<storagetype>(e); } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>::set(enumtype e) +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>::set(enumtype e) { mBits = static_cast<storagetype>(e); return *this; } template <typename enumtype, typename storagetype> -PX_INLINE bool PxFlags<enumtype, storagetype>::operator==(enumtype e) const +PX_CUDA_CALLABLE PX_INLINE bool PxFlags<enumtype, storagetype>::operator==(enumtype e) const { return mBits == static_cast<storagetype>(e); } template <typename enumtype, typename storagetype> -PX_INLINE bool PxFlags<enumtype, storagetype>::operator==(const PxFlags<enumtype, storagetype>& f) const +PX_CUDA_CALLABLE PX_INLINE bool PxFlags<enumtype, storagetype>::operator==(const PxFlags<enumtype, storagetype>& f) const { return mBits == f.mBits; } template <typename enumtype, typename storagetype> -PX_INLINE bool PxFlags<enumtype, storagetype>::operator==(bool b) const +PX_CUDA_CALLABLE PX_INLINE bool PxFlags<enumtype, storagetype>::operator==(bool b) const { return bool(*this) == b; } template <typename enumtype, typename storagetype> -PX_INLINE bool PxFlags<enumtype, storagetype>::operator!=(enumtype e) const +PX_CUDA_CALLABLE PX_INLINE bool PxFlags<enumtype, storagetype>::operator!=(enumtype e) const { return mBits != static_cast<storagetype>(e); } template <typename enumtype, typename storagetype> -PX_INLINE bool PxFlags<enumtype, storagetype>::operator!=(const PxFlags<enumtype, storagetype>& f) const +PX_CUDA_CALLABLE PX_INLINE bool PxFlags<enumtype, storagetype>::operator!=(const PxFlags<enumtype, storagetype>& f) const { return mBits != f.mBits; } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>::operator=(enumtype e) +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>::operator=(enumtype e) { mBits = static_cast<storagetype>(e); return *this; } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>::operator=(const PxFlags<enumtype, storagetype>& f) +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>::operator=(const PxFlags<enumtype, storagetype>& f) { mBits = f.mBits; return *this; } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>::operator|=(enumtype e) +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>::operator|=(enumtype e) { mBits |= static_cast<storagetype>(e); return *this; } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>:: +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>:: operator|=(const PxFlags<enumtype, storagetype>& f) { mBits |= f.mBits; @@ -249,7 +251,7 @@ operator|=(const PxFlags<enumtype, storagetype>& f) } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>::operator|(enumtype e) const +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>::operator|(enumtype e) const { PxFlags<enumtype, storagetype> out(*this); out |= e; @@ -257,7 +259,7 @@ PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>::operato } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>:: +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>:: operator|(const PxFlags<enumtype, storagetype>& f) const { PxFlags<enumtype, storagetype> out(*this); @@ -266,14 +268,14 @@ operator|(const PxFlags<enumtype, storagetype>& f) const } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>::operator&=(enumtype e) +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>::operator&=(enumtype e) { mBits &= static_cast<storagetype>(e); return *this; } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>:: +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>:: operator&=(const PxFlags<enumtype, storagetype>& f) { mBits &= f.mBits; @@ -281,7 +283,7 @@ operator&=(const PxFlags<enumtype, storagetype>& f) } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>::operator&(enumtype e) const +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>::operator&(enumtype e) const { PxFlags<enumtype, storagetype> out = *this; out.mBits &= static_cast<storagetype>(e); @@ -289,7 +291,7 @@ PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>::operato } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>:: +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>:: operator&(const PxFlags<enumtype, storagetype>& f) const { PxFlags<enumtype, storagetype> out = *this; @@ -298,14 +300,14 @@ operator&(const PxFlags<enumtype, storagetype>& f) const } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>::operator^=(enumtype e) +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>::operator^=(enumtype e) { mBits ^= static_cast<storagetype>(e); return *this; } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>:: +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>:: operator^=(const PxFlags<enumtype, storagetype>& f) { mBits ^= f.mBits; @@ -313,7 +315,7 @@ operator^=(const PxFlags<enumtype, storagetype>& f) } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>::operator^(enumtype e) const +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>::operator^(enumtype e) const { PxFlags<enumtype, storagetype> out = *this; out.mBits ^= static_cast<storagetype>(e); @@ -321,7 +323,7 @@ PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>::operato } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>:: +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>:: operator^(const PxFlags<enumtype, storagetype>& f) const { PxFlags<enumtype, storagetype> out = *this; @@ -330,7 +332,7 @@ operator^(const PxFlags<enumtype, storagetype>& f) const } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>::operator~(void) const +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>::operator~(void) const { PxFlags<enumtype, storagetype> out; out.mBits = storagetype(~mBits); @@ -338,38 +340,37 @@ PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>::operato } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>::operator bool(void) const +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>::operator bool(void) const { return mBits ? true : false; } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>::operator uint8_t(void) const +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>::operator uint8_t(void) const { return static_cast<uint8_t>(mBits); } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>::operator uint16_t(void) const +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>::operator uint16_t(void) const { return static_cast<uint16_t>(mBits); } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>::operator uint32_t(void) const +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>::operator uint32_t(void) const { return static_cast<uint32_t>(mBits); } template <typename enumtype, typename storagetype> -PX_INLINE void PxFlags<enumtype, storagetype>::clear(enumtype e) +PX_CUDA_CALLABLE PX_INLINE void PxFlags<enumtype, storagetype>::clear(enumtype e) { mBits &= ~static_cast<storagetype>(e); } -#if !PX_DOXYGEN } // namespace physx -#endif +#endif //!PX_DOXYGEN /** @} */ #endif // #ifndef PXFOUNDATION_PXFLAGS_H diff --git a/PxShared/include/foundation/PxFoundation.h b/PxShared/include/foundation/PxFoundation.h deleted file mode 100644 index aae84a9..0000000 --- a/PxShared/include/foundation/PxFoundation.h +++ /dev/null @@ -1,158 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 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 PX_FOUNDATION_PX_FOUNDATION_H -#define PX_FOUNDATION_PX_FOUNDATION_H - -/** \addtogroup foundation - @{ -*/ - -#include "foundation/Px.h" -#include "foundation/PxErrors.h" - -#if !PX_DOXYGEN -namespace physx -{ -#endif - -/** -\brief Foundation SDK singleton class. - -You need to have an instance of this class to instance the higher level SDKs. -*/ -class PX_FOUNDATION_API PxFoundation -{ - public: - /** - \brief Destroys the instance it is called on. - - The operation will fail, if there are still modules referencing the foundation object. Release all dependent modules - prior - to calling this method. - - @see PxCreateFoundation() - */ - virtual void release() = 0; - - /** - retrieves error callback - */ - virtual PxErrorCallback& getErrorCallback() = 0; - - /** - Sets mask of errors to report. - */ - virtual void setErrorLevel(PxErrorCode::Enum mask = PxErrorCode::eMASK_ALL) = 0; - - /** - Retrieves mask of errors to be reported. - */ - virtual PxErrorCode::Enum getErrorLevel() const = 0; - - /** - Retrieves the allocator this object was created with. - */ - virtual PxAllocatorCallback& getAllocatorCallback() = 0; - - /** - Retrieves if allocation names are being passed to allocator callback. - */ - virtual bool getReportAllocationNames() const = 0; - - /** - Set if allocation names are being passed to allocator callback. - \details Enabled by default in debug and checked build, disabled by default in profile and release build. - */ - virtual void setReportAllocationNames(bool value) = 0; - - protected: - virtual ~PxFoundation() - { - } -}; - -#if !PX_DOXYGEN -} // namespace physx -#endif - -/** -\brief Creates an instance of the foundation class - -The foundation class is needed to initialize higher level SDKs. There may be only one instance per process. -Calling this method after an instance has been created already will result in an error message and NULL will be -returned. - -\param version Version number we are expecting (should be PX_FOUNDATION_VERSION) -\param allocator User supplied interface for allocating memory(see #PxAllocatorCallback) -\param errorCallback User supplied interface for reporting errors and displaying messages(see #PxErrorCallback) -\return Foundation instance on success, NULL if operation failed - -@see PxFoundation -*/ - -PX_C_EXPORT PX_FOUNDATION_API physx::PxFoundation* PX_CALL_CONV -PxCreateFoundation(physx::PxU32 version, physx::PxAllocatorCallback& allocator, physx::PxErrorCallback& errorCallback); -/** -\brief Retrieves the Foundation SDK after it has been created. - -\note The behavior of this method is undefined if the foundation instance has not been created already. - -@see PxCreateFoundation() -*/ -#if PX_CLANG -#if PX_LINUX - #pragma clang diagnostic push - #pragma clang diagnostic ignored "-Wreturn-type-c-linkage" -#endif // PX_LINUX -#endif // PX_CLANG -PX_C_EXPORT PX_FOUNDATION_API physx::PxFoundation& PX_CALL_CONV PxGetFoundation(); -#if PX_CLANG -#if PX_LINUX - #pragma clang diagnostic pop -#endif // PX_LINUX -#endif // PX_CLANG - -namespace physx -{ -class PxProfilerCallback; -} - -/** -\brief Get the callback that will be used for all profiling. -*/ -PX_C_EXPORT PX_FOUNDATION_API physx::PxProfilerCallback* PX_CALL_CONV PxGetProfilerCallback(); - -/** -\brief Set the callback that will be used for all profiling. -*/ -PX_C_EXPORT PX_FOUNDATION_API void PX_CALL_CONV PxSetProfilerCallback(physx::PxProfilerCallback* profiler); - -/** @} */ -#endif // PX_FOUNDATION_PX_FOUNDATION_H diff --git a/PxShared/include/foundation/PxFoundationVersion.h b/PxShared/include/foundation/PxFoundationVersion.h deleted file mode 100644 index 6547405..0000000 --- a/PxShared/include/foundation/PxFoundationVersion.h +++ /dev/null @@ -1,65 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 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 PX_FOUNDATION_VERSION_NUMBER_H -#define PX_FOUNDATION_VERSION_NUMBER_H - -/* -VersionNumbers: The combination of these -numbers uniquely identifies the API, and should -be incremented when the SDK API changes. This may -include changes to file formats. - -This header is included in the main SDK header files -so that the entire SDK and everything that builds on it -is completely rebuilt when this file changes. Thus, -this file is not to include a frequently changing -build number. See BuildNumber.h for that. - -Each of these three values should stay below 255 because -sometimes they are stored in a byte. -*/ -/** \addtogroup foundation - @{ -*/ - -#define PX_FOUNDATION_VERSION_MAJOR 1 -#define PX_FOUNDATION_VERSION_MINOR 0 -#define PX_FOUNDATION_VERSION_BUGFIX 0 - -/** -The constant PX_FOUNDATION_VERSION is used when creating certain PhysX module objects. -This is to ensure that the application is using the same header version as the library was built with. -*/ -#define PX_FOUNDATION_VERSION \ - ((PX_FOUNDATION_VERSION_MAJOR << 24) + (PX_FOUNDATION_VERSION_MINOR << 16) + (PX_FOUNDATION_VERSION_BUGFIX << 8) + 0) - -#endif // PX_FOUNDATION_VERSION_NUMBER_H - -/** @} */ diff --git a/PxShared/include/foundation/PxIO.h b/PxShared/include/foundation/PxIO.h index 77ea1b6..1db6a80 100644 --- a/PxShared/include/foundation/PxIO.h +++ b/PxShared/include/foundation/PxIO.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// 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. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// 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. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. diff --git a/PxShared/include/foundation/PxIntrinsics.h b/PxShared/include/foundation/PxIntrinsics.h index b4aff28..8ddea2a 100644 --- a/PxShared/include/foundation/PxIntrinsics.h +++ b/PxShared/include/foundation/PxIntrinsics.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// 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. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// 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. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. diff --git a/PxShared/include/foundation/PxMat33.h b/PxShared/include/foundation/PxMat33.h index a3977c5..3019ba2 100644 --- a/PxShared/include/foundation/PxMat33.h +++ b/PxShared/include/foundation/PxMat33.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// 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. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// 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. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. @@ -309,13 +309,13 @@ class PxMat33 } //! Element access, mathematical way! - PX_DEPRECATED PX_CUDA_CALLABLE PX_FORCE_INLINE float operator()(unsigned int row, unsigned int col) const + PX_CUDA_CALLABLE PX_FORCE_INLINE float operator()(unsigned int row, unsigned int col) const { return (*this)[col][row]; } //! Element access, mathematical way! - PX_DEPRECATED PX_CUDA_CALLABLE PX_FORCE_INLINE float& operator()(unsigned int row, unsigned int col) + PX_CUDA_CALLABLE PX_FORCE_INLINE float& operator()(unsigned int row, unsigned int col) { return (*this)[col][row]; } @@ -339,11 +339,11 @@ class PxMat33 return &column0.x; } - PX_DEPRECATED PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3& operator[](unsigned int num) + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3& operator[](unsigned int num) { return (&column0)[num]; } - PX_DEPRECATED PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3& operator[](unsigned int num) const + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3& operator[](unsigned int num) const { return (&column0)[num]; } diff --git a/PxShared/include/foundation/PxMat44.h b/PxShared/include/foundation/PxMat44.h index 95f4636..577a93f 100644 --- a/PxShared/include/foundation/PxMat44.h +++ b/PxShared/include/foundation/PxMat44.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// 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. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// 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. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. @@ -264,13 +264,13 @@ class PxMat44 } //! Element access, mathematical way! - PX_DEPRECATED PX_CUDA_CALLABLE PX_FORCE_INLINE float operator()(unsigned int row, unsigned int col) const + PX_CUDA_CALLABLE PX_FORCE_INLINE float operator()(unsigned int row, unsigned int col) const { return (*this)[col][row]; } //! Element access, mathematical way! - PX_DEPRECATED PX_CUDA_CALLABLE PX_FORCE_INLINE float& operator()(unsigned int row, unsigned int col) + PX_CUDA_CALLABLE PX_FORCE_INLINE float& operator()(unsigned int row, unsigned int col) { return (*this)[col][row]; } @@ -301,7 +301,7 @@ class PxMat44 PX_CUDA_CALLABLE PX_INLINE const PxVec3 getBasis(int num) const { - PX_ASSERT(num >= 0 && num < 3); + PX_SHARED_ASSERT(num >= 0 && num < 3); return (&column0)[num].getXYZ(); } @@ -322,11 +322,11 @@ class PxMat44 return &column0.x; } - PX_DEPRECATED PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec4& operator[](unsigned int num) + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec4& operator[](unsigned int num) { return (&column0)[num]; } - PX_DEPRECATED PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec4& operator[](unsigned int num) const + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec4& operator[](unsigned int num) const { return (&column0)[num]; } diff --git a/PxShared/include/foundation/PxMath.h b/PxShared/include/foundation/PxMath.h index 7cea398..d75d8bc 100644 --- a/PxShared/include/foundation/PxMath.h +++ b/PxShared/include/foundation/PxMath.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// 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. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// 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. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. @@ -47,7 +47,7 @@ #include <float.h> #include "foundation/PxIntrinsics.h" -#include "foundation/PxAssert.h" +#include "foundation/PxSharedAssert.h" #if !PX_DOXYGEN namespace physx @@ -136,7 +136,7 @@ PX_CUDA_CALLABLE PX_FORCE_INLINE int32_t PxAbs(int32_t a) template <class T> PX_CUDA_CALLABLE PX_FORCE_INLINE T PxClamp(T v, T lo, T hi) { - PX_ASSERT(lo <= hi); + PX_SHARED_ASSERT(lo <= hi); return PxMin(hi, PxMax(lo, v)); } diff --git a/PxShared/include/foundation/PxMathUtils.h b/PxShared/include/foundation/PxMathUtils.h deleted file mode 100644 index 11ddde5..0000000 --- a/PxShared/include/foundation/PxMathUtils.h +++ /dev/null @@ -1,73 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 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 PXFOUNDATION_PXMATHUTILS_H -#define PXFOUNDATION_PXMATHUTILS_H - -/** \addtogroup common - @{ -*/ - -#include "foundation/Px.h" - -#if !PX_DOXYGEN -namespace physx -{ -#endif - -/** -\brief finds the shortest rotation between two vectors. - -\param[in] from the vector to start from -\param[in] target the vector to rotate to -\return a rotation about an axis normal to the two vectors which takes one to the other via the shortest path -*/ - -PX_FOUNDATION_API PxQuat PxShortestRotation(const PxVec3& from, const PxVec3& target); - -/* \brief diagonalizes a 3x3 symmetric matrix y - -The returned matrix satisfies M = R * D * R', where R is the rotation matrix for the output quaternion, R' its -transpose, and D the diagonal matrix - -If the matrix is not symmetric, the result is undefined. - -\param[in] m the matrix to diagonalize -\param[out] axes a quaternion rotation which diagonalizes the matrix -\return the vector diagonal of the diagonalized matrix. -*/ - -PX_FOUNDATION_API PxVec3 PxDiagonalize(const PxMat33& m, PxQuat& axes); - -#if !PX_DOXYGEN -} // namespace physx -#endif - -/** @} */ -#endif diff --git a/PxShared/include/foundation/PxMemory.h b/PxShared/include/foundation/PxMemory.h index 6a8a6ed..911b0d4 100644 --- a/PxShared/include/foundation/PxMemory.h +++ b/PxShared/include/foundation/PxMemory.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// 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. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// 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. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. diff --git a/PxShared/include/foundation/PxPlane.h b/PxShared/include/foundation/PxPlane.h index dcd542a..76f63f2 100644 --- a/PxShared/include/foundation/PxPlane.h +++ b/PxShared/include/foundation/PxPlane.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// 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. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// 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. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. diff --git a/PxShared/include/foundation/PxPreprocessor.h b/PxShared/include/foundation/PxPreprocessor.h index ddbf258..55dc196 100644 --- a/PxShared/include/foundation/PxPreprocessor.h +++ b/PxShared/include/foundation/PxPreprocessor.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// 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. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// 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. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. @@ -38,6 +38,12 @@ @{ */ +#define PX_STRINGIZE_HELPER(X) #X +#define PX_STRINGIZE(X) PX_STRINGIZE_HELPER(X) + +#define PX_CONCAT_HELPER(X, Y) X##Y +#define PX_CONCAT(X, Y) PX_CONCAT_HELPER(X, Y) + /* The following preprocessor identifiers specify compiler, OS, and architecture. All definitions have a value of 1 or 0, use '#if' instead of '#ifdef'. @@ -64,6 +70,13 @@ Compiler defines, see http://sourceforge.net/p/predef/wiki/Compilers/ #endif #elif defined(__clang__) #define PX_CLANG 1 + #if defined (__clang_major__) + #define PX_CLANG_MAJOR __clang_major__ + #elif defined (_clang_major) + #define PX_CLANG_MAJOR _clang_major + #else + #define PX_CLANG_MAJOR 0 + #endif #elif defined(__GNUC__) // note: __clang__ implies __GNUC__ #define PX_GCC 1 #else @@ -75,6 +88,8 @@ Operating system defines, see http://sourceforge.net/p/predef/wiki/OperatingSyst */ #if defined(_XBOX_ONE) #define PX_XBOXONE 1 +#elif defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_APP +#define PX_UWP 1 #elif defined(_WIN64) // note: _XBOX_ONE implies _WIN64 #define PX_WIN64 1 #elif defined(_WIN32) // note: _M_PPC implies _WIN32 @@ -102,7 +117,7 @@ Architecture defines, see http://sourceforge.net/p/predef/wiki/Architectures/ #define PX_X64 1 #elif defined(__i386__) || defined(_M_IX86) || defined (__EMSCRIPTEN__) #define PX_X86 1 -#elif defined(__arm64__) || defined(__aarch64__) +#elif defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64) #define PX_A64 1 #elif defined(__arm__) || defined(_M_ARM) #define PX_ARM 1 @@ -166,6 +181,9 @@ define anything not defined on this platform to 0 #ifndef PX_SWITCH #define PX_SWITCH 0 #endif +#ifndef PX_UWP +#define PX_UWP 0 +#endif #ifndef PX_X64 #define PX_X64 0 #endif @@ -203,6 +221,9 @@ define anything not defined through the command line to 0 #ifndef PX_PROFILE #define PX_PROFILE 0 #endif +#ifndef PX_DEBUG_CRT +#define PX_DEBUG_CRT 0 +#endif #ifndef PX_NVTX #define PX_NVTX 0 #endif @@ -216,7 +237,7 @@ family shortcuts // compiler #define PX_GCC_FAMILY (PX_CLANG || PX_GCC) // os -#define PX_WINDOWS_FAMILY (PX_WIN32 || PX_WIN64) +#define PX_WINDOWS_FAMILY (PX_WIN32 || PX_WIN64 || PX_UWP) #define PX_MICROSOFT_FAMILY (PX_XBOXONE || PX_WINDOWS_FAMILY) #define PX_LINUX_FAMILY (PX_LINUX || PX_ANDROID) #define PX_APPLE_FAMILY (PX_IOS || PX_OSX) // equivalent to #if __APPLE__ @@ -234,7 +255,7 @@ family shortcuts /** C++ standard library defines */ -#if defined(_LIBCPP_VERSION) || PX_WIN64 || PX_WIN32 || PX_PS4 || PX_XBOXONE || PX_EMSCRIPTEN +#if defined(_LIBCPP_VERSION) || PX_WIN64 || PX_WIN32 || PX_PS4 || PX_XBOXONE || PX_UWP || PX_EMSCRIPTEN #define PX_LIBCPP 1 #else #define PX_LIBCPP 0 @@ -280,31 +301,6 @@ DLL export macros #endif /** -Define API function declaration - -PX_FOUNDATION_DLL=1 - used by the DLL library (PhysXCommon) to export the API -PX_FOUNDATION_DLL=0 - for windows configurations where the PX_FOUNDATION_API is linked through standard static linking -no definition - this will allow DLLs and libraries to use the exported API from PhysXCommon - -*/ - -#if PX_WINDOWS_FAMILY && !PX_ARM_FAMILY -#ifndef PX_FOUNDATION_DLL -#define PX_FOUNDATION_API PX_DLL_IMPORT -#elif PX_FOUNDATION_DLL -#define PX_FOUNDATION_API PX_DLL_EXPORT -#endif -#elif PX_UNIX_FAMILY -#ifdef PX_FOUNDATION_DLL -#define PX_FOUNDATION_API PX_UNIX_EXPORT -#endif -#endif - -#ifndef PX_FOUNDATION_API -#define PX_FOUNDATION_API -#endif - -/** Calling convention */ #ifndef PX_CALL_CONV @@ -428,7 +424,7 @@ General defines // static assert #if(defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))) || (PX_PS4) || (PX_APPLE_FAMILY) || (PX_SWITCH) || (PX_CLANG && PX_ARM) -#define PX_COMPILE_TIME_ASSERT(exp) typedef char PxCompileTimeAssert_Dummy[(exp) ? 1 : -1] __attribute__((unused)) +#define PX_COMPILE_TIME_ASSERT(exp) typedef char PX_CONCAT(PxCompileTimeAssert_Dummy, __COUNTER__)[(exp) ? 1 : -1] __attribute__((unused)) #else #define PX_COMPILE_TIME_ASSERT(exp) typedef char PxCompileTimeAssert_Dummy[(exp) ? 1 : -1] #endif @@ -520,12 +516,6 @@ protected: Class(const Class&); \ Class& operator=(const Class&); -#define PX_STRINGIZE_HELPER(X) #X -#define PX_STRINGIZE(X) PX_STRINGIZE_HELPER(X) - -#define PX_CONCAT_HELPER(X, Y) X##Y -#define PX_CONCAT(X, Y) PX_CONCAT_HELPER(X, Y) - #ifndef DISABLE_CUDA_PHYSX //CUDA is currently supported only on windows #define PX_SUPPORT_GPU_PHYSX ((PX_WINDOWS_FAMILY) || (PX_LINUX && PX_X64)) diff --git a/PxShared/include/foundation/PxProfiler.h b/PxShared/include/foundation/PxProfiler.h index 4864969..a949b72 100644 --- a/PxShared/include/foundation/PxProfiler.h +++ b/PxShared/include/foundation/PxProfiler.h @@ -1,34 +1,34 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// 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. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// 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. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. #ifndef PXFOUNDATION_PXPROFILER_H #define PXFOUNDATION_PXPROFILER_H -#include "foundation/PxFoundation.h" +#include "foundation/Px.h" namespace physx { @@ -71,7 +71,7 @@ public: class PxProfileScoped { public: - PX_FORCE_INLINE PxProfileScoped(const char* eventName, bool detached, uint64_t contextId) : mCallback(PxGetProfilerCallback()), mProfilerData(NULL) + PX_FORCE_INLINE PxProfileScoped(PxProfilerCallback* callback, const char* eventName, bool detached, uint64_t contextId) : mCallback(callback), mProfilerData(NULL) { if(mCallback) { @@ -87,7 +87,7 @@ class PxProfileScoped if(mCallback) mCallback->zoneEnd(mProfilerData, mEventName, mDetached, mContextId); } - physx::PxProfilerCallback* mCallback; + PxProfilerCallback* mCallback; const char* mEventName; void* mProfilerData; uint64_t mContextId; @@ -96,21 +96,4 @@ class PxProfileScoped } // end of physx namespace -#if PX_DEBUG || PX_CHECKED || PX_PROFILE - #define PX_PROFILE_ZONE(x, y) \ - physx::PxProfileScoped PX_CONCAT(_scoped, __LINE__)(x, false, y) - #define PX_PROFILE_START_CROSSTHREAD(x, y) \ - if(PxGetProfilerCallback()) \ - PxGetProfilerCallback()->zoneStart(x, true, y) - #define PX_PROFILE_STOP_CROSSTHREAD(x, y) \ - if(PxGetProfilerCallback()) \ - PxGetProfilerCallback()->zoneEnd(NULL, x, true, y) -#else - #define PX_PROFILE_ZONE(x, y) - #define PX_PROFILE_START_CROSSTHREAD(x, y) - #define PX_PROFILE_STOP_CROSSTHREAD(x, y) -#endif - -#define PX_PROFILE_POINTER_TO_U64(pointer) static_cast<uint64_t>(reinterpret_cast<size_t>(pointer)) - #endif // PXFOUNDATION_PXPROFILER_H diff --git a/PxShared/include/foundation/PxQuat.h b/PxShared/include/foundation/PxQuat.h index 1313b0e..f29a372 100644 --- a/PxShared/include/foundation/PxQuat.h +++ b/PxShared/include/foundation/PxQuat.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// 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. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// 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. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. @@ -87,7 +87,7 @@ class PxQuat */ PX_CUDA_CALLABLE PX_INLINE PxQuat(float angleRadians, const PxVec3& unitAxis) { - PX_ASSERT(PxAbs(1.0f - unitAxis.magnitude()) < 1e-3f); + PX_SHARED_ASSERT(PxAbs(1.0f - unitAxis.magnitude()) < 1e-3f); const float a = angleRadians * 0.5f; const float s = PxSin(a); w = PxCos(a); diff --git a/PxShared/include/foundation/PxSharedAssert.h b/PxShared/include/foundation/PxSharedAssert.h new file mode 100644 index 0000000..1cb05cb --- /dev/null +++ b/PxShared/include/foundation/PxSharedAssert.h @@ -0,0 +1,46 @@ +// +// 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-2019 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 PXFOUNDATION_PXASSERT_H +#define PXFOUNDATION_PXASSERT_H + +/** \addtogroup foundation +@{ */ + +#include "foundation/Px.h" + +#if !PX_ENABLE_ASSERTS + #define PX_SHARED_ASSERT(exp) ((void)0) +#else + #include <assert.h> + #define PX_SHARED_ASSERT(exp) assert(exp); +#endif // !PX_ENABLE_ASSERTS + +/** @} */ +#endif // #ifndef PXFOUNDATION_PXASSERT_H diff --git a/PxShared/include/foundation/PxSimpleTypes.h b/PxShared/include/foundation/PxSimpleTypes.h index 655fbb3..a9ced08 100644 --- a/PxShared/include/foundation/PxSimpleTypes.h +++ b/PxShared/include/foundation/PxSimpleTypes.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// 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. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// 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. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. @@ -56,7 +56,7 @@ #if PX_VC // we could use inttypes.h starting with VC12 #define PX_PRIu64 "I64u" #else -#if !PX_PS4 && !PX_APPLE_FAMILY && !PX_SWITCH +#if !PX_PS4 && !PX_APPLE_FAMILY #define __STDC_FORMAT_MACROS #endif #include <inttypes.h> diff --git a/PxShared/include/foundation/PxStrideIterator.h b/PxShared/include/foundation/PxStrideIterator.h index 1e4c448..dd6dd10 100644 --- a/PxShared/include/foundation/PxStrideIterator.h +++ b/PxShared/include/foundation/PxStrideIterator.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// 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. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// 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. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. @@ -31,7 +31,7 @@ #define PXFOUNDATION_PXSTRIDEITERATOR_H #include "foundation/Px.h" -#include "foundation/PxAssert.h" +#include "foundation/PxSharedAssert.h" /** \addtogroup foundation @{ @@ -106,7 +106,7 @@ class PxStrideIterator */ explicit PX_INLINE PxStrideIterator(T* ptr = NULL, PxU32 stride = sizeof(T)) : mPtr(ptr), mStride(stride) { - PX_ASSERT(mStride == 0 || sizeof(T) <= mStride); + PX_SHARED_ASSERT(mStride == 0 || sizeof(T) <= mStride); } /** @@ -117,7 +117,7 @@ class PxStrideIterator PX_INLINE PxStrideIterator(const PxStrideIterator<typename StripConst<T>::Type>& strideIterator) : mPtr(strideIterator.ptr()), mStride(strideIterator.stride()) { - PX_ASSERT(mStride == 0 || sizeof(T) <= mStride); + PX_SHARED_ASSERT(mStride == 0 || sizeof(T) <= mStride); } /** @@ -237,7 +237,7 @@ class PxStrideIterator */ PX_INLINE int operator-(const PxStrideIterator& other) const { - PX_ASSERT(isCompatible(other)); + PX_SHARED_ASSERT(isCompatible(other)); int byteDiff = static_cast<int>(reinterpret_cast<const PxU8*>(mPtr) - reinterpret_cast<const PxU8*>(other.mPtr)); return byteDiff / static_cast<int>(stride()); } @@ -247,7 +247,7 @@ class PxStrideIterator */ PX_INLINE bool operator==(const PxStrideIterator& other) const { - PX_ASSERT(isCompatible(other)); + PX_SHARED_ASSERT(isCompatible(other)); return mPtr == other.mPtr; } @@ -256,7 +256,7 @@ class PxStrideIterator */ PX_INLINE bool operator!=(const PxStrideIterator& other) const { - PX_ASSERT(isCompatible(other)); + PX_SHARED_ASSERT(isCompatible(other)); return mPtr != other.mPtr; } @@ -265,7 +265,7 @@ class PxStrideIterator */ PX_INLINE bool operator<(const PxStrideIterator& other) const { - PX_ASSERT(isCompatible(other)); + PX_SHARED_ASSERT(isCompatible(other)); return mPtr < other.mPtr; } @@ -274,7 +274,7 @@ class PxStrideIterator */ PX_INLINE bool operator>(const PxStrideIterator& other) const { - PX_ASSERT(isCompatible(other)); + PX_SHARED_ASSERT(isCompatible(other)); return mPtr > other.mPtr; } @@ -283,7 +283,7 @@ class PxStrideIterator */ PX_INLINE bool operator<=(const PxStrideIterator& other) const { - PX_ASSERT(isCompatible(other)); + PX_SHARED_ASSERT(isCompatible(other)); return mPtr <= other.mPtr; } @@ -292,7 +292,7 @@ class PxStrideIterator */ PX_INLINE bool operator>=(const PxStrideIterator& other) const { - PX_ASSERT(isCompatible(other)); + PX_SHARED_ASSERT(isCompatible(other)); return mPtr >= other.mPtr; } diff --git a/PxShared/include/foundation/PxTransform.h b/PxShared/include/foundation/PxTransform.h index ddba031..f639903 100644 --- a/PxShared/include/foundation/PxTransform.h +++ b/PxShared/include/foundation/PxTransform.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// 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. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// 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. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. @@ -66,7 +66,7 @@ class PxTransform PX_CUDA_CALLABLE PX_FORCE_INLINE explicit PxTransform(const PxQuat& orientation) : q(orientation), p(0) { - PX_ASSERT(orientation.isSane()); + PX_SHARED_ASSERT(orientation.isSane()); } PX_CUDA_CALLABLE PX_FORCE_INLINE PxTransform(float x, float y, float z, PxQuat aQ = PxQuat(PxIdentity)) @@ -76,7 +76,7 @@ class PxTransform PX_CUDA_CALLABLE PX_FORCE_INLINE PxTransform(const PxVec3& p0, const PxQuat& q0) : q(q0), p(p0) { - PX_ASSERT(q0.isSane()); + PX_SHARED_ASSERT(q0.isSane()); } PX_CUDA_CALLABLE PX_FORCE_INLINE explicit PxTransform(const PxMat44& m); // defined in PxMat44.h @@ -91,7 +91,7 @@ class PxTransform PX_CUDA_CALLABLE PX_FORCE_INLINE PxTransform operator*(const PxTransform& x) const { - PX_ASSERT(x.isSane()); + PX_SHARED_ASSERT(x.isSane()); return transform(x); } @@ -104,39 +104,39 @@ class PxTransform PX_CUDA_CALLABLE PX_FORCE_INLINE PxTransform getInverse() const { - PX_ASSERT(isFinite()); + PX_SHARED_ASSERT(isFinite()); return PxTransform(q.rotateInv(-p), q.getConjugate()); } PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 transform(const PxVec3& input) const { - PX_ASSERT(isFinite()); + PX_SHARED_ASSERT(isFinite()); return q.rotate(input) + p; } PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 transformInv(const PxVec3& input) const { - PX_ASSERT(isFinite()); + PX_SHARED_ASSERT(isFinite()); return q.rotateInv(input - p); } PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 rotate(const PxVec3& input) const { - PX_ASSERT(isFinite()); + PX_SHARED_ASSERT(isFinite()); return q.rotate(input); } PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 rotateInv(const PxVec3& input) const { - PX_ASSERT(isFinite()); + PX_SHARED_ASSERT(isFinite()); return q.rotateInv(input); } //! Transform transform to parent (returns compound transform: first src, then *this) PX_CUDA_CALLABLE PX_FORCE_INLINE PxTransform transform(const PxTransform& src) const { - PX_ASSERT(src.isSane()); - PX_ASSERT(isSane()); + PX_SHARED_ASSERT(src.isSane()); + PX_SHARED_ASSERT(isSane()); // src = [srct, srcr] -> [r*srct + t, r*srcr] return PxTransform(q.rotate(src.p) + p, q * src.q); } @@ -171,8 +171,8 @@ class PxTransform //! Transform transform from parent (returns compound transform: first src, then this->inverse) PX_CUDA_CALLABLE PX_FORCE_INLINE PxTransform transformInv(const PxTransform& src) const { - PX_ASSERT(src.isSane()); - PX_ASSERT(isFinite()); + PX_SHARED_ASSERT(src.isSane()); + PX_SHARED_ASSERT(isFinite()); // src = [srct, srcr] -> [r^-1*(srct-t), r^-1*srcr] PxQuat qinv = q.getConjugate(); return PxTransform(qinv.rotate(src.p - p), qinv * src.q); diff --git a/PxShared/include/foundation/PxUnionCast.h b/PxShared/include/foundation/PxUnionCast.h index 7bead42..007493c 100644 --- a/PxShared/include/foundation/PxUnionCast.h +++ b/PxShared/include/foundation/PxUnionCast.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// 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. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// 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. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. @@ -41,6 +41,13 @@ namespace physx { #endif +// Needed for clang 7 +#if PX_CLANG && PX_CLANG_MAJOR >= 7 + #define USE_VOLATILE_UNION volatile +#else + #define USE_VOLATILE_UNION +#endif + template <class A, class B> PX_FORCE_INLINE A PxUnionCast(B b) { @@ -49,12 +56,14 @@ PX_FORCE_INLINE A PxUnionCast(B b) AB(B bb) : _b(bb) { } - B _b; - A _a; - } u(b); + B _b; + A _a; + } USE_VOLATILE_UNION u(b); return u._a; } +#undef USE_VOLATILE_UNION + #if !PX_DOXYGEN } // namespace physx #endif diff --git a/PxShared/include/foundation/PxVec2.h b/PxShared/include/foundation/PxVec2.h index bee58e8..1128111 100644 --- a/PxShared/include/foundation/PxVec2.h +++ b/PxShared/include/foundation/PxVec2.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// 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. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// 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. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. @@ -107,9 +107,9 @@ class PxVec2 /** \brief element access */ - PX_DEPRECATED PX_CUDA_CALLABLE PX_FORCE_INLINE float& operator[](int index) + PX_CUDA_CALLABLE PX_FORCE_INLINE float& operator[](int index) { - PX_ASSERT(index >= 0 && index <= 1); + PX_SHARED_ASSERT(index >= 0 && index <= 1); return reinterpret_cast<float*>(this)[index]; } @@ -117,9 +117,9 @@ class PxVec2 /** \brief element access */ - PX_DEPRECATED PX_CUDA_CALLABLE PX_FORCE_INLINE const float& operator[](int index) const + PX_CUDA_CALLABLE PX_FORCE_INLINE const float& operator[](int index) const { - PX_ASSERT(index >= 0 && index <= 1); + PX_SHARED_ASSERT(index >= 0 && index <= 1); return reinterpret_cast<const float*>(this)[index]; } diff --git a/PxShared/include/foundation/PxVec3.h b/PxShared/include/foundation/PxVec3.h index 7c15afb..d3baead 100644 --- a/PxShared/include/foundation/PxVec3.h +++ b/PxShared/include/foundation/PxVec3.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// 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. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// 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. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. @@ -109,9 +109,9 @@ class PxVec3 /** \brief element access */ - PX_DEPRECATED PX_CUDA_CALLABLE PX_FORCE_INLINE float& operator[](unsigned int index) + PX_CUDA_CALLABLE PX_FORCE_INLINE float& operator[](unsigned int index) { - PX_ASSERT(index <= 2); + PX_SHARED_ASSERT(index <= 2); return reinterpret_cast<float*>(this)[index]; } @@ -119,12 +119,13 @@ class PxVec3 /** \brief element access */ - PX_DEPRECATED PX_CUDA_CALLABLE PX_FORCE_INLINE const float& operator[](unsigned int index) const + PX_CUDA_CALLABLE PX_FORCE_INLINE const float& operator[](unsigned int index) const { - PX_ASSERT(index <= 2); + PX_SHARED_ASSERT(index <= 2); return reinterpret_cast<const float*>(this)[index]; } + /** \brief returns true if the two vectors are exactly equal. */ @@ -324,7 +325,7 @@ class PxVec3 PX_CUDA_CALLABLE PX_FORCE_INLINE float normalizeFast() { const float mag = magnitude(); - PX_ASSERT(mag >= PX_NORMALIZATION_EPSILON); + PX_SHARED_ASSERT(mag >= PX_NORMALIZATION_EPSILON); *this *= 1.0f / mag; return mag; } diff --git a/PxShared/include/foundation/PxVec4.h b/PxShared/include/foundation/PxVec4.h index e33eddf..711e531 100644 --- a/PxShared/include/foundation/PxVec4.h +++ b/PxShared/include/foundation/PxVec4.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// 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. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// 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. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. @@ -34,7 +34,7 @@ */ #include "foundation/PxMath.h" #include "foundation/PxVec3.h" -#include "foundation/PxAssert.h" +#include "foundation/PxSharedAssert.h" /** \brief 4 Element vector class. @@ -130,9 +130,9 @@ class PxVec4 /** \brief element access */ - PX_DEPRECATED PX_CUDA_CALLABLE PX_INLINE float& operator[](unsigned int index) + PX_CUDA_CALLABLE PX_INLINE float& operator[](unsigned int index) { - PX_ASSERT(index <= 3); + PX_SHARED_ASSERT(index <= 3); return reinterpret_cast<float*>(this)[index]; } @@ -140,9 +140,9 @@ class PxVec4 /** \brief element access */ - PX_DEPRECATED PX_CUDA_CALLABLE PX_INLINE const float& operator[](unsigned int index) const + PX_CUDA_CALLABLE PX_INLINE const float& operator[](unsigned int index) const { - PX_ASSERT(index <= 3); + PX_SHARED_ASSERT(index <= 3); return reinterpret_cast<const float*>(this)[index]; } diff --git a/PxShared/include/foundation/unix/PxUnixIntrinsics.h b/PxShared/include/foundation/unix/PxUnixIntrinsics.h index 5f492bc..1095b13 100644 --- a/PxShared/include/foundation/unix/PxUnixIntrinsics.h +++ b/PxShared/include/foundation/unix/PxUnixIntrinsics.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// 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. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// 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. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. @@ -31,7 +31,7 @@ #define PXFOUNDATION_PXUNIXINTRINSICS_H #include "foundation/Px.h" -#include "foundation/PxAssert.h" +#include "foundation/PxSharedAssert.h" #if !(PX_LINUX || PX_ANDROID || PX_PS4 || PX_APPLE_FAMILY) #error "This file should only be included by Unix builds!!" @@ -175,7 +175,7 @@ Set 128B to zero starting at \c dst+offset. Must be aligned. */ PX_FORCE_INLINE void memZero128(void* dest, uint32_t offset = 0) { - PX_ASSERT(((size_t(dest) + offset) & 0x7f) == 0); + PX_SHARED_ASSERT(((size_t(dest) + offset) & 0x7f) == 0); memSet(reinterpret_cast<char*>(dest) + offset, 0, 128); } diff --git a/PxShared/include/foundation/windows/PxWindowsFoundationDelayLoadHook.h b/PxShared/include/foundation/windows/PxWindowsFoundationDelayLoadHook.h deleted file mode 100644 index 1d42185..0000000 --- a/PxShared/include/foundation/windows/PxWindowsFoundationDelayLoadHook.h +++ /dev/null @@ -1,71 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 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 PX_FOUNDATION_DELAY_LOAD_HOOK -#define PX_FOUNDATION_DELAY_LOAD_HOOK - -#include "foundation/PxPreprocessor.h" - -/** \addtogroup foundation -@{ -*/ - -#if !PX_DOXYGEN -namespace physx -{ -#endif - /** - \brief PxFoundationDelayLoadHook - - This is a helper class for delay loading the PxFoundation dll. - If a PxFoundation dll with a non-default file name needs to be loaded, - PxFoundationDelayLoadHook can be sub-classed to provide the custom file names. - - Once the names are set, the instance must be set for use by the loading dll. - */ - class PxFoundationDelayLoadHook - { - public: - PxFoundationDelayLoadHook() {} - virtual ~PxFoundationDelayLoadHook() {} - - virtual const char* getPxFoundationDEBUGDllName() const = 0; - virtual const char* getPxFoundationCHECKEDDllName() const = 0; - virtual const char* getPxFoundationPROFILEDllName() const = 0; - virtual const char* getPxFoundationDllName() const = 0; - - protected: - private: - }; - -#if !PX_DOXYGEN -} // namespace physx -#endif -/** @} */ -#endif diff --git a/PxShared/include/foundation/windows/PxWindowsIntrinsics.h b/PxShared/include/foundation/windows/PxWindowsIntrinsics.h index 3cc63b5..804c20b 100644 --- a/PxShared/include/foundation/windows/PxWindowsIntrinsics.h +++ b/PxShared/include/foundation/windows/PxWindowsIntrinsics.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// 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. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// 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. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. @@ -31,7 +31,7 @@ #define PXFOUNDATION_PXWINDOWSINTRINSICS_H #include "foundation/Px.h" -#include "foundation/PxAssert.h" +#include "foundation/PxSharedAssert.h" #if !PX_WINDOWS_FAMILY #error "This file should only be included by Windows builds!!" @@ -176,7 +176,7 @@ Set 128B to zero starting at \c dst+offset. Must be aligned. */ PX_FORCE_INLINE void memZero128(void* dest, uint32_t offset = 0) { - PX_ASSERT(((size_t(dest) + offset) & 0x7f) == 0); + PX_SHARED_ASSERT(((size_t(dest) + offset) & 0x7f) == 0); memSet(reinterpret_cast<char*>(dest) + offset, 0, 128); } diff --git a/PxShared/include/pvd/PxPvd.h b/PxShared/include/pvd/PxPvd.h deleted file mode 100644 index 277ac4f..0000000 --- a/PxShared/include/pvd/PxPvd.h +++ /dev/null @@ -1,193 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 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 PXPVDSDK_PXPVD_H -#define PXPVDSDK_PXPVD_H - -/** \addtogroup pvd -@{ -*/ -#include "foundation/PxFlags.h" -#include "foundation/PxProfiler.h" - -#if !PX_DOXYGEN -namespace physx -{ -#endif - -class PxPvdTransport; - -#if PX_WINDOWS_FAMILY && !PX_ARM_FAMILY -#ifndef PX_PVDSDK_DLL -#define PX_PVDSDK_API PX_DLL_IMPORT -#elif PX_PVDSDK_DLL -#define PX_PVDSDK_API PX_DLL_EXPORT -#endif -#elif PX_UNIX_FAMILY -#ifdef PX_PVDSDK_DLL -#define PX_PVDSDK_API PX_UNIX_EXPORT -#endif -#endif - -#ifndef PX_PVDSDK_API -#define PX_PVDSDK_API -#endif - -/** -\brief types of instrumentation that PVD can do. -*/ -struct PxPvdInstrumentationFlag -{ - enum Enum - { - /** - \brief Send debugging information to PVD. - - This information is the actual object data of the rigid statics, shapes, - articulations, etc. Sending this information has a noticeable impact on - performance and thus this flag should not be set if you want an accurate - performance profile. - */ - eDEBUG = 1 << 0, - - /** - \brief Send profile information to PVD. - - This information populates PVD's profile view. It has (at this time) negligible - cost compared to Debug information and makes PVD *much* more useful so it is quite - highly recommended. - - This flag works together with a PxCreatePhysics parameter. - Using it allows the SDK to send profile events to PVD. - */ - ePROFILE = 1 << 1, - - /** - \brief Send memory information to PVD. - - The PVD sdk side hooks into the Foundation memory controller and listens to - allocation/deallocation events. This has a noticable hit on the first frame, - however, this data is somewhat compressed and the PhysX SDK doesn't allocate much - once it hits a steady state. This information also has a fairly negligible - impact and thus is also highly recommended. - - This flag works together with a PxCreatePhysics parameter, - trackOutstandingAllocations. Using both of them together allows users to have - an accurate view of the overall memory usage of the simulation at the cost of - a hashtable lookup per allocation/deallocation. Again, PhysX makes a best effort - attempt not to allocate or deallocate during simulation so this hashtable lookup - tends to have no effect past the first frame. - - Sending memory information without tracking outstanding allocations means that - PVD will accurate information about the state of the memory system before the - actual connection happened. - */ - eMEMORY = 1 << 2, - - eALL = (eDEBUG | ePROFILE | eMEMORY) - }; -}; - -/** -\brief Bitfield that contains a set of raised flags defined in PxPvdInstrumentationFlag. - -@see PxPvdInstrumentationFlag -*/ -typedef PxFlags<PxPvdInstrumentationFlag::Enum, uint8_t> PxPvdInstrumentationFlags; -PX_FLAGS_OPERATORS(PxPvdInstrumentationFlag::Enum, uint8_t) - -/** -\brief PxPvd is the top-level class for the PVD framework, and the main customer interface for PVD -configuration.It is a singleton class, instantiated and owned by the application. -*/ -class PxPvd : public physx::PxProfilerCallback -{ - public: - /** - Connects the SDK to the PhysX Visual Debugger application. - \param transport transport for pvd captured data. - \param flags Flags to set. - return True if success - */ - virtual bool connect(PxPvdTransport& transport, PxPvdInstrumentationFlags flags) = 0; - - /** - Disconnects the SDK from the PhysX Visual Debugger application. - If we are still connected, this will kill the entire debugger connection. - */ - virtual void disconnect() = 0; - - /** - * Return if connection to PVD is created. - \param useCachedStatus - 1> When useCachedStaus is false, isConnected() checks the lowlevel network status. - This can be slow because it needs to lock the lowlevel network stream. If isConnected() is - called frequently, the expense of locking can be significant. - 2> When useCachedStatus is true, isConnected() checks the highlevel cached status with atomic access. - It is faster than locking, but the status may be different from the lowlevel network with latency of up to - one frame. - The reason for this is that the cached status is changed inside socket listener, which is not - called immediately when the lowlevel connection status changes. - */ - virtual bool isConnected(bool useCachedStatus = true) = 0; - - /** - returns the PVD data transport - returns NULL if no transport is present. - */ - virtual PxPvdTransport* getTransport() = 0; - - /** - Retrieves the PVD flags. See PxPvdInstrumentationFlags. - */ - virtual PxPvdInstrumentationFlags getInstrumentationFlags() = 0; - - /** - \brief Releases the pvd instance. - */ - virtual void release() = 0; - - protected: - virtual ~PxPvd() - { - } -}; - -/** - \brief Create a pvd instance. - \param foundation is the foundation instance that stores the allocator and error callbacks. -*/ -PX_PVDSDK_API PxPvd* PX_CALL_CONV PxCreatePvd(PxFoundation& foundation); - -#if !PX_DOXYGEN -} // namespace physx -#endif - -/** @} */ -#endif // PXPVDSDK_PXPVD_H diff --git a/PxShared/include/pvd/PxPvdTransport.h b/PxShared/include/pvd/PxPvdTransport.h deleted file mode 100644 index dbaf878..0000000 --- a/PxShared/include/pvd/PxPvdTransport.h +++ /dev/null @@ -1,129 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 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 PXPVDSDK_PXPVDTRANSPORT_H -#define PXPVDSDK_PXPVDTRANSPORT_H - -/** \addtogroup pvd -@{ -*/ -#include "foundation/PxErrors.h" -#include "foundation/PxFlags.h" -#include "pvd/PxPvd.h" - -#if !PX_DOXYGEN -namespace physx -{ -#endif - -/** -\brief PxPvdTransport is an interface representing the data transport mechanism. -This class defines all services associated with the transport: configuration, connection, reading, writing etc. -It is owned by the application, and can be realized as a file or a socket (using one-line PxDefault<...> methods in -PhysXExtensions) or in a custom implementation. This is a class that is intended for use by PVD, not by the -application, the application entry points are PxPvd and PvdClient. -*/ - -class PxPvdTransport -{ - public: - // connect, isConnected, disconnect, read, write, flush - - /** - Connects to the Visual Debugger application. - return True if success - */ - virtual bool connect() = 0; - - /** - Disconnects from the Visual Debugger application. - If we are still connected, this will kill the entire debugger connection. - */ - virtual void disconnect() = 0; - - /** - * Return if connection to PVD is created. - */ - virtual bool isConnected() = 0; - - /** - * write bytes to the other endpoint of the connection. should lock before witre. If an error occurs - * this connection will assume to be dead. - */ - virtual bool write(const uint8_t* inBytes, uint32_t inLength) = 0; - - /* - lock this transport and return it - */ - virtual PxPvdTransport& lock() = 0; - - /* - unlock this transport - */ - virtual void unlock() = 0; - - /** - * send any data and block until we know it is at least on the wire. - */ - virtual void flush() = 0; - - /** - * Return size of written data. - */ - virtual uint64_t getWrittenDataSize() = 0; - - virtual void release() = 0; - - protected: - virtual ~PxPvdTransport() - { - } -}; - -/** - \brief Create a default socket transport. - \param host host address of the pvd application. - \param port ip port used for pvd, should same as the port setting in pvd application. - \param timeoutInMilliseconds timeout when connect to pvd host. -*/ -PX_PVDSDK_API PxPvdTransport* PX_CALL_CONV -PxDefaultPvdSocketTransportCreate(const char* host, int port, unsigned int timeoutInMilliseconds); - -/** - \brief Create a default file transport. - \param name full path filename used save captured pvd data. -*/ -PX_PVDSDK_API PxPvdTransport* PX_CALL_CONV PxDefaultPvdFileTransportCreate(const char* name); - -#if !PX_DOXYGEN -} // namespace physx -#endif - -/** @} */ -#endif // PXPVDSDK_PXPVDTRANSPORT_H diff --git a/PxShared/include/pvd/windows/PxWindowsPvdDelayLoadHook.h b/PxShared/include/pvd/windows/PxWindowsPvdDelayLoadHook.h deleted file mode 100644 index 13bd7e9..0000000 --- a/PxShared/include/pvd/windows/PxWindowsPvdDelayLoadHook.h +++ /dev/null @@ -1,60 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 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 PX_PVD_DELAY_LOAD_HOOK -#define PX_PVD_DELAY_LOAD_HOOK - -#include "foundation/PxPreprocessor.h" -#include "foundation/windows/PxWindowsFoundationDelayLoadHook.h" -#include "../PxPvd.h" - -/** \addtogroup pvd -@{ -*/ - -#if !PX_DOXYGEN -namespace physx -{ -#endif - - /** - \brief Sets delay load hook instance for Foundation dll. - - \param[in] hook Delay load hook. - - @see PxFoundationDelayLoadHook - */ - PX_C_EXPORT PX_PVDSDK_API void PX_CALL_CONV PxPvdSetFoundationDelayLoadHook(const physx::PxFoundationDelayLoadHook* hook); - -#if !PX_DOXYGEN -} // namespace physx -#endif -/** @} */ -#endif diff --git a/PxShared/include/task/PxCpuDispatcher.h b/PxShared/include/task/PxCpuDispatcher.h deleted file mode 100644 index ffd5cfd..0000000 --- a/PxShared/include/task/PxCpuDispatcher.h +++ /dev/null @@ -1,79 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXTASK_PXCPUDISPATCHER_H -#define PXTASK_PXCPUDISPATCHER_H - -#include "task/PxTaskDefine.h" -#include "foundation/PxSimpleTypes.h" - -namespace physx -{ - -class PxBaseTask; - -/** - \brief A CpuDispatcher is responsible for scheduling the execution of tasks passed to it by the SDK. - - A typical implementation would for example use a thread pool with the dispatcher - pushing tasks onto worker thread queues or a global queue. - - @see PxBaseTask - @see PxTask - @see PxTaskManager -*/ -class PxCpuDispatcher -{ -public: - /** - \brief Called by the TaskManager when a task is to be queued for execution. - - Upon receiving a task, the dispatcher should schedule the task - to run when resource is available. After the task has been run, - it should call the release() method and discard it's pointer. - - \param[in] task The task to be run. - - @see PxBaseTask - */ - virtual void submitTask( PxBaseTask& task ) = 0; - - /** - \brief Returns the number of available worker threads for this dispatcher. - - The SDK will use this count to control how many tasks are submitted. By - matching the number of tasks with the number of execution units task - overhead can be reduced. - */ - virtual uint32_t getWorkerCount() const = 0; - - virtual ~PxCpuDispatcher() {} -}; - -} // end physx namespace - -#endif // PXTASK_PXCPUDISPATCHER_H diff --git a/PxShared/include/task/PxGpuDispatcher.h b/PxShared/include/task/PxGpuDispatcher.h deleted file mode 100644 index 6cd4c3b..0000000 --- a/PxShared/include/task/PxGpuDispatcher.h +++ /dev/null @@ -1,248 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXTASK_PXGPUDISPATCHER_H -#define PXTASK_PXGPUDISPATCHER_H - -#include "task/PxTaskDefine.h" -#include "task/PxTask.h" - -/* forward decl to avoid including <cuda.h> */ -typedef struct CUstream_st* CUstream; - -namespace physx -{ - -struct PxGpuCopyDesc; -class PxCudaContextManager; - -PX_PUSH_PACK_DEFAULT - -class PxTaskManager; - -/** \brief A GpuTask dispatcher - * - * A PxGpuDispatcher executes GpuTasks submitted by one or more TaskManagers (one - * or more scenes). It maintains a CPU worker thread which waits on GpuTask - * "groups" to be submitted. The submission API is explicitly sessioned so that - * GpuTasks are dispatched together as a group whenever possible to improve - * parallelism on the GPU. - * - * A PxGpuDispatcher cannot be allocated ad-hoc, they are created as a result of - * creating a PxCudaContextManager. Every PxCudaContextManager has a PxGpuDispatcher - * instance that can be queried. In this way, each PxGpuDispatcher is tied to - * exactly one CUDA context. - * - * A scene will use CPU fallback Tasks for GpuTasks if the PxTaskManager provided - * to it does not have a PxGpuDispatcher. For this reason, the PxGpuDispatcher must - * be assigned to the PxTaskManager before the PxTaskManager is given to a scene. - * - * Multiple TaskManagers may safely share a single PxGpuDispatcher instance, thus - * enabling scenes to share a CUDA context. - * - * Only failureDetected() is intended for use by the user. The rest of the - * nvGpuDispatcher public methods are reserved for internal use by only both - * TaskManagers and GpuTasks. - */ -class PxGpuDispatcher -{ -public: - /** \brief Record the start of a simulation step - * - * A PxTaskManager calls this function to record the beginning of a simulation - * step. The PxGpuDispatcher uses this notification to initialize the - * profiler state. - */ - virtual void startSimulation() = 0; - - /** \brief Record the start of a GpuTask batch submission - * - * A PxTaskManager calls this function to notify the PxGpuDispatcher that one or - * more GpuTasks are about to be submitted for execution. The PxGpuDispatcher - * will not read the incoming task queue until it receives one finishGroup() - * call for each startGroup() call. This is to ensure as many GpuTasks as - * possible are executed together as a group, generating optimal parallelism - * on the GPU. - */ - virtual void startGroup() = 0; - - /** \brief Submit a GpuTask for execution - * - * Submitted tasks are pushed onto an incoming queue. The PxGpuDispatcher - * will take the contents of this queue every time the pending group count - * reaches 0 and run the group of submitted GpuTasks as an interleaved - * group. - */ - virtual void submitTask(PxTask& task) = 0; - - /** \brief Record the end of a GpuTask batch submission - * - * A PxTaskManager calls this function to notify the PxGpuDispatcher that it is - * done submitting a group of GpuTasks (GpuTasks which were all make ready - * to run by the same prerequisite dependency becoming resolved). If no - * other group submissions are in progress, the PxGpuDispatcher will execute - * the set of ready tasks. - */ - virtual void finishGroup() = 0; - - /** \brief Add a CUDA completion prerequisite dependency to a task - * - * A GpuTask calls this function to add a prerequisite dependency on another - * task (usually a CpuTask) preventing that task from starting until all of - * the CUDA kernels and copies already launched have been completed. The - * PxGpuDispatcher will increment that task's reference count, blocking its - * execution, until the CUDA work is complete. - * - * This is generally only required when a CPU task is expecting the results - * of the CUDA kernels to have been copied into host memory. - * - * This mechanism is not at all not required to ensure CUDA kernels and - * copies are issued in the correct order. Kernel issue order is determined - * by normal task dependencies. The rule of thumb is to only use a blocking - * completion prerequisite if the task in question depends on a completed - * GPU->Host DMA. - * - * The PxGpuDispatcher issues a blocking event record to CUDA for the purposes - * of tracking the already submitted CUDA work. When this event is - * resolved, the PxGpuDispatcher manually decrements the reference count of - * the specified task, allowing it to execute (assuming it does not have - * other pending prerequisites). - */ - virtual void addCompletionPrereq(PxBaseTask& task) = 0; - - /** \brief Retrieve the PxCudaContextManager associated with this - * PxGpuDispatcher - * - * Every PxCudaContextManager has one PxGpuDispatcher, and every PxGpuDispatcher - * has one PxCudaContextManager. - */ - virtual PxCudaContextManager* getCudaContextManager() = 0; - - /** \brief Record the end of a simulation frame - * - * A PxTaskManager calls this function to record the completion of its - * dependency graph. If profiling is enabled, the PxGpuDispatcher will - * trigger the retrieval of profiling data from the GPU at this point. - */ - virtual void stopSimulation() = 0; - - /** \brief Returns true if a CUDA call has returned a non-recoverable error - * - * A return value of true indicates a fatal error has occurred. To protect - * itself, the PxGpuDispatcher enters a fall through mode that allows GpuTasks - * to complete without being executed. This allows simulations to continue - * but leaves GPU content static or corrupted. - * - * The user may try to recover from these failures by deleting GPU content - * so the visual artifacts are minimized. But there is no way to recover - * the state of the GPU actors before the failure. Once a CUDA context is - * in this state, the only recourse is to create a new CUDA context, a new - * scene, and start over. - * - * This is our "Best Effort" attempt to not turn a soft failure into a hard - * failure because continued use of a CUDA context after it has returned an - * error will usually result in a driver reset. However if the initial - * failure was serious enough, a reset may have already occurred by the time - * we learn of it. - */ - virtual bool failureDetected() const = 0; - - /** \brief Force the PxGpuDispatcher into failure mode - * - * This API should be used if user code detects a non-recoverable CUDA - * error. This ensures the PxGpuDispatcher does not launch any further - * CUDA work. Subsequent calls to failureDetected() will return true. - */ - virtual void forceFailureMode() = 0; - - /** \brief Launch a copy kernel with arbitrary number of copy commands - * - * This method is intended to be called from Kernel GpuTasks, but it can - * function outside of that context as well. - * - * If count is 1, the descriptor is passed to the kernel as arguments, so it - * may be declared on the stack. - * - * If count is greater than 1, the kernel will read the descriptors out of - * host memory. Because of this, the descriptor array must be located in - * page locked (pinned) memory. The provided descriptors may be modified by - * this method (converting host pointers to their GPU mapped equivalents) - * and should be considered *owned* by CUDA until the current batch of work - * has completed, so descriptor arrays should not be freed or modified until - * you have received a completion notification. - * - * If your GPU does not support mapping of page locked memory (SM>=1.1), - * this function degrades to calling CUDA copy methods. - */ - virtual void launchCopyKernel(PxGpuCopyDesc* desc, uint32_t count, CUstream stream) = 0; - - /** \brief Query pre launch task that runs before launching gpu kernels. - * - * This is part of an optional feature to schedule multiple gpu features - * at the same time to get kernels to run in parallel. - * \note Do *not* set the continuation on the returned task, but use addPreLaunchDependent(). - */ - virtual PxBaseTask& getPreLaunchTask() = 0; - - /** \brief Adds a gpu launch task that gets executed after the pre launch task. - * - * This is part of an optional feature to schedule multiple gpu features - * at the same time to get kernels to run in parallel. - * \note Each call adds a reference to the pre-launch task. - */ - virtual void addPreLaunchDependent(PxBaseTask& dependent) = 0; - - /** \brief Query post launch task that runs after the gpu is done. - * - * This is part of an optional feature to schedule multiple gpu features - * at the same time to get kernels to run in parallel. - * \note Do *not* set the continuation on the returned task, but use addPostLaunchDependent(). - */ - virtual PxBaseTask& getPostLaunchTask() = 0; - - /** \brief Adds a task that gets executed after the post launch task. - * - * This is part of an optional feature to schedule multiple gpu features - * at the same time to get kernels to run in parallel. - * \note Each call adds a reference to the pre-launch task. - */ - virtual void addPostLaunchDependent(PxBaseTask& dependent) = 0; - -protected: - /** \brief protected destructor - * - * GpuDispatchers are allocated and freed by their PxCudaContextManager. - */ - virtual ~PxGpuDispatcher() {} -}; - -PX_POP_PACK - -} // end physx namespace - - -#endif // PXTASK_PXGPUDISPATCHER_H diff --git a/PxShared/include/task/PxGpuTask.h b/PxShared/include/task/PxGpuTask.h deleted file mode 100644 index 197fc3d..0000000 --- a/PxShared/include/task/PxGpuTask.h +++ /dev/null @@ -1,118 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - - -#ifndef PXTASK_PXGPUTASK_H -#define PXTASK_PXGPUTASK_H - -#include "task/PxTaskDefine.h" -#include "task/PxTask.h" -#include "task/PxGpuDispatcher.h" - -namespace physx -{ - -PX_PUSH_PACK_DEFAULT - -/** \brief Define the 'flavor' of a PxGpuTask - * - * Each PxGpuTask should have a specific function; either copying data to the - * device, running kernels on that data, or copying data from the device. - * - * For optimal performance, the dispatcher should run all available HtoD tasks - * before running all Kernel tasks, and all Kernel tasks before running any DtoH - * tasks. This provides maximal kernel overlap and the least number of CUDA - * flushes. - */ -struct PxGpuTaskHint -{ - /// \brief Enums for the type of GPU task - enum Enum - { - HostToDevice, - Kernel, - DeviceToHost, - - NUM_GPU_TASK_HINTS - }; -}; - -/** - * \brief PxTask implementation for launching CUDA work - */ -class PxGpuTask : public PxTask -{ -public: - PxGpuTask() : mComp(NULL) {} - - /** - * \brief iterative "run" function for a PxGpuTask - * - * The GpuDispatcher acquires the CUDA context for the duration of this - * function call, and it is highly recommended that the PxGpuTask use the - * provided CUstream for all kernels. - * - * kernelIndex will be 0 for the initial call and incremented before each - * subsequent call. Once launchInstance() returns false, its PxGpuTask is - * considered completed and is released. - */ - virtual bool launchInstance(CUstream stream, int kernelIndex) = 0; - - /** - * \brief Returns a hint indicating the function of this task - */ - virtual PxGpuTaskHint::Enum getTaskHint() const = 0; - - /** - * \brief Specify a task that will have its reference count decremented - * when this task is released - */ - void setCompletionTask(PxBaseTask& task) - { - mComp = &task; - } - - void release() - { - if (mComp) - { - mComp->removeReference(); - mComp = NULL; - } - PxTask::release(); - } - -protected: - /// \brief A pointer to the completion task - PxBaseTask* mComp; -}; - -PX_POP_PACK - -} // end physx namespace - -#endif // PXTASK_PXGPUTASK_H diff --git a/PxShared/include/task/PxTask.h b/PxShared/include/task/PxTask.h deleted file mode 100644 index 85d91da..0000000 --- a/PxShared/include/task/PxTask.h +++ /dev/null @@ -1,335 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXTASK_PXTASK_H -#define PXTASK_PXTASK_H - -#include "task/PxTaskDefine.h" -#include "task/PxTaskManager.h" -#include "task/PxCpuDispatcher.h" -#include "task/PxGpuDispatcher.h" -#include "foundation/PxAssert.h" - -namespace physx -{ - -/** - * \brief Base class of all task types - * - * PxBaseTask defines a runnable reference counted task with built-in profiling. - */ -class PxBaseTask -{ -public: - PxBaseTask() : mContextID(0), mTm(NULL) {} - virtual ~PxBaseTask() {} - - /** - * \brief The user-implemented run method where the task's work should be performed - * - * run() methods must be thread safe, stack friendly (no alloca, etc), and - * must never block. - */ - virtual void run() = 0; - - /** - * \brief Return a user-provided task name for profiling purposes. - * - * It does not have to be unique, but unique names are helpful. - * - * \return The name of this task - */ - virtual const char* getName() const = 0; - - //! \brief Implemented by derived implementation classes - virtual void addReference() = 0; - //! \brief Implemented by derived implementation classes - virtual void removeReference() = 0; - //! \brief Implemented by derived implementation classes - virtual int32_t getReference() const = 0; - - /** \brief Implemented by derived implementation classes - * - * A task may assume in its release() method that the task system no longer holds - * references to it - so it may safely run its destructor, recycle itself, etc. - * provided no additional user references to the task exist - */ - virtual void release() = 0; - - /** - * \brief Return PxTaskManager to which this task was submitted - * - * Note, can return NULL if task was not submitted, or has been - * completed. - */ - PX_FORCE_INLINE PxTaskManager* getTaskManager() const - { - return mTm; - } - - PX_FORCE_INLINE void setContextId(PxU64 id) { mContextID = id; } - PX_FORCE_INLINE PxU64 getContextId() const { return mContextID; } - -protected: - PxU64 mContextID; //!< Context ID for profiler interface - PxTaskManager* mTm; //!< Owning PxTaskManager instance - - friend class PxTaskMgr; -}; - - -/** - * \brief A PxBaseTask implementation with deferred execution and full dependencies - * - * A PxTask must be submitted to a PxTaskManager to to be executed, Tasks may - * optionally be named when they are submitted. - */ -class PxTask : public PxBaseTask -{ -public: - PxTask() : mTaskID(0) {} - virtual ~PxTask() {} - - //! \brief Release method implementation - virtual void release() - { - PX_ASSERT(mTm); - - // clear mTm before calling taskCompleted() for safety - PxTaskManager* save = mTm; - mTm = NULL; - save->taskCompleted( *this ); - } - - //! \brief Inform the PxTaskManager this task must finish before the given - // task is allowed to start. - PX_INLINE void finishBefore( PxTaskID taskID ) - { - PX_ASSERT(mTm); - mTm->finishBefore( *this, taskID); - } - - //! \brief Inform the PxTaskManager this task cannot start until the given - // task has completed. - PX_INLINE void startAfter( PxTaskID taskID ) - { - PX_ASSERT(mTm); - mTm->startAfter( *this, taskID ); - } - - /** - * \brief Manually increment this task's reference count. The task will - * not be allowed to run until removeReference() is called. - */ - PX_INLINE void addReference() - { - PX_ASSERT(mTm); - mTm->addReference( mTaskID ); - } - - /** - * \brief Manually decrement this task's reference count. If the reference - * count reaches zero, the task will be dispatched. - */ - PX_INLINE void removeReference() - { - PX_ASSERT(mTm); - mTm->decrReference( mTaskID ); - } - - /** - * \brief Return the ref-count for this task - */ - PX_INLINE int32_t getReference() const - { - return mTm->getReference( mTaskID ); - } - - /** - * \brief Return the unique ID for this task - */ - PX_INLINE PxTaskID getTaskID() const - { - return mTaskID; - } - - /** - * \brief Called by PxTaskManager at submission time for initialization - * - * Perform simulation step initialization here. - */ - virtual void submitted() - { - mStreamIndex = 0; - mPreSyncRequired = false; - } - - /** - * \brief Specify that the GpuTask sync flag be set - */ - PX_INLINE void requestSyncPoint() - { - mPreSyncRequired = true; - } - - -protected: - PxTaskID mTaskID; //!< ID assigned at submission - uint32_t mStreamIndex; //!< GpuTask CUDA stream index - bool mPreSyncRequired; //!< GpuTask sync flag - - friend class PxTaskMgr; - friend class PxGpuWorkerThread; -}; - - -/** - * \brief A PxBaseTask implementation with immediate execution and simple dependencies - * - * A PxLightCpuTask bypasses the PxTaskManager launch dependencies and will be - * submitted directly to your scene's CpuDispatcher. When the run() function - * completes, it will decrement the reference count of the specified - * continuation task. - * - * You must use a full-blown PxTask if you want your task to be resolved - * by another PxTask, or you need more than a single dependency to be - * resolved when your task completes, or your task will not run on the - * CpuDispatcher. - */ -class PxLightCpuTask : public PxBaseTask -{ -public: - PxLightCpuTask() - : mCont( NULL ) - , mRefCount( 0 ) - { - } - virtual ~PxLightCpuTask() - { - mTm = NULL; - } - - /** - * \brief Initialize this task and specify the task that will have its ref count decremented on completion. - * - * Submission is deferred until the task's mRefCount is decremented to zero. - * Note that we only use the PxTaskManager to query the appropriate dispatcher. - * - * \param[in] tm The PxTaskManager this task is managed by - * \param[in] c The task to be executed when this task has finished running - */ - PX_INLINE void setContinuation(PxTaskManager& tm, PxBaseTask* c) - { - PX_ASSERT( mRefCount == 0 ); - mRefCount = 1; - mCont = c; - mTm = &tm; - if( mCont ) - { - mCont->addReference(); - } - } - - /** - * \brief Initialize this task and specify the task that will have its ref count decremented on completion. - * - * This overload of setContinuation() queries the PxTaskManager from the continuation - * task, which cannot be NULL. - * \param[in] c The task to be executed after this task has finished running - */ - PX_INLINE void setContinuation( PxBaseTask* c ) - { - PX_ASSERT( c ); - PX_ASSERT( mRefCount == 0 ); - mRefCount = 1; - mCont = c; - if( mCont ) - { - mCont->addReference(); - mTm = mCont->getTaskManager(); - PX_ASSERT( mTm ); - } - } - - /** - * \brief Retrieves continuation task - */ - PX_INLINE PxBaseTask* getContinuation() const - { - return mCont; - } - - /** - * \brief Manually decrement this task's reference count. If the reference - * count reaches zero, the task will be dispatched. - */ - PX_INLINE void removeReference() - { - mTm->decrReference(*this); - } - - /** \brief Return the ref-count for this task */ - PX_INLINE int32_t getReference() const - { - return mRefCount; - } - - /** - * \brief Manually increment this task's reference count. The task will - * not be allowed to run until removeReference() is called. - */ - PX_INLINE void addReference() - { - mTm->addReference(*this); - } - - /** - * \brief called by CpuDispatcher after run method has completed - * - * Decrements the continuation task's reference count, if specified. - */ - PX_INLINE void release() - { - if( mCont ) - { - mCont->removeReference(); - } - } - -protected: - - PxBaseTask* mCont; //!< Continuation task, can be NULL - volatile int32_t mRefCount; //!< PxTask is dispatched when reaches 0 - - friend class PxTaskMgr; -}; - - -}// end physx namespace - - -#endif // PXTASK_PXTASK_H diff --git a/PxShared/include/task/PxTaskDefine.h b/PxShared/include/task/PxTaskDefine.h deleted file mode 100644 index c1daea7..0000000 --- a/PxShared/include/task/PxTaskDefine.h +++ /dev/null @@ -1,37 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXTASK_PXTASKDEFINE_H -#define PXTASK_PXTASKDEFINE_H - -#include "foundation/PxPreprocessor.h" - -#ifndef PX_SUPPORT_PXTASK_PROFILING -#define PX_SUPPORT_PXTASK_PROFILING 1 -#endif - -#endif // PXTASK_PXTASKDEFINE_H diff --git a/PxShared/include/task/PxTaskManager.h b/PxShared/include/task/PxTaskManager.h deleted file mode 100644 index f40f7b1..0000000 --- a/PxShared/include/task/PxTaskManager.h +++ /dev/null @@ -1,231 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXTASK_PXTASKMANAGER_H -#define PXTASK_PXTASKMANAGER_H - -#include "task/PxTaskDefine.h" -#include "foundation/PxSimpleTypes.h" -#include "foundation/PxErrorCallback.h" - -namespace physx -{ - -PX_PUSH_PACK_DEFAULT - -class PxBaseTask; -class PxTask; -class PxLightCpuTask; -typedef unsigned int PxTaskID; - -/** -\brief Identifies the type of each heavyweight PxTask object - -\note This enum type is only used by PxTask and GpuTask objects, LightCpuTasks do not use this enum. - -@see PxTask -@see PxLightCpuTask -*/ -struct PxTaskType -{ - /** - * \brief Identifies the type of each heavyweight PxTask object - */ - enum Enum - { - TT_CPU, //!< PxTask will be run on the CPU - TT_GPU, //!< PxTask will be run on the GPU - TT_NOT_PRESENT, //!< Return code when attempting to find a task that does not exist - TT_COMPLETED //!< PxTask execution has been completed - }; -}; - -class PxCpuDispatcher; -class PxGpuDispatcher; - -/** - \brief The PxTaskManager interface - - A PxTaskManager instance holds references to user-provided dispatcher objects, when tasks are - submitted the PxTaskManager routes them to the appropriate dispatcher and handles task profiling if enabled. - Users should not implement the PxTaskManager interface, the SDK creates it's own concrete PxTaskManager object - per-scene which users can configure by passing dispatcher objects into the PxSceneDesc. - - - @see CpuDispatcher - @see PxGpuDispatcher - -*/ -class PxTaskManager -{ -public: - - /** - \brief Set the user-provided dispatcher object for CPU tasks - - \param[in] ref The dispatcher object. - - @see CpuDispatcher - */ - virtual void setCpuDispatcher(PxCpuDispatcher& ref) = 0; - - /** - \brief Set the user-provided dispatcher object for GPU tasks - - \param[in] ref The dispatcher object. - - @see PxGpuDispatcher - */ - virtual void setGpuDispatcher(PxGpuDispatcher& ref) = 0; - - /** - \brief Get the user-provided dispatcher object for CPU tasks - - \return The CPU dispatcher object. - - @see CpuDispatcher - */ - virtual PxCpuDispatcher* getCpuDispatcher() const = 0; - - /** - \brief Get the user-provided dispatcher object for GPU tasks - - \return The GPU dispatcher object. - - @see PxGpuDispatcher - */ - virtual PxGpuDispatcher* getGpuDispatcher() const = 0; - - /** - \brief Reset any dependencies between Tasks - - \note Will be called at the start of every frame before tasks are submitted. - - @see PxTask - */ - virtual void resetDependencies() = 0; - - /** - \brief Called by the owning scene to start the task graph. - - \note All tasks with with ref count of 1 will be dispatched. - - @see PxTask - */ - virtual void startSimulation() = 0; - - /** - \brief Called by the owning scene at the end of a simulation step to synchronize the PxGpuDispatcher - - @see PxGpuDispatcher - */ - virtual void stopSimulation() = 0; - - /** - \brief Called by the worker threads to inform the PxTaskManager that a task has completed processing - - \param[in] task The task which has been completed - */ - virtual void taskCompleted(PxTask& task) = 0; - - /** - \brief Retrieve a task by name - - \param[in] name The unique name of a task - \return The ID of the task with that name, or TT_NOT_PRESENT if not found - */ - virtual PxTaskID getNamedTask(const char* name) = 0; - - /** - \brief Submit a task with a unique name. - - \param[in] task The task to be executed - \param[in] name The unique name of a task - \param[in] type The type of the task (default TT_CPU) - \return The ID of the task with that name, or TT_NOT_PRESENT if not found - - */ - virtual PxTaskID submitNamedTask(PxTask* task, const char* name, PxTaskType::Enum type = PxTaskType::TT_CPU) = 0; - - /** - \brief Submit an unnamed task. - - \param[in] task The task to be executed - \param[in] type The type of the task (default TT_CPU) - - \return The ID of the task with that name, or TT_NOT_PRESENT if not found - */ - virtual PxTaskID submitUnnamedTask(PxTask& task, PxTaskType::Enum type = PxTaskType::TT_CPU) = 0; - - /** - \brief Retrieve a task given a task ID - - \param[in] id The ID of the task to return, a valid ID must be passed or results are undefined - - \return The task associated with the ID - */ - virtual PxTask* getTaskFromID(PxTaskID id) = 0; - - /** - \brief Release the PxTaskManager object, referenced dispatchers will not be released - */ - virtual void release() = 0; - - /** - \brief Construct a new PxTaskManager instance with the given [optional] dispatchers - */ - static PxTaskManager* createTaskManager(PxErrorCallback& errorCallback, PxCpuDispatcher* = 0, PxGpuDispatcher* = 0); - -protected: - virtual ~PxTaskManager() {} - - /*! \cond PRIVATE */ - - virtual void finishBefore(PxTask& task, PxTaskID taskID) = 0; - virtual void startAfter(PxTask& task, PxTaskID taskID) = 0; - - virtual void addReference(PxTaskID taskID) = 0; - virtual void decrReference(PxTaskID taskID) = 0; - virtual int32_t getReference(PxTaskID taskID) const = 0; - - virtual void decrReference(PxLightCpuTask&) = 0; - virtual void addReference(PxLightCpuTask&) = 0; - - /*! \endcond */ - - friend class PxBaseTask; - friend class PxTask; - friend class PxLightCpuTask; - friend class PxGpuWorkerThread; -}; - -PX_POP_PACK - -} // end physx namespace - - -#endif // PXTASK_PXTASKMANAGER_H |