From d7e77019274d325b45a43b4819f405e6f15a14ac Mon Sep 17 00:00:00 2001 From: Shyotl Date: Tue, 23 Apr 2019 15:23:04 -0500 Subject: [PATCH] Make texture fetch type (mFTType) a const member variable and remove from init() call. forceRefetch was clobbering mFFType via init call and firstinit boolean is a stupid hack. --- indra/newview/lltexturefetch.cpp | 6 +++--- indra/newview/llviewertexture.cpp | 11 ++++------- indra/newview/llviewertexture.h | 2 +- indra/newview/llviewertexturelist.cpp | 10 +++++----- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 77b7eb1d0..3f040cda8 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -263,7 +263,7 @@ private: LLPointer mFormattedImage; LLPointer mRawImage, mAuxImage; - FTType mFTType; + const FTType mFTType; LLUUID mID; LLHost mHost; std::string mUrl; @@ -483,7 +483,7 @@ private: LLTextureFetch* mFetcher; LLUUID mID; - FTType mFTType; + const FTType mFTType; LLPointer mFetchRetryPolicy; U64 mMetricsStartTime; S32 mRequestedSize; @@ -1247,7 +1247,7 @@ bool LLTextureFetchWorker::doWork(S32 param) { if (mFTType != FTT_DEFAULT) { - LL_WARNS(LOG_TXT) << "trying to seek a non-default texture on the sim. Bad!" << LL_ENDL; + LL_WARNS(LOG_TXT) << "trying to seek a non-default texture on the sim. Bad! mFTType: " << mFTType << LL_ENDL; } mUrl = http_url + "/?texture_id=" + mID.asString().c_str(); LL_DEBUGS(LOG_TXT) << "Texture URL: " << mUrl << LL_ENDL; diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 274fe6cc1..3e5c98e7f 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -996,10 +996,9 @@ const std::string& fttype_to_string(const FTType& fttype) LLViewerFetchedTexture::LLViewerFetchedTexture(const LLUUID& id, FTType f_type, const LLHost& host, BOOL usemipmaps) : LLViewerTexture(id, usemipmaps, f_type == FTT_DEFAULT || f_type == FTT_MAP_TILE), - mTargetHost(host) + mTargetHost(host), mFTType(f_type) { init(TRUE); - mFTType = f_type; if (mFTType == FTT_HOST_BAKE) { LL_WARNS() << "Unsupported fetch type " << mFTType << LL_ENDL; @@ -1009,19 +1008,18 @@ LLViewerFetchedTexture::LLViewerFetchedTexture(const LLUUID& id, FTType f_type, } LLViewerFetchedTexture::LLViewerFetchedTexture(const LLImageRaw* raw, FTType f_type, BOOL usemipmaps) - : LLViewerTexture(raw, usemipmaps, f_type == FTT_DEFAULT || f_type == FTT_MAP_TILE) + : LLViewerTexture(raw, usemipmaps, f_type == FTT_DEFAULT || f_type == FTT_MAP_TILE), + mFTType(f_type) { init(TRUE); - mFTType = f_type; mGLTexturep->setNeedsAlphaAndPickMask(TRUE); } LLViewerFetchedTexture::LLViewerFetchedTexture(const std::string& url, FTType f_type, const LLUUID& id, BOOL usemipmaps) : LLViewerTexture(id, usemipmaps, f_type == FTT_DEFAULT || f_type == FTT_MAP_TILE), - mUrl(url) + mUrl(url), mFTType(f_type) { init(TRUE); - mFTType = f_type; generateGLTexture(); mGLTexturep->setNeedsAlphaAndPickMask(TRUE); } @@ -1089,7 +1087,6 @@ void LLViewerFetchedTexture::init(bool firstinit) mKeptSavedRawImageTime = 0.f; mLastCallBackActiveTime = 0.f; mForceCallbackFetch = FALSE; - mFTType = FTT_UNKNOWN; } LLViewerFetchedTexture::~LLViewerFetchedTexture() diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index 85eb158f7..5e77c8900 100644 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -473,7 +473,7 @@ protected: S8 mIsFetching; // Fetch request is active bool mCanUseHTTP ; //This texture can be fetched through http if true. - FTType mFTType; // What category of image is this - map tile, server bake, etc? + const FTType mFTType; // What category of image is this - map tile, server bake, etc? mutable S8 mIsMissingAsset; // True if we know that there is no image asset with this image id in the database. typedef std::list callback_list_t; diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index da84e94ec..970c1888c 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -617,12 +617,12 @@ void LLViewerTextureList::addImageToList(LLViewerFetchedTexture *image) } else { - if((mImageList.insert(image)).second != true) - { - LL_WARNS() << "Error happens when insert image " << image->getID() << " into mImageList!" << LL_ENDL ; + if((mImageList.insert(image)).second != true) + { + LL_WARNS() << "Error happens when insert image " << image->getID() << " into mImageList!" << LL_ENDL ; + } + image->setInImageList(TRUE) ; } - image->setInImageList(TRUE) ; -} } void LLViewerTextureList::removeImageFromList(LLViewerFetchedTexture *image)