From 80b3884a6add8600d8d13d7b72018ec85337cd7e Mon Sep 17 00:00:00 2001
From: Xiaohong Bao <bao@lindenlab.com>
Date: Mon, 7 Jun 2010 15:34:43 -0600
Subject: [PATCH] more for EXT-7500: PARTIAL FIXED: Texture Jamming problems
 with http texture off. Raise priorities of textures for self avatar to the
 highest.

---
 indra/newview/llviewertexture.cpp | 10 +++++-----
 indra/newview/llviewertexture.h   |  1 +
 indra/newview/llvoavatar.cpp      |  6 ++++++
 indra/newview/llvoavatarself.cpp  |  5 +++++
 4 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index 7e779986df5..9b5b210bf72 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -541,11 +541,6 @@ void LLViewerTexture::setBoostLevel(S32 level)
 		if(mBoostLevel != LLViewerTexture::BOOST_NONE)
 		{
 			setNoDelete() ;		
-
-			if(LLViewerTexture::BOOST_AVATAR_BAKED_SELF == mBoostLevel || LLViewerTexture::BOOST_AVATAR_BAKED == mBoostLevel)
-			{
-				mCanResetMaxVirtualSize = false ;
-			}
 		}
 		if(gAuditTexture)
 		{
@@ -596,6 +591,11 @@ void LLViewerTexture::forceImmediateUpdate()
 {
 }
 
+void LLViewerTexture::setResetMaxVirtualSizeFlag(bool flag) 
+{
+	mCanResetMaxVirtualSize = flag ;
+}
+
 void LLViewerTexture::addTextureStats(F32 virtual_size, BOOL needs_gltexture) const 
 {
 	if(needs_gltexture)
diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h
index 1bd4cc793d8..361f56e02f4 100644
--- a/indra/newview/llviewertexture.h
+++ b/indra/newview/llviewertexture.h
@@ -166,6 +166,7 @@ class LLViewerTexture : public LLTexture
 
 	void addTextureStats(F32 virtual_size, BOOL needs_gltexture = TRUE) const;
 	void resetTextureStats();	
+	void setResetMaxVirtualSizeFlag(bool flag) ;
 
 	virtual F32  getMaxVirtualSize() ;
 
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 1fa953f1577..b5faa984eb6 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -4209,10 +4209,16 @@ void LLVOAvatar::addBakedTextureStats( LLViewerFetchedTexture* imagep, F32 pixel
 {
 	mMaxPixelArea = llmax(pixel_area, mMaxPixelArea);
 	mMinPixelArea = llmin(pixel_area, mMinPixelArea);
+
 	imagep->resetTextureStats();
+	imagep->setResetMaxVirtualSizeFlag(false) ;
 	imagep->setCanUseHTTP(false) ; //turn off http fetching for baked textures.
 	imagep->addTextureStats(pixel_area / texel_area_ratio);
 	imagep->setBoostLevel(boost_level);
+	if(boost_level == LLViewerTexture::BOOST_AVATAR_BAKED_SELF)
+	{
+		imagep->setAdditionalDecodePriority(1.0f) ;
+	}
 }
 
 //virtual	
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index 2722646eff4..91a5c50b506 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -2036,8 +2036,13 @@ void LLVOAvatarSelf::addLocalTextureStats( ETextureIndex type, LLViewerFetchedTe
 			F32 desired_pixels;
 			desired_pixels = llmin(mPixelArea, (F32)getTexImageArea());
 			imagep->setBoostLevel(getAvatarBoostLevel());
+
+			imagep->resetTextureStats();
+			imagep->setResetMaxVirtualSizeFlag(false) ;
 			imagep->addTextureStats( desired_pixels / texel_area_ratio );
+			imagep->setAdditionalDecodePriority(1.0f) ;
 			imagep->forceUpdateBindStats() ;
+			
 			if (imagep->getDiscardLevel() < 0)
 			{
 				mHasGrey = TRUE; // for statistics gathering
-- 
GitLab