| 2945 | } |
| 2946 | |
| 2947 | void NpScene::sceneQueriesUpdate(physx::PxBaseTask* completionTask, bool controlSimulation) |
| 2948 | { |
| 2949 | PX_SIMD_GUARD; |
| 2950 | |
| 2951 | bool runUpdateTasks[PruningIndex::eCOUNT] = {true, true}; |
| 2952 | { |
| 2953 | // write guard must end before scene queries tasks kicks off worker threads |
| 2954 | NP_WRITE_CHECK(this); |
| 2955 | |
| 2956 | PX_PROFILE_START_CROSSTHREAD("Basic.sceneQueriesUpdate", getContextId()); |
| 2957 | |
| 2958 | if(mSceneQueriesUpdateRunning) |
| 2959 | { |
| 2960 | //fetchSceneQueries doesn't get called |
| 2961 | Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxScene::fetchSceneQueries was not called!"); |
| 2962 | return; |
| 2963 | } |
| 2964 | |
| 2965 | // flush scene queries updates |
| 2966 | mSQManager.flushUpdates(); |
| 2967 | |
| 2968 | // prepare scene queries for build - copy bounds |
| 2969 | runUpdateTasks[PruningIndex::eSTATIC] = mSQManager.prepareSceneQueriesUpdate(PruningIndex::eSTATIC); |
| 2970 | runUpdateTasks[PruningIndex::eDYNAMIC] = mSQManager.prepareSceneQueriesUpdate(PruningIndex::eDYNAMIC); |
| 2971 | |
| 2972 | mSceneQueriesUpdateRunning = true; |
| 2973 | } |
| 2974 | |
| 2975 | { |
| 2976 | PX_PROFILE_ZONE("Sim.sceneQueriesTaskSetup", getContextId()); |
| 2977 | |
| 2978 | if (controlSimulation) |
| 2979 | { |
| 2980 | { |
| 2981 | PX_PROFILE_ZONE("Sim.resetDependencies", getContextId()); |
| 2982 | // Only reset dependencies, etc if we own the TaskManager. Will be false |
| 2983 | // when an NpScene is controlled by an APEX scene. |
| 2984 | mTaskManager->resetDependencies(); |
| 2985 | } |
| 2986 | mTaskManager->startSimulation(); |
| 2987 | } |
| 2988 | |
| 2989 | mSceneQueriesCompletion.setContinuation(*mTaskManager, completionTask); |
| 2990 | if(runUpdateTasks[PruningIndex::eSTATIC]) |
| 2991 | mSceneQueriesStaticPrunerUpdate.setContinuation(&mSceneQueriesCompletion); |
| 2992 | if(runUpdateTasks[PruningIndex::eDYNAMIC]) |
| 2993 | mSceneQueriesDynamicPrunerUpdate.setContinuation(&mSceneQueriesCompletion); |
| 2994 | |
| 2995 | mSceneQueriesCompletion.removeReference(); |
| 2996 | if(runUpdateTasks[PruningIndex::eSTATIC]) |
| 2997 | mSceneQueriesStaticPrunerUpdate.removeReference(); |
| 2998 | if(runUpdateTasks[PruningIndex::eDYNAMIC]) |
| 2999 | mSceneQueriesDynamicPrunerUpdate.removeReference(); |
| 3000 | } |
| 3001 | } |
| 3002 | |
| 3003 | bool NpScene::checkSceneQueriesInternal(bool block) |
| 3004 | { |
nothing calls this directly
no test coverage detected