diff options
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/newview/llagent.cpp | 50 | ||||
-rwxr-xr-x | indra/newview/llagent.h | 1 | ||||
-rwxr-xr-x[-rw-r--r--] | indra/newview/llviewerobject.cpp | 27 | ||||
-rwxr-xr-x[-rw-r--r--] | indra/newview/llviewerobject.h | 3 | ||||
-rwxr-xr-x | indra/newview/llviewertexturelist.cpp | 37 | ||||
-rwxr-xr-x | indra/newview/llvoavatar.cpp | 144 | ||||
-rwxr-xr-x | indra/newview/llvoavatar.h | 1 | ||||
-rwxr-xr-x[-rw-r--r--] | indra/newview/llvoavatarself.cpp | 10 |
8 files changed, 204 insertions, 69 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 1760d4769a..60873cf41f 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -816,6 +816,7 @@ void LLAgent::handleServerBakeRegionTransition(const LLUUID& region_id) !gAgentAvatarp->isUsingServerBakes() && (mRegionp->getCentralBakeVersion()>0)) { + llinfos << "update requested due to region transition" << llendl; LLAppearanceMgr::instance().requestServerAppearanceUpdate(); } } @@ -4281,6 +4282,49 @@ void LLAgent::requestLeaveGodMode() sendReliableMessage(); } +extern void dump_visual_param(apr_file_t* file, LLVisualParam* viewer_param, F32 value); +extern std::string get_sequential_numbered_file_name(const std::string& prefix, + const std::string& suffix); + +// For debugging, trace agent state at times appearance message are sent out. +void LLAgent::dumpSentAppearance(const std::string& dump_prefix) +{ + std::string outfilename = get_sequential_numbered_file_name(dump_prefix,".xml"); + + LLAPRFile outfile; + std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,outfilename); + outfile.open(fullpath, LL_APR_WB ); + apr_file_t* file = outfile.getFileHandle(); + if (!file) + { + return; + } + else + { + LL_DEBUGS("Avatar") << "dumping sent appearance message to " << fullpath << llendl; + } + + LLVisualParam* appearance_version_param = gAgentAvatarp->getVisualParam(11000); + if (appearance_version_param) + { + F32 value = appearance_version_param->getWeight(); + dump_visual_param(file, appearance_version_param, value); + } + for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin(); + iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end(); + ++iter) + { + const ETextureIndex index = iter->first; + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second; + if (texture_dict->mIsBakedTexture) + { + LLTextureEntry* entry = gAgentAvatarp->getTE((U8) index); + const LLUUID& uuid = entry->getID(); + apr_file_printf( file, "\t\t<texture te=\"%i\" uuid=\"%s\"/>\n", index, uuid.asString().c_str()); + } + } +} + //----------------------------------------------------------------------------- // sendAgentSetAppearance() //----------------------------------------------------------------------------- @@ -4377,6 +4421,12 @@ void LLAgent::sendAgentSetAppearance() // composites to false, and update mesh textures. if (textures_current) { + bool enable_verbose_dumps = gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"); + std::string dump_prefix = gAgentAvatarp->getFullname() + "_sent_appearance"; + if (enable_verbose_dumps) + { + dumpSentAppearance(dump_prefix); + } LL_INFOS("Avatar") << gAgentAvatarp->avString() << "TAT: Sending cached texture data" << LL_ENDL; for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++) { diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 693c123851..306dc2d99c 100755 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -845,6 +845,7 @@ private: public: void sendMessage(); // Send message to this agent's region void sendReliableMessage(); + void dumpSentAppearance(const std::string& dump_prefix); void sendAgentSetAppearance(); void sendAgentDataUpdateRequest(); void sendAgentUserInfoRequest(); diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 15560be9ba..c4b370a4b4 100644..100755 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4034,32 +4034,15 @@ void LLViewerObject::setTEImage(const U8 te, LLViewerTexture *imagep) } } - -S32 LLViewerObject::setTETextureCore(const U8 te, const LLUUID& uuid, const std::string &url ) -{ - S32 retval = 0; - if (uuid != getTE(te)->getID() || - uuid == LLUUID::null) - { - retval = LLPrimitive::setTETexture(te, uuid); - mTEImages[te] = LLViewerTextureManager::getFetchedTextureFromUrl (url, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid); - setChanged(TEXTURE); - if (mDrawable.notNull()) - { - gPipeline.markTextured(mDrawable); - } - } - return retval; -} - -S32 LLViewerObject::setTETextureCore(const U8 te, const LLUUID& uuid, LLHost host) +S32 LLViewerObject::setTETextureCore(const U8 te, LLViewerTexture *image) { + const LLUUID& uuid = image->getID(); S32 retval = 0; if (uuid != getTE(te)->getID() || uuid == LLUUID::null) { retval = LLPrimitive::setTETexture(te, uuid); - mTEImages[te] = LLViewerTextureManager::getFetchedTexture(uuid, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); + mTEImages[te] = image; setChanged(TEXTURE); if (mDrawable.notNull()) { @@ -4082,7 +4065,9 @@ void LLViewerObject::changeTEImage(S32 index, LLViewerTexture* new_image) S32 LLViewerObject::setTETexture(const U8 te, const LLUUID& uuid) { // Invalid host == get from the agent's sim - return setTETextureCore(te, uuid, LLHost::invalid); + LLViewerFetchedTexture *image = LLViewerTextureManager::getFetchedTexture( + uuid, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost::invalid); + return setTETextureCore(te,image); } diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 889025962c..728d279c39 100644..100755 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -301,8 +301,7 @@ public: /*virtual*/ void setNumTEs(const U8 num_tes); /*virtual*/ void setTE(const U8 te, const LLTextureEntry &texture_entry); /*virtual*/ S32 setTETexture(const U8 te, const LLUUID &uuid); - S32 setTETextureCore(const U8 te, const LLUUID& uuid, LLHost host); - S32 setTETextureCore(const U8 te, const LLUUID& uuid, const std::string &url ); + S32 setTETextureCore(const U8 te, LLViewerTexture *image); /*virtual*/ S32 setTEColor(const U8 te, const LLColor3 &color); /*virtual*/ S32 setTEColor(const U8 te, const LLColor4 &color); /*virtual*/ S32 setTEScale(const U8 te, const F32 s, const F32 t); diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index a65a90b9ab..6e7f6c9b32 100755 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -374,7 +374,24 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromUrl(const std::string& } LLPointer<LLViewerFetchedTexture> imagep = findImage(new_id); - + + if (!imagep.isNull()) + { + LLViewerFetchedTexture *texture = imagep.get(); + if (texture->getUrl().empty()) + { + llwarns << "Requested texture " << new_id << " already exists but does not have a URL" << llendl; + } + else if (texture->getUrl() != url) + { + // This is not an error as long as the images really match - + // e.g. could be two avatars wearing the same outfit. + LL_DEBUGS("Avatar") << "Requested texture " << new_id + << " already exists with a different url, requested: " << url + << " current: " << texture->getUrl() << llendl; + } + + } if (imagep.isNull()) { switch(texture_type) @@ -436,7 +453,23 @@ LLViewerFetchedTexture* LLViewerTextureList::getImage(const LLUUID &image_id, } LLPointer<LLViewerFetchedTexture> imagep = findImage(image_id); - + if (!imagep.isNull()) + { + LLViewerFetchedTexture *texture = imagep.get(); + if (request_from_host.isOk() && + !texture->getTargetHost().isOk()) + { + llwarns << "Requested texture " << image_id << " already exists but does not have a host" << llendl; + } + else if (request_from_host.isOk() && + texture->getTargetHost().isOk() && + request_from_host != texture->getTargetHost()) + { + llwarns << "Requested texture " << image_id << " already exists with a different target host, requested: " + << request_from_host << " current: " << texture->getTargetHost() << llendl; + } + + } if (imagep.isNull()) { imagep = createImage(image_id, usemipmaps, boost_priority, texture_type, internal_format, primary_format, request_from_host) ; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 90887b5861..483bc25b33 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1776,29 +1776,53 @@ U32 LLVOAvatar::processUpdateMessage(LLMessageSystem *mesgsys, return retval; } -// virtual -S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid) +LLViewerFetchedTexture *LLVOAvatar::getBakedTextureImage(const U8 te, const LLUUID& uuid) { - // The core setTETexture() method requests images, so we need - // to redirect certain avatar texture requests to different sims. - if (isIndexBakedTexture((ETextureIndex)te)) + LLViewerFetchedTexture *result = NULL; + + if (uuid == IMG_DEFAULT_AVATAR || + uuid == IMG_DEFAULT || + uuid == IMG_INVISIBLE) + { + // Should already exist, don't need to find it on sim or baked-texture host. + result = gTextureList.findImage(uuid); + } + + if (!result) { const std::string url = getImageURL(te,uuid); if (!url.empty()) { llinfos << "texture URL " << url << llendl; - return setTETextureCore(te, uuid, url); + result = LLViewerTextureManager::getFetchedTextureFromUrl( + url, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid); + } + else + { + llinfos << "get texture from host " << uuid << llendl; + LLHost host = getObjectHost(); + result = LLViewerTextureManager::getFetchedTexture( + uuid, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); } - - llinfos << "get texture from host " << uuid << llendl; - LLHost target_host = getObjectHost(); - return setTETextureCore(te, uuid, target_host); } - else + return result; +} + +// virtual +S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid) +{ + if (!isIndexBakedTexture((ETextureIndex)te)) { - llinfos << "get texture from other " << uuid << llendl; - return setTETextureCore(te, uuid, LLHost::invalid); + if (!uuid.isNull()) + { + llinfos << "ignoring texture " << uuid << " in non-baked slot " << (S32)te << " - will use null " << llendl; + } + return LLViewerObject::setTETexture(te, LLUUID::null); } + + LLViewerFetchedTexture *image = getBakedTextureImage(te,uuid); + llassert(image); + return setTETextureCore(te, image); } static LLFastTimer::DeclareTimer FTM_AVATAR_UPDATE("Avatar Update"); @@ -6070,6 +6094,8 @@ void LLVOAvatar::updateMeshTextures() last_id_string = "A"; else if (mBakedTextureDatas[i].mLastTextureID == IMG_DEFAULT) last_id_string = "D"; + else if (mBakedTextureDatas[i].mLastTextureID == IMG_INVISIBLE) + last_id_string = "I"; else last_id_string = "*"; bool is_ltda = layerset @@ -6591,7 +6617,7 @@ void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix, } else { - llinfos << "xmlfile write handle obtained : " << fullpath << llendl; + LL_DEBUGS("Avatar") << "dumping appearance message to " << fullpath << llendl; } @@ -6619,11 +6645,13 @@ struct LLAppearanceMessageContents { LLAppearanceMessageContents(): mAppearanceVersion(-1), + mParamAppearanceVersion(-1), mCOFVersion(LLViewerInventoryCategory::VERSION_UNKNOWN) { } LLTEContents mTEContents; S32 mAppearanceVersion; + S32 mParamAppearanceVersion; S32 mCOFVersion; // For future use: //U32 appearance_flags = 0; @@ -6703,27 +6731,48 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe } } - if (contents.mAppearanceVersion < 0) // not set explicitly, try to get from visual param. + LLVisualParam* appearance_version_param = getVisualParam(11000); + if (appearance_version_param) { - LLVisualParam* appearance_version_param = getVisualParam(11000); - if (appearance_version_param) + std::vector<LLVisualParam*>::iterator it = std::find(contents.mParams.begin(), contents.mParams.end(),appearance_version_param); + if (it != contents.mParams.end()) { - std::vector<LLVisualParam*>::iterator it = std::find(contents.mParams.begin(), contents.mParams.end(),appearance_version_param); - if (it != contents.mParams.end()) - { - S32 index = it - contents.mParams.begin(); - llinfos << "index: " << index << llendl; - S32 appearance_version = llround(contents.mParamWeights[index]); - contents.mAppearanceVersion = appearance_version; - llinfos << "appversion set by appearance_version param: " << contents.mAppearanceVersion << llendl; - } + S32 index = it - contents.mParams.begin(); + llinfos << "index: " << index << llendl; + contents.mParamAppearanceVersion = llround(contents.mParamWeights[index]); + LL_DEBUGS("Avatar") << "appversion req by appearance_version param: " << contents.mParamAppearanceVersion << llendl; } } - if (contents.mAppearanceVersion < 0) // still not set, go with 0. +} + +bool resolve_appearance_version(const LLAppearanceMessageContents& contents, S32& appearance_version) +{ + appearance_version = -1; + + if ((contents.mAppearanceVersion) >= 0 && + (contents.mParamAppearanceVersion >= 0) && + (contents.mAppearanceVersion != contents.mParamAppearanceVersion)) { - contents.mAppearanceVersion = 0; - llinfos << "appversion set by default: " << contents.mAppearanceVersion << llendl; + llwarns << "inconsistent appearance_version settings - field: " << + contents.mAppearanceVersion << ", param: " << contents.mParamAppearanceVersion << llendl; + return false; } + if (contents.mParamAppearanceVersion >= 0) // use visual param if available. + { + appearance_version = contents.mParamAppearanceVersion; + } + if (contents.mAppearanceVersion >= 0) + { + appearance_version = contents.mAppearanceVersion; + } + if (appearance_version < 0) // still not set, go with 0. + { + appearance_version = 0; + } + LL_DEBUGS("Avatar") << "appearance version info - field " << contents.mAppearanceVersion + << " param: " << contents.mParamAppearanceVersion + << " final: " << appearance_version << llendl; + return true; } //----------------------------------------------------------------------------- @@ -6731,6 +6780,8 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe //----------------------------------------------------------------------------- void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) { + LL_DEBUGS("Avatar") << "starts" << llendl; + bool enable_verbose_dumps = gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"); std::string dump_prefix = getFullname() + "_" + (isSelf()?"s":"o") + "_"; //if (enable_verbose_dumps) { dumpArchetypeXML(dump_prefix + "process_start"); } @@ -6740,19 +6791,21 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) return; } - BOOL is_first_appearance_message = !mFirstAppearanceMessageReceived; - mFirstAppearanceMessageReceived = TRUE; - - LL_INFOS("Avatar") << avString() << "processAvatarAppearance start " << mID - << " first? " << is_first_appearance_message << " self? " << isSelf() << LL_ENDL; - - ESex old_sex = getSex(); LLAppearanceMessageContents contents; parseAppearanceMessage(mesgsys, contents); + if (enable_verbose_dumps) + { + dumpAppearanceMsgParams(dump_prefix + "appearance_msg", contents.mParamWeights, contents.mTEContents); + } - U8 appearance_version = contents.mAppearanceVersion; + S32 appearance_version; + if (!resolve_appearance_version(contents, appearance_version)) + { + llwarns << "bad appearance version info, discarding" << llendl; + return; + } S32 this_update_cof_version = contents.mCOFVersion; S32 last_update_request_cof_version = LLAppearanceMgr::instance().mLastUpdateRequestCOFVersion; @@ -6774,6 +6827,10 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) return; } } + else + { + LL_DEBUGS("Avatar") << "appearance message received" << llendl; + } // Check for stale update. if (isSelf() @@ -6821,6 +6878,12 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) // runway - was // if (!is_first_appearance_message ) // which means it would be called on second appearance message - probably wrong. + BOOL is_first_appearance_message = !mFirstAppearanceMessageReceived; + mFirstAppearanceMessageReceived = TRUE; + + LL_INFOS("Avatar") << avString() << "processAvatarAppearance start " << mID + << " first? " << is_first_appearance_message << " self? " << isSelf() << LL_ENDL; + if (is_first_appearance_message ) { onFirstTEMessageReceived(); @@ -6855,13 +6918,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } } } - if (enable_verbose_dumps) - { - dumpAppearanceMsgParams(dump_prefix + "appearance_msg", contents.mParamWeights, contents.mTEContents); - } - - //if (enable_verbose_dumps) { dumpArchetypeXML(dump_prefix + "process_post_set_weights"); } - const S32 expected_tweakable_count = getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TWEAKABLE); // don't worry about VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT if (num_params != expected_tweakable_count) { diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index bdb477590f..c14f18d00e 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -147,6 +147,7 @@ public: void collectTextureUUIDs(std::set<LLUUID>& ids); void releaseOldTextures(); /*virtual*/ void updateTextures(); + LLViewerFetchedTexture* getBakedTextureImage(const U8 te, const LLUUID& uuid); /*virtual*/ S32 setTETexture(const U8 te, const LLUUID& uuid); // If setting a baked texture, need to request it from a non-local sim. /*virtual*/ void onShift(const LLVector4a& shift_vector); /*virtual*/ U32 getPartitionType() const; diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 757d029513..aeac478d4e 100644..100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -759,6 +759,15 @@ U32 LLVOAvatarSelf::processUpdateMessage(LLMessageSystem *mesgsys, { U32 retval = LLVOAvatar::processUpdateMessage(mesgsys,user_data,block_num,update_type,dp); +#if 0 + // DRANO - it's not clear this does anything useful. If we wait + // until an appearance message has been received, we already have + // the texture ids. If we don't wait, we don't yet know where to + // look for baked textures, because we haven't received the + // appearance version data from the appearance message. This looks + // like an old optimization that's incompatible with server-side + // texture baking. + // FIXME DRANO - skipping in the case of !mFirstAppearanceMessageReceived prevents us from trying to // load textures before we know where they come from (ie, from baking service or not); // unknown impact on performance. @@ -783,6 +792,7 @@ U32 LLVOAvatarSelf::processUpdateMessage(LLMessageSystem *mesgsys, mInitialBakesLoaded = true; } +#endif return retval; } |