diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2024-08-28 20:47:43 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2024-08-28 20:47:43 -0400 |
commit | cde1174345224d33d6b45b1e3243fa39043223e5 (patch) | |
tree | 6c8db6e0499622d8c7206a11c997eb173ebd478f /indra/newview/lltexturefetch.cpp | |
parent | 6f454ad8366ed33bbe199c3fc3ed69e6d3448cec (diff) | |
parent | 35efadf78315f9b351415930dca4fae251ef4dd0 (diff) |
Merge branch 'main' into release/luau-scripting.
Diffstat (limited to 'indra/newview/lltexturefetch.cpp')
-rw-r--r-- | indra/newview/lltexturefetch.cpp | 93 |
1 files changed, 49 insertions, 44 deletions
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 77c28bd3f4..ee13baaa18 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -392,7 +392,7 @@ public: // Threads: Ttc void callbackCacheRead(bool success, LLImageFormatted* image, - S32 imagesize, BOOL islocal); + S32 imagesize, bool islocal); // Threads: Ttc void callbackCacheWrite(bool success); @@ -571,13 +571,13 @@ private: mCachedSize; e_request_state mSentRequest; handle_t mDecodeHandle; - BOOL mLoaded; - BOOL mDecoded; - BOOL mWritten; - BOOL mNeedsAux; - BOOL mHaveAllData; - BOOL mInLocalCache; - BOOL mInCache; + bool mLoaded; + bool mDecoded; + bool mWritten; + bool mNeedsAux; + bool mHaveAllData; + bool mInLocalCache; + bool mInCache; bool mCanUseHTTP; S32 mRetryAttempt; S32 mActiveCount; @@ -909,15 +909,15 @@ LLTextureFetchWorker::LLTextureFetchWorker(LLTextureFetch* fetcher, mFileSize(0), mSkippedStatesTime(0), mCachedSize(0), - mLoaded(FALSE), + mLoaded(false), mSentRequest(UNSENT), mDecodeHandle(0), - mDecoded(FALSE), - mWritten(FALSE), - mNeedsAux(FALSE), - mHaveAllData(FALSE), - mInLocalCache(FALSE), - mInCache(FALSE), + mDecoded(false), + mWritten(false), + mNeedsAux(false), + mHaveAllData(false), + mInLocalCache(false), + mInCache(false), mCanUseHTTP(true), mRetryAttempt(0), mActiveCount(0), @@ -1054,7 +1054,7 @@ void LLTextureFetchWorker::resetFormattedData() } mHttpReplySize = 0; mHttpReplyOffset = 0; - mHaveAllData = FALSE; + mHaveAllData = false; } F32 LLTextureFetchWorker::getImagePriority() const @@ -1152,10 +1152,10 @@ bool LLTextureFetchWorker::doWork(S32 param) mRequestedOffset = 0; mFileSize = 0; mCachedSize = 0; - mLoaded = FALSE; + mLoaded = false; mSentRequest = UNSENT; - mDecoded = FALSE; - mWritten = FALSE; + mDecoded = false; + mWritten = false; if (mHttpBufferArray) { mHttpBufferArray->release(); @@ -1163,12 +1163,12 @@ bool LLTextureFetchWorker::doWork(S32 param) } mHttpReplySize = 0; mHttpReplyOffset = 0; - mHaveAllData = FALSE; + mHaveAllData = false; clearPackets(); // TODO: Shouldn't be necessary mCacheReadHandle = LLTextureCache::nullHandle(); mCacheWriteHandle = LLTextureCache::nullHandle(); setState(LOAD_FROM_TEXTURE_CACHE); - mInCache = FALSE; + mInCache = false; mDesiredSize = llmax(mDesiredSize, TEXTURE_CACHE_ENTRY_SIZE); // min desired size is TEXTURE_CACHE_ENTRY_SIZE LL_DEBUGS(LOG_TXT) << mID << ": Priority: " << llformat("%8.0f",mImagePriority) << " Desired Discard: " << mDesiredDiscard << " Desired Size: " << mDesiredSize << LL_ENDL; @@ -1190,7 +1190,7 @@ bool LLTextureFetchWorker::doWork(S32 param) // return false; } mFileSize = 0; - mLoaded = FALSE; + mLoaded = false; add(LLTextureFetch::sCacheAttempt, 1.0); @@ -1264,7 +1264,7 @@ bool LLTextureFetchWorker::doWork(S32 param) << ", should be >=0" << LL_ENDL; } setState(DECODE_IMAGE); - mInCache = TRUE; + mInCache = true; mWriteToCacheState = NOT_WRITE ; LL_DEBUGS(LOG_TXT) << mID << ": Cached. Bytes: " << mFormattedImage->getDataSize() << " Size: " << llformat("%dx%d",mFormattedImage->getWidth(),mFormattedImage->getHeight()) @@ -1476,7 +1476,7 @@ bool LLTextureFetchWorker::doWork(S32 param) } mRequestedDeltaTimer.reset(); - mLoaded = FALSE; + mLoaded = false; mGetStatus = LLCore::HttpStatus(); mGetReason.clear(); LL_DEBUGS(LOG_TXT) << "HTTP GET: " << mID << " Offset: " << mRequestedOffset @@ -1593,7 +1593,7 @@ bool LLTextureFetchWorker::doWork(S32 param) else if (http_not_sat == mGetStatus) { // Allowed, we'll accept whatever data we have as complete. - mHaveAllData = TRUE; + mHaveAllData = true; } else { @@ -1655,7 +1655,7 @@ bool LLTextureFetchWorker::doWork(S32 param) return true; } - S32 append_size(mHttpBufferArray->size()); + S32 append_size(static_cast<S32>(mHttpBufferArray->size())); S32 total_size(cur_size + append_size); S32 src_offset(0); llassert_always(append_size == mRequestedSize); @@ -1664,7 +1664,7 @@ bool LLTextureFetchWorker::doWork(S32 param) // In case of a partial response, our offset may // not be trivially contiguous with the data we have. // Get back into alignment. - if ( (mHttpReplyOffset > cur_size) || (cur_size > mHttpReplyOffset + append_size)) + if ( ((S32)mHttpReplyOffset > cur_size) || (cur_size > (S32)mHttpReplyOffset + append_size)) { LL_WARNS(LOG_TXT) << "Partial HTTP response produces break in image data for texture " << mID << ". Aborting load." << LL_ENDL; @@ -1700,6 +1700,8 @@ bool LLTextureFetchWorker::doWork(S32 param) } } + LLImageDataLock lock(mFormattedImage); + if (mHaveAllData) //the image file is fully loaded. { mFileSize = total_size; @@ -1796,7 +1798,7 @@ bool LLTextureFetchWorker::doWork(S32 param) mAuxImage = NULL; llassert_always(mFormattedImage.notNull()); S32 discard = mHaveAllData ? 0 : mLoadedDiscard; - mDecoded = FALSE; + mDecoded = false; setState(DECODE_IMAGE_UPDATE); LL_DEBUGS(LOG_TXT) << mID << ": Decoding. Bytes: " << mFormattedImage->getDataSize() << " Discard: " << discard << " All Data: " << mHaveAllData << LL_ENDL; @@ -1871,6 +1873,9 @@ bool LLTextureFetchWorker::doWork(S32 param) //return false; return doWork(param); } + + LLImageDataSharedLock lock(mFormattedImage); + S32 datasize = mFormattedImage->getDataSize(); if(mFileSize < datasize)//This could happen when http fetching and sim fetching mixed. { @@ -1884,7 +1889,7 @@ bool LLTextureFetchWorker::doWork(S32 param) } } llassert_always(datasize); - mWritten = FALSE; + mWritten = false; setState(WAIT_ON_WRITE); ++mCacheWriteCount; CacheWriteResponder* responder = new CacheWriteResponder(mFetcher, mID); @@ -2188,7 +2193,7 @@ S32 LLTextureFetchWorker::callbackHttpGet(LLCore::HttpResponse * response, { // get length of stream: LLCore::BufferArray * body(response->getBody()); - data_size = body ? body->size() : 0; + data_size = body ? static_cast<S32>(body->size()) : 0; LL_DEBUGS(LOG_TXT) << "HTTP RECEIVED: " << mID.asString() << " Bytes: " << data_size << LL_ENDL; if (data_size > 0) @@ -2234,19 +2239,19 @@ S32 LLTextureFetchWorker::callbackHttpGet(LLCore::HttpResponse * response, << mFileSize << " datasize: " << mFormattedImage->getDataSize() << LL_ENDL; } - mHaveAllData = TRUE; + mHaveAllData = true; llassert_always(mDecodeHandle == 0); mFormattedImage = NULL; // discard any previous data we had } else if (data_size < mRequestedSize) { - mHaveAllData = TRUE; + mHaveAllData = true; } else if (data_size > mRequestedSize) { // *TODO: This shouldn't be happening any more (REALLY don't expect this anymore) LL_WARNS(LOG_TXT) << "data_size = " << data_size << " > requested: " << mRequestedSize << LL_ENDL; - mHaveAllData = TRUE; + mHaveAllData = true; llassert_always(mDecodeHandle == 0); mFormattedImage = NULL; // discard any previous data we had } @@ -2255,7 +2260,7 @@ S32 LLTextureFetchWorker::callbackHttpGet(LLCore::HttpResponse * response, { // We requested data but received none (and no error), // so presumably we have all of it - mHaveAllData = TRUE; + mHaveAllData = true; } mRequestedSize = data_size; @@ -2271,7 +2276,7 @@ S32 LLTextureFetchWorker::callbackHttpGet(LLCore::HttpResponse * response, mRequestedSize = -1; // error } - mLoaded = TRUE; + mLoaded = true; return data_size ; } @@ -2280,7 +2285,7 @@ S32 LLTextureFetchWorker::callbackHttpGet(LLCore::HttpResponse * response, // Threads: Ttc void LLTextureFetchWorker::callbackCacheRead(bool success, LLImageFormatted* image, - S32 imagesize, BOOL islocal) + S32 imagesize, bool islocal) { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; LLMutexLock lock(&mWorkMutex); // +Mw @@ -2298,10 +2303,10 @@ void LLTextureFetchWorker::callbackCacheRead(bool success, LLImageFormatted* ima mInLocalCache = islocal; if (mFileSize != 0 && mFormattedImage->getDataSize() >= mFileSize) { - mHaveAllData = TRUE; + mHaveAllData = true; } } - mLoaded = TRUE; + mLoaded = true; } // -Mw // Threads: Ttc @@ -2313,7 +2318,7 @@ void LLTextureFetchWorker::callbackCacheWrite(bool success) // LL_WARNS(LOG_TXT) << "Write callback for " << mID << " with state = " << mState << LL_ENDL; return; } - mWritten = TRUE; + mWritten = true; } // -Mw ////////////////////////////////////////////////////////////////////////////// @@ -2358,7 +2363,7 @@ void LLTextureFetchWorker::callbackDecoded(bool success, const std::string &erro removeFromCache(); mDecodedDiscard = -1; // Redundant, here for clarity and paranoia } - mDecoded = TRUE; + mDecoded = true; // LL_INFOS(LOG_TXT) << mID << " : DECODE COMPLETE " << LL_ENDL; } // -Mw @@ -2435,7 +2440,7 @@ std::string LLTextureFetch::getStateString(S32 state) LLTextureFetch::LLTextureFetch(LLTextureCache* cache, bool threaded, bool qa_mode) : LLWorkerThread("TextureFetch", threaded, true), mDebugCount(0), - mDebugPause(FALSE), + mDebugPause(false), mPacketCount(0), mBadPacketCount(0), mQueueMutex(), @@ -3144,9 +3149,9 @@ LLViewerRegion* LLTextureFetchWorker::getRegion() ////////////////////////////////////////////////////////////////////////////// // Threads: T* -BOOL LLTextureFetch::isFromLocalCache(const LLUUID& id) +bool LLTextureFetch::isFromLocalCache(const LLUUID& id) { - BOOL from_cache = FALSE ; + bool from_cache = false ; LLTextureFetchWorker* worker = getWorker(id); if (worker) @@ -3400,7 +3405,7 @@ void LLTextureFetch::cancelHttpWaiters() int LLTextureFetch::getHttpWaitersCount() { mNetworkQueueMutex.lock(); // +Mfnq - int ret(mHttpWaitResource.size()); + int ret(static_cast<int>(mHttpWaitResource.size())); mNetworkQueueMutex.unlock(); // -Mfnq return ret; } |