diff options
| author | Erik Kundiman <erik@megapahit.org> | 2026-08-18 13:57:14 +0800 |
|---|---|---|
| committer | Erik Kundiman <erik@megapahit.org> | 2026-08-18 13:57:14 +0800 |
| commit | 2fa8281b2d8ce8bdbcacf139ec674480da6c9d81 (patch) | |
| tree | ffb343fee97f21942123fd322d88fea3ef1a4811 /indra/llrender/llshadermgr.cpp | |
| parent | 742d802f073e81abc6d4cd512e58a4d03b414b83 (diff) | |
| parent | 214fa765986b4c1e1de1b917581f8508278abd8e (diff) | |
Merge branch '26.3'
Diffstat (limited to 'indra/llrender/llshadermgr.cpp')
| -rw-r--r-- | indra/llrender/llshadermgr.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index f50ce26793..fae2bd5034 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -1026,8 +1026,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 |
