| 2895 | } |
| 2896 | |
| 2897 | void NpScene::sceneQueriesUpdate(physx::PxBaseTask* completionTask, bool controlSimulation) |
| 2898 | { |
| 2899 | PX_SIMD_GUARD; |
| 2900 | |
| 2901 | bool runUpdateTasks[PruningIndex::eCOUNT] = {true, true}; |
| 2902 | { |
| 2903 | // write guard must end before scene queries tasks kicks off worker threads |
| 2904 | NP_WRITE_CHECK(this); |
| 2905 | |
| 2906 | PX_PROFILE_START_CROSSTHREAD("Basic.sceneQueriesUpdate", getContextId()); |
| 2907 | |
| 2908 | if(mSceneQueriesUpdateRunning) |
| 2909 | { |
| 2910 | //fetchSceneQueries doesn't get called |
| 2911 | Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxScene::fetchSceneQueries was not called!"); |
| 2912 | return; |
| 2913 | } |
| 2914 | |
| 2915 | // flush scene queries updates |
| 2916 | mSQManager.flushUpdates(); |
| 2917 | |
| 2918 | // prepare scene queries for build - copy bounds |
| 2919 | runUpdateTasks[PruningIndex::eSTATIC] = mSQManager.prepareSceneQueriesUpdate(PruningIndex::eSTATIC); |
| 2920 | runUpdateTasks[PruningIndex::eDYNAMIC] = mSQManager.prepareSceneQueriesUpdate(PruningIndex::eDYNAMIC); |
| 2921 | |
| 2922 | mSceneQueriesUpdateRunning = true; |
| 2923 | } |
| 2924 | |
| 2925 | { |
| 2926 | PX_PROFILE_ZONE("Sim.sceneQueriesTaskSetup", getContextId()); |
| 2927 | |
| 2928 | if (controlSimulation) |
| 2929 | { |
| 2930 | { |
| 2931 | PX_PROFILE_ZONE("Sim.resetDependencies", getContextId()); |
| 2932 | // Only reset dependencies, etc if we own the TaskManager. Will be false |
| 2933 | // when an NpScene is controlled by an APEX scene. |
| 2934 | mTaskManager->resetDependencies(); |
| 2935 | } |
| 2936 | mTaskManager->startSimulation(); |
| 2937 | } |
| 2938 | |
| 2939 | mSceneQueriesCompletion.setContinuation(*mTaskManager, completionTask); |
| 2940 | if(runUpdateTasks[PruningIndex::eSTATIC]) |
| 2941 | mSceneQueriesStaticPrunerUpdate.setContinuation(&mSceneQueriesCompletion); |
| 2942 | if(runUpdateTasks[PruningIndex::eDYNAMIC]) |
| 2943 | mSceneQueriesDynamicPrunerUpdate.setContinuation(&mSceneQueriesCompletion); |
| 2944 | |
| 2945 | mSceneQueriesCompletion.removeReference(); |
| 2946 | if(runUpdateTasks[PruningIndex::eSTATIC]) |
| 2947 | mSceneQueriesStaticPrunerUpdate.removeReference(); |
| 2948 | if(runUpdateTasks[PruningIndex::eDYNAMIC]) |
| 2949 | mSceneQueriesDynamicPrunerUpdate.removeReference(); |
| 2950 | } |
| 2951 | } |
| 2952 | |
| 2953 | bool NpScene::checkSceneQueriesInternal(bool block) |
| 2954 | { |
nothing calls this directly
no test coverage detected