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-2017 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 00038 PX_PUSH_PACK_DEFAULT 00039 00040 class PxBaseTask; 00041 class PxTask; 00042 class PxLightCpuTask; 00043 typedef unsigned int PxTaskID; 00044 00053 struct PxTaskType 00054 { 00058 enum Enum 00059 { 00060 TT_CPU, 00061 TT_GPU, 00062 TT_NOT_PRESENT, 00063 TT_COMPLETED 00064 }; 00065 }; 00066 00067 class PxCpuDispatcher; 00068 class PxGpuDispatcher; 00069 00083 class PxTaskManager 00084 { 00085 public: 00086 00094 virtual void setCpuDispatcher(PxCpuDispatcher& ref) = 0; 00095 00103 virtual void setGpuDispatcher(PxGpuDispatcher& ref) = 0; 00104 00112 virtual PxCpuDispatcher* getCpuDispatcher() const = 0; 00113 00121 virtual PxGpuDispatcher* getGpuDispatcher() const = 0; 00122 00130 virtual void resetDependencies() = 0; 00131 00139 virtual void startSimulation() = 0; 00140 00146 virtual void stopSimulation() = 0; 00147 00153 virtual void taskCompleted(PxTask& task) = 0; 00154 00161 virtual PxTaskID getNamedTask(const char* name) = 0; 00162 00172 virtual PxTaskID submitNamedTask(PxTask* task, const char* name, PxTaskType::Enum type = PxTaskType::TT_CPU) = 0; 00173 00182 virtual PxTaskID submitUnnamedTask(PxTask& task, PxTaskType::Enum type = PxTaskType::TT_CPU) = 0; 00183 00191 virtual PxTask* getTaskFromID(PxTaskID id) = 0; 00192 00196 virtual void release() = 0; 00197 00201 static PxTaskManager* createTaskManager(PxErrorCallback& errorCallback, PxCpuDispatcher* = 0, PxGpuDispatcher* = 0); 00202 00203 protected: 00204 virtual ~PxTaskManager() {} 00205 00208 virtual void finishBefore(PxTask& task, PxTaskID taskID) = 0; 00209 virtual void startAfter(PxTask& task, PxTaskID taskID) = 0; 00210 00211 virtual void addReference(PxTaskID taskID) = 0; 00212 virtual void decrReference(PxTaskID taskID) = 0; 00213 virtual int32_t getReference(PxTaskID taskID) const = 0; 00214 00215 virtual void decrReference(PxLightCpuTask&) = 0; 00216 virtual void addReference(PxLightCpuTask&) = 0; 00217 00220 friend class PxBaseTask; 00221 friend class PxTask; 00222 friend class PxLightCpuTask; 00223 friend class PxGpuWorkerThread; 00224 }; 00225 00226 PX_POP_PACK 00227 00228 } // end physx namespace 00229 00230 00231 #endif // PXTASK_PXTASKMANAGER_H
Copyright © 2008-2017 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com