diff options
author | Roxie Linden <roxie@lindenlab.com> | 2024-05-06 16:40:12 -0700 |
---|---|---|
committer | Roxie Linden <roxie@lindenlab.com> | 2024-05-06 16:40:12 -0700 |
commit | 4af9128db1fb65ff99d1e8086352698f46e049b4 (patch) | |
tree | 4b98d8afb138a4a1ac9f2d4b01a7d83dce314d17 /indra/llmath/llvolume.cpp | |
parent | 05b2dd913fcb1c5485ce19885e4e60f26752e6b0 (diff) | |
parent | 10aa7f4254fd04c24f15f507188705146f92ee60 (diff) |
Merge branch 'main' of https://github.com/secondlife/viewer into roxie/webrtc-voice
Diffstat (limited to 'indra/llmath/llvolume.cpp')
-rw-r--r-- | indra/llmath/llvolume.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 6d36daa92a..e694732da2 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -5592,9 +5592,9 @@ bool LLVolumeFace::cacheOptimize(bool gen_tangents) U32 stream_count = data.w.empty() ? 4 : 5; - U32 vert_count = meshopt_generateVertexRemapMulti(&remap[0], nullptr, data.p.size(), data.p.size(), mos, stream_count); + size_t vert_count = meshopt_generateVertexRemapMulti(&remap[0], nullptr, data.p.size(), data.p.size(), mos, stream_count); - if (vert_count < 65535) + if (vert_count < 65535 && vert_count != 0) { std::vector<U32> indices; indices.resize(mNumIndices); @@ -5613,6 +5613,13 @@ bool LLVolumeFace::cacheOptimize(bool gen_tangents) { U32 src_idx = i; U32 dst_idx = remap[i]; + if (dst_idx >= mNumVertices) + { + dst_idx = mNumVertices - 1; + // Shouldn't happen, figure out what gets returned in remap and why. + llassert(false); + LL_DEBUGS_ONCE("LLVOLUME") << "Invalid destination index, substituting" << LL_ENDL; + } mIndices[i] = dst_idx; mPositions[dst_idx].load3(data.p[src_idx].mV); @@ -5646,6 +5653,10 @@ bool LLVolumeFace::cacheOptimize(bool gen_tangents) } else { + if (vert_count == 0) + { + LL_WARNS_ONCE("LLVOLUME") << "meshopt_generateVertexRemapMulti failed to process a model or model was invalid" << LL_ENDL; + } // blew past the max vertex size limit, use legacy tangent generation which never adds verts createTangents(); } |