summaryrefslogtreecommitdiff
path: root/indra/llrender/llshadermgr.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2026-07-16 19:22:02 +0300
committerAndrey Lihatskiy <alihatskiy@productengine.com>2026-07-16 19:22:02 +0300
commit72581ab99d2e891821f5266330ecd8a58a277eb7 (patch)
tree528629c8943a400bc1a6186b49cdabdb4b8ed507 /indra/llrender/llshadermgr.cpp
parentf5e788b1b4ff5fb45f20ee5fa5daad7cca42069f (diff)
parent1577ca1724787fdc0f0317ade3dab8ea3c5df7e7 (diff)
Merge branch 'release/26.3' into marchcat/slua-26.3
# Conflicts: # .github/workflows/build.yaml # autobuild.xml # indra/llcommon/llsys.cpp # indra/llrender/llimagegl.cpp # indra/llrender/llimagegl.h # indra/newview/CMakeLists.txt # indra/newview/featuretable.txt # indra/newview/featuretable_linux.txt # indra/newview/featuretable_mac.txt # indra/newview/llvoavatar.cpp # indra/newview/llvoiceclient.cpp # indra/newview/llvoicevivox.cpp # indra/newview/viewer_manifest.py
Diffstat (limited to 'indra/llrender/llshadermgr.cpp')
-rw-r--r--indra/llrender/llshadermgr.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp
index f6738364a6..d8a620cf5b 100644
--- a/indra/llrender/llshadermgr.cpp
+++ b/indra/llrender/llshadermgr.cpp
@@ -1023,8 +1023,23 @@ void LLShaderMgr::initShaderCache(bool enabled, const LLUUID& old_cache_version,
llifstream instream(meta_out_path, std::ifstream::in | std::ifstream::binary);
LLSD in_data;
- // todo: this is likely very expensive to parse, should use binary
- LLSDSerialize::fromBinary(in_data, instream, LLSDSerialize::SIZE_UNLIMITED);
+ try
+ {
+ LLSDSerialize::fromBinary(in_data, instream, LLSDSerialize::SIZE_UNLIMITED);
+ }
+ catch( std::bad_alloc& )
+ {
+ // Try to get a bit more memory back before we try to clear the cache.
+ in_data.clear();
+ // Just in case it was somehow the cause, clear cache.
+ clearShaderCache();
+ // If user run out of memory this early in init,
+ // we don't want to keep going just to crash again.
+ // Notify user and close.
+ LLError::LLUserWarningMsg::showOutOfMemory();
+ LL_ERRS("ShaderMgr") << "Failed to parse shader cache metadata, potentially due to size. Purged cache." << LL_ENDL;
+ return;
+ }
instream.close();
if (old_cache_version == current_cache_version