Skip to content

Commit ed6732e

Browse files
#2315 Ensure textures are deleted when they are no longer referenced. (#2343)
* #2315 WIP -- Clean up deletion rules in texture list. Incidental decruft. * Touch up assertions. * Move mLastReferencedTimer to LLViewerMediaTexture since it's no longer used by LLViewerTexture
1 parent 16c9c47 commit ed6732e

10 files changed

+26
-174
lines changed

indra/llrender/llgltexture.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ class LLGLTexture : public LLTexture
8282
typedef enum
8383
{
8484
DELETED = 0, //removed from memory
85-
DELETION_CANDIDATE, //ready to be removed from memory
86-
INACTIVE, //not be used for the last certain period (i.e., 30 seconds).
8785
ACTIVE, //just being used, can become inactive if not being used for a certain time (10 seconds).
8886
NO_DELETE = 99 //stay in memory, can not be removed.
8987
} LLGLTextureState;

indra/newview/gltfscenemanager.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,9 @@ void GLTFSceneManager::addGLTFObject(LLViewerObject* obj, LLUUID gltf_id)
357357

358358
if (obj->mGLTFAsset)
359359
{ // object already has a GLTF asset, don't reload it
360-
llassert(std::find(mObjects.begin(), mObjects.end(), obj) != mObjects.end());
360+
361+
// TODO: below assertion fails on dupliate requests for assets -- possibly need to touch up asset loading state machine
362+
// llassert(std::find(mObjects.begin(), mObjects.end(), obj) != mObjects.end());
361363
return;
362364
}
363365

indra/newview/llappviewer.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,6 @@ extern LLVector3 gRelativeWindVec;
408408
extern U32 gPacketsIn;
409409
extern bool gPrintMessagesThisFrame;
410410

411-
extern LLUUID gBlackSquareID;
412-
413411
extern bool gRandomizeFramerate;
414412
extern bool gPeriodicSlowFrame;
415413

indra/newview/lldrawpoolavatar.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ S32 LLDrawPoolAvatar::sShadowPass = -1;
6262
S32 LLDrawPoolAvatar::sDiffuseChannel = 0;
6363
F32 LLDrawPoolAvatar::sMinimumAlpha = 0.2f;
6464

65-
LLUUID gBlackSquareID;
66-
6765
static bool is_deferred_render = false;
6866
static bool is_post_deferred_render = false;
6967

indra/newview/llface.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,6 @@ void LLFace::switchTexture(U32 ch, LLViewerTexture* new_texture)
357357
return;
358358
}
359359

360-
llassert(mTexture[ch].notNull());
361-
362360
if (ch == LLRender::DIFFUSE_MAP)
363361
{
364362
getViewerObject()->changeTEImage(mTEOffset, new_texture) ;

indra/newview/lltextureview.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@ void LLTextureView::draw()
836836
for (LLViewerTextureList::image_list_t::iterator iter = gTextureList.mImageList.begin();
837837
iter != gTextureList.mImageList.end(); )
838838
{
839-
LLPointer<LLViewerFetchedTexture> imagep = *iter++;
839+
LLViewerFetchedTexture* imagep = *iter++;
840840
if(!imagep->hasFetcher())
841841
{
842842
continue ;

indra/newview/llviewertexture.cpp

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,8 +1083,6 @@ void LLViewerFetchedTexture::init(bool firstinit)
10831083
mKeptSavedRawImageTime = 0.f;
10841084
mLastCallBackActiveTime = 0.f;
10851085
mForceCallbackFetch = false;
1086-
mInDebug = false;
1087-
mUnremovable = false;
10881086

10891087
mFTType = FTT_UNKNOWN;
10901088
}
@@ -1234,32 +1232,6 @@ bool LLViewerFetchedTexture::isDeleted()
12341232
return mTextureState == DELETED;
12351233
}
12361234

1237-
bool LLViewerFetchedTexture::isInactive()
1238-
{
1239-
return mTextureState == INACTIVE;
1240-
}
1241-
1242-
bool LLViewerFetchedTexture::isDeletionCandidate()
1243-
{
1244-
return mTextureState == DELETION_CANDIDATE;
1245-
}
1246-
1247-
void LLViewerFetchedTexture::setDeletionCandidate()
1248-
{
1249-
if(mGLTexturep.notNull() && mGLTexturep->getTexName() && (mTextureState == INACTIVE))
1250-
{
1251-
mTextureState = DELETION_CANDIDATE;
1252-
}
1253-
}
1254-
1255-
//set the texture inactive
1256-
void LLViewerFetchedTexture::setInactive()
1257-
{
1258-
if(mTextureState == ACTIVE && mGLTexturep.notNull() && mGLTexturep->getTexName() && !mGLTexturep->getBoundRecently())
1259-
{
1260-
mTextureState = INACTIVE;
1261-
}
1262-
}
12631235

12641236
bool LLViewerFetchedTexture::isFullyLoaded() const
12651237
{
@@ -1778,20 +1750,6 @@ S32 LLViewerFetchedTexture::getCurrentDiscardLevelForFetching()
17781750
return current_discard;
17791751
}
17801752

1781-
bool LLViewerFetchedTexture::setDebugFetching(S32 debug_level)
1782-
{
1783-
if(debug_level < 0)
1784-
{
1785-
mInDebug = false;
1786-
return false;
1787-
}
1788-
mInDebug = true;
1789-
1790-
mDesiredDiscardLevel = debug_level;
1791-
1792-
return true;
1793-
}
1794-
17951753
bool LLViewerFetchedTexture::isActiveFetching()
17961754
{
17971755
static LLCachedControl<bool> monitor_enabled(gSavedSettings,"DebugShowTextureInfo");

indra/newview/llviewertexture.h

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,6 @@ class LLViewerTexture : public LLGLTexture
146146

147147
virtual F32 getMaxVirtualSize() ;
148148

149-
LLFrameTimer* getLastReferencedTimer() {return &mLastReferencedTimer ;}
150-
151149
S32 getFullWidth() const { return mFullWidth; }
152150
S32 getFullHeight() const { return mFullHeight; }
153151
/*virtual*/ void setKnownDrawSize(S32 width, S32 height);
@@ -197,7 +195,6 @@ class LLViewerTexture : public LLGLTexture
197195
mutable F32 mMaxVirtualSize = 0.f; // The largest virtual size of the image, in pixels - how much data to we need?
198196
mutable S32 mMaxVirtualSizeResetCounter;
199197
mutable S32 mMaxVirtualSizeResetInterval;
200-
LLFrameTimer mLastReferencedTimer;
201198

202199
ll_face_list_t mFaceList[LLRender::NUM_TEXTURE_CHANNELS]; //reverse pointer pointing to the faces using this image as texture
203200
U32 mNumFaces[LLRender::NUM_TEXTURE_CHANNELS];
@@ -339,11 +336,6 @@ class LLViewerFetchedTexture : public LLViewerTexture
339336

340337
void setBoostLevel(S32 level) override;
341338
bool updateFetch();
342-
bool setDebugFetching(S32 debug_level);
343-
bool isInDebug() const { return mInDebug; }
344-
345-
void setUnremovable(bool value) { mUnremovable = value; }
346-
bool isUnremovable() const { return mUnremovable; }
347339

348340
void clearFetchedResults(); //clear all fetched results, for debug use.
349341

@@ -378,10 +370,6 @@ class LLViewerFetchedTexture : public LLViewerTexture
378370
const std::string& getUrl() const {return mUrl;}
379371
//---------------
380372
bool isDeleted() ;
381-
bool isInactive() ;
382-
bool isDeletionCandidate();
383-
void setDeletionCandidate() ;
384-
void setInactive() ;
385373
bool getUseDiscard() const { return mUseMipMaps && !mDontDiscard; }
386374
//---------------
387375

@@ -434,8 +422,6 @@ class LLViewerFetchedTexture : public LLViewerTexture
434422

435423
private:
436424
bool mFullyLoaded;
437-
bool mInDebug;
438-
bool mUnremovable;
439425
bool mInFastCacheList;
440426
bool mForceCallbackFetch;
441427

@@ -586,6 +572,10 @@ class LLViewerMediaTexture : public LLViewerTexture
586572
/*virtual*/ void removeFace(U32 ch, LLFace* facep) ;
587573

588574
/*virtual*/ F32 getMaxVirtualSize() ;
575+
576+
// get the timer that tracks the last time reinit was called
577+
LLFrameTimer* getLastReferencedTimer() { return &mLastReferencedTimer; }
578+
589579
private:
590580
void switchTexture(U32 ch, LLFace* facep) ;
591581
bool findFaces() ;
@@ -606,6 +596,9 @@ class LLViewerMediaTexture : public LLViewerTexture
606596
bool mIsPlaying ;
607597
U32 mUpdateVirtualSizeTime ;
608598

599+
// tracks last time reinit was called
600+
LLFrameTimer mLastReferencedTimer;
601+
609602
public:
610603
static void updateClass() ;
611604
static void cleanUpClass() ;

0 commit comments

Comments
 (0)