diff options
| author | Erik Kundiman <erik@megapahit.org> | 2025-04-03 06:12:38 +0800 | 
|---|---|---|
| committer | Erik Kundiman <erik@megapahit.org> | 2025-04-03 06:12:38 +0800 | 
| commit | a502f7d78ec7e3b6f9322a16311db54c22dcd38c (patch) | |
| tree | 36c9e6371ddcf3e5dc226e90098407957c4217ff | |
| parent | 15ff3eaea87e658e3606b1e6741b555ef6737524 (diff) | |
| parent | 4ddd9d1fefc3b956e19ef25cfdd199fde352437a (diff) | |
Merge remote-tracking branch 'secondlife/release/2025.03' into 2025.03
| -rw-r--r-- | indra/llmath/llvolume.cpp | 41 | 
1 files changed, 33 insertions, 8 deletions
| diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 6bf276a3cf..6335da5b62 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -5590,14 +5590,22 @@ struct MikktData      {          U32 count = face->mNumIndices; -        p.resize(count); -        n.resize(count); -        tc.resize(count); -        t.resize(count); +        try +        { +            p.resize(count); +            n.resize(count); +            tc.resize(count); +            t.resize(count); -        if (face->mWeights) +            if (face->mWeights) +            { +                w.resize(count); +            } +        } +        catch (std::bad_alloc&)          { -            w.resize(count); +            LLError::LLUserWarningMsg::showOutOfMemory(); +            LL_ERRS("LLCoros") << "Bad memory allocation in MikktData, elements count: " << count << LL_ENDL;          } @@ -5669,7 +5677,16 @@ bool LLVolumeFace::cacheOptimize(bool gen_tangents)          // and is executed on a background thread          MikktData data(this);          mikk::Mikktspace ctx(data); -        ctx.genTangSpace(); +        try +        { +            ctx.genTangSpace(); +        } +        catch (std::bad_alloc&) +        { +            LLError::LLUserWarningMsg::showOutOfMemory(); +            LL_ERRS("LLCoros") << "Bad memory allocation in MikktData::genTangSpace" << LL_ENDL; +        } +          //re-weld          meshopt_Stream mos[] = @@ -5682,7 +5699,15 @@ bool LLVolumeFace::cacheOptimize(bool gen_tangents)          };          std::vector<U32> remap; -        remap.resize(data.p.size()); +        try +        { +            remap.resize(data.p.size()); +        } +        catch (std::bad_alloc&) +        { +            LLError::LLUserWarningMsg::showOutOfMemory(); +            LL_ERRS("LLCoros") << "Failed to allocate memory for remap: " << (S32)data.p.size() << LL_ENDL; +        }          U32 stream_count = data.w.empty() ? 4 : 5; | 
