summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenri Beauchamp <8734940+vldevel@users.noreply.github.com>2025-07-22 18:22:55 +0200
committerGitHub <noreply@github.com>2025-07-22 19:22:55 +0300
commit08971cd9ac4a865ccc312f8ebe381e620062339c (patch)
treecc45b9a2881932f4859178f501032236df01f8dc
parent8efc4744decd4827ebd84d864dda154ecd8c5ce0 (diff)
Fix a crash bug and bogus calculations in LLMeshRepoThread::lodReceived() (#4398, #4408)
When trying to update the rigging info for a newly received mesh LOD, a wrong usage of LLVolume::getNumFaces() is done to get the number of volume faces, causing the code to iterate over the number of faces in the underlying LLProfile instead. LLVolume::getNumVolumeFaces() must be used here. This fixes a crash bug seen with low LODs in some meshes (when the number of mesh faces is smaller than the number of faces in the LLProfile), and also properly updates the rigging info for all mesh faces, as it should, when the mesh got more faces than the LLProfile.
-rw-r--r--indra/newview/llmeshrepository.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index e7e95034b2..f25cb25517 100644
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -2362,7 +2362,13 @@ EMeshProcessingResult LLMeshRepoThread::lodReceived(const LLVolumeParams& mesh_p
LLPointer<LLVolume> volume = new LLVolume(mesh_params, LLVolumeLODGroup::getVolumeScaleFromDetail(lod));
if (volume->unpackVolumeFaces(data, data_size))
{
- if (volume->getNumFaces() > 0)
+ // Use LLVolume::getNumVolumeFaces() here and not LLVolume::getNumFaces(),
+ // because setMeshAssetLoaded() has not yet been called for this volume
+ // (it is set later in LLMeshRepository::notifyMeshLoaded()), and
+ // getNumFaces() would return the number of faces in the LLProfile
+ // instead. HB
+ S32 num_faces = volume->getNumVolumeFaces();
+ if (num_faces > 0)
{
// if we have a valid SkinInfo, cache per-joint bounding boxes for this LOD
LLPointer<LLMeshSkinInfo> skin_info = nullptr;
@@ -2376,7 +2382,7 @@ EMeshProcessingResult LLMeshRepoThread::lodReceived(const LLVolumeParams& mesh_p
}
if (skin_info.notNull() && isAgentAvatarValid())
{
- for (S32 i = 0; i < volume->getNumFaces(); ++i)
+ for (S32 i = 0; i < num_faces; ++i)
{
// NOTE: no need to lock gAgentAvatarp as the state being checked is not changed after initialization
LLVolumeFace& face = volume->getVolumeFace(i);