diff options
author | Erik Kundiman <erik@megapahit.org> | 2024-04-20 14:08:23 +0800 |
---|---|---|
committer | Erik Kundiman <erik@megapahit.org> | 2024-04-20 14:08:23 +0800 |
commit | 23a35d763bca645ce628d80ebd939c979590724c (patch) | |
tree | 434e8413c209d8a29fe93ed17ea2717817660a7e /indra/llmath | |
parent | 1a4517e5af8f43433fc2547658615dce4073d9a3 (diff) | |
parent | 78174fc8658caeddfd8306ec19eb0e1c2975368e (diff) |
Merge tag '7.1.5-release'
source for viewer 7.1.5.8443591509
Diffstat (limited to 'indra/llmath')
-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 f6abc7eadd..3ae6bd4833 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -5596,9 +5596,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); @@ -5617,6 +5617,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); @@ -5650,6 +5657,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(); } |