From 9d7ad2733e1a41a573b0cf6c9a272f6f696f189c Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 15 Jan 2010 15:36:43 -0800 Subject: partial fix for EXT-4352: Texture loading problems in Viewer 2.0. More to come later (next week). --- indra/newview/llappviewer.cpp | 2 +- indra/newview/lltexturefetch.cpp | 6 +++--- indra/newview/llviewertexture.cpp | 37 +++++++++++++++++++++---------------- indra/newview/llviewertexture.h | 2 -- 4 files changed, 25 insertions(+), 22 deletions(-) (limited to 'indra') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index fb1bded795..3b73343857 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1676,7 +1676,7 @@ bool LLAppViewer::initThreads() // Image decoding LLAppViewer::sImageDecodeThread = new LLImageDecodeThread(enable_threads && true); LLAppViewer::sTextureCache = new LLTextureCache(enable_threads && true); - LLAppViewer::sTextureFetch = new LLTextureFetch(LLAppViewer::getTextureCache(), sImageDecodeThread, enable_threads && false); + LLAppViewer::sTextureFetch = new LLTextureFetch(LLAppViewer::getTextureCache(), sImageDecodeThread, enable_threads && true); LLImage::initClass(); if (LLFastTimer::sLog || LLFastTimer::sMetricLog) diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index eeedf38543..5ce6884239 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -495,8 +495,8 @@ void LLTextureFetchWorker::setupPacketData() U32 LLTextureFetchWorker::calcWorkPriority() { // llassert_always(mImagePriority >= 0 && mImagePriority <= LLViewerTexture::maxDecodePriority()); - F32 priority_scale = (F32)LLWorkerThread::PRIORITY_LOWBITS / LLViewerFetchedTexture::maxDecodePriority(); - mWorkPriority = (U32)(mImagePriority * priority_scale); + static F32 PRIORITY_SCALE = (F32)LLWorkerThread::PRIORITY_LOWBITS / LLViewerFetchedTexture::maxDecodePriority(); + mWorkPriority = (U32)(mImagePriority * PRIORITY_SCALE); return mWorkPriority; } @@ -574,7 +574,7 @@ bool LLTextureFetchWorker::doWork(S32 param) { LLMutexLock lock(&mWorkMutex); - if ((mFetcher->isQuitting() || getFlags(LLWorkerClass::WCF_DELETE_REQUESTED))) + if ((mFetcher->isQuitting() || mImagePriority < 1.0f || getFlags(LLWorkerClass::WCF_DELETE_REQUESTED))) { if (mState < WRITE_TO_CACHE) { diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 1edaeec848..ad993bc056 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1513,16 +1513,20 @@ F32 LLViewerFetchedTexture::calcDecodePriority() { desired_discard -= 2; } - else if (!isJustBound() && mCachedRawImageReady && !mBoostLevel) + else if (!isJustBound() && mCachedRawImageReady) { - // We haven't rendered this in the last half second, and we have a cached raw image, leave the desired discard as-is - desired_discard = cur_discard; - } - else if (mGLTexturep.notNull() && !mGLTexturep->getBoundRecently() && mBoostLevel == LLViewerTexture::BOOST_NONE) - { - // We haven't rendered this in a while, de-prioritize it - desired_discard += 2; + if(mBoostLevel < BOOST_HIGH) + { + // We haven't rendered this in a while, de-prioritize it + desired_discard += 2; + } + //else + //{ + // // We haven't rendered this in the last half second, and we have a cached raw image, leave the desired discard as-is + // desired_discard = cur_discard; + //} } + S32 ddiscard = cur_discard - desired_discard; ddiscard = llclamp(ddiscard, 0, 4); priority = (ddiscard+1)*100000.f; @@ -1629,7 +1633,7 @@ bool LLViewerFetchedTexture::updateFetch() S32 desired_discard = getDesiredDiscardLevel(); F32 decode_priority = getDecodePriority(); decode_priority = llmax(decode_priority, 0.0f); - + if (mIsFetching) { // Sets mRawDiscardLevel, mRawImage, mAuxRawImage @@ -1772,10 +1776,10 @@ bool LLViewerFetchedTexture::updateFetch() { make_request = false; } - else if (!isJustBound() && mCachedRawImageReady) - { - make_request = false; - } + //else if (!isJustBound() && mCachedRawImageReady) + //{ + // make_request = false; + //} else { if (mIsFetching) @@ -1847,12 +1851,12 @@ BOOL LLViewerFetchedTexture::forceFetch() { return false ; } - if(mDesiredSavedRawDiscardLevel < getDiscardLevel()) + //if(mDesiredSavedRawDiscardLevel < getDiscardLevel()) { //no need to force fetching. normal fetching flow will do the work. //return false ; } - if (mNeedsCreateTexture) + //if (mNeedsCreateTexture) { // We may be fetching still (e.g. waiting on write) // but don't check until we've processed the raw data we have @@ -1888,7 +1892,8 @@ BOOL LLViewerFetchedTexture::forceFetch() h = getHeight(0); c = getComponents(); } - fetch_request_created = LLAppViewer::getTextureFetch()->createRequest(mUrl, getID(),getTargetHost(), maxDecodePriority(), + setDecodePriority(maxDecodePriority()) ; + fetch_request_created = LLAppViewer::getTextureFetch()->createRequest(mUrl, getID(),getTargetHost(), getDecodePriority(), w, h, c, desired_discard, needsAux()); if (fetch_request_created) diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index 6aaaa4021b..79d9c4e7bb 100644 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -384,8 +384,6 @@ public: void updateVirtualSize() ; - // setDesiredDiscardLevel is only used by LLViewerTextureList - void setDesiredDiscardLevel(S32 discard) { mDesiredDiscardLevel = discard; } S32 getDesiredDiscardLevel() { return mDesiredDiscardLevel; } void setMinDiscardLevel(S32 discard) { mMinDesiredDiscardLevel = llmin(mMinDesiredDiscardLevel,(S8)discard); } -- cgit v1.2.3