From 56d57552e495893775712f28cb92ae15593a3c53 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 13 Feb 2014 17:03:36 -0600 Subject: [PATCH] MAINT-2876 Fix for freeze when editing certain rigged meshes at high altitude. --- indra/llmath/lloctree.h | 15 +++++++++++---- indra/newview/app_settings/settings.xml | 12 ++++++++++++ indra/newview/llspatialpartition.cpp | 1 + indra/newview/llviewercontrol.cpp | 1 + indra/newview/pipeline.cpp | 1 + 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h index 97bd7f98b3..e2187ed24c 100755 --- a/indra/llmath/lloctree.h +++ b/indra/llmath/lloctree.h @@ -36,6 +36,8 @@ extern U32 gOctreeMaxCapacity; +extern float gOctreeMinSize; + /*#define LL_OCTREE_PARANOIA_CHECK 0 #if LL_DARWIN #define LL_OCTREE_MAX_CAPACITY 32 @@ -106,6 +108,7 @@ public: : mParent((oct_node*)parent), mOctant(octant) { + llassert(size[0] >= gOctreeMinSize*0.5f); //always keep a NULL terminated list to avoid out of bounds exceptions in debug builds mData.push_back(NULL); mDataEnd = &mData[0]; @@ -213,7 +216,7 @@ public: F32 size = mSize[0]; F32 p_size = size * 2.f; - return (radius <= 0.001f && size <= 0.001f) || + return (radius <= gOctreeMinSize && size <= gOctreeMinSize) || (radius <= p_size && radius > size); } @@ -319,7 +322,7 @@ public: //is it here? if (isInside(data->getPositionGroup())) { - if ((getElementCount() < gOctreeMaxCapacity && contains(data->getBinRadius()) || + if (((getElementCount() < gOctreeMaxCapacity || getSize()[0] <= gOctreeMinSize) && contains(data->getBinRadius()) || (data->getBinRadius() > getSize()[0] && parent && parent->getElementCount() >= gOctreeMaxCapacity))) { //it belongs here mData.push_back(NULL); @@ -356,8 +359,9 @@ public: LLVector4a val; val.setSub(center, getCenter()); val.setAbs(val); - - S32 lt = val.lessThan(LLVector4a::getEpsilon()).getGatheredBits() & 0x7; + LLVector4a min_diff(gOctreeMinSize); + + S32 lt = val.lessThan(min_diff).getGatheredBits() & 0x7; if( lt == 0x7 ) { @@ -389,6 +393,7 @@ public: } #endif + llassert(size[0] >= gOctreeMinSize*0.5f); //make the new kid child = new LLOctreeNode(center, size, this); addChild(child); @@ -798,6 +803,8 @@ public: this->setSize(size2); this->updateMinMax(); + llassert(size[0] >= gOctreeMinSize); + //copy our children to a new branch LLOctreeNode* newnode = new LLOctreeNode(center, size, this); diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 94eee97dcc..1fa749d275 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -10321,6 +10321,18 @@ Change of this parameter will affect the layout of buttons in notification toast 0 + OctreeMinimumNodeSize + + Comment + Minimum size of any octree node + Persist + 1 + Type + F32 + Value + 0.01 + + OctreeStaticObjectSizeFactor Comment diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index acde80dc40..0f2473a33e 100755 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -80,6 +80,7 @@ U32 LLSpatialGroup::sNodeCount = 0; std::set LLSpatialGroup::sPendingQueries; U32 gOctreeMaxCapacity; +F32 gOctreeMinSize; BOOL LLSpatialGroup::sNoDelete = FALSE; diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index af83bd8227..a210ce3785 100755 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -410,6 +410,7 @@ static bool handleRepartition(const LLSD&) if (gPipeline.isInit()) { gOctreeMaxCapacity = gSavedSettings.getU32("OctreeMaxNodeCapacity"); + gOctreeMinSize = gSavedSettings.getF32("OctreeMinimumNodeSize"); gObjectList.repartitionObjects(); } return true; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index a005bb0702..455dc55181 100755 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -506,6 +506,7 @@ void LLPipeline::init() refreshCachedSettings(); gOctreeMaxCapacity = gSavedSettings.getU32("OctreeMaxNodeCapacity"); + gOctreeMinSize = gSavedSettings.getF32("OctreeMinimumNodeSize"); sDynamicLOD = gSavedSettings.getBOOL("RenderDynamicLOD"); sRenderBump = gSavedSettings.getBOOL("RenderObjectBump"); sUseTriStrips = gSavedSettings.getBOOL("RenderUseTriStrips");