PxTaskManager.h

Go to the documentation of this file.
00001 // This code contains NVIDIA Confidential Information and is disclosed to you
00002 // under a form of NVIDIA software license agreement provided separately to you.
00003 //
00004 // Notice
00005 // NVIDIA Corporation and its licensors retain all intellectual property and
00006 // proprietary rights in and to this software and related documentation and
00007 // any modifications thereto. Any use, reproduction, disclosure, or
00008 // distribution of this software and related documentation without an express
00009 // license agreement from NVIDIA Corporation is strictly prohibited.
00010 //
00011 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
00012 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
00013 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
00014 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
00015 //
00016 // Information and code furnished is believed to be accurate and reliable.
00017 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
00018 // information or for any infringement of patents or other rights of third parties that may
00019 // result from its use. No license is granted by implication or otherwise under any patent
00020 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
00021 // This code supersedes and replaces all information previously supplied.
00022 // NVIDIA Corporation products are not authorized for use as critical
00023 // components in life support devices or systems without express written approval of
00024 // NVIDIA Corporation.
00025 //
00026 // Copyright (c) 2008-2018 NVIDIA Corporation. All rights reserved.
00027 
00028 #ifndef PXTASK_PXTASKMANAGER_H
00029 #define PXTASK_PXTASKMANAGER_H
00030 
00031 #include "task/PxTaskDefine.h"
00032 #include "foundation/PxSimpleTypes.h"
00033 #include "foundation/PxErrorCallback.h"
00034 
00035 namespace physx
00036 {
00037 PX_PUSH_PACK_DEFAULT
00038 
00039 class PxBaseTask;
00040 class PxTask;
00041 class PxLightCpuTask;
00042 typedef unsigned int PxTaskID;
00043 
00052 struct PxTaskType
00053 {
00057     enum Enum
00058     {
00059         TT_CPU,             
00060         TT_GPU,             
00061         TT_NOT_PRESENT,     
00062         TT_COMPLETED        
00063     };
00064 };
00065 
00066 class PxCpuDispatcher;
00067 class PxGpuDispatcher;
00068 
00081 class PxTaskManager
00082 {
00083 public:
00084 
00092     virtual void     setCpuDispatcher(PxCpuDispatcher& ref) = 0;
00093 
00101     virtual void     setGpuDispatcher(PxGpuDispatcher& ref) = 0;
00102     
00110     virtual PxCpuDispatcher*            getCpuDispatcher() const = 0;
00111 
00119     virtual PxGpuDispatcher*            getGpuDispatcher() const = 0;
00120 
00128     virtual void    resetDependencies() = 0;
00129     
00137     virtual void    startSimulation() = 0;
00138 
00144     virtual void    stopSimulation() = 0;
00145 
00151     virtual void    taskCompleted(PxTask& task) = 0;
00152 
00159     virtual PxTaskID  getNamedTask(const char* name) = 0;
00160 
00169     virtual PxTaskID  submitNamedTask(PxTask* task, const char* name, PxTaskType::Enum type = PxTaskType::TT_CPU) = 0;
00170 
00179     virtual PxTaskID  submitUnnamedTask(PxTask& task, PxTaskType::Enum type = PxTaskType::TT_CPU) = 0;
00180 
00188     virtual PxTask*   getTaskFromID(PxTaskID id) = 0;
00189 
00193     virtual void        release() = 0;
00194 
00198     static PxTaskManager* createTaskManager(PxErrorCallback& errorCallback, PxCpuDispatcher* = 0, PxGpuDispatcher* = 0);
00199     
00200 protected:
00201     virtual ~PxTaskManager() {}
00202 
00205     virtual void finishBefore(PxTask& task, PxTaskID taskID) = 0;
00206     virtual void startAfter(PxTask& task, PxTaskID taskID) = 0;
00207 
00208     virtual void addReference(PxTaskID taskID) = 0;
00209     virtual void decrReference(PxTaskID taskID) = 0;
00210     virtual int32_t getReference(PxTaskID taskID) const = 0;
00211 
00212     virtual void decrReference(PxLightCpuTask&) = 0;
00213     virtual void addReference(PxLightCpuTask&) = 0;
00214 
00217     friend class PxBaseTask;
00218     friend class PxTask;
00219     friend class PxLightCpuTask;
00220     friend class PxGpuWorkerThread;
00221 };
00222 
00223 PX_POP_PACK
00224 
00225 } // end physx namespace
00226 
00227 
00228 #endif // PXTASK_PXTASKMANAGER_H


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