1 | // |
2 | // Redistribution and use in source and binary forms, with or without |
3 | // modification, are permitted provided that the following conditions |
4 | // are met: |
5 | // * Redistributions of source code must retain the above copyright |
6 | // notice, this list of conditions and the following disclaimer. |
7 | // * Redistributions in binary form must reproduce the above copyright |
8 | // notice, this list of conditions and the following disclaimer in the |
9 | // documentation and/or other materials provided with the distribution. |
10 | // * Neither the name of NVIDIA CORPORATION nor the names of its |
11 | // contributors may be used to endorse or promote products derived |
12 | // from this software without specific prior written permission. |
13 | // |
14 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY |
15 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
16 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
17 | // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
18 | // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 | // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
20 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
21 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
22 | // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
23 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
24 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 | // |
26 | // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved. |
27 | // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. |
28 | // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. |
29 | |
30 | #ifndef BP_AABB_MANAGER_TASKS_H |
31 | #define BP_AABB_MANAGER_TASKS_H |
32 | |
33 | #include "PsUserAllocated.h" |
34 | #include "CmTask.h" |
35 | |
36 | namespace physx |
37 | { |
38 | class PxcScratchAllocator; |
39 | namespace Bp |
40 | { |
41 | class AABBManager; |
42 | class Aggregate; |
43 | |
44 | class AggregateBoundsComputationTask : public Cm::Task, public shdfnd::UserAllocated |
45 | { |
46 | public: |
47 | AggregateBoundsComputationTask(PxU64 contextId) : |
48 | Cm::Task (contextId), |
49 | mManager (NULL), |
50 | mStart (0), |
51 | mNbToGo (0), |
52 | mAggregates (NULL) |
53 | {} |
54 | ~AggregateBoundsComputationTask() {} |
55 | |
56 | virtual const char* getName() const { return "AggregateBoundsComputationTask" ; } |
57 | virtual void runInternal(); |
58 | |
59 | void Init(AABBManager* manager, PxU32 start, PxU32 nb, Aggregate** aggregates) |
60 | { |
61 | mManager = manager; |
62 | mStart = start; |
63 | mNbToGo = nb; |
64 | mAggregates = aggregates; |
65 | } |
66 | private: |
67 | AABBManager* mManager; |
68 | PxU32 mStart; |
69 | PxU32 mNbToGo; |
70 | Aggregate** mAggregates; |
71 | |
72 | AggregateBoundsComputationTask& operator=(const AggregateBoundsComputationTask&); |
73 | }; |
74 | |
75 | class FinalizeUpdateTask : public Cm::Task, public shdfnd::UserAllocated |
76 | { |
77 | public: |
78 | FinalizeUpdateTask(PxU64 contextId) : |
79 | Cm::Task (contextId), |
80 | mManager (NULL), |
81 | mNumCpuTasks (0), |
82 | mScratchAllocator (NULL), |
83 | mNarrowPhaseUnlockTask (NULL) |
84 | {} |
85 | ~FinalizeUpdateTask() {} |
86 | |
87 | virtual const char* getName() const { return "FinalizeUpdateTask" ; } |
88 | virtual void runInternal(); |
89 | |
90 | void Init(AABBManager* manager, PxU32 numCpuTasks, PxcScratchAllocator* scratchAllocator, PxBaseTask* narrowPhaseUnlockTask) |
91 | { |
92 | mManager = manager; |
93 | mNumCpuTasks = numCpuTasks; |
94 | mScratchAllocator = scratchAllocator; |
95 | mNarrowPhaseUnlockTask = narrowPhaseUnlockTask; |
96 | } |
97 | private: |
98 | AABBManager* mManager; |
99 | PxU32 mNumCpuTasks; |
100 | PxcScratchAllocator* mScratchAllocator; |
101 | PxBaseTask* mNarrowPhaseUnlockTask; |
102 | |
103 | FinalizeUpdateTask& operator=(const FinalizeUpdateTask&); |
104 | }; |
105 | |
106 | } |
107 | } //namespace physx |
108 | |
109 | #endif // BP_AABB_MANAGER_TASKS_H |
110 | |