From 354ccc1640dd223ccea20908183cc05a00ecaf6f Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Fri, 15 Feb 2013 13:44:21 -0500
Subject: additional safety check for bad appearance messages

---
 indra/llprimitive/llprimitive.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp
index faf98883d9..cf6a3f97d2 100755
--- a/indra/llprimitive/llprimitive.cpp
+++ b/indra/llprimitive/llprimitive.cpp
@@ -1259,7 +1259,7 @@ S32 LLPrimitive::parseTEMessage(LLMessageSystem* mesgsys, char const* block_name
 		mesgsys->getBinaryDataFast(block_name, _PREHASH_TextureEntry, tec.packed_buffer, 0, block_num, LLTEContents::MAX_TE_BUFFER);
 	}
 
-	tec.face_count = getNumTEs();
+	tec.face_count = llmin((U32)getNumTEs(),LLTEContents::MAX_TES);
 
 	U8 *cur_ptr = tec.packed_buffer;
 	cur_ptr += unpackTEField(cur_ptr, tec.packed_buffer+tec.size, (U8 *)tec.image_data, 16, tec.face_count, MVT_LLUUID);
-- 
cgit v1.2.3


From ce9a15bf989224ccda03d2d8461a3c619ae4339d Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Tue, 19 Feb 2013 10:09:38 -0500
Subject: SH-3792 WIP - changed local texture loading to be consistent with
 viewer_development - this fixes the gray head issue. There is still some
 remaining issue with bakes not uploading at full resolution, probably due to
 a bad image asset.

---
 indra/newview/app_settings/settings.xml |  2 +-
 indra/newview/llvoavatar.cpp            | 44 +++++++++++++++++++++------------
 indra/newview/llvoavatarself.cpp        | 41 +++++++++++++++---------------
 3 files changed, 49 insertions(+), 38 deletions(-)
 mode change 100644 => 100755 indra/newview/app_settings/settings.xml

(limited to 'indra')

diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
old mode 100644
new mode 100755
index eaad45ee9e..5db8d4e6a1
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -7258,7 +7258,7 @@
       <key>Type</key>
       <string>Boolean</string>
       <key>Value</key>
-      <integer>0</integer>
+      <integer>1</integer>
     </map>
     <key>QuietSnapshotsToDisk</key>
     <map>
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index c654d9ea64..58c0a412ed 100755
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -4096,26 +4096,38 @@ std::string LLVOAvatar::bakedTextureOriginInfo()
 	
 	std::set<LLUUID> baked_ids;
 	collectBakedTextureUUIDs(baked_ids);
-	for (std::set<LLUUID>::const_iterator it = baked_ids.begin(); it != baked_ids.end(); ++it)
+	for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
 	{
-		LLViewerFetchedTexture *imagep = gTextureList.findImage(*it);
-		bool has_url = false, has_host = false;
-		if (!imagep->getUrl().empty())
-		{
-			has_url = true;
-		}
-		if (imagep->getTargetHost().isOk())
+		ETextureIndex texture_index = mBakedTextureDatas[i].mTextureIndex;
+		LLViewerFetchedTexture *imagep =
+			LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index,0), TRUE);
+		if (!imagep ||
+			imagep->getID() == IMG_DEFAULT ||
+			imagep->getID() == IMG_DEFAULT_AVATAR)
+			
 		{
-			has_host = true;
+			result += "-";
 		}
-		S32 discard = imagep->getDiscardLevel();
-		if (has_url && !has_host) result += discard ? "u" : "U"; // server-bake texture with url 
-		else if (has_host && !has_url) result += discard ? "h" : "H"; // old-style texture on sim
-		else if (has_host && has_url) result += discard ? "ERRx" : "ERRX"; // both origins?
-		else if (!has_host && !has_url) result += discard ? "ERRn" : "ERRN"; // no origin?
-		if (discard != 0)
+		else
 		{
-			result += llformat("(%d/%d)",discard,imagep->getDesiredDiscardLevel());
+			bool has_url = false, has_host = false;
+			if (!imagep->getUrl().empty())
+			{
+				has_url = true;
+			}
+			if (imagep->getTargetHost().isOk())
+			{
+				has_host = true;
+			}
+			S32 discard = imagep->getDiscardLevel();
+			if (has_url && !has_host) result += discard ? "u" : "U"; // server-bake texture with url 
+			else if (has_host && !has_url) result += discard ? "h" : "H"; // old-style texture on sim
+			else if (has_host && has_url) result += discard ? "x" : "X"; // both origins?
+			else if (!has_host && !has_url) result += discard ? "n" : "N"; // no origin?
+			if (discard != 0)
+			{
+				result += llformat("(%d/%d)",discard,imagep->getDesiredDiscardLevel());
+			}
 		}
 
 	}
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index 7e24c43017..0e8e48099e 100755
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -2540,34 +2540,33 @@ void LLVOAvatarSelf::addLocalTextureStats( ETextureIndex type, LLViewerFetchedTe
 {
 	if (!isIndexLocalTexture(type)) return;
 
-	if (getLocalTextureID(type, index) != IMG_DEFAULT_AVATAR)
+	if (!covered_by_baked)
 	{
-		imagep->setNoDelete();
-		if (imagep->getDiscardLevel() != 0)
+		if (getLocalTextureID(type, index) != IMG_DEFAULT_AVATAR)
 		{
-			F32 desired_pixels;
-			desired_pixels = llmin(mPixelArea, (F32)getTexImageArea());
-
-			// DRANO what priority should wearable-based textures have?
-			if (isUsingLocalAppearance())
+			imagep->setNoDelete();
+			if (imagep->getDiscardLevel() != 0)
 			{
+				F32 desired_pixels;
+				desired_pixels = llmin(mPixelArea, (F32)getTexImageArea());
+				
 				imagep->setBoostLevel(getAvatarBoostLevel());
 				imagep->setAdditionalDecodePriority(SELF_ADDITIONAL_PRI) ;
-			}
-			imagep->resetTextureStats();
-			imagep->setMaxVirtualSizeResetInterval(MAX_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL);
-			imagep->addTextureStats( desired_pixels / texel_area_ratio );
-			imagep->forceUpdateBindStats() ;
-			if (imagep->getDiscardLevel() < 0)
-			{
-				mHasGrey = TRUE; // for statistics gathering
+				imagep->resetTextureStats();
+				imagep->setMaxVirtualSizeResetInterval(MAX_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL);
+				imagep->addTextureStats( desired_pixels / texel_area_ratio );
+				imagep->forceUpdateBindStats() ;
+				if (imagep->getDiscardLevel() < 0)
+				{
+					mHasGrey = TRUE; // for statistics gathering
+				}
 			}
 		}
-	}
-	else
-	{
-		// texture asset is missing
-		mHasGrey = TRUE; // for statistics gathering
+		else
+		{
+			// texture asset is missing
+			mHasGrey = TRUE; // for statistics gathering
+		}
 	}
 }
 
-- 
cgit v1.2.3