From 361a2277733a0afaf61f6c6150f1933d2e5aceb7 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 29 Oct 2009 16:12:12 -0600 Subject: fix EXT-1661: Avatars' icons should be cached only once per 24 hours, but not every time the viewer is restarted. to be reviewed by steve. --- indra/newview/llviewertexture.cpp | 48 ++++++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 11 deletions(-) (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index e5c53c91c9..2368a2da33 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -93,6 +93,7 @@ BOOL LLViewerTexture::sUseTextureAtlas = FALSE ; const F32 desired_discard_bias_min = -2.0f; // -max number of levels to improve image quality by const F32 desired_discard_bias_max = 1.5f; // max number of levels to reduce image quality by +const F64 log_2 = log(2.0); //---------------------------------------------------------------------------------------------- //namespace: LLViewerTextureAccess @@ -134,7 +135,7 @@ LLViewerMediaTexture* LLViewerTextureManager::getMediaTexture(const LLUUID& id, return tex ; } -LLViewerFetchedTexture* LLViewerTextureManager::staticCastToFetchedTexture(LLViewerTexture* tex, BOOL report_error) +LLViewerFetchedTexture* LLViewerTextureManager::staticCastToFetchedTexture(LLTexture* tex, BOOL report_error) { if(!tex) { @@ -522,6 +523,12 @@ F32 LLViewerTexture::getMaxVirtualSize() return mMaxVirtualSize ; } +//virtual +void LLViewerTexture::setKnownDrawSize(S32 width, S32 height) +{ + //nothing here. +} + //virtual void LLViewerTexture::addFace(LLFace* facep) { @@ -852,6 +859,7 @@ void LLViewerFetchedTexture::init(bool firstinit) mKnownDrawWidth = 0; mKnownDrawHeight = 0; + mKnownDrawSizeChanged = FALSE ; if (firstinit) { @@ -1084,10 +1092,17 @@ BOOL LLViewerFetchedTexture::createTexture(S32 usename/*= 0*/) } // Call with 0,0 to turn this feature off. +//virtual void LLViewerFetchedTexture::setKnownDrawSize(S32 width, S32 height) { - mKnownDrawWidth = width; - mKnownDrawHeight = height; + if(mKnownDrawWidth != width || mKnownDrawHeight != height) + { + mKnownDrawWidth = width; + mKnownDrawHeight = height; + + mKnownDrawSizeChanged = TRUE ; + mFullyLoaded = FALSE ; + } addTextureStats((F32)(width * height)); } @@ -1104,13 +1119,26 @@ void LLViewerFetchedTexture::processTextureStats() mDesiredDiscardLevel = getMaxDiscardLevel() ; } else - { - mDesiredDiscardLevel = 0; - if (mFullWidth > MAX_IMAGE_SIZE_DEFAULT || mFullHeight > MAX_IMAGE_SIZE_DEFAULT) + { + if(!mKnownDrawWidth || !mKnownDrawHeight || mFullWidth <= mKnownDrawWidth || mFullHeight <= mKnownDrawHeight) { - mDesiredDiscardLevel = 1; // MAX_IMAGE_SIZE_DEFAULT = 1024 and max size ever is 2048 + if (mFullWidth > MAX_IMAGE_SIZE_DEFAULT || mFullHeight > MAX_IMAGE_SIZE_DEFAULT) + { + mDesiredDiscardLevel = 1; // MAX_IMAGE_SIZE_DEFAULT = 1024 and max size ever is 2048 + } + else + { + mDesiredDiscardLevel = 0; + } } - + else if(mKnownDrawSizeChanged)//known draw size is set + { + mDesiredDiscardLevel = (S8)llmin(log((F32)mFullWidth / mKnownDrawWidth) / log_2, + log((F32)mFullHeight / mKnownDrawHeight) / log_2) ; + mDesiredDiscardLevel = llclamp(mDesiredDiscardLevel, (S8)0, (S8)getMaxDiscardLevel()) ; + } + mKnownDrawSizeChanged = FALSE ; + if(getDiscardLevel() >= 0 && (getDiscardLevel() <= mDesiredDiscardLevel)) { mFullyLoaded = TRUE ; @@ -1121,8 +1149,6 @@ void LLViewerFetchedTexture::processTextureStats() //texture does not have any data, so we don't know the size of the image, treat it like 32 * 32. F32 LLViewerFetchedTexture::calcDecodePriorityForUnknownTexture(F32 pixel_priority) { - static const F64 log_2 = log(2.0); - F32 desired = (F32)(log(32.0/pixel_priority) / log_2); S32 ddiscard = MAX_DISCARD_LEVEL - (S32)desired + 1; ddiscard = llclamp(ddiscard, 1, 9); @@ -1169,7 +1195,7 @@ F32 LLViewerFetchedTexture::calcDecodePriority() // Don't decode anything we don't need priority = -1.0f; } - else if (mBoostLevel == LLViewerTexture::BOOST_UI && !have_all_data) + else if ((mBoostLevel == LLViewerTexture::BOOST_UI || mBoostLevel == LLViewerTexture::BOOST_ICON) && !have_all_data) { priority = 1.f; } -- cgit v1.2.3 From 801301c435414df1e22c321a685044b7cd43055e Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 30 Oct 2009 21:22:47 -0600 Subject: fix DEV-41913: parcel media does not display on particle textures. --- indra/newview/llviewertexture.cpp | 57 ++++++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 15 deletions(-) (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 2368a2da33..28ef128265 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -416,6 +416,7 @@ void LLViewerTexture::init(bool firstinit) mDontDiscard = FALSE; mMaxVirtualSize = 0.f; mNeedsResetMaxVirtualSize = FALSE ; + mHasParcelMedia = FALSE ; } //virtual @@ -2150,19 +2151,20 @@ void LLViewerMediaTexture::updateClass() for(media_map_t::iterator iter = sMediaMap.begin() ; iter != sMediaMap.end(); ) { LLViewerMediaTexture* mediap = iter->second; - - // - //Note: delay some time to delete the media textures to stop endlessly creating and immediately removing media texture. - // - if(mediap->getNumRefs() == 1 && mediap->getLastReferencedTimer()->getElapsedTimeF32() > MAX_INACTIVE_TIME) //one by sMediaMap - { - media_map_t::iterator cur = iter++ ; - sMediaMap.erase(cur) ; - } - else + + if(mediap->getNumRefs() == 1) //one reference by sMediaMap { - ++iter ; + // + //Note: delay some time to delete the media textures to stop endlessly creating and immediately removing media texture. + // + if(mediap->getLastReferencedTimer()->getElapsedTimeF32() > MAX_INACTIVE_TIME) + { + media_map_t::iterator cur = iter++ ; + sMediaMap.erase(cur) ; + continue ; + } } + ++iter ; } } @@ -2215,11 +2217,22 @@ LLViewerMediaTexture::LLViewerMediaTexture(const LLUUID& id, BOOL usemipmaps, LL mIsPlaying = FALSE ; setMediaImpl() ; + + LLViewerTexture* tex = gTextureList.findImage(mID) ; + if(tex) //this media is a parcel media for tex. + { + tex->setParcelMedia(TRUE) ; + mParcelTexture = tex ; + } } //virtual LLViewerMediaTexture::~LLViewerMediaTexture() { + if(mParcelTexture.notNull()) + { + mParcelTexture->setParcelMedia(FALSE) ; + } } void LLViewerMediaTexture::reinit(BOOL usemipmaps /* = TRUE */) @@ -2272,10 +2285,19 @@ BOOL LLViewerMediaTexture::findFaces() BOOL ret = TRUE ; //for parcel media - LLViewerTexture* tex = gTextureList.findImage(mID) ; - if(tex) + if(mParcelTexture.isNull()) { - const ll_face_list_t* face_list = tex->getFaceList() ; + LLViewerTexture* tex = gTextureList.findImage(mID) ; + if(tex) + { + tex->setParcelMedia(TRUE) ; + mParcelTexture = tex ; + } + } + + if(mParcelTexture.notNull()) + { + const ll_face_list_t* face_list = mParcelTexture->getFaceList() ; for(ll_face_list_t::const_iterator iter = face_list->begin(); iter != face_list->end(); ++iter) { mMediaFaceList.push_back(*iter) ; @@ -2382,9 +2404,14 @@ void LLViewerMediaTexture::addFace(LLFace* facep) if(facep->getTexture() && facep->getTexture() != this && facep->getTexture()->getID() == mID) { mTextureList.push_back(facep->getTexture()) ; //a parcel media. + if(mParcelTexture.isNull()) + { + mParcelTexture = facep->getTexture() ; + mParcelTexture->setParcelMedia(TRUE) ; + } return ; } - + llerrs << "The face does not have a valid texture before media texture." << llendl ; } -- cgit v1.2.3 From 99d9712dd7f2a11a1094cba380f92e677710b56b Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Sun, 1 Nov 2009 17:27:25 -0700 Subject: additional fix for DEV-41913: parcel media does not display on particle textures. --- indra/newview/llviewertexture.cpp | 37 ++++++++++++++----------------------- 1 file changed, 14 insertions(+), 23 deletions(-) (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 28ef128265..758bf8c1aa 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -416,7 +416,7 @@ void LLViewerTexture::init(bool firstinit) mDontDiscard = FALSE; mMaxVirtualSize = 0.f; mNeedsResetMaxVirtualSize = FALSE ; - mHasParcelMedia = FALSE ; + mParcelMedia = NULL ; } //virtual @@ -2148,6 +2148,12 @@ void LLViewerMediaTexture::updateClass() { static const F32 MAX_INACTIVE_TIME = 30.f ; +#if 0 + //force to play media. + gSavedSettings.setBOOL("AudioSteamingMedia", true) ; + gSavedSettings.setBOOL("AudioStreamingVideo", true) ; +#endif + for(media_map_t::iterator iter = sMediaMap.begin() ; iter != sMediaMap.end(); ) { LLViewerMediaTexture* mediap = iter->second; @@ -2221,17 +2227,17 @@ LLViewerMediaTexture::LLViewerMediaTexture(const LLUUID& id, BOOL usemipmaps, LL LLViewerTexture* tex = gTextureList.findImage(mID) ; if(tex) //this media is a parcel media for tex. { - tex->setParcelMedia(TRUE) ; - mParcelTexture = tex ; + tex->setParcelMedia(this) ; } } //virtual LLViewerMediaTexture::~LLViewerMediaTexture() { - if(mParcelTexture.notNull()) + LLViewerTexture* tex = gTextureList.findImage(mID) ; + if(tex) //this media is a parcel media for tex. { - mParcelTexture->setParcelMedia(FALSE) ; + tex->setParcelMedia(NULL) ; } } @@ -2283,21 +2289,11 @@ BOOL LLViewerMediaTexture::findFaces() mMediaFaceList.clear() ; BOOL ret = TRUE ; - - //for parcel media - if(mParcelTexture.isNull()) - { - LLViewerTexture* tex = gTextureList.findImage(mID) ; - if(tex) - { - tex->setParcelMedia(TRUE) ; - mParcelTexture = tex ; - } - } - if(mParcelTexture.notNull()) + LLViewerTexture* tex = gTextureList.findImage(mID) ; + if(tex) //this media is a parcel media for tex. { - const ll_face_list_t* face_list = mParcelTexture->getFaceList() ; + const ll_face_list_t* face_list = tex->getFaceList() ; for(ll_face_list_t::const_iterator iter = face_list->begin(); iter != face_list->end(); ++iter) { mMediaFaceList.push_back(*iter) ; @@ -2404,11 +2400,6 @@ void LLViewerMediaTexture::addFace(LLFace* facep) if(facep->getTexture() && facep->getTexture() != this && facep->getTexture()->getID() == mID) { mTextureList.push_back(facep->getTexture()) ; //a parcel media. - if(mParcelTexture.isNull()) - { - mParcelTexture = facep->getTexture() ; - mParcelTexture->setParcelMedia(TRUE) ; - } return ; } -- cgit v1.2.3