summaryrefslogtreecommitdiff
path: root/indra/llmath/llvolume.cpp
diff options
context:
space:
mode:
authorJonathan "Geenz" Goodman <geenz@lindenlab.com>2025-04-15 10:14:27 -0400
committerGitHub <noreply@github.com>2025-04-15 10:14:27 -0400
commitd19d44cc727b4c360ff8618c4c9375f4f10cec71 (patch)
tree46ce4ffb1a10c1203a0189918ddc536cf5a9a958 /indra/llmath/llvolume.cpp
parent42dc4501b5c66ddeb9d1fa16ee424e2de988028b (diff)
parentcf2b4dbfb280986cf859b12fd55158d7b9e0ac3d (diff)
Merge pull request #3911 from secondlife/main
Merge 2025.03 release into develop.
Diffstat (limited to 'indra/llmath/llvolume.cpp')
-rw-r--r--indra/llmath/llvolume.cpp41
1 files changed, 33 insertions, 8 deletions
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp
index 44b6e7923b..76e5e3aae9 100644
--- a/indra/llmath/llvolume.cpp
+++ b/indra/llmath/llvolume.cpp
@@ -5586,14 +5586,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;
}
@@ -5665,7 +5673,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[] =
@@ -5678,7 +5695,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;