PxTaskManager.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved.
3  *
4  * NVIDIA CORPORATION and its licensors retain all intellectual property
5  * and proprietary rights in and to this software, related documentation
6  * and any modifications thereto. Any use, reproduction, disclosure or
7  * distribution of this software and related documentation without an express
8  * license agreement from NVIDIA CORPORATION is strictly prohibited.
9  */
10 
11 #ifndef PX_TASK_MANAGER_H
12 #define PX_TASK_MANAGER_H
13 
14 #include "foundation/Px.h"
15 
16 #ifndef PX_DOXYGEN
17 namespace physx
18 {
19 #endif
20 
21 class PxProfileZoneManager;
22 
24 
25 class PxBaseTask;
26 class PxTask;
27 class PxLightCpuTask;
28 class PxSpuTask;
29 typedef PxU32 PxTaskID;
30 
39 struct PxTaskType
40 {
44  enum Enum
45  {
49  TT_COMPLETED
50  };
51 };
52 
53 class PxCpuDispatcher;
54 class PxSpuDispatcher;
55 class PxGpuDispatcher;
56 
71 {
72 public:
73 
81  virtual void setCpuDispatcher(PxCpuDispatcher& ref) = 0;
82 
90  virtual void setGpuDispatcher(PxGpuDispatcher& ref) = 0;
91 
99  virtual void setSpuDispatcher(PxSpuDispatcher& ref) = 0;
100 
108  virtual void initializeProfiling(PxProfileZoneManager& ref) = 0;
109 
117  virtual PxCpuDispatcher* getCpuDispatcher() const = 0;
118 
126  virtual PxGpuDispatcher* getGpuDispatcher() const = 0;
127 
135  virtual PxSpuDispatcher* getSpuDispatcher() const = 0;
136 
144  virtual void resetDependencies() = 0;
145 
153  virtual void startSimulation() = 0;
154 
160  virtual void stopSimulation() = 0;
161 
167  virtual void taskCompleted(PxTask& task) = 0;
168 
175  virtual PxTaskID getNamedTask(const char* name) = 0;
176 
186  virtual PxTaskID submitNamedTask(PxTask* task, const char* name, PxTaskType::Enum type = PxTaskType::TT_CPU) = 0;
187 
196  virtual PxTaskID submitUnnamedTask(PxTask& task, PxTaskType::Enum type = PxTaskType::TT_CPU) = 0;
197 
205  virtual PxTask* getTaskFromID(PxTaskID id) = 0;
206 
210  virtual void release() = 0;
211 
215  static PxTaskManager* createTaskManager(PxCpuDispatcher* = 0, PxGpuDispatcher* = 0, PxSpuDispatcher* = 0);
216 
217 protected:
218  virtual ~PxTaskManager() {}
219 
222  virtual void finishBefore(PxTask& task, PxTaskID taskID) = 0;
223  virtual void startAfter(PxTask& task, PxTaskID taskID) = 0;
224 
225  virtual void addReference(PxTaskID taskID) = 0;
226  virtual void decrReference(PxTaskID taskID) = 0;
227  virtual PxI32 getReference(PxTaskID taskID) const = 0;
228 
229  virtual void decrReference(PxLightCpuTask&) = 0;
230  virtual void addReference(PxLightCpuTask&) = 0;
231 
232  virtual void decrReference(PxSpuTask& spuTask) = 0;
233 
234  virtual void emitStartEvent(PxBaseTask&, PxU32 threadId=0) = 0;
235  virtual void emitStopEvent(PxBaseTask&, PxU32 threadId=0) = 0;
236 
239  friend class PxBaseTask;
240  friend class PxTask;
241  friend class PxLightCpuTask;
242  friend class PxSpuTask;
243  friend class PxGpuWorkerThread;
244 };
245 
247 
248 #ifndef PX_DOXYGEN
249 } // end physx namespace
250 #endif
251 
252 #endif


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