@@ -925,7 +925,7 @@ void LLMeshRepoThread::run()
925
925
}
926
926
sRequestWaterLevel = static_cast <S32>(mHttpRequestSet .size ()); // Stats data update
927
927
928
- // NOTE: order of queue processing intentionally favors LOD requests over header requests
928
+ // NOTE: order of queue processing intentionally favors LOD and Skin requests over header requests
929
929
// Todo: we are processing mLODReqQ, mHeaderReqQ, mSkinRequests, mDecompositionRequests and mPhysicsShapeRequests
930
930
// in relatively similar manners, remake code to simplify/unify the process,
931
931
// like processRequests(&requestQ, fetchFunction); which does same thing for each element
@@ -979,6 +979,50 @@ void LLMeshRepoThread::run()
979
979
}
980
980
}
981
981
982
+ if (mHttpRequestSet .size () < sRequestHighWater
983
+ && !mSkinRequests .empty ())
984
+ {
985
+ if (!mSkinRequests .empty ())
986
+ {
987
+ std::list<UUIDBasedRequest> incomplete;
988
+ while (!mSkinRequests .empty () && mHttpRequestSet .size () < sRequestHighWater )
989
+ {
990
+
991
+ mMutex ->lock ();
992
+ auto req = mSkinRequests .front ();
993
+ mSkinRequests .pop_front ();
994
+ mMutex ->unlock ();
995
+ if (req.isDelayed ())
996
+ {
997
+ incomplete.emplace_back (req);
998
+ }
999
+ else if (!fetchMeshSkinInfo (req.mId , req.canRetry ()))
1000
+ {
1001
+ if (req.canRetry ())
1002
+ {
1003
+ req.updateTime ();
1004
+ incomplete.emplace_back (req);
1005
+ }
1006
+ else
1007
+ {
1008
+ LLMutexLock locker (mMutex );
1009
+ mSkinUnavailableQ .push_back (req);
1010
+ LL_DEBUGS () << " mSkinReqQ failed: " << req.mId << LL_ENDL;
1011
+ }
1012
+ }
1013
+ }
1014
+
1015
+ if (!incomplete.empty ())
1016
+ {
1017
+ LLMutexLock locker (mMutex );
1018
+ for (const auto & req : incomplete)
1019
+ {
1020
+ mSkinRequests .push_back (req);
1021
+ }
1022
+ }
1023
+ }
1024
+ }
1025
+
982
1026
if (!mHeaderReqQ .empty () && mHttpRequestSet .size () < sRequestHighWater )
983
1027
{
984
1028
std::list<HeaderRequest> incomplete;
@@ -1028,54 +1072,13 @@ void LLMeshRepoThread::run()
1028
1072
// performing long-duration actions.
1029
1073
1030
1074
if (mHttpRequestSet .size () < sRequestHighWater
1031
- && (!mSkinRequests .empty ()
1032
- || !mDecompositionRequests .empty ()
1075
+ && (!mDecompositionRequests .empty ()
1033
1076
|| !mPhysicsShapeRequests .empty ()))
1034
1077
{
1035
1078
// Something to do probably, lock and double-check. We don't want
1036
1079
// to hold the lock long here. That will stall main thread activities
1037
1080
// so we bounce it.
1038
1081
1039
- if (!mSkinRequests .empty ())
1040
- {
1041
- std::list<UUIDBasedRequest> incomplete;
1042
- while (!mSkinRequests .empty () && mHttpRequestSet .size () < sRequestHighWater )
1043
- {
1044
-
1045
- mMutex ->lock ();
1046
- auto req = mSkinRequests .front ();
1047
- mSkinRequests .pop_front ();
1048
- mMutex ->unlock ();
1049
- if (req.isDelayed ())
1050
- {
1051
- incomplete.emplace_back (req);
1052
- }
1053
- else if (!fetchMeshSkinInfo (req.mId , req.canRetry ()))
1054
- {
1055
- if (req.canRetry ())
1056
- {
1057
- req.updateTime ();
1058
- incomplete.emplace_back (req);
1059
- }
1060
- else
1061
- {
1062
- LLMutexLock locker (mMutex );
1063
- mSkinUnavailableQ .push_back (req);
1064
- LL_DEBUGS () << " mSkinReqQ failed: " << req.mId << LL_ENDL;
1065
- }
1066
- }
1067
- }
1068
-
1069
- if (!incomplete.empty ())
1070
- {
1071
- LLMutexLock locker (mMutex );
1072
- for (const auto & req : incomplete)
1073
- {
1074
- mSkinRequests .push_back (req);
1075
- }
1076
- }
1077
- }
1078
-
1079
1082
// holding lock, try next list
1080
1083
// *TODO: For UI/debug-oriented lists, we might drop the fine-
1081
1084
// grained locking as there's a lowered expectation of smoothness
@@ -1195,7 +1198,6 @@ void LLMeshRepoThread::lockAndLoadMeshLOD(const LLVolumeParams& mesh_params, S32
1195
1198
}
1196
1199
}
1197
1200
1198
-
1199
1201
void LLMeshRepoThread::loadMeshLOD (const LLVolumeParams& mesh_params, S32 lod)
1200
1202
{ // could be called from any thread
1201
1203
const LLUUID& mesh_id = mesh_params.getSculptID ();
@@ -3781,7 +3783,7 @@ S32 LLMeshRepository::loadMesh(LLVOVolume* vobj, const LLVolumeParams& mesh_para
3781
3783
{
3782
3784
// first request for this mesh
3783
3785
mLoadingMeshes [detail][mesh_id].push_back (vobj);
3784
- mPendingRequests .push_back (LLMeshRepoThread::LODRequest (mesh_params, detail));
3786
+ mPendingRequests .push_back (PendingRequestLOD (mesh_params, detail));
3785
3787
LLMeshRepository::sLODPending ++;
3786
3788
}
3787
3789
}
@@ -4054,35 +4056,64 @@ void LLMeshRepository::notifyLoadedMeshes()
4054
4056
score_map[iter->first ] = max_score;
4055
4057
}
4056
4058
}
4059
+ for (mesh_load_map::iterator iter = mLoadingSkins .begin (); iter != mLoadingSkins .end (); ++iter)
4060
+ {
4061
+ F32 max_score = 0 .f ;
4062
+ for (auto obj_iter = iter->second .begin (); obj_iter != iter->second .end (); ++obj_iter)
4063
+ {
4064
+ LLVOVolume* object = *obj_iter;
4065
+ if (object)
4066
+ {
4067
+ LLDrawable* drawable = object->mDrawable ;
4068
+ if (drawable)
4069
+ {
4070
+ F32 cur_score = drawable->getRadius () / llmax (drawable->mDistanceWRTCamera , 1 .f );
4071
+ max_score = llmax (max_score, cur_score);
4072
+ }
4073
+ }
4074
+ }
4075
+
4076
+ score_map[iter->first ] = max_score;
4077
+ }
4057
4078
4058
4079
// set "score" for pending requests
4059
- for (std::vector<LLMeshRepoThread::LODRequest >::iterator iter = mPendingRequests .begin (); iter != mPendingRequests .end (); ++iter)
4080
+ for (std::vector<PendingRequestBase >::iterator iter = mPendingRequests .begin (); iter != mPendingRequests .end (); ++iter)
4060
4081
{
4061
- iter->mScore = score_map[iter->mMeshParams . getSculptID ()];
4082
+ iter->setScore ( score_map[iter->getId ()]) ;
4062
4083
}
4063
4084
4064
4085
// sort by "score"
4065
4086
std::partial_sort (mPendingRequests .begin (), mPendingRequests .begin () + push_count,
4066
- mPendingRequests .end (), LLMeshRepoThread ::CompareScoreGreater ());
4087
+ mPendingRequests .end (), PendingRequestBase ::CompareScoreGreater ());
4067
4088
}
4068
4089
4069
4090
while (!mPendingRequests .empty () && push_count > 0 )
4070
4091
{
4071
- LLMeshRepoThread::LODRequest& request = mPendingRequests .front ();
4072
- mThread ->loadMeshLOD (request.mMeshParams , request.mLOD );
4092
+ PendingRequestBase& request = mPendingRequests .front ();
4093
+ switch (request.getRequestType ())
4094
+ {
4095
+ case MESH_REQUEST_LOD:
4096
+ {
4097
+ PendingRequestLOD& lod = (PendingRequestLOD&)request;
4098
+ mThread ->loadMeshLOD (lod.mMeshParams , lod.mLOD );
4099
+ LLMeshRepository::sLODPending --;
4100
+ break ;
4101
+ }
4102
+ case MESH_REQUEST_SKIN:
4103
+ {
4104
+ PendingRequestUUID& skin = (PendingRequestUUID&)request;
4105
+ mThread ->loadMeshSkinInfo (skin.getId ());
4106
+ break ;
4107
+ }
4108
+
4109
+ default :
4110
+ break ;
4111
+ }
4073
4112
mPendingRequests .erase (mPendingRequests .begin ());
4074
- LLMeshRepository::sLODPending --;
4075
4113
push_count--;
4076
4114
}
4077
4115
}
4078
4116
4079
- // send skin info requests
4080
- while (!mPendingSkinRequests .empty ())
4081
- {
4082
- mThread ->loadMeshSkinInfo (mPendingSkinRequests .front ());
4083
- mPendingSkinRequests .pop ();
4084
- }
4085
-
4086
4117
// send decomposition requests
4087
4118
while (!mPendingDecompositionRequests .empty ())
4088
4119
{
@@ -4274,7 +4305,7 @@ const LLMeshSkinInfo* LLMeshRepository::getSkinInfo(const LLUUID& mesh_id, LLVOV
4274
4305
{
4275
4306
// first request for this mesh
4276
4307
mLoadingSkins [mesh_id].push_back (requesting_obj);
4277
- mPendingSkinRequests . push ( mesh_id);
4308
+ mPendingRequests . push_back ( PendingRequestUUID ( mesh_id, MESH_REQUEST_SKIN) );
4278
4309
}
4279
4310
}
4280
4311
}
0 commit comments