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-2012 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 namespace pxtask 00041 { 00042 00043 PX_PUSH_PACK_DEFAULT 00044 00045 class BaseTask; 00046 class Task; 00047 class LightCpuTask; 00048 class SpuTask; 00049 typedef unsigned long TaskID; 00050 00059 struct TaskType 00060 { 00064 enum Enum 00065 { 00066 TT_CPU, 00067 TT_GPU, 00068 TT_NOT_PRESENT, 00069 TT_COMPLETED 00070 }; 00071 }; 00072 00073 class CpuDispatcher; 00074 class SpuDispatcher; 00075 class GpuDispatcher; 00076 00090 class TaskManager 00091 { 00092 public: 00093 00101 virtual void setCpuDispatcher(CpuDispatcher& ref) = 0; 00102 00110 virtual void setGpuDispatcher(GpuDispatcher& ref) = 0; 00111 00119 virtual void setSpuDispatcher(SpuDispatcher& ref) = 0; 00120 00128 virtual void initializeProfiling(PxProfileZoneManager& ref) = 0; 00129 00137 virtual CpuDispatcher* getCpuDispatcher() const = 0; 00138 00146 virtual GpuDispatcher* getGpuDispatcher() const = 0; 00147 00155 virtual SpuDispatcher* getSpuDispatcher() const = 0; 00156 00164 virtual void resetDependencies() = 0; 00165 00173 virtual void startSimulation() = 0; 00174 00180 virtual void stopSimulation() = 0; 00181 00187 virtual void taskCompleted(Task& task) = 0; 00188 00195 virtual TaskID getNamedTask(const char* name) = 0; 00196 00206 virtual TaskID submitNamedTask(Task* task, const char* name, TaskType::Enum type = TaskType::TT_CPU) = 0; 00207 00216 virtual TaskID submitUnnamedTask(Task& task, TaskType::Enum type = TaskType::TT_CPU) = 0; 00217 00225 virtual Task* getTaskFromID(TaskID id) = 0; 00226 00230 virtual void release() = 0; 00231 00235 static TaskManager* createTaskManager(CpuDispatcher* = 0, GpuDispatcher* = 0, SpuDispatcher* = 0); 00236 00237 protected: 00238 virtual ~TaskManager() {} 00239 00242 virtual void finishBefore(Task& task, TaskID taskID) = 0; 00243 virtual void startAfter(Task& task, TaskID taskID) = 0; 00244 00245 virtual void addReference(TaskID taskID) = 0; 00246 virtual void decrReference(TaskID taskID) = 0; 00247 virtual PxI32 getReference(TaskID taskID) const = 0; 00248 00249 virtual void decrReference(LightCpuTask&) = 0; 00250 virtual void addReference(LightCpuTask&) = 0; 00251 00252 virtual void decrReference(SpuTask& spuTask) = 0; 00253 00254 virtual void emitStartEvent(BaseTask&) = 0; 00255 virtual void emitStopEvent(BaseTask&) = 0; 00256 00259 friend class BaseTask; 00260 friend class Task; 00261 friend class LightCpuTask; 00262 friend class SpuTask; 00263 friend class GpuWorkerThread; 00264 }; 00265 00266 PX_POP_PACK 00267 00268 } // end pxtask namespace 00269 00270 #ifndef PX_DOXYGEN 00271 } // end physx namespace 00272 #endif 00273 00274 #endif
Copyright © 2008-2012 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com