From b07f51b4c74f035b084076d6c75f3c95a9fb9a90 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 15 Jun 2011 16:55:26 -0400 Subject: SH-1773 FIX --- indra/newview/llmeshrepository.cpp | 54 ++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 29 deletions(-) (limited to 'indra') diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 4673289094..494f6f2e01 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -468,38 +468,36 @@ public: }; -void log_upload_error(const LLSD& content,std::string stage) +void log_upload_error(S32 status, const LLSD& content,std::string stage) { + llwarns << "stage: " << stage << " http status: " << status << llendl; if (content.has("error")) { const LLSD& err = content["error"]; - llwarns << "mesh upload failed, stage " << stage - << " message " << err["message"].asString() << " id " << err["identifier"].asString() - << llendl; - - if (content.has("errors")) - { - const LLSD& err_list = content["errors"]; + llwarns << "err: " << err << llendl; + llwarns << "mesh upload failed, stage '" << stage + << "' error '" << err["error"].asString() + << "', message '" << err["message"].asString() + << "', id '" << err["identifier"].asString() + << "'" << llendl; + if (err.has("errors")) + { + S32 error_num = 0; + const LLSD& err_list = err["errors"]; for (LLSD::array_const_iterator it = err_list.beginArray(); it != err_list.endArray(); ++it) { const LLSD& err_entry = *it; - std::string index_info; - std::string texture_index_str = err_entry["TextureIndex"].asString(); - if (!texture_index_str.empty()) + llwarns << "error[" << error_num << "]:" << llendl; + for (LLSD::map_const_iterator map_it = err_entry.beginMap(); + map_it != err_entry.endMap(); + ++map_it) { - index_info += " texture_index: " + texture_index_str; + llwarns << "\t" << map_it->first << ": " + << map_it->second << llendl; } - std::string mesh_index_str = err_entry["MeshIndex"].asString(); - if (!mesh_index_str.empty()) - { - index_info += " mesh_index: " + mesh_index_str; - } - llwarns << "mesh err code " << err_entry["error"].asString() - << " message " << err_entry["message"] - << index_info - << llendl; + error_num++; } } } @@ -507,8 +505,6 @@ void log_upload_error(const LLSD& content,std::string stage) { llwarns << "bad mesh, no error information available" << llendl; } - - } class LLModelObjectUploadResponder: public LLCurl::Responder @@ -547,12 +543,11 @@ public: const std::string& reason, const LLSD& content) { - //assert_main_thread(); llinfos << "completed" << llendl; mThread->mPendingUploads--; dumpLLSDToFile(content,make_dump_name("whole_model_fee_response_",dump_num)); - llinfos << "LLWholeModelFeeResponder content: " << content << llendl; - if (isGoodStatus(status)) + if (isGoodStatus(status) && + content["state"].asString() == "upload") { llinfos << "fee request succeeded" << llendl; mThread->mWholeModelUploadURL = content["uploader"].asString(); @@ -560,7 +555,7 @@ public: else { llwarns << "fee request failed" << llendl; - log_upload_error(content,"fee"); + log_upload_error(status,content,"fee"); mThread->mWholeModelUploadURL = ""; } } @@ -588,7 +583,8 @@ public: llinfos << "LLWholeModelUploadResponder content: " << content << llendl; // requested "mesh" asset type isn't actually the type // of the resultant object, fix it up here. - if (isGoodStatus(status)) + if (isGoodStatus(status) && + content["state"].asString() == "complete") { llinfos << "upload succeeded" << llendl; mPostData["asset_type"] = "object"; @@ -597,7 +593,7 @@ public: else { llwarns << "upload failed" << llendl; - log_upload_error(content,"upload"); + log_upload_error(status,content,"upload"); } } }; -- cgit v1.2.3 From 0bb7bcc96cfea7b5d56f083d0afcbc1fce7e9f21 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 15 Jun 2011 16:20:33 -0600 Subject: fix for SH-1788: Assert in texture load when uploading textured mesh model and beyond: fixed the thread-safe and highest texture resolution flaws in the mesh texture uploading flow. --- indra/llprimitive/llmodel.cpp | 2 +- indra/newview/llfloatermodelpreview.cpp | 21 +++++++++++++++++++-- indra/newview/llfloatermodelpreview.h | 3 +++ indra/newview/llmeshrepository.cpp | 21 ++++++++++----------- indra/newview/llviewertexture.cpp | 19 +++++++++++++++++-- indra/newview/llviewertexture.h | 3 ++- 6 files changed, 52 insertions(+), 17 deletions(-) (limited to 'indra') diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index e0cfa07614..0463d5364b 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -2252,7 +2252,7 @@ LLSD LLModel::Decomposition::asLLSD() const ret["Positions"] = p; } - llassert(!mBaseHull.empty()); + //llassert(!mBaseHull.empty()); if (!mBaseHull.empty()) { diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 866cc39eec..aa608ea67c 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -1121,7 +1121,7 @@ LLModelLoader::LLModelLoader( std::string filename, S32 lod, LLModelPreview* pre std::deque& jointsFromNodes ) : mJointList( jointMap ) , mJointsFromNode( jointsFromNodes ) -, LLThread("Model Loader"), mFilename(filename), mLod(lod), mPreview(preview), mFirstTransform(TRUE) +, LLThread("Model Loader"), mFilename(filename), mLod(lod), mPreview(preview), mFirstTransform(TRUE), mNumOfFetchingTextures(0) { mJointMap["mPelvis"] = "mPelvis"; mJointMap["mTorso"] = "mTorso"; @@ -2266,7 +2266,8 @@ void LLModelLoader::loadTextures() iter->second[i].mMaterial[j].mDiffuseMap = LLViewerTextureManager::getFetchedTextureFromUrl("file://" + iter->second[i].mMaterial[j].mDiffuseMapFilename, TRUE, LLViewerTexture::BOOST_PREVIEW); iter->second[i].mMaterial[j].mDiffuseMap->setLoadedCallback(LLModelPreview::textureLoadedCallback, 0, TRUE, FALSE, mPreview, NULL, FALSE); - iter->second[i].mMaterial[j].mDiffuseMap->forceToSaveRawImage(); + iter->second[i].mMaterial[j].mDiffuseMap->forceToSaveRawImage(0, F32_MAX); + mNumOfFetchingTextures++ ; } } } @@ -4140,6 +4141,14 @@ void LLModelPreview::updateStatusMessages() } } + if(upload_ok && mModelLoader) + { + if(!mModelLoader->areTexturesReady() && mFMP->childGetValue("upload_textures").asBoolean()) + { + upload_ok = false ; + } + } + const BOOL confirmed_checkbox = mFMP->getChild("confirm_checkbox")->getValue().asBoolean(); if ( upload_ok && !errorStateFromLoader && skinAndRigOk && !has_degenerate && confirmed_checkbox) { @@ -5278,6 +5287,14 @@ void LLModelPreview::textureLoadedCallback( BOOL success, LLViewerFetchedTexture { LLModelPreview* preview = (LLModelPreview*) userdata; preview->refresh(); + + if(final && preview->mModelLoader) + { + if(preview->mModelLoader->mNumOfFetchingTextures > 0) + { + preview->mModelLoader->mNumOfFetchingTextures-- ; + } + } } void LLModelPreview::onLODParamCommit(bool enforce_tri_limit) diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index a328bfb4dd..dcc2fc8898 100644 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -132,6 +132,9 @@ public: JointTransformMap& mJointList; std::deque& mJointsFromNode; + S32 mNumOfFetchingTextures ; //updated in the main thread + bool areTexturesReady() { return !mNumOfFetchingTextures; } //called in the main thread. + private: static std::list sActiveLoaderList; static bool isAlive(LLModelLoader* loader) ; diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 4673289094..f8ffb16adb 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1556,16 +1556,12 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) std::stringstream texture_str; if (texture != NULL && include_textures && mUploadTextures) { - // Get binary rep of texture, if needed. - LLTextureUploadData data(texture, material.mDiffuseMapLabel); - if (!data.mTexture->isRawImageValid()) - { - data.mTexture->reloadRawImage(data.mTexture->getDiscardLevel()); + if(texture->hasSavedRawImage()) + { + LLPointer upload_file = + LLViewerTextureList::convertToUploadFile(texture->getSavedRawImage()); + texture_str.write((const char*) upload_file->getData(), upload_file->getDataSize()); } - - LLPointer upload_file = - LLViewerTextureList::convertToUploadFile(data.mTexture->getRawImage()); - texture_str.write((const char*) upload_file->getData(), upload_file->getDataSize()); } if (texture != NULL && @@ -2868,9 +2864,12 @@ void LLMeshUploadThread::doUploadTexture(LLTextureUploadData& data) data.mTexture->reloadRawImage(data.mTexture->getDiscardLevel()); } - LLPointer upload_file = LLViewerTextureList::convertToUploadFile(data.mTexture->getRawImage()); + if(data.mTexture->hasSavedRawImage()) + { + LLPointer upload_file = LLViewerTextureList::convertToUploadFile(data.mTexture->getSavedRawImage()); - ostr.write((const char*) upload_file->getData(), upload_file->getDataSize()); + ostr.write((const char*) upload_file->getData(), upload_file->getDataSize()); + } data.mAssetData = ostr.str(); diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index af06421bf9..4da0f80a00 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1168,6 +1168,7 @@ void LLViewerFetchedTexture::init(bool firstinit) mSavedRawDiscardLevel = -1 ; mDesiredSavedRawDiscardLevel = -1 ; mLastReferencedSavedRawImageTime = 0.0f ; + mKeptSavedRawImageTime = 0.f ; mLastCallBackActiveTime = 0.f; } @@ -2696,8 +2697,16 @@ void LLViewerFetchedTexture::saveRawImage() mLastReferencedSavedRawImageTime = sCurrentTime ; } -void LLViewerFetchedTexture::forceToSaveRawImage(S32 desired_discard) +void LLViewerFetchedTexture::forceToSaveRawImage(S32 desired_discard, F32 kept_time) { + mKeptSavedRawImageTime = kept_time ; + mLastReferencedSavedRawImageTime = sCurrentTime ; + + if(mSavedRawDiscardLevel > -1 && mSavedRawDiscardLevel <= desired_discard) + { + return ; //raw imge is ready. + } + if(!mForceToSaveRawImage || mDesiredSavedRawDiscardLevel < 0 || mDesiredSavedRawDiscardLevel > desired_discard) { mForceToSaveRawImage = TRUE ; @@ -2713,11 +2722,16 @@ void LLViewerFetchedTexture::forceToSaveRawImage(S32 desired_discard) mRawImage = NULL ; mRawDiscardLevel = INVALID_DISCARD_LEVEL ; - } + } } } void LLViewerFetchedTexture::destroySavedRawImage() { + if(mLastReferencedSavedRawImageTime < mKeptSavedRawImageTime) + { + return ; //keep the saved raw image. + } + mForceToSaveRawImage = FALSE ; mSaveRawImage = FALSE ; @@ -2729,6 +2743,7 @@ void LLViewerFetchedTexture::destroySavedRawImage() mSavedRawDiscardLevel = -1 ; mDesiredSavedRawDiscardLevel = -1 ; mLastReferencedSavedRawImageTime = 0.0f ; + mKeptSavedRawImageTime = 0.f ; } LLImageRaw* LLViewerFetchedTexture::getSavedRawImage() diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index d512f8ec3a..c5b8c8923a 100644 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -465,7 +465,7 @@ public: S32 getCachedRawImageLevel() const {return mCachedRawDiscardLevel;} BOOL isCachedRawImageReady() const {return mCachedRawImageReady ;} BOOL isRawImageValid()const { return mIsRawImageValid ; } - void forceToSaveRawImage(S32 desired_discard = 0) ; + void forceToSaveRawImage(S32 desired_discard = 0, F32 kept_time = 0.f) ; /*virtual*/ void setCachedRawImage(S32 discard_level, LLImageRaw* imageraw) ; void destroySavedRawImage() ; LLImageRaw* getSavedRawImage() ; @@ -550,6 +550,7 @@ protected: S32 mSavedRawDiscardLevel; S32 mDesiredSavedRawDiscardLevel; F32 mLastReferencedSavedRawImageTime ; + F32 mKeptSavedRawImageTime ; //a small version of the copy of the raw image (<= 64 * 64) LLPointer mCachedRawImage; -- cgit v1.2.3