diff options
author | andreykproductengine <akleshchev@productengine.com> | 2016-02-18 17:35:43 +0200 |
---|---|---|
committer | andreykproductengine <akleshchev@productengine.com> | 2016-02-18 17:35:43 +0200 |
commit | 10e2bd56c1722526d14656aa6870a23b86f51333 (patch) | |
tree | 97069a5b180135ff945bf927f98282319b05c5cc /indra | |
parent | a0e9ee475758c1825ba4a0957f4047e1dc24c8a3 (diff) |
MAINT-2199 In some rare cases priorities can change, it shouldn't affect texture list.
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/newview/lllocalbitmaps.cpp | 10 | ||||
-rwxr-xr-x | indra/newview/llpanelface.cpp | 2 | ||||
-rwxr-xr-x | indra/newview/lltexturefetch.cpp | 4 | ||||
-rwxr-xr-x | indra/newview/llviewertexture.cpp | 29 | ||||
-rwxr-xr-x | indra/newview/llviewertexture.h | 7 | ||||
-rwxr-xr-x | indra/newview/llviewertexturelist.cpp | 55 | ||||
-rwxr-xr-x | indra/newview/llviewertexturelist.h | 16 | ||||
-rwxr-xr-x | indra/newview/llvoavatar.cpp | 8 |
8 files changed, 69 insertions, 62 deletions
diff --git a/indra/newview/lllocalbitmaps.cpp b/indra/newview/lllocalbitmaps.cpp index 766b1e3eaf..366b9ac034 100755 --- a/indra/newview/lllocalbitmaps.cpp +++ b/indra/newview/lllocalbitmaps.cpp @@ -135,7 +135,7 @@ LLLocalBitmap::~LLLocalBitmap() } // delete self from gimagelist - LLViewerFetchedTexture* image = gTextureList.findImage(mWorldID, false); + LLViewerFetchedTexture* image = gTextureList.findImage(mWorldID, TEX_LIST_DISCARD); gTextureList.deleteImage(image); if (image) @@ -207,7 +207,7 @@ bool LLLocalBitmap::updateSelf(EUpdateType optional_firstupdate) texture->setCachedRawImage(LL_LOCAL_DISCARD_LEVEL, raw_image); texture->ref(); - gTextureList.addImage(texture, false); + gTextureList.addImage(texture, TEX_LIST_DISCARD); if (optional_firstupdate != UT_FIRSTUSE) { @@ -215,7 +215,7 @@ bool LLLocalBitmap::updateSelf(EUpdateType optional_firstupdate) replaceIDs(old_id, mWorldID); // remove old_id from gimagelist - LLViewerFetchedTexture* image = gTextureList.findImage(old_id, false); + LLViewerFetchedTexture* image = gTextureList.findImage(old_id, TEX_LIST_DISCARD); if (image != NULL) { gTextureList.deleteImage(image); @@ -384,7 +384,7 @@ void LLLocalBitmap::replaceIDs(LLUUID old_id, LLUUID new_id) std::vector<LLViewerObject*> LLLocalBitmap::prepUpdateObjects(LLUUID old_id, U32 channel) { std::vector<LLViewerObject*> obj_list; - LLViewerFetchedTexture* old_texture = gTextureList.findImage(old_id, false); + LLViewerFetchedTexture* old_texture = gTextureList.findImage(old_id, TEX_LIST_DISCARD); for(U32 face_iterator = 0; face_iterator < old_texture->getNumFaces(channel); face_iterator++) { @@ -502,7 +502,7 @@ void LLLocalBitmap::updateUserPrims(LLUUID old_id, LLUUID new_id, U32 channel) void LLLocalBitmap::updateUserSculpts(LLUUID old_id, LLUUID new_id) { - LLViewerFetchedTexture* old_texture = gTextureList.findImage(old_id, false); + LLViewerFetchedTexture* old_texture = gTextureList.findImage(old_id, TEX_LIST_DISCARD); for(U32 volume_iter = 0; volume_iter < old_texture->getNumVolumes(); volume_iter++) { LLVOVolume* volume_to_object = (*old_texture->getVolumeList())[volume_iter]; diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 58da73727a..551495c6ad 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -2214,7 +2214,7 @@ void LLPanelFace::LLSelectedTE::getTexId(LLUUID& id, bool& identical) LLTextureEntry *te = object->getTE(te_index); if (te) { - LLViewerTexture* tex = te->getID().notNull() ? gTextureList.findImage(te->getID(), false) : NULL; + LLViewerTexture* tex = te->getID().notNull() ? gTextureList.findImage(te->getID(), TEX_LIST_DISCARD) : NULL; if(!tex) { tex = LLViewerFetchedTexture::sDefaultImagep; diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index f845ecc455..27d754bed2 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -4460,7 +4460,7 @@ void LLTextureFetchDebugger::addHistoryEntry(LLTextureFetchWorker* worker) mRefetchedAllData += worker->mFormattedImage->getDataSize(); // refetch list only requests/creates normal images, so requesting ui='false' - LLViewerFetchedTexture* tex = LLViewerTextureManager::findFetchedTexture(worker->mID, false); + LLViewerFetchedTexture* tex = LLViewerTextureManager::findFetchedTexture(worker->mID, TEX_LIST_DISCARD); if(tex && mRefetchList[tex].begin() != mRefetchList[tex].end()) { if(worker->mDecodedDiscard == mFetchingHistory[mRefetchList[tex][0]].mDecodedLevel) @@ -4780,7 +4780,7 @@ void LLTextureFetchDebugger::makeRefetchList() } // todo: Will attempt to refetch icons and ui elements as normal images (boost_none) - // thus will create unnesesary LLViewerFetchedTexture, consider supporting separate UI textures + // thus will create unnecessary LLViewerFetchedTexture, consider supporting separate UI textures mRefetchList[tex].push_back(i); } } diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 50d9467b4a..e2b8ff8e80 100755 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -131,7 +131,7 @@ LLLoadedCallbackEntry::LLLoadedCallbackEntry(loaded_callback_func cb, { if(mSourceCallbackList) { - mSourceCallbackList->insert(LLTextureKey(target->getID(), target->isUITexture())); + mSourceCallbackList->insert(LLTextureKey(target->getID(), (ETexListType)target->getTextureListType())); } } @@ -143,7 +143,7 @@ void LLLoadedCallbackEntry::removeTexture(LLViewerFetchedTexture* tex) { if(mSourceCallbackList) { - mSourceCallbackList->erase(LLTextureKey(tex->getID(), tex->isUITexture())); + mSourceCallbackList->erase(LLTextureKey(tex->getID(), (ETexListType)tex->getTextureListType())); } } @@ -200,9 +200,9 @@ void LLViewerTextureManager::findTextures(const LLUUID& id, std::vector<LLViewe } -LLViewerFetchedTexture* LLViewerTextureManager::findFetchedTexture(const LLUUID& id, bool is_ui) +LLViewerFetchedTexture* LLViewerTextureManager::findFetchedTexture(const LLUUID& id, S32 tex_type) { - return gTextureList.findImage(id, is_ui); + return gTextureList.findImage(id, (ETexListType)tex_type); } LLViewerMediaTexture* LLViewerTextureManager::findMediaTexture(const LLUUID &media_id) @@ -729,13 +729,6 @@ void LLViewerTexture::setBoostLevel(S32 level) } -bool LLViewerTexture::isUITexture() -{ - // can be substituted with mDontDiscard - return mBoostLevel == LLViewerTexture::BOOST_ICON - || mBoostLevel == LLViewerTexture::BOOST_UI; -} - bool LLViewerTexture::isActiveFetching() { return false; @@ -3329,7 +3322,7 @@ LLViewerMediaTexture::LLViewerMediaTexture(const LLUUID& id, BOOL usemipmaps, LL setCategory(LLGLTexture::MEDIA); - LLViewerTexture* tex = gTextureList.findImage(mID, false); + LLViewerTexture* tex = gTextureList.findImage(mID, TEX_LIST_DISCARD); if(tex) //this media is a parcel media for tex. { tex->setParcelMedia(this); @@ -3339,7 +3332,7 @@ LLViewerMediaTexture::LLViewerMediaTexture(const LLUUID& id, BOOL usemipmaps, LL //virtual LLViewerMediaTexture::~LLViewerMediaTexture() { - LLViewerTexture* tex = gTextureList.findImage(mID, false); + LLViewerTexture* tex = gTextureList.findImage(mID, TEX_LIST_DISCARD); if(tex) //this media is a parcel media for tex. { tex->setParcelMedia(NULL); @@ -3394,7 +3387,7 @@ BOOL LLViewerMediaTexture::findFaces() BOOL ret = TRUE; - LLViewerTexture* tex = gTextureList.findImage(mID, false); + LLViewerTexture* tex = gTextureList.findImage(mID, TEX_LIST_DISCARD); if(tex) //this media is a parcel media for tex. { for (U32 ch = 0; ch < LLRender::NUM_TEXTURE_CHANNELS; ++ch) @@ -3503,7 +3496,7 @@ void LLViewerMediaTexture::addFace(U32 ch, LLFace* facep) const LLTextureEntry* te = facep->getTextureEntry(); if(te && te->getID().notNull()) { - LLViewerTexture* tex = gTextureList.findImage(te->getID(), false); + LLViewerTexture* tex = gTextureList.findImage(te->getID(), TEX_LIST_DISCARD); if(tex) { mTextureList.push_back(tex);//increase the reference number by one for tex to avoid deleting it. @@ -3532,7 +3525,7 @@ void LLViewerMediaTexture::removeFace(U32 ch, LLFace* facep) const LLTextureEntry* te = facep->getTextureEntry(); if(te && te->getID().notNull()) { - LLViewerTexture* tex = gTextureList.findImage(te->getID(), false); + LLViewerTexture* tex = gTextureList.findImage(te->getID(), TEX_LIST_DISCARD); if(tex) { for(std::list< LLPointer<LLViewerTexture> >::iterator iter = mTextureList.begin(); @@ -3641,10 +3634,10 @@ void LLViewerMediaTexture::switchTexture(U32 ch, LLFace* facep) const LLTextureEntry* te = facep->getTextureEntry(); if(te) { - LLViewerTexture* tex = te->getID().notNull() ? gTextureList.findImage(te->getID(), false) : NULL; + LLViewerTexture* tex = te->getID().notNull() ? gTextureList.findImage(te->getID(), TEX_LIST_DISCARD) : NULL; if(!tex && te->getID() != mID)//try parcel media. { - tex = gTextureList.findImage(mID, false); + tex = gTextureList.findImage(mID, TEX_LIST_DISCARD); } if(!tex) { diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index a5e5a35f91..cedac44633 100755 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -133,7 +133,8 @@ public: /*virtual*/ const LLUUID& getID() const { return mID; } void setBoostLevel(S32 level); S32 getBoostLevel() { return mBoostLevel; } - bool isUITexture(); + void setTextureListType(S32 tex_type) { mTextureListType = tex_type; } + S32 getTextureListType() { return mTextureListType; } void addTextureStats(F32 virtual_size, BOOL needs_gltexture = TRUE) const; void resetTextureStats(); @@ -187,6 +188,8 @@ private: static bool isMemoryForTextureLow() ; protected: LLUUID mID; + S32 mTextureListType; // along with mID identifies where to search for this texture in TextureList + F32 mSelectedTime; // time texture was last selected mutable F32 mMaxVirtualSize; // The largest virtual size of the image, in pixels - how much data to we need? mutable S32 mMaxVirtualSizeResetCounter ; @@ -630,7 +633,7 @@ public: // static void findFetchedTextures(const LLUUID& id, std::vector<LLViewerFetchedTexture*> &output); static void findTextures(const LLUUID& id, std::vector<LLViewerTexture*> &output); - static LLViewerFetchedTexture* findFetchedTexture(const LLUUID& id, bool is_ui); + static LLViewerFetchedTexture* findFetchedTexture(const LLUUID& id, S32 tex_type); static LLViewerMediaTexture* findMediaTexture(const LLUUID& id) ; static LLViewerMediaTexture* createMediaTexture(const LLUUID& id, BOOL usemipmaps = TRUE, LLImageGL* gl_image = NULL) ; diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 10fbc8bd25..a8c93646c6 100755 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -70,23 +70,27 @@ S32 LLViewerTextureList::sNumImages = 0; LLViewerTextureList gTextureList; static LLTrace::BlockTimerStatHandle FTM_PROCESS_IMAGES("Process Images"); -bool is_ui_element(S32 priority) +ETexListType get_element_type(S32 priority) { - // alternatively don't discard flag can be used - return priority == LLViewerFetchedTexture::BOOST_ICON - || priority == LLViewerFetchedTexture::BOOST_UI; + // don't discard flag can be used in some cases, but it usually is not set yet + if (priority == LLViewerFetchedTexture::BOOST_ICON + || priority == LLViewerFetchedTexture::BOOST_UI) + { + return TEX_LIST_UI; + } + return TEX_LIST_DISCARD; } /////////////////////////////////////////////////////////////////////////////// LLTextureKey::LLTextureKey() : textureId(LLUUID::null), -isUI(false) +textureType(TEX_LIST_DISCARD) { } -LLTextureKey::LLTextureKey(LLUUID id, bool is_ui) -: textureId(id), isUI(is_ui) +LLTextureKey::LLTextureKey(LLUUID id, ETexListType tex_type) +: textureId(id), textureType(tex_type) { } @@ -404,7 +408,7 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromUrl(const std::string& new_id.generate(url); } - LLPointer<LLViewerFetchedTexture> imagep = findImage(new_id, is_ui_element(boost_priority)); + LLPointer<LLViewerFetchedTexture> imagep = findImage(new_id, get_element_type(boost_priority)); if (!imagep.isNull()) { @@ -442,12 +446,12 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromUrl(const std::string& imagep->setExplicitFormat(internal_format, primary_format); } - bool is_ui = is_ui_element(boost_priority); - addImage(imagep, is_ui); + addImage(imagep, get_element_type(boost_priority)); if (boost_priority != 0) { - if (is_ui) + if (boost_priority == LLViewerFetchedTexture::BOOST_UI + || boost_priority == LLViewerFetchedTexture::BOOST_ICON) { imagep->dontDiscard(); } @@ -484,7 +488,7 @@ LLViewerFetchedTexture* LLViewerTextureList::getImage(const LLUUID &image_id, return (LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI)); } - LLPointer<LLViewerFetchedTexture> imagep = findImage(image_id, is_ui_element(boost_priority)); + LLPointer<LLViewerFetchedTexture> imagep = findImage(image_id, get_element_type(boost_priority)); if (!imagep.isNull()) { LLViewerFetchedTexture *texture = imagep.get(); @@ -546,12 +550,12 @@ LLViewerFetchedTexture* LLViewerTextureList::createImage(const LLUUID &image_id, imagep->setExplicitFormat(internal_format, primary_format); } - bool is_ui = is_ui_element(boost_priority); - addImage(imagep, is_ui); + addImage(imagep, get_element_type(boost_priority)); if (boost_priority != 0) { - if (is_ui) + if (boost_priority == LLViewerFetchedTexture::BOOST_UI + || boost_priority == LLViewerFetchedTexture::BOOST_ICON) { imagep->dontDiscard(); } @@ -575,7 +579,7 @@ LLViewerFetchedTexture* LLViewerTextureList::createImage(const LLUUID &image_id, void LLViewerTextureList::findTexturesByID(const LLUUID &image_id, std::vector<LLViewerFetchedTexture*> &output) { - LLTextureKey search_key(image_id, false); + LLTextureKey search_key(image_id, TEX_LIST_DISCARD); uuid_map_t::iterator iter = mUUIDMap.lower_bound(search_key); while (iter != mUUIDMap.end() && iter->first.textureId == image_id) { @@ -592,9 +596,9 @@ LLViewerFetchedTexture *LLViewerTextureList::findImage(const LLTextureKey &searc return iter->second; } -LLViewerFetchedTexture *LLViewerTextureList::findImage(const LLUUID &image_id, bool is_ui) +LLViewerFetchedTexture *LLViewerTextureList::findImage(const LLUUID &image_id, ETexListType tex_type) { - return findImage(LLTextureKey(image_id, is_ui)); + return findImage(LLTextureKey(image_id, tex_type)); } void LLViewerTextureList::addImageToList(LLViewerFetchedTexture *image) @@ -639,7 +643,7 @@ void LLViewerTextureList::removeImageFromList(LLViewerFetchedTexture *image) << " but doesn't have mInImageList set" << " ref count is " << image->getNumRefs() << LL_ENDL; - uuid_map_t::iterator iter = mUUIDMap.find(LLTextureKey(image->getID(), image->isUITexture())); + uuid_map_t::iterator iter = mUUIDMap.find(LLTextureKey(image->getID(), (ETexListType)image->getTextureListType())); if(iter == mUUIDMap.end()) { LL_INFOS() << "Image " << image->getID() << " is also not in mUUIDMap!" << LL_ENDL ; @@ -664,7 +668,7 @@ void LLViewerTextureList::removeImageFromList(LLViewerFetchedTexture *image) image->setInImageList(FALSE) ; } -void LLViewerTextureList::addImage(LLViewerFetchedTexture *new_image, bool add_ui) +void LLViewerTextureList::addImage(LLViewerFetchedTexture *new_image, ETexListType tex_type) { if (!new_image) { @@ -672,7 +676,7 @@ void LLViewerTextureList::addImage(LLViewerFetchedTexture *new_image, bool add_u } //llassert(new_image); LLUUID image_id = new_image->getID(); - LLTextureKey key(image_id, add_ui); + LLTextureKey key(image_id, tex_type); LLViewerFetchedTexture *image = findImage(key); if (image) @@ -683,6 +687,7 @@ void LLViewerTextureList::addImage(LLViewerFetchedTexture *new_image, bool add_u addImageToList(new_image); mUUIDMap[key] = new_image; + new_image->setTextureListType(tex_type); } @@ -694,7 +699,7 @@ void LLViewerTextureList::deleteImage(LLViewerFetchedTexture *image) { mCallbackList.erase(image); } - LLTextureKey key(image->getID(), image->isUITexture()); + LLTextureKey key(image->getID(), (ETexListType)image->getTextureListType()); llverify(mUUIDMap.erase(key) == 1); sNumImages--; removeImageFromList(image); @@ -1128,7 +1133,7 @@ F32 LLViewerTextureList::updateImagesFetchTextures(F32 max_time) fetch_count += (imagep->updateFetch() ? 1 : 0); if (min_count <= min_update_count) { - mLastFetchKey = LLTextureKey(imagep->getID(), imagep->isUITexture()); + mLastFetchKey = LLTextureKey(imagep->getID(), (ETexListType)imagep->getTextureListType()); } if ((min_count-- <= 0) && (image_op_timer.getElapsedTimeF32() > max_time)) { @@ -1580,14 +1585,14 @@ void LLViewerTextureList::processImageNotInDatabase(LLMessageSystem *msg,void ** LLUUID image_id; msg->getUUIDFast(_PREHASH_ImageID, _PREHASH_ID, image_id); - LLViewerFetchedTexture* image = gTextureList.findImage( image_id, false); + LLViewerFetchedTexture* image = gTextureList.findImage( image_id, TEX_LIST_DISCARD); if( image ) { LL_WARNS() << "Image not in db" << LL_ENDL; image->setIsMissingAsset(); } - image = gTextureList.findImage(image_id, true); + image = gTextureList.findImage(image_id, TEX_LIST_UI); if (image) { LL_WARNS() << "Icon not in db" << LL_ENDL; diff --git a/indra/newview/llviewertexturelist.h b/indra/newview/llviewertexturelist.h index b1b6f4d2aa..9f94f2f1bc 100755 --- a/indra/newview/llviewertexturelist.h +++ b/indra/newview/llviewertexturelist.h @@ -59,12 +59,18 @@ typedef void (*LLImageCallback)(BOOL success, BOOL final, void* userdata); +enum ETexListType +{ + TEX_LIST_DISCARD = 0, + TEX_LIST_UI +}; + struct LLTextureKey { LLTextureKey(); - LLTextureKey(LLUUID id, bool is_ui); + LLTextureKey(LLUUID id, ETexListType tex_type); LLUUID textureId; - bool isUI; + ETexListType textureType; friend bool operator<(const LLTextureKey& key1, const LLTextureKey& key2) { @@ -74,7 +80,7 @@ struct LLTextureKey } else { - return key1.isUI < key2.isUI; + return key1.textureType < key2.textureType; } } }; @@ -104,7 +110,7 @@ public: BOOL isInitialized() const {return mInitialized;} void findTexturesByID(const LLUUID &image_id, std::vector<LLViewerFetchedTexture*> &output); - LLViewerFetchedTexture *findImage(const LLUUID &image_id, bool is_ui); + LLViewerFetchedTexture *findImage(const LLUUID &image_id, ETexListType tex_type); LLViewerFetchedTexture *findImage(const LLTextureKey &search_key); void dirtyImage(LLViewerFetchedTexture *image); @@ -142,7 +148,7 @@ private: void updateImagesUpdateStats(); F32 updateImagesLoadingFastCache(F32 max_time); - void addImage(LLViewerFetchedTexture *image, bool add_ui); + void addImage(LLViewerFetchedTexture *image, ETexListType tex_type); void deleteImage(LLViewerFetchedTexture *image); void addImageToList(LLViewerFetchedTexture *image); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 654d0ccfc8..4efad480f1 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1992,7 +1992,7 @@ LLViewerFetchedTexture *LLVOAvatar::getBakedTextureImage(const U8 te, const LLUU uuid == IMG_INVISIBLE) { // Should already exist, don't need to find it on sim or baked-texture host. - result = gTextureList.findImage(uuid, false); + result = gTextureList.findImage(uuid, TEX_LIST_DISCARD); } if (!result) { @@ -4313,7 +4313,7 @@ bool LLVOAvatar::allTexturesCompletelyDownloaded(std::set<LLUUID>& ids) const { for (std::set<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); ++it) { - LLViewerFetchedTexture *imagep = gTextureList.findImage(*it, false); + LLViewerFetchedTexture *imagep = gTextureList.findImage(*it, TEX_LIST_DISCARD); if (imagep && imagep->getDiscardLevel()!=0) { return false; @@ -4385,7 +4385,7 @@ S32Bytes LLVOAvatar::totalTextureMemForUUIDS(std::set<LLUUID>& ids) S32Bytes result(0); for (std::set<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); ++it) { - LLViewerFetchedTexture *imagep = gTextureList.findImage(*it, false); + LLViewerFetchedTexture *imagep = gTextureList.findImage(*it, TEX_LIST_DISCARD); if (imagep) { result += imagep->getTextureMemory(); @@ -4473,7 +4473,7 @@ void LLVOAvatar::releaseOldTextures() { if (new_texture_ids.find(*it) == new_texture_ids.end()) { - LLViewerFetchedTexture *imagep = gTextureList.findImage(*it, false); + LLViewerFetchedTexture *imagep = gTextureList.findImage(*it, TEX_LIST_DISCARD); if (imagep) { current_texture_mem += imagep->getTextureMemory(); |