diff options
| author | Cosmic Linden <cosmic@lindenlab.com> | 2023-07-11 16:08:03 -0700 | 
|---|---|---|
| committer | Cosmic Linden <cosmic@lindenlab.com> | 2023-07-11 16:28:36 -0700 | 
| commit | 59a626c2a22aa7cbccf87ce435012583d7610cd4 (patch) | |
| tree | 6aab97476709b71bcf76f5ee30af29310c8f317b | |
| parent | ba4b596894e8eb9b9eb51169b9b3f88c21173c29 (diff) | |
SL-19992: Fix assert in LLVolumeLODGroup::refLOD when LLMeshRepository::notifyMeshUnavailable is called on the highest LOD
| -rw-r--r-- | indra/llmath/llvolumemgr.cpp | 18 | ||||
| -rw-r--r-- | indra/newview/llmeshrepository.cpp | 20 | 
2 files changed, 19 insertions, 19 deletions
diff --git a/indra/llmath/llvolumemgr.cpp b/indra/llmath/llvolumemgr.cpp index 89cdb1c6b9..9399504529 100644 --- a/indra/llmath/llvolumemgr.cpp +++ b/indra/llmath/llvolumemgr.cpp @@ -89,7 +89,7 @@ BOOL LLVolumeMgr::cleanup()  // Note however that LLVolumeLODGroup that contains the volume  //  also holds a LLPointer so the volume will only go away after  //  anything holding the volume and the LODGroup are destroyed -LLVolume* LLVolumeMgr::refVolume(const LLVolumeParams &volume_params, const S32 detail) +LLVolume* LLVolumeMgr::refVolume(const LLVolumeParams &volume_params, const S32 lod)  {  	LLVolumeLODGroup* volgroupp;  	if (mDataMutex) @@ -109,7 +109,7 @@ LLVolume* LLVolumeMgr::refVolume(const LLVolumeParams &volume_params, const S32  	{  		mDataMutex->unlock();  	} -	return volgroupp->refLOD(detail); +	return volgroupp->refLOD(lod);  }  // virtual @@ -287,18 +287,18 @@ bool LLVolumeLODGroup::cleanupRefs()  	return res;  } -LLVolume* LLVolumeLODGroup::refLOD(const S32 detail) +LLVolume* LLVolumeLODGroup::refLOD(const S32 lod)  { -	llassert(detail >=0 && detail < NUM_LODS); -	mAccessCount[detail]++; +	llassert(lod >=0 && lod < NUM_LODS); +	mAccessCount[lod]++;  	mRefs++; -	if (mVolumeLODs[detail].isNull()) +	if (mVolumeLODs[lod].isNull())  	{ -		mVolumeLODs[detail] = new LLVolume(mVolumeParams, mDetailScales[detail]); +		mVolumeLODs[lod] = new LLVolume(mVolumeParams, mDetailScales[lod]);  	} -	mLODRefs[detail]++; -	return mVolumeLODs[detail]; +	mLODRefs[lod]++; +	return mVolumeLODs[lod];  }  BOOL LLVolumeLODGroup::derefLOD(LLVolume *volumep) diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 57ac111fdf..2118ee74d3 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -3021,7 +3021,7 @@ S32 LLMeshRepository::getActualMeshLOD(LLMeshHeader& header, S32 lod)  	}  	//search up to find then ext available higher lod -	for (S32 i = lod+1; i < 4; ++i) +	for (S32 i = lod+1; i < LLVolumeLODGroup::NUM_LODS; ++i)  	{  		if (header.mLodSize[i] > 0)  		{ @@ -3183,7 +3183,7 @@ void LLMeshHeaderHandler::processFailure(LLCore::HttpStatus status)  	// Can't get the header so none of the LODs will be available  	LLMutexLock lock(gMeshRepo.mThread->mMutex); -	for (int i(0); i < 4; ++i) +	for (int i(0); i < LLVolumeLODGroup::NUM_LODS; ++i)  	{  		gMeshRepo.mThread->mUnavailableQ.push_back(LLMeshRepoThread::LODRequest(mMeshParams, i));  	} @@ -3212,7 +3212,7 @@ void LLMeshHeaderHandler::processData(LLCore::BufferArray * /* body */, S32 /* b  		// Can't get the header so none of the LODs will be available  		LLMutexLock lock(gMeshRepo.mThread->mMutex); -		for (int i(0); i < 4; ++i) +		for (int i(0); i < LLVolumeLODGroup::NUM_LODS; ++i)  		{  			gMeshRepo.mThread->mUnavailableQ.push_back(LLMeshRepoThread::LODRequest(mMeshParams, i));  		} @@ -3293,7 +3293,7 @@ void LLMeshHeaderHandler::processData(LLCore::BufferArray * /* body */, S32 /* b  			// headerReceived() parsed header, but header's data is invalid so none of the LODs will be available  			LLMutexLock lock(gMeshRepo.mThread->mMutex); -			for (int i(0); i < 4; ++i) +			for (int i(0); i < LLVolumeLODGroup::NUM_LODS; ++i)  			{  				gMeshRepo.mThread->mUnavailableQ.push_back(LLMeshRepoThread::LODRequest(mMeshParams, i));  			} @@ -3654,7 +3654,7 @@ S32 LLMeshRepository::loadMesh(LLVOVolume* vobj, const LLVolumeParams& mesh_para  	// Manage time-to-load metrics for mesh download operations.  	metricsProgress(1); -	if (detail < 0 || detail >= 4) +	if (detail < 0 || detail >= LLVolumeLODGroup::NUM_LODS)  	{  		return detail;  	} @@ -3717,7 +3717,7 @@ S32 LLMeshRepository::loadMesh(LLVOVolume* vobj, const LLVolumeParams& mesh_para  			}  			//no lower LOD is a available, is a higher lod available? -			for (S32 i = detail+1; i < 4; ++i) +			for (S32 i = detail+1; i < LLVolumeLODGroup::NUM_LODS; ++i)  			{  				LLVolume* lod = group->refLOD(i);  				if (lod && lod->isMeshAssetLoaded() && lod->getNumVolumeFaces() > 0) @@ -3918,7 +3918,7 @@ void LLMeshRepository::notifyLoadedMeshes()  				//create score map  				std::map<LLUUID, F32> score_map; -				for (U32 i = 0; i < 4; ++i) +				for (U32 i = 0; i < LLVolumeLODGroup::NUM_LODS; ++i)  				{  					for (mesh_load_map::iterator iter = mLoadingMeshes[i].begin();  iter != mLoadingMeshes[i].end(); ++iter)  					{ @@ -4099,7 +4099,7 @@ void LLMeshRepository::notifyMeshUnavailable(const LLVolumeParams& mesh_params,  	{  		F32 detail = LLVolumeLODGroup::getVolumeScaleFromDetail(lod); -        LLVolume* sys_volume = LLPrimitive::getVolumeManager()->refVolume(mesh_params, detail); +        LLVolume* sys_volume = LLPrimitive::getVolumeManager()->refVolume(mesh_params, lod);          if (sys_volume)          {              sys_volume->setMeshAssetUnavaliable(true); @@ -4480,7 +4480,7 @@ F32 LLMeshRepository::getStreamingCostLegacy(LLUUID mesh_id, F32 radius, S32* by              {                  LL_WARNS() << mesh_id << "bytes mismatch " << *bytes << " " << data.getSizeTotal() << LL_ENDL;              } -            if (bytes_visible && (lod >=0) && (lod < 4) && (*bytes_visible != data.getSizeByLOD(lod))) +            if (bytes_visible && (lod >=0) && (lod < LLVolumeLODGroup::NUM_LODS) && (*bytes_visible != data.getSizeByLOD(lod)))              {                  LL_WARNS() << mesh_id << "bytes_visible mismatch " << *bytes_visible << " " << data.getSizeByLOD(lod) << LL_ENDL;              } @@ -4640,7 +4640,7 @@ bool LLMeshCostData::init(const LLMeshHeader& header)      static LLCachedControl<U32> minimum_size(gSavedSettings, "MeshMinimumByteSize", 16); //make sure nothing is "free"      static LLCachedControl<U32> bytes_per_triangle(gSavedSettings, "MeshBytesPerTriangle", 16); -    for (S32 i=0; i<4; i++) +    for (S32 i=0; i<LLVolumeLODGroup::NUM_LODS; i++)      {          mEstTrisByLOD[i] = llmax((F32)mSizeByLOD[i] - (F32)metadata_discount, (F32)minimum_size) / (F32)bytes_per_triangle;      }  | 
