FIRE-36016 - Re-added Store/Restore boost levels of selected objects

Re-adding the feature to store and restore texture boost levels when a user edit's an object.

When you right click on an object. All the textures assigned to it get their boost level set to BOOST_SELECTED.

For LOD textures, once the texture's ProcessStats is completed, it resets the boost level to BOOST_NONE. This can cause the texture to then be subject to Texture Bias when in low memory, where before it was possibly protected as being a higher priority texture.

Now when the boost levels is about to change to BOOST_SELECTED, it gets stored and in ProcessStats, the boost level is restored.

Issue was fixed before but was rolled back. This is just restoring this one fix.
master
minerjr 2025-10-13 21:04:25 -03:00
parent 56648715d6
commit 2ef2233afa
4 changed files with 54 additions and 2 deletions

View File

@ -63,6 +63,10 @@ LLGLTexture::~LLGLTexture()
void LLGLTexture::init()
{
mBoostLevel = LLGLTexture::BOOST_NONE;
// <FS:minerjr> [FIRE-36016] - Re-added Store/Restore boost levels of selected objects
// Added a previous boost level to allow for restoring boost after BOOST_SELECTED is applied
mPrevBoostLevel = LLGLTexture::BOOST_NONE;
// </FS:minerjr> [FIRE-36016]
mFullWidth = 0;
mFullHeight = 0;
@ -107,6 +111,20 @@ void LLGLTexture::setBoostLevel(S32 level)
}
}
// <FS:minerjr> [FIRE-36016] - Re-added Store/Restore boost levels of selected objects
// Changes the current boost level back to the previous value
void LLGLTexture::restoreBoostLevel()
{
mBoostLevel = mPrevBoostLevel;
}
// Stores the current boost level in the previous boost
void LLGLTexture::storeBoostLevel()
{
mPrevBoostLevel = mBoostLevel;
}
// </FS:minerjr> [FIRE-36016]
void LLGLTexture::forceActive()
{
mTextureState = ACTIVE ;

View File

@ -101,6 +101,10 @@ public:
void setBoostLevel(S32 level);
S32 getBoostLevel() { return mBoostLevel; }
// <FS:minerjr> [FIRE-36016] - Re-added Store/Restore boost levels of selected objects
void restoreBoostLevel(); // Now restores the mBoostLevel with the mPrevBoostLevel
void storeBoostLevel(); // Stores the current mBoostLevel in mPrevBoostLevel
// </FS:minerjr> [FIRE-36016]
S32 getFullWidth() const { return mFullWidth; }
S32 getFullHeight() const { return mFullHeight; }
@ -183,6 +187,9 @@ public:
protected:
S32 mBoostLevel; // enum describing priority level
// <FS:minerjr> [FIRE-36016] - Re-added Store/Restore boost levels of selected objects
S32 mPrevBoostLevel; // enum describing priority level (Previous Value for BOOST_SELECTION restore)
// </FS:minerjr> [FIRE-36016]
U32 mFullWidth;
U32 mFullHeight;
bool mUseMipMaps;

View File

@ -4336,6 +4336,14 @@ void LLViewerObject::boostTexturePriority(bool boost_children /* = true */)
S32 tex_count = getNumTEs();
for (i = 0; i < tex_count; i++)
{
// <FS:minerjr> [FIRE-36016] - Re-added Store/Restore boost levels of selected objects
// This fixes textures becoming blury (Esepecially with Bias > 1.0f) after an object is selected and unselected.
// If this is changing the boost level for the TEImage for the first time, store the boost level before modifying it.
if (getTEImage(i)->getBoostLevel() != LLGLTexture::BOOST_SELECTED)
{
getTEImage(i)->storeBoostLevel();
}
// </FS:minerjr> [FIRE-36016]
getTEImage(i)->setBoostLevel(LLGLTexture::BOOST_SELECTED);
}
@ -4345,7 +4353,21 @@ void LLViewerObject::boostTexturePriority(bool boost_children /* = true */)
if (sculpt_params)
{
LLUUID sculpt_id = sculpt_params->getSculptTexture();
LLViewerTextureManager::getFetchedTexture(sculpt_id, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)->setBoostLevel(LLGLTexture::BOOST_SELECTED);
// <FS:minerjr> [FIRE-36016] - Re-added Store/Restore boost levels of selected objects
//LLViewerTextureManager::getFetchedTexture(sculpt_id, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)->setBoostLevel(LLGLTexture::BOOST_SELECTED);
// This fixes textures becoming blury (Esepecially with Bias > 1.0f) after an object is selected and unselected.
// If this is changing the boost level for the sculpted for the first time, store the boost level before modifying it.
LLViewerFetchedTexture* sculptedTexture = LLViewerTextureManager::getFetchedTexture(sculpt_id, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
if (sculptedTexture)
{
// If the texture is already boost selected, don't store the boost level again. Otherwise, it will overwrite the saved boost level with itself.
if (sculptedTexture->getBoostLevel() != LLGLTexture::BOOST_SELECTED)
{
sculptedTexture->storeBoostLevel();
}
sculptedTexture->setBoostLevel(LLGLTexture::BOOST_SELECTED);
}
// </FS:minerjr> [FIRE-36016]
}
}

View File

@ -3150,7 +3150,12 @@ void LLViewerLODTexture::processTextureStats()
// unset it immediately after we consume it
if (getBoostLevel() == BOOST_SELECTED)
{
setBoostLevel(BOOST_NONE);
// <FS:minerjr> [FIRE-36016] - Re-added Store/Restore boost levels of selected objects
//setBoostLevel(BOOST_NONE);
// Restore the boost level instead of just setting to BOOST_NONE
// Can cause Sculpts and other boosted objects to lose boost and become subject to discard levels with Bias over 1.0f
restoreBoostLevel();
// </FS:minerjr>> [FIRE-36016]
}
}