Upgrade to PhysX 5.1.3

This commit is contained in:
Wojtek Figat
2023-03-03 17:13:46 +01:00
parent 0112f70c05
commit a26d0d03eb
452 changed files with 58188 additions and 8646 deletions

View File

@@ -1,4 +1,3 @@
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
@@ -11,7 +10,7 @@
// 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
// 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
@@ -23,16 +22,17 @@
// (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) 2008-2023 NVIDIA Corporation. All rights reserved.
#ifndef PXTASK_PXCPUDISPATCHER_H
#define PXTASK_PXCPUDISPATCHER_H
#ifndef PX_CPU_DISPATCHER_H
#define PX_CPU_DISPATCHER_H
#include "task/PxTaskDefine.h"
#include "foundation/PxSimpleTypes.h"
#if !PX_DOXYGEN
namespace physx
{
#endif
class PxBaseTask;
@@ -52,15 +52,15 @@ 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.
Upon receiving a task, the dispatcher should schedule the task to run.
After the task has been run, it should call the release() method and
discard its pointer.
\param[in] task The task to be run.
@see PxBaseTask
*/
virtual void submitTask( PxBaseTask& task ) = 0;
virtual void submitTask(PxBaseTask& task) = 0;
/**
\brief Returns the number of available worker threads for this dispatcher.
@@ -74,6 +74,9 @@ public:
virtual ~PxCpuDispatcher() {}
};
} // end physx namespace
#if !PX_DOXYGEN
} // namespace physx
#endif
#endif
#endif // PXTASK_PXCPUDISPATCHER_H

View File

@@ -1,4 +1,3 @@
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
@@ -11,7 +10,7 @@
// 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
// 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
@@ -23,18 +22,19 @@
// (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) 2008-2023 NVIDIA Corporation. All rights reserved.
#ifndef PXTASK_PXTASK_H
#define PXTASK_PXTASK_H
#ifndef PX_TASK_H
#define PX_TASK_H
#include "task/PxTaskDefine.h"
#include "task/PxTaskManager.h"
#include "task/PxCpuDispatcher.h"
#include "foundation/PxAssert.h"
#if !PX_DOXYGEN
namespace physx
{
#endif
/**
* \brief Base class of all task types
@@ -114,58 +114,58 @@ public:
virtual ~PxTask() {}
//! \brief Release method implementation
virtual void release()
virtual void release() PX_OVERRIDE
{
PX_ASSERT(mTm);
// clear mTm before calling taskCompleted() for safety
PxTaskManager* save = mTm;
mTm = NULL;
save->taskCompleted( *this );
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_INLINE void finishBefore(PxTaskID taskID)
{
PX_ASSERT(mTm);
mTm->finishBefore( *this, taskID);
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_INLINE void startAfter(PxTaskID taskID)
{
PX_ASSERT(mTm);
mTm->startAfter( *this, taskID );
mTm->startAfter(*this, taskID);
}
/**
* \brief Manually increment this task's reference count. The task will
* \brief Manually increment this task's reference count. The task will
* not be allowed to run until removeReference() is called.
*/
PX_INLINE void addReference()
virtual void addReference() PX_OVERRIDE
{
PX_ASSERT(mTm);
mTm->addReference( mTaskID );
mTm->addReference(mTaskID);
}
/**
* \brief Manually decrement this task's reference count. If the reference
* \brief Manually decrement this task's reference count. If the reference
* count reaches zero, the task will be dispatched.
*/
PX_INLINE void removeReference()
virtual void removeReference() PX_OVERRIDE
{
PX_ASSERT(mTm);
mTm->decrReference( mTaskID );
mTm->decrReference(mTaskID);
}
/**
* \brief Return the ref-count for this task
*/
PX_INLINE int32_t getReference() const
virtual int32_t getReference() const PX_OVERRIDE
{
return mTm->getReference( mTaskID );
return mTm->getReference(mTaskID);
}
/**
@@ -229,14 +229,12 @@ public:
*/
PX_INLINE void setContinuation(PxTaskManager& tm, PxBaseTask* c)
{
PX_ASSERT( mRefCount == 0 );
PX_ASSERT(mRefCount == 0);
mRefCount = 1;
mCont = c;
mTm = &tm;
if( mCont )
{
if(mCont)
mCont->addReference();
}
}
/**
@@ -246,17 +244,17 @@ public:
* 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_INLINE void setContinuation(PxBaseTask* c)
{
PX_ASSERT( c );
PX_ASSERT( mRefCount == 0 );
PX_ASSERT(c);
PX_ASSERT(mRefCount == 0);
mRefCount = 1;
mCont = c;
if( mCont )
if(mCont)
{
mCont->addReference();
mTm = mCont->getTaskManager();
PX_ASSERT( mTm );
PX_ASSERT(mTm);
}
}
@@ -269,25 +267,25 @@ public:
}
/**
* \brief Manually decrement this task's reference count. If the reference
* \brief Manually decrement this task's reference count. If the reference
* count reaches zero, the task will be dispatched.
*/
PX_INLINE void removeReference()
virtual void removeReference() PX_OVERRIDE
{
mTm->decrReference(*this);
}
/** \brief Return the ref-count for this task */
PX_INLINE int32_t getReference() const
virtual int32_t getReference() const PX_OVERRIDE
{
return mRefCount;
}
/**
* \brief Manually increment this task's reference count. The task will
* \brief Manually increment this task's reference count. The task will
* not be allowed to run until removeReference() is called.
*/
PX_INLINE void addReference()
virtual void addReference() PX_OVERRIDE
{
mTm->addReference(*this);
}
@@ -297,12 +295,10 @@ public:
*
* Decrements the continuation task's reference count, if specified.
*/
PX_INLINE void release()
virtual void release() PX_OVERRIDE
{
if( mCont )
{
if(mCont)
mCont->removeReference();
}
}
protected:
@@ -314,7 +310,10 @@ protected:
};
}// end physx namespace
#if !PX_DOXYGEN
} // namespace physx
#endif
#endif // PXTASK_PXTASK_H
#endif

View File

@@ -1,37 +0,0 @@
//
// 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.
#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

View File

@@ -1,4 +1,3 @@
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
@@ -11,7 +10,7 @@
// 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
// 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
@@ -23,18 +22,18 @@
// (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) 2008-2023 NVIDIA Corporation. All rights reserved.
#ifndef PXTASK_PXTASKMANAGER_H
#define PXTASK_PXTASKMANAGER_H
#ifndef PX_TASK_MANAGER_H
#define PX_TASK_MANAGER_H
#include "task/PxTaskDefine.h"
#include "foundation/PxSimpleTypes.h"
#include "foundation/PxErrorCallback.h"
#if !PX_DOXYGEN
namespace physx
{
PX_PUSH_PACK_DEFAULT
#endif
class PxBaseTask;
class PxTask;
@@ -44,7 +43,7 @@ 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.
\note This enum type is only used by PxTask objects, PxLightCpuTasks do not use this enum.
@see PxTask
@see PxLightCpuTask
@@ -56,9 +55,12 @@ struct PxTaskType
*/
enum Enum
{
TT_CPU, //!< PxTask will be run on the CPU
TT_NOT_PRESENT, //!< Return code when attempting to find a task that does not exist
TT_COMPLETED //!< PxTask execution has been completed
eCPU, //!< PxTask will be run on the CPU
eNOT_PRESENT, //!< Return code when attempting to find a task that does not exist
eCOMPLETED, //!< PxTask execution has been completed
TT_CPU PX_DEPRECATED = eCPU,
TT_NOT_PRESENT PX_DEPRECATED = eNOT_PRESENT,
TT_COMPLETED PX_DEPRECATED = eCOMPLETED
};
};
@@ -67,12 +69,12 @@ class PxCpuDispatcher;
/**
\brief The PxTaskManager interface
A PxTaskManager instance holds references to user-provided dispatcher objects, when tasks are
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 its own concrete PxTaskManager object
per-scene which users can configure by passing dispatcher objects into the PxSceneDesc.
@see CpuDispatcher
@see PxCpuDispatcher
*/
class PxTaskManager
@@ -84,7 +86,7 @@ public:
\param[in] ref The dispatcher object.
@see CpuDispatcher
@see PxCpuDispatcher
*/
virtual void setCpuDispatcher(PxCpuDispatcher& ref) = 0;
@@ -93,9 +95,9 @@ public:
\return The CPU dispatcher object.
@see CpuDispatcher
@see PxCpuDispatcher
*/
virtual PxCpuDispatcher* getCpuDispatcher() const = 0;
virtual PxCpuDispatcher* getCpuDispatcher() const = 0;
/**
\brief Reset any dependencies between Tasks
@@ -109,7 +111,7 @@ public:
/**
\brief Called by the owning scene to start the task graph.
\note All tasks with with ref count of 1 will be dispatched.
\note All tasks with ref count of 1 will be dispatched.
@see PxTask
*/
@@ -121,7 +123,7 @@ public:
virtual void stopSimulation() = 0;
/**
\brief Called by the worker threads to inform the PxTaskManager that a task has completed processing
\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
*/
@@ -131,7 +133,7 @@ public:
\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
\return The ID of the task with that name, or eNOT_PRESENT if not found
*/
virtual PxTaskID getNamedTask(const char* name) = 0;
@@ -140,20 +142,20 @@ public:
\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
\param[in] type The type of the task (default eCPU)
\return The ID of the task with that name, or eNOT_PRESENT if not found
*/
virtual PxTaskID submitNamedTask(PxTask* task, const char* name, PxTaskType::Enum type = PxTaskType::TT_CPU) = 0;
virtual PxTaskID submitNamedTask(PxTask* task, const char* name, PxTaskType::Enum type = PxTaskType::eCPU) = 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)
\param[in] type The type of the task (default eCPU)
\return The ID of the task with that name, or TT_NOT_PRESENT if not found
\return The ID of the task with that name, or eNOT_PRESENT if not found
*/
virtual PxTaskID submitUnnamedTask(PxTask& task, PxTaskType::Enum type = PxTaskType::TT_CPU) = 0;
virtual PxTaskID submitUnnamedTask(PxTask& task, PxTaskType::Enum type = PxTaskType::eCPU) = 0;
/**
\brief Retrieve a task given a task ID
@@ -172,7 +174,7 @@ public:
/**
\brief Construct a new PxTaskManager instance with the given [optional] dispatchers
*/
static PxTaskManager* createTaskManager(PxErrorCallback& errorCallback, PxCpuDispatcher* = 0);
static PxTaskManager* createTaskManager(PxErrorCallback& errorCallback, PxCpuDispatcher* = NULL);
protected:
virtual ~PxTaskManager() {}
@@ -196,9 +198,9 @@ protected:
friend class PxLightCpuTask;
};
PX_POP_PACK
} // end physx namespace
#if !PX_DOXYGEN
} // namespace physx
#endif
#endif // PXTASK_PXTASKMANAGER_H
#endif