summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorJonathan Wolk <none@none>2010-10-19 11:29:42 -0700
committerJonathan Wolk <none@none>2010-10-19 11:29:42 -0700
commit256c6e6a252feaa7ae50f81778aab1e0246a526a (patch)
treeef1982449f3942fe6a5504b5e18536e21644e7e5 /indra
parenta045261002963fce7a719c9bcffee396aef821ca (diff)
Moved retry logic for certain mesh header fetches to help with SH-323 'Some mesh objects fail to load data for valid meshes'. Renamed some variables to be more clear.
Diffstat (limited to 'indra')
-rw-r--r--indra/llprimitive/llmodel.cpp113
-rw-r--r--indra/llprimitive/llmodel.h76
-rw-r--r--indra/newview/llfloaterimportcollada.cpp15
-rw-r--r--indra/newview/llfloatermodelpreview.cpp40
-rw-r--r--indra/newview/llmeshrepository.cpp61
-rw-r--r--indra/newview/llmeshrepository.h4
6 files changed, 214 insertions, 95 deletions
diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp
index 7ae472ce82..7fa72d82e1 100644
--- a/indra/llprimitive/llmodel.cpp
+++ b/indra/llprimitive/llmodel.cpp
@@ -950,13 +950,14 @@ void LLModel::setNumVolumeFaces(S32 count)
mVolumeFaces.resize(count);
}
-void LLModel::setVolumeFaceData(S32 f,
- LLStrider<LLVector3> pos,
- LLStrider<LLVector3> norm,
- LLStrider<LLVector2> tc,
- LLStrider<U16> ind,
- U32 num_verts,
- U32 num_indices)
+void LLModel::setVolumeFaceData(
+ S32 f,
+ LLStrider<LLVector3> pos,
+ LLStrider<LLVector3> norm,
+ LLStrider<LLVector2> tc,
+ LLStrider<U16> ind,
+ U32 num_verts,
+ U32 num_indices)
{
LLVolumeFace& face = mVolumeFaces[f];
@@ -1283,18 +1284,63 @@ LLModel* LLModel::loadModelFromDomMesh(domMesh *mesh)
}
//static
-LLSD LLModel::writeModel(std::string filename, LLModel* physics, LLModel* high, LLModel* medium, LLModel* low, LLModel* impostor, LLModel::physics_shape& decomp, bool upload_skin, bool upload_joints, bool nowrite)
+LLSD LLModel::writeModel(
+ std::string filename,
+ LLModel* physics,
+ LLModel* high,
+ LLModel* medium,
+ LLModel* low,
+ LLModel* impostor,
+ const convex_hull_decomposition& decomp,
+ BOOL upload_skin,
+ BOOL upload_joints,
+ BOOL nowrite)
{
LLModel::hull dummy_hull;
- return writeModel(filename, physics, high, medium, low, impostor, decomp, dummy_hull, upload_skin, upload_joints, nowrite);
+ return writeModel(
+ filename,
+ physics,
+ high,
+ medium,
+ low,
+ impostor,
+ decomp,
+ dummy_hull,
+ upload_skin,
+ upload_joints,
+ nowrite);
}
//static
-LLSD LLModel::writeModel(std::string filename, LLModel* physics, LLModel* high, LLModel* medium, LLModel* low, LLModel* impostor, LLModel::physics_shape& decomp, LLModel::hull& base_hull, bool upload_skin, bool upload_joints, bool nowrite)
+LLSD LLModel::writeModel(
+ std::string filename,
+ LLModel* physics,
+ LLModel* high,
+ LLModel* medium,
+ LLModel* low,
+ LLModel* impostor,
+ const convex_hull_decomposition& decomp,
+ const hull& base_hull,
+ BOOL upload_skin,
+ BOOL upload_joints,
+ BOOL nowrite)
{
- std::ofstream os(filename.c_str(), std::ofstream::out | std::ofstream::binary);
+ std::ofstream os(
+ filename.c_str(),
+ std::ofstream::out | std::ofstream::binary);
- LLSD header = writeModel(os, physics, high, medium, low, impostor, decomp, base_hull, upload_skin, upload_joints, nowrite);
+ LLSD header = writeModel(
+ os,
+ physics,
+ high,
+ medium,
+ low,
+ impostor,
+ decomp,
+ base_hull,
+ upload_skin,
+ upload_joints,
+ nowrite);
os.close();
@@ -1302,7 +1348,18 @@ LLSD LLModel::writeModel(std::string filename, LLModel* physics, LLModel* high,
}
//static
-LLSD LLModel::writeModel(std::ostream& ostr, LLModel* physics, LLModel* high, LLModel* medium, LLModel* low, LLModel* impostor, LLModel::physics_shape& decomp, LLModel::hull& base_hull, bool upload_skin, bool upload_joints, bool nowrite)
+LLSD LLModel::writeModel(
+ std::ostream& ostr,
+ LLModel* physics,
+ LLModel* high,
+ LLModel* medium,
+ LLModel* low,
+ LLModel* impostor,
+ const convex_hull_decomposition& decomp,
+ const hull& base_hull,
+ BOOL upload_skin,
+ BOOL upload_joints,
+ BOOL nowrite)
{
LLSD mdl;
@@ -1392,12 +1449,15 @@ LLSD LLModel::writeModel(std::ostream& ostr, LLModel* physics, LLModel* high, LL
{
U32 size = decomp[i].size();
total += size;
- hulls[i] = (U8) size;
+ // The valid range of sizes is actually 3-256 verts. We need this to fit into a U8,
+ // So we just subtract 1
+ hulls[i] = (U8) (size - 1);
for (U32 j = 0; j < decomp[i].size(); ++j)
{
update_min_max(min, max, decomp[i][j]);
}
+
}
for (U32 i = 0; i < base_hull.size(); ++i)
@@ -1779,29 +1839,30 @@ LLModel::weight_list& LLModel::getJointInfluences(const LLVector3& pos)
}
}
-void LLModel::setPhysicsShape(const LLModel::physics_shape& shape)
+void LLModel::setConvexHullDecomposition(
+ const LLModel::convex_hull_decomposition& decomp)
{
- mPhysicsShape = shape;
+ mConvexHullDecomp = decomp;
- mHullCenter.resize(mPhysicsShape.size());
- mPhysicsPoints = 0;
- mPhysicsCenter.clear();
+ mHullCenter.resize(mConvexHullDecomp.size());
+ mHullPoints = 0;
+ mCenterOfHullCenters.clear();
- for (U32 i = 0; i < shape.size(); ++i)
+ for (U32 i = 0; i < decomp.size(); ++i)
{
LLVector3 cur_center;
- for (U32 j = 0; j < shape[i].size(); ++j)
+ for (U32 j = 0; j < decomp[i].size(); ++j)
{
- cur_center += shape[i][j];
+ cur_center += decomp[i][j];
}
- mPhysicsCenter += cur_center;
- cur_center *= 1.f/shape[i].size();
+ mCenterOfHullCenters += cur_center;
+ cur_center *= 1.f/decomp[i].size();
mHullCenter[i] = cur_center;
- mPhysicsPoints += shape[i].size();
+ mHullPoints += decomp[i].size();
}
- mPhysicsCenter *= 1.f/mPhysicsPoints;
+ mCenterOfHullCenters *= 1.f / mHullPoints;
}
diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h
index c95ffd882d..b45bca626a 100644
--- a/indra/llprimitive/llmodel.h
+++ b/indra/llprimitive/llmodel.h
@@ -50,16 +50,52 @@ public:
NUM_LODS
};
- //physics shape is a vector of convex hulls
+ //convex_hull_decomposition is a vector of convex hulls
//each convex hull is a set of points
+ typedef std::vector<std::vector<LLVector3> > convex_hull_decomposition;
typedef std::vector<LLVector3> hull;
- typedef std::vector<hull> physics_shape;
LLModel(LLVolumeParams& params, F32 detail);
- static LLSD writeModel(std::string filename, LLModel* physics, LLModel* high, LLModel* medium, LLModel* low, LLModel* imposotr, LLModel::physics_shape& physics_shape, bool upload_skin, bool upload_joints, bool nowrite = FALSE);
- static LLSD writeModel(std::string filename, LLModel* physics, LLModel* high, LLModel* medium, LLModel* low, LLModel* imposotr, LLModel::physics_shape& physics_shape, LLModel::hull& base_hull, bool upload_skin, bool upload_joints, bool nowrite = FALSE);
- static LLSD writeModel(std::ostream& ostr, LLModel* physics, LLModel* high, LLModel* medium, LLModel* low, LLModel* imposotr, LLModel::physics_shape& physics_shape, LLModel::hull& base_hull, bool upload_skin, bool upload_joints, bool nowrite = FALSE);
- static LLSD writeModelToStream(std::ostream& ostr, LLSD& mdl, BOOL nowrite = FALSE);
+ static LLSD writeModel(
+ std::string filename,
+ LLModel* physics,
+ LLModel* high,
+ LLModel* medium,
+ LLModel* low,
+ LLModel* imposotr,
+ const LLModel::convex_hull_decomposition& convex_hull_decomposition,
+ const LLModel::hull& base_hull,
+ BOOL upload_skin,
+ BOOL upload_joints,
+ BOOL nowrite = FALSE);
+ static LLSD writeModel(
+ std::string filename,
+ LLModel* physics,
+ LLModel* high,
+ LLModel* medium,
+ LLModel* low,
+ LLModel* imposotr,
+ const LLModel::convex_hull_decomposition& convex_hull_decomposition,
+ BOOL upload_skin,
+ BOOL upload_joints,
+ BOOL nowrite = FALSE);
+ static LLSD writeModel(
+ std::ostream& ostr,
+ LLModel* physics,
+ LLModel* high,
+ LLModel* medium,
+ LLModel* low,
+ LLModel* imposotr,
+ const LLModel::convex_hull_decomposition& convex_hull_decomposition,
+ const LLModel::hull& base_hull,
+ BOOL upload_skin,
+ BOOL upload_joints,
+ BOOL nowrite = FALSE);
+ static LLSD writeModelToStream(
+ std::ostream& ostr,
+ LLSD& mdl,
+ BOOL nowrite = FALSE);
+
static LLModel* loadModelFromAsset(std::string filename, S32 lod);
static LLModel* loadModelFromDae(std::string filename);
static LLModel* loadModelFromDomMesh(domMesh* mesh);
@@ -69,13 +105,14 @@ public:
void appendFace(const LLVolumeFace& src_face, std::string src_material, LLMatrix4& mat, LLMatrix4& norm_mat);
void setNumVolumeFaces(S32 count);
- void setVolumeFaceData(S32 f,
- LLStrider<LLVector3> pos,
- LLStrider<LLVector3> norm,
- LLStrider<LLVector2> tc,
- LLStrider<U16> ind,
- U32 num_verts,
- U32 num_indices);
+ void setVolumeFaceData(
+ S32 f,
+ LLStrider<LLVector3> pos,
+ LLStrider<LLVector3> norm,
+ LLStrider<LLVector2> tc,
+ LLStrider<U16> ind,
+ U32 num_verts,
+ U32 num_indices);
void smoothNormals(F32 angle_cutoff);
@@ -84,8 +121,6 @@ public:
void normalizeVolumeFaces();
void optimizeVolumeFaces();
-
- U32 getResourceCost();
void getNormalizedScaleTranslation(LLVector3& scale_out, LLVector3& translation_out);
std::vector<std::string> mMaterialList;
@@ -155,13 +190,14 @@ public:
LLVector3 mNormalizedScale;
LLVector3 mNormalizedTranslation;
- //physics shape
- physics_shape mPhysicsShape;
- void setPhysicsShape(const physics_shape& shape);
+ // convex hull decomposition
+ convex_hull_decomposition mConvexHullDecomp;
+ void setConvexHullDecomposition(
+ const convex_hull_decomposition& decomp);
- LLVector3 mPhysicsCenter;
+ LLVector3 mCenterOfHullCenters;
std::vector<LLVector3> mHullCenter;
- U32 mPhysicsPoints;
+ U32 mHullPoints;
protected:
void addVolumeFacesFromDomMesh(domMesh* mesh);
diff --git a/indra/newview/llfloaterimportcollada.cpp b/indra/newview/llfloaterimportcollada.cpp
index cd4d13b58d..20907e899e 100644
--- a/indra/newview/llfloaterimportcollada.cpp
+++ b/indra/newview/llfloaterimportcollada.cpp
@@ -481,13 +481,14 @@ BOOL LLImportColladaAssetCache::uploadMeshAsset(domMesh* mesh)
// write model to temp file
std::string filename = gDirUtilp->getTempFilename();
- LLModel::writeModel(filename,
- lods[4],
- lods[0],
- lods[1],
- lods[2],
- lods[3],
- lods[4]->mPhysicsShape);
+ LLModel::writeModel(
+ filename,
+ lods[4],
+ lods[0],
+ lods[1],
+ lods[2],
+ lods[3],
+ lods[4]->mConvexHullDecomp);
// copy file to VFS
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index d067970806..1e87e84eb2 100644
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -2122,24 +2122,28 @@ U32 LLModelPreview::calcResourceCost()
{
accounted.insert(instance.mModel);
- LLModel::physics_shape& physics_shape = instance.mLOD[LLModel::LOD_PHYSICS] ? instance.mLOD[LLModel::LOD_PHYSICS]->mPhysicsShape : instance.mModel->mPhysicsShape;
-
- LLSD ret = LLModel::writeModel("",
- instance.mLOD[4],
- instance.mLOD[3],
- instance.mLOD[2],
- instance.mLOD[1],
- instance.mLOD[0],
- physics_shape,
- mFMP->childGetValue("upload_skin").asBoolean(),
- mFMP->childGetValue("upload_joints").asBoolean(),
- true);
+ LLModel::convex_hull_decomposition& decomp =
+ instance.mLOD[LLModel::LOD_PHYSICS] ?
+ instance.mLOD[LLModel::LOD_PHYSICS]->mConvexHullDecomp :
+ instance.mModel->mConvexHullDecomp;
+
+ LLSD ret = LLModel::writeModel(
+ "",
+ instance.mLOD[4],
+ instance.mLOD[3],
+ instance.mLOD[2],
+ instance.mLOD[1],
+ instance.mLOD[0],
+ decomp,
+ mFMP->childGetValue("upload_skin").asBoolean(),
+ mFMP->childGetValue("upload_joints").asBoolean(),
+ TRUE);
cost += gMeshRepo.calcResourceCost(ret);
- num_hulls += physics_shape.size();
- for (U32 i = 0; i < physics_shape.size(); ++i)
+ num_hulls += decomp.size();
+ for (U32 i = 0; i < decomp.size(); ++i)
{
- num_points += physics_shape[i].size();
+ num_points += decomp[i].size();
}
//calculate streaming cost
@@ -2771,7 +2775,7 @@ void LLModelPreview::genLODs(S32 which_lod)
if (which_lod == -1)
{
- mModel[LLModel::LOD_HIGH] = mBaseModel;
+ mModel[LLModel::LOD_HIGH] = mBaseModel;
}
return;
@@ -3478,7 +3482,7 @@ BOOL LLModelPreview::render()
{
gGL.pushMatrix();
- LLVector3 offset = model->mHullCenter[i]-model->mPhysicsCenter;
+ LLVector3 offset = model->mHullCenter[i]-model->mCenterOfHullCenters;
offset *= explode;
gGL.translatef(offset.mV[0], offset.mV[1], offset.mV[2]);
@@ -3820,7 +3824,7 @@ S32 LLFloaterModelPreview::DecompRequest::statusCallback(const char* status, S32
void LLFloaterModelPreview::DecompRequest::completed()
{
- mModel->setPhysicsShape(mHull);
+ mModel->setConvexHullDecomposition(mHull);
if (sInstance)
{
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index 28db665ff9..5e95376830 100644
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -1031,6 +1031,8 @@ bool LLMeshRepoThread::headerReceived(const LLVolumeParams& mesh_params, U8* dat
}
else
{
+ llinfos
+ << "Marking header as non-existent, will not retry." << llendl;
header["404"] = 1;
}
@@ -1984,7 +1986,25 @@ void LLMeshHeaderResponder::completedRaw(U32 status, const std::string& reason,
LLMeshRepoThread::sActiveHeaderRequests--;
if (status < 200 || status > 400)
{
- llwarns << status << ": " << reason << llendl;
+ llwarns
+ << "Header responder failed with status: "
+ << status << ": " << reason << llendl;
+
+ // 503 (service unavailable) or 499 (timeout)
+ // can be due to server load and can be retried
+
+ // TODO*: Add maximum retry logic, exponential backoff
+ // and (somewhat more optional than the others) retries
+ // again after some set period of time
+ if (status == 503 || status == 499)
+ { //retry
+ LLMeshRepository::sHTTPRetryCount++;
+ LLMeshRepoThread::HeaderRequest req(mMeshParams);
+ LLMutexLock lock(gMeshRepo.mThread->mMutex);
+ gMeshRepo.mThread->mHeaderReqQ.push(req);
+
+ return;
+ }
}
S32 data_size = buffer->countAfter(channels.in(), NULL);
@@ -2001,14 +2021,9 @@ void LLMeshHeaderResponder::completedRaw(U32 status, const std::string& reason,
if (!gMeshRepo.mThread->headerReceived(mMeshParams, data, data_size))
{
- llwarns << "Header responder failed with status: " << status << ": " << reason << llendl;
- if (status == 503 || status == 499)
- { //retry
- LLMeshRepository::sHTTPRetryCount++;
- LLMeshRepoThread::HeaderRequest req(mMeshParams);
- LLMutexLock lock(gMeshRepo.mThread->mMutex);
- gMeshRepo.mThread->mHeaderReqQ.push(req);
- }
+ llwarns
+ << "Unable to parse mesh header: "
+ << status << ": " << reason << llendl;
}
else if (data && data_size > 0)
{
@@ -2660,20 +2675,22 @@ void LLMeshUploadThread::sendCostRequest(LLMeshUploadData& data)
{
//write model file to memory buffer
std::stringstream ostr;
-
- LLModel::physics_shape& phys_shape = data.mModel[LLModel::LOD_PHYSICS].notNull() ?
- data.mModel[LLModel::LOD_PHYSICS]->mPhysicsShape :
- data.mBaseModel->mPhysicsShape;
+
+ LLModel::convex_hull_decomposition& decomp =
+ data.mModel[LLModel::LOD_PHYSICS].notNull() ?
+ data.mModel[LLModel::LOD_PHYSICS]->mConvexHullDecomp :
+ data.mBaseModel->mConvexHullDecomp;
LLModel::hull dummy_hull;
- LLSD header = LLModel::writeModel(ostr,
+ LLSD header = LLModel::writeModel(
+ ostr,
data.mModel[LLModel::LOD_PHYSICS],
data.mModel[LLModel::LOD_HIGH],
data.mModel[LLModel::LOD_MEDIUM],
data.mModel[LLModel::LOD_LOW],
data.mModel[LLModel::LOD_IMPOSTOR],
- phys_shape,
+ decomp,
dummy_hull,
mUploadSkin,
mUploadJoints,
@@ -2750,19 +2767,19 @@ void LLMeshUploadThread::doUploadModel(LLMeshUploadData& data)
{
std::stringstream ostr;
- LLModel::physics_shape& phys_shape = data.mModel[LLModel::LOD_PHYSICS].notNull() ?
- data.mModel[LLModel::LOD_PHYSICS]->mPhysicsShape :
- data.mBaseModel->mPhysicsShape;
-
-
+ LLModel::convex_hull_decomposition& decomp =
+ data.mModel[LLModel::LOD_PHYSICS].notNull() ?
+ data.mModel[LLModel::LOD_PHYSICS]->mConvexHullDecomp :
+ data.mBaseModel->mConvexHullDecomp;
- LLModel::writeModel(ostr,
+ LLModel::writeModel(
+ ostr,
data.mModel[LLModel::LOD_PHYSICS],
data.mModel[LLModel::LOD_HIGH],
data.mModel[LLModel::LOD_MEDIUM],
data.mModel[LLModel::LOD_LOW],
data.mModel[LLModel::LOD_IMPOSTOR],
- phys_shape,
+ decomp,
mHullMap[data.mBaseModel],
mUploadSkin,
mUploadJoints);
diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h
index bbfe2e46f2..427bcb8a75 100644
--- a/indra/newview/llmeshrepository.h
+++ b/indra/newview/llmeshrepository.h
@@ -139,7 +139,7 @@ public:
void merge(const LLMeshDecomposition* rhs);
LLUUID mMeshID;
- LLModel::physics_shape mHull;
+ LLModel::convex_hull_decomposition mHull;
LLModel::hull mBaseHull;
std::vector<LLPointer<LLVertexBuffer> > mMesh;
@@ -165,7 +165,7 @@ public:
//output state
std::string mStatusMessage;
std::vector<LLPointer<LLVertexBuffer> > mHullMesh;
- LLModel::physics_shape mHull;
+ LLModel::convex_hull_decomposition mHull;
virtual S32 statusCallback(const char* status, S32 p1, S32 p2) = 0;
virtual void completed() = 0;