From 1f052ac15d68df4f6585cd5b97540ed9e16be296 Mon Sep 17 00:00:00 2001 From: Beq Date: Fri, 1 Sep 2023 20:36:31 +0100 Subject: [PATCH] More Area Search and 360 fixes Remove the old flags that we no longer need Fix misplaced callback used by LL's code that results in NULL region ID sometimes. Clean up the handling of overlapping "360 mode" usage. Intercept VOCache clean when in AreaSearch mode --- indra/newview/llagent.cpp | 15 +++++++++++++-- indra/newview/llfloater360capture.cpp | 14 ++++++++++---- indra/newview/llviewerregion.cpp | 7 ++++--- indra/newview/llviewerregion.h | 1 - indra/newview/llvocache.cpp | 13 ++++--------- indra/newview/pipeline.cpp | 2 +- 6 files changed, 32 insertions(+), 20 deletions(-) diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index cf4dc5c8cd..331d684e6d 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -1068,7 +1068,10 @@ void LLAgent::capabilityReceivedCallback(const LLUUID ®ion_id, LLViewerRegion if (gAgent.getInterestListMode() == LLViewerRegion::IL_MODE_360) { - gAgent.changeInterestListMode(LLViewerRegion::IL_MODE_360); + // make this actually work + // gAgent.changeInterestListMode(LLViewerRegion::IL_MODE_360); + regionp->setInterestListMode(LLViewerRegion::IL_MODE_360); + // } } } @@ -1124,6 +1127,14 @@ void LLAgent::setRegion(LLViewerRegion *regionp) { regionp->requestSimulatorFeatures(); LLAppViewer::instance()->updateNameLookupUrl(regionp); + // move the interestlist update to a place where it is safe. + // Set the region to the desired interest list mode + if (getInterestListMode() == LLViewerRegion::IL_MODE_360) + { + changeInterestListMode(LLViewerRegion::IL_MODE_360); + regionp->setCapabilitiesReceivedCallback(LLAgent::capabilityReceivedCallback); + } + // } else { @@ -3510,7 +3521,7 @@ void LLAgent::changeInterestListMode(const std::string &new_mode) if ( (new_mode == LLViewerRegion::IL_MODE_DEFAULT && (!mFSAreaSearchActive && !m360CaptureActive)) || (new_mode == LLViewerRegion::IL_MODE_360) ) { - LL_DEBUGS("360Capture") << "Setting Agent interest list mode to " << mInterestListMode << " and updating regions" << LL_ENDL; + LL_DEBUGS("360Capture") << "Setting Agent interest list mode to " << new_mode << " and updating regions" << LL_ENDL; // mInterestListMode = new_mode; // Change interest list mode for all regions. If they are already set for the current mode, diff --git a/indra/newview/llfloater360capture.cpp b/indra/newview/llfloater360capture.cpp index 30551da3ea..97377b5ca9 100644 --- a/indra/newview/llfloater360capture.cpp +++ b/indra/newview/llfloater360capture.cpp @@ -83,12 +83,18 @@ LLFloater360Capture::~LLFloater360Capture() // Normally LLFloater360Capture tells the Simulator send everything // and now reverts to the regular "keyhole" frustum of interest // list updates. - if (!LLApp::isExiting() && - // gSavedSettings.getBOOL("360CaptureUseInterestListCap") && // Invalid dependency - This is not used anywhere else now. - mStartILMode != gAgent.getInterestListMode()) + // This whole thing is wrong because it is not a simple before/after state states can overlap. + // if (!LLApp::isExiting() && + // // gSavedSettings.getBOOL("360CaptureUseInterestListCap") && // Invalid dependency - This is not used anywhere else now. + // mStartILMode != gAgent.getInterestListMode()) + // { + // gAgent.set360CaptureActive(false); // make FS Area search work again + // gAgent.changeInterestListMode(mStartILMode); + // } + if ( !LLApp::isExiting() ) { gAgent.set360CaptureActive(false); // make FS Area search work again - gAgent.changeInterestListMode(mStartILMode); + gAgent.changeInterestListMode(LLViewerRegion::IL_MODE_DEFAULT);// The Change Interest Mode target mode is indicative only. If something else is holding the 360 mode open then this will be ignored. } } diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 14773e147f..f8e90bd8db 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -106,7 +106,6 @@ const S32 MAX_CAP_REQUEST_ATTEMPTS = 30; const U32 DEFAULT_MAX_REGION_WIDE_PRIM_COUNT = 15000; -bool LLViewerRegion::sFSAreaSearchActive = false; // FIRE-32688 Area Search improvements BOOL LLViewerRegion::sVOCacheCullingEnabled = FALSE; S32 LLViewerRegion::sLastCameraUpdated = 0; S32 LLViewerRegion::sNewObjectCreationThrottle = -1; @@ -3541,8 +3540,10 @@ void LLViewerRegion::setCapabilitiesReceived(bool received) // This is a single-shot signal. Forget callbacks to save resources. mCapabilitiesReceivedSignal.disconnect_all_slots(); - // Set the region to the desired interest list mode - setInterestListMode(gAgent.getInterestListMode()); + // 360/AreaSearch fix - Move this to agent callback to avoid premature triggere with null region + // // Set the region to the desired interest list mode + // setInterestListMode(gAgent.getInterestListMode()); + // } } diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index b07578df75..c07ffefd44 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -489,7 +489,6 @@ public: std::vector mMapAvatars; std::vector mMapAvatarIDs; - static bool sFSAreaSearchActive; // FIRE-32688 Area Search improvements static BOOL sVOCacheCullingEnabled; //vo cache culling enabled or not. static S32 sLastCameraUpdated; diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index b92f147506..9465d132b5 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -35,6 +35,7 @@ #include "pipeline.h" #include "llagentcamera.h" #include "llmemory.h" +#include "llagent.h" // For gAgent //static variables U32 LLVOCacheEntry::sMinFrameRange = 0; @@ -451,7 +452,7 @@ F32 LLVOCacheEntry::getSquaredPixelThreshold(bool is_front) bool LLVOCacheEntry::isAnyVisible(const LLVector4a& camera_origin, const LLVector4a& local_camera_origin, F32 dist_threshold) { - if( LLViewerRegion::sFSAreaSearchActive ) { return true; } // FIRE-32688 Area Search improvements + if( gAgent.getFSAreaSearchActive() ) { return true; } // FIRE-32688 Area Search improvements LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)getGroup(); if(!group) { @@ -948,10 +949,7 @@ S32 LLVOCachePartition::cull(LLCamera &camera, bool do_occlusion) //process back objects selection selectBackObjects(camera, LLVOCacheEntry::getSquaredPixelThreshold(mFrontCull), - // FIRE-32688 Area Search improvements - // do_occlusion && use_object_cache_occlusion); - do_occlusion && use_object_cache_occlusion && !LLViewerRegion::sFSAreaSearchActive); - // + do_occlusion && use_object_cache_occlusion); return 0; //nothing changed, reduce frequency of culling } } @@ -965,10 +963,7 @@ S32 LLVOCachePartition::cull(LLCamera &camera, bool do_occlusion) camera.calcRegionFrustumPlanes(region_agent, gAgentCamera.mDrawDistance); mFrontCull = TRUE; - // FIRE-32688 Area Search improvements - // LLVOCacheOctreeCull culler(&camera, mRegionp, region_agent, do_occlusion && use_object_cache_occlusion, - LLVOCacheOctreeCull culler(&camera, mRegionp, region_agent, do_occlusion && use_object_cache_occlusion && !LLViewerRegion::sFSAreaSearchActive, - // + LLVOCacheOctreeCull culler(&camera, mRegionp, region_agent, do_occlusion && use_object_cache_occlusion, LLVOCacheEntry::getSquaredPixelThreshold(mFrontCull), this); culler.traverse(mOctree); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 6e993b2a62..ddabeba9db 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -2592,7 +2592,7 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, LLPlane* pla LLVOCachePartition* vo_part = region->getVOCachePartition(); if(vo_part) { - bool do_occlusion_cull = can_use_occlusion && use_occlusion && !gUseWireframe; + bool do_occlusion_cull = can_use_occlusion && use_occlusion && !gUseWireframe && !gAgent.getFSAreaSearchActive(); vo_part->cull(camera, do_occlusion_cull); } }