SL-5161 Don't render meshes that are waiting for skin data

meow-7.2.2
Andrey Kleshchev 2023-06-22 00:53:18 +03:00
parent f0dc9ea3fd
commit 4e6303792a
4 changed files with 107 additions and 17 deletions

View File

@ -4255,6 +4255,37 @@ bool LLMeshRepository::hasPhysicsShape(const LLUUID& mesh_id)
return false;
}
bool LLMeshRepository::hasSkinInfo(const LLUUID& mesh_id)
{
if (mesh_id.isNull())
{
return false;
}
if (mThread->hasSkinInfoInHeader(mesh_id))
{
return true;
}
const LLMeshSkinInfo* skininfo = getSkinInfo(mesh_id);
if (skininfo)
{
return true;
}
return false;
}
bool LLMeshRepository::hasHeader(const LLUUID& mesh_id)
{
if (mesh_id.isNull())
{
return false;
}
return mThread->hasHeader(mesh_id);
}
bool LLMeshRepoThread::hasPhysicsShapeInHeader(const LLUUID& mesh_id)
{
LLMutexLock lock(mHeaderMutex);
@ -4271,6 +4302,29 @@ bool LLMeshRepoThread::hasPhysicsShapeInHeader(const LLUUID& mesh_id)
return false;
}
bool LLMeshRepoThread::hasSkinInfoInHeader(const LLUUID& mesh_id)
{
LLMutexLock lock(mHeaderMutex);
mesh_header_map::iterator iter = mMeshHeader.find(mesh_id);
if (iter != mMeshHeader.end() && iter->second.first > 0)
{
LLMeshHeader& mesh = iter->second.second;
if (mesh.mSkinOffset >= 0
&& mesh.mSkinSize > 0)
{
return true;
}
}
return false;
}
bool LLMeshRepoThread::hasHeader(const LLUUID& mesh_id)
{
LLMutexLock lock(mHeaderMutex);
mesh_header_map::iterator iter = mMeshHeader.find(mesh_id);
return iter != mMeshHeader.end();
}
void LLMeshRepository::uploadModel(std::vector<LLModelInstance>& data, LLVector3& scale, bool upload_textures,
bool upload_skin, bool upload_joints, bool lock_scale_if_joint_position,

View File

@ -401,6 +401,8 @@ public:
bool decompositionReceived(const LLUUID& mesh_id, U8* data, S32 data_size);
EMeshProcessingResult physicsShapeReceived(const LLUUID& mesh_id, U8* data, S32 data_size);
bool hasPhysicsShapeInHeader(const LLUUID& mesh_id);
bool hasSkinInfoInHeader(const LLUUID& mesh_id);
bool hasHeader(const LLUUID& mesh_id);
void notifyLoadedMeshes();
S32 getActualMeshLOD(const LLVolumeParams& mesh_params, S32 lod);
@ -650,6 +652,8 @@ public:
LLModel::Decomposition* getDecomposition(const LLUUID& mesh_id);
void fetchPhysicsShape(const LLUUID& mesh_id);
bool hasPhysicsShape(const LLUUID& mesh_id);
bool hasSkinInfo(const LLUUID& mesh_id);
bool hasHeader(const LLUUID& mesh_id);
void buildHull(const LLVolumeParams& params, S32 detail);
void buildPhysicsMesh(LLModel::Decomposition& decomp);

View File

@ -230,7 +230,7 @@ LLVOVolume::LLVOVolume(const LLUUID &id, const LLPCode pcode, LLViewerRegion *re
mColorChanged = FALSE;
mSpotLightPriority = 0.f;
mSkinInfoFailed = false;
mSkinInfoUnavaliable = false;
mSkinInfo = NULL;
mMediaImplList.resize(getNumTEs());
@ -1132,7 +1132,7 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams &params_in, const S32 detail, bo
if (mSkinInfo && mSkinInfo->mMeshID != volume_params.getSculptID())
{
mSkinInfo = NULL;
mSkinInfoFailed = false;
mSkinInfoUnavaliable = false;
}
if (!getVolume()->isMeshAssetLoaded())
@ -1145,13 +1145,24 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams &params_in, const S32 detail, bo
}
}
if (!mSkinInfo && !mSkinInfoFailed)
if (!mSkinInfo && !mSkinInfoUnavaliable)
{
const LLMeshSkinInfo* skin_info = gMeshRepo.getSkinInfo(volume_params.getSculptID(), this);
if (skin_info)
{
notifySkinInfoLoaded(skin_info);
}
LLUUID mesh_id = volume_params.getSculptID();
if (gMeshRepo.hasHeader(mesh_id) && !gMeshRepo.hasSkinInfo(mesh_id))
{
// If header is present but has no data about skin,
// no point fetching
mSkinInfoUnavaliable = true;
}
if (!mSkinInfoUnavaliable)
{
const LLMeshSkinInfo* skin_info = gMeshRepo.getSkinInfo(mesh_id, this);
if (skin_info)
{
notifySkinInfoLoaded(skin_info);
}
}
}
}
else // otherwise is sculptie
@ -1186,7 +1197,7 @@ void LLVOVolume::updateSculptTexture()
mSculptTexture = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
}
mSkinInfoFailed = false;
mSkinInfoUnavaliable = false;
mSkinInfo = NULL;
}
else
@ -1227,6 +1238,16 @@ void LLVOVolume::notifyMeshLoaded()
mSculptChanged = TRUE;
gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_GEOMETRY);
if (!mSkinInfo && !mSkinInfoUnavaliable)
{
// Header was loaded, update skin info state from header
LLUUID mesh_id = getVolume()->getParams().getSculptID();
if (!gMeshRepo.hasSkinInfo(mesh_id))
{
mSkinInfoUnavaliable = true;
}
}
LLVOAvatar *av = getAvatar();
if (av && !isAnimatedObject())
{
@ -1244,7 +1265,7 @@ void LLVOVolume::notifyMeshLoaded()
void LLVOVolume::notifySkinInfoLoaded(const LLMeshSkinInfo* skin)
{
mSkinInfoFailed = false;
mSkinInfoUnavaliable = false;
mSkinInfo = skin;
notifyMeshLoaded();
@ -1252,7 +1273,7 @@ void LLVOVolume::notifySkinInfoLoaded(const LLMeshSkinInfo* skin)
void LLVOVolume::notifySkinInfoUnavailable()
{
mSkinInfoFailed = true;
mSkinInfoUnavaliable = true;
mSkinInfo = nullptr;
}
@ -5589,11 +5610,21 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
std::string vobj_name = llformat("Vol%p", vobj);
bool is_mesh = vobj->isMesh();
if (is_mesh &&
((vobj->getVolume() && !vobj->getVolume()->isMeshAssetLoaded()) || !gMeshRepo.meshRezEnabled()))
{
continue;
}
if (is_mesh)
{
if ((vobj->getVolume() && !vobj->getVolume()->isMeshAssetLoaded())
|| !gMeshRepo.meshRezEnabled())
{
// Waiting for asset to fetch
continue;
}
if (!vobj->getSkinInfo() && !vobj->isSkinInfoUnavaliable())
{
// Waiting for skin info to fetch
continue;
}
}
LLVolume* volume = vobj->getVolume();
if (volume)

View File

@ -330,6 +330,7 @@ public:
BOOL setIsFlexible(BOOL is_flexible);
const LLMeshSkinInfo* getSkinInfo() const;
const bool isSkinInfoUnavaliable() const { return mSkinInfoUnavaliable; }
//convenience accessor for mesh ID (which is stored in sculpt id for legacy reasons)
const LLUUID& getMeshID() const { return getVolume()->getParams().getSculptID(); }
@ -480,7 +481,7 @@ private:
LLPointer<LLRiggedVolume> mRiggedVolume;
bool mSkinInfoFailed;
bool mSkinInfoUnavaliable;
LLConstPointer<LLMeshSkinInfo> mSkinInfo;
// statics
public: