From 2ef2233afaae8726ed8e87d7b9b86c0d8bb86282 Mon Sep 17 00:00:00 2001 From: minerjr Date: Mon, 13 Oct 2025 21:04:25 -0300 Subject: [PATCH] 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. --- indra/llrender/llgltexture.cpp | 18 ++++++++++++++++++ indra/llrender/llgltexture.h | 7 +++++++ indra/newview/llviewerobject.cpp | 24 +++++++++++++++++++++++- indra/newview/llviewertexture.cpp | 7 ++++++- 4 files changed, 54 insertions(+), 2 deletions(-) diff --git a/indra/llrender/llgltexture.cpp b/indra/llrender/llgltexture.cpp index 87e7400a24..1143f54d1e 100644 --- a/indra/llrender/llgltexture.cpp +++ b/indra/llrender/llgltexture.cpp @@ -63,6 +63,10 @@ LLGLTexture::~LLGLTexture() void LLGLTexture::init() { mBoostLevel = LLGLTexture::BOOST_NONE; + // [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; + // [FIRE-36016] mFullWidth = 0; mFullHeight = 0; @@ -107,6 +111,20 @@ void LLGLTexture::setBoostLevel(S32 level) } } +// [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; +} +// [FIRE-36016] + void LLGLTexture::forceActive() { mTextureState = ACTIVE ; diff --git a/indra/llrender/llgltexture.h b/indra/llrender/llgltexture.h index 48132fa956..bc06784917 100644 --- a/indra/llrender/llgltexture.h +++ b/indra/llrender/llgltexture.h @@ -101,6 +101,10 @@ public: void setBoostLevel(S32 level); S32 getBoostLevel() { return mBoostLevel; } + // [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 + // [FIRE-36016] S32 getFullWidth() const { return mFullWidth; } S32 getFullHeight() const { return mFullHeight; } @@ -183,6 +187,9 @@ public: protected: S32 mBoostLevel; // enum describing priority level + // [FIRE-36016] - Re-added Store/Restore boost levels of selected objects + S32 mPrevBoostLevel; // enum describing priority level (Previous Value for BOOST_SELECTION restore) + // [FIRE-36016] U32 mFullWidth; U32 mFullHeight; bool mUseMipMaps; diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 396dd43130..81a9138939 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4336,6 +4336,14 @@ void LLViewerObject::boostTexturePriority(bool boost_children /* = true */) S32 tex_count = getNumTEs(); for (i = 0; i < tex_count; i++) { + // [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(); + } + // [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); + // [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); + } + // [FIRE-36016] } } diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 9567f55efa..9c0eb6472f 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -3150,7 +3150,12 @@ void LLViewerLODTexture::processTextureStats() // unset it immediately after we consume it if (getBoostLevel() == BOOST_SELECTED) { - setBoostLevel(BOOST_NONE); + // [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(); + // > [FIRE-36016] } }