From a43b997c0768b32f0dd3bd80b9a44b3b37084cfe Mon Sep 17 00:00:00 2001
From: Andrey Kleshchev <andreykproductengine@lindenlab.com>
Date: Tue, 4 Feb 2020 22:41:55 +0200
Subject: [PATCH] SL-4354 Used wrong condition

---
 indra/newview/llvoavatar.cpp | 9 +++++----
 indra/newview/llvoavatar.h   | 2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 780b6f81f1f..090766e71c7 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -5362,9 +5362,10 @@ void LLVOAvatar::checkTextureLoading()
 				tex->unpauseLoadedCallbacks(&mCallbackTextureList) ;
 				tex->addTextureStats(START_AREA); //jump start the fetching again
 
-				if (tex->isFullyLoaded())
+				// technically shouldn't need to account for missing, but callback might not have happened yet
+				if (tex->getDiscardLevel() >= 0 || tex->isMissingAsset())
 				{
-					mLoadedCallbackTextures++; // consider it loaded
+					mLoadedCallbackTextures++; // consider it loaded (we have at least some data)
 				}
 			}
 		}
@@ -8204,7 +8205,7 @@ void LLVOAvatar::updateMeshTextures()
 				}
 				baked_img->setLoadedCallback(onBakedTextureLoaded, SWITCH_TO_BAKED_DISCARD, FALSE, FALSE, new LLUUID( mID ), 
 					src_callback_list, paused );
-				if (!baked_img->isFullyLoaded() && !paused)
+				if (baked_img->getDiscardLevel() < 0 && !paused)
 				{
 					mLastTexCallbackAddedTime.reset();
 				}
@@ -8605,7 +8606,7 @@ void LLVOAvatar::onFirstTEMessageReceived()
 				LL_DEBUGS("Avatar") << avString() << "layer_baked, setting onInitialBakedTextureLoaded as callback" << LL_ENDL;
 				image->setLoadedCallback( onInitialBakedTextureLoaded, MAX_DISCARD_LEVEL, FALSE, FALSE, new LLUUID( mID ), 
 					src_callback_list, paused );
-				if (!image->isFullyLoaded() && !paused)
+				if (image->getDiscardLevel() < 0 && !paused)
 				{
 					mLastTexCallbackAddedTime.reset();
 				}
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index 3526142ff59..55d8886dafb 100644
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -629,7 +629,7 @@ class LLVOAvatar :
 
 	LLLoadedCallbackEntry::source_callback_list_t mCallbackTextureList ; 
 	BOOL mLoadedCallbacksPaused;
-	S32 mLoadedCallbackTextures; // count of fully loaded textures filled from mCallbackTextureList
+	S32 mLoadedCallbackTextures; // count of 'loaded' textures filled from mCallbackTextureList
 	LLFrameTimer mLastTexCallbackAddedTime;
 	std::set<LLUUID>	mTextureIDs;
 	//--------------------------------------------------------------------
-- 
GitLab