PxTaskManager.h
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-2013 NVIDIA Corporation. All rights reserved.
00027 
00028 #ifndef PX_TASK_MANAGER_H
00029 #define PX_TASK_MANAGER_H
00030 
00031 #include "foundation/Px.h"
00032 
00033 #ifndef PX_DOXYGEN
00034 namespace physx
00035 {
00036 #endif
00037 
00038 class PxProfileZoneManager;
00039 
00040 PX_PUSH_PACK_DEFAULT
00041 
00042 class PxBaseTask;
00043 class PxTask;
00044 class PxLightCpuTask;
00045 class PxSpuTask;
00046 typedef unsigned long PxTaskID;
00047 
00056 struct PxTaskType
00057 {
00061     enum Enum
00062     {
00063         TT_CPU,             
00064         TT_GPU,             
00065         TT_NOT_PRESENT,     
00066         TT_COMPLETED        
00067     };
00068 };
00069 
00070 class PxCpuDispatcher;
00071 class PxSpuDispatcher;
00072 class PxGpuDispatcher;
00073 
00087 class PxTaskManager
00088 {
00089 public:
00090 
00098     virtual void     setCpuDispatcher(PxCpuDispatcher& ref) = 0;
00099 
00107     virtual void     setGpuDispatcher(PxGpuDispatcher& ref) = 0;
00108     
00116     virtual void     setSpuDispatcher(PxSpuDispatcher& ref) = 0;
00117 
00125     virtual void     initializeProfiling(PxProfileZoneManager& ref) = 0;
00126 
00134     virtual PxCpuDispatcher*            getCpuDispatcher() const = 0;
00135 
00143     virtual PxGpuDispatcher*            getGpuDispatcher() const = 0;
00144 
00152     virtual PxSpuDispatcher*            getSpuDispatcher() const = 0;
00153 
00161     virtual void    resetDependencies() = 0;
00162     
00170     virtual void    startSimulation() = 0;
00171 
00177     virtual void    stopSimulation() = 0;
00178 
00184     virtual void    taskCompleted(PxTask& task) = 0;
00185 
00192     virtual PxTaskID  getNamedTask(const char* name) = 0;
00193 
00203     virtual PxTaskID  submitNamedTask(PxTask* task, const char* name, PxTaskType::Enum type = PxTaskType::TT_CPU) = 0;
00204 
00213     virtual PxTaskID  submitUnnamedTask(PxTask& task, PxTaskType::Enum type = PxTaskType::TT_CPU) = 0;
00214 
00222     virtual PxTask*   getTaskFromID(PxTaskID id) = 0;
00223 
00227     virtual void        release() = 0;
00228 
00232     static PxTaskManager* createTaskManager(PxCpuDispatcher* = 0, PxGpuDispatcher* = 0, PxSpuDispatcher* = 0);
00233     
00234 protected:
00235     virtual ~PxTaskManager() {}
00236 
00239     virtual void finishBefore(PxTask& task, PxTaskID taskID) = 0;
00240     virtual void startAfter(PxTask& task, PxTaskID taskID) = 0;
00241 
00242     virtual void addReference(PxTaskID taskID) = 0;
00243     virtual void decrReference(PxTaskID taskID) = 0;
00244     virtual PxI32 getReference(PxTaskID taskID) const = 0;
00245 
00246     virtual void decrReference(PxLightCpuTask&) = 0;
00247     virtual void addReference(PxLightCpuTask&) = 0;
00248 
00249     virtual void decrReference(PxSpuTask& spuTask) = 0;
00250 
00251     virtual void emitStartEvent(PxBaseTask&, PxU32 threadId=0) = 0;
00252     virtual void emitStopEvent(PxBaseTask&, PxU32 threadId=0) = 0;
00253 
00256     friend class PxBaseTask;
00257     friend class PxTask;
00258     friend class PxLightCpuTask;
00259     friend class PxSpuTask;
00260     friend class PxGpuWorkerThread;
00261 };
00262 
00263 PX_POP_PACK
00264 
00265 #ifndef PX_DOXYGEN
00266 } // end physx namespace
00267 #endif
00268 
00269 #endif

Generated on Mon Apr 28 2014 08:02:18

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