From 1727c4d26429dd256fb2cd90fa83085e976794cc Mon Sep 17 00:00:00 2001 From: Rye Date: Fri, 24 Oct 2025 01:38:56 -0400 Subject: Reintroduce llappearanceutility to viewer tree from archive/develop Signed-off-by: Rye --- indra/llappearance/lltexlayer.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'indra/llappearance/lltexlayer.cpp') diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp index b3800e6981..389efe47a9 100644 --- a/indra/llappearance/lltexlayer.cpp +++ b/indra/llappearance/lltexlayer.cpp @@ -435,6 +435,31 @@ const std::string LLTexLayerSet::getBodyRegionName() const return mInfo->mBodyRegion; } +// virtual +void LLTexLayerSet::asLLSD(LLSD& sd) const +{ + sd["visible"] = LLSD::Boolean(isVisible()); + LLSD layer_list_sd; + layer_list_t::const_iterator layer_iter = mLayerList.begin(); + layer_list_t::const_iterator layer_end = mLayerList.end(); + for(; layer_iter != layer_end; ++layer_iter) + { + LLSD layer_sd; + LLTexLayerInterface* layer = (*layer_iter); + if (layer) + { + layer->asLLSD(layer_sd); + } + layer_list_sd.append(layer_sd); + } + LLSD mask_list_sd; + LLSD info_sd; + sd["layers"] = layer_list_sd; + sd["masks"] = mask_list_sd; + sd["info"] = info_sd; +} + + void LLTexLayerSet::destroyComposite() { if( mComposite ) -- cgit v1.3 From 79ca9eecfcc483fa4f89fc99466f4b93a2343211 Mon Sep 17 00:00:00 2001 From: Andrey Lihatskiy Date: Mon, 17 Aug 2026 19:30:30 +0300 Subject: #6141 #6142 Prevent morph mask cache allocation leaks --- indra/llappearance/lltexlayer.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'indra/llappearance/lltexlayer.cpp') diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp index 5a02dfe716..45f3e8dcd2 100644 --- a/indra/llappearance/lltexlayer.cpp +++ b/indra/llappearance/lltexlayer.cpp @@ -1430,6 +1430,15 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC // We should only be doing this when we believe something has changed with respect to the user's appearance. { LL_DEBUGS("Morph") << "gl alpha cache of morph mask not found, doing readback: " << getName() << LL_ENDL; + + // Replace the cached mask without leaking its old allocation. + alpha_cache_t::iterator cached = mAlphaCache.find(cache_index); + if (cached != mAlphaCache.end()) + { + ll_aligned_free_32(cached->second); + mAlphaCache.erase(cached); + } + // clear out a slot if we have filled our cache S32 max_cache_entries = getTexLayerSet()->getAvatarAppearance()->isSelf() ? 4 : 1; while ((S32)mAlphaCache.size() >= max_cache_entries) @@ -1466,6 +1475,7 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC U8* temp = (U8*)ll_aligned_malloc_32(mem_size << 2); // allocate same size, but RGBA if (!temp) { + ll_aligned_free_32(alpha_data); LLError::LLUserWarningMsg::showOutOfMemory(); LL_ERRS() << "Failed to allocate temporary memory for morph texture readback: " << (S32)(mem_size << 2) << LL_ENDL; return; @@ -1508,6 +1518,7 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC U8* temp_data = (U8*)ll_aligned_malloc_32(mem_size * TEMP_BYTES_PER_PIXEL); if (!temp_data) { + ll_aligned_free_32(alpha_data); LLError::LLUserWarningMsg::showOutOfMemory(); LL_ERRS() << "Failed to allocate temporary memory for morph texture: " << (S32)(mem_size * TEMP_BYTES_PER_PIXEL) << LL_ENDL; return; -- cgit v1.3