From 1f754e50908ba325c132b8d83383f7f0dbbdf793 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 6 Sep 2024 16:39:58 -0500 Subject: #2467 Fix for sim surrounds not fully loading (#2524) Also fixes some sculpts getting wrong LoD --- indra/newview/llviewertexture.cpp | 19 ++++++++++++++++--- indra/newview/llvovolume.cpp | 15 +++------------ indra/newview/llvovolume.h | 1 + 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 15b4a3aab3..99f8db00f2 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1553,6 +1553,17 @@ void LLViewerFetchedTexture::postCreateTexture() setActive(); + // rebuild any volumes that are using this texture for sculpts in case their LoD has changed + for (U32 i = 0; i < mNumVolumes[LLRender::SCULPT_TEX]; ++i) + { + LLVOVolume* volume = mVolumeList[LLRender::SCULPT_TEX][i]; + if (volume) + { + volume->mSculptChanged = true; + gPipeline.markRebuild(volume->mDrawable); + } + } + if (!needsToSaveRawImage()) { mNeedsAux = false; @@ -2647,7 +2658,7 @@ void LLViewerFetchedTexture::destroyRawImage() if (mAuxRawImage.notNull() && !needsToSaveRawImage()) { sAuxCount--; - mAuxRawImage = NULL; + mAuxRawImage = nullptr; } if (mRawImage.notNull()) @@ -2662,7 +2673,7 @@ void LLViewerFetchedTexture::destroyRawImage() } } - mRawImage = NULL; + mRawImage = nullptr; mIsRawImageValid = false; mRawDiscardLevel = INVALID_DISCARD_LEVEL; @@ -2774,7 +2785,9 @@ void LLViewerFetchedTexture::readbackRawImage() { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; - if (mGLTexturep.notNull() && mGLTexturep->getTexName() != 0 && mRawImage.isNull()) + // readback the raw image from vram if the current raw image is null or smaller than the texture + if (mGLTexturep.notNull() && mGLTexturep->getTexName() != 0 && + (mRawImage.isNull() || mRawImage->getWidth() < mGLTexturep->getWidth() || mRawImage->getHeight() < mGLTexturep->getHeight() )) { mRawImage = new LLImageRaw(); if (!mGLTexturep->readBackRaw(-1, mRawImage, false)) diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 669ccb0924..6cd38078bf 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1149,7 +1149,7 @@ void LLVOVolume::updateSculptTexture() { mSculptTexture = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, true, LLGLTexture::BOOST_SCULPTED, LLViewerTexture::LOD_TEXTURE); mSculptTexture->forceToSaveRawImage(0, F32_MAX); - mSculptTexture->addTextureStats(256.f*256.f); + mSculptTexture->setKnownDrawSize(256, 256); } mSkinInfoUnavaliable = false; @@ -1251,7 +1251,7 @@ void LLVOVolume::sculpt() discard_level = mSculptTexture->getSavedRawImageLevel(); } - if (!raw_image) + if (!raw_image || raw_image->getWidth() < mSculptTexture->getWidth() || raw_image->getHeight() < mSculptTexture->getHeight()) { // last resort, read back from GL mSculptTexture->readbackRawImage(); @@ -1338,17 +1338,8 @@ void LLVOVolume::sculpt() mSculptTexture->updateBindStatsForTester() ; } } - getVolume()->sculpt(sculpt_width, sculpt_height, sculpt_components, sculpt_data, discard_level, mSculptTexture->isMissingAsset()); - //notify rebuild any other VOVolumes that reference this sculpty volume - for (S32 i = 0; i < mSculptTexture->getNumVolumes(LLRender::SCULPT_TEX); ++i) - { - LLVOVolume* volume = (*(mSculptTexture->getVolumeList(LLRender::SCULPT_TEX)))[i]; - if (volume != this && volume->getVolume() == getVolume()) - { - gPipeline.markRebuild(volume->mDrawable, LLDrawable::REBUILD_GEOMETRY); - } - } + getVolume()->sculpt(sculpt_width, sculpt_height, sculpt_components, sculpt_data, discard_level, mSculptTexture->isMissingAsset()); } } diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index 6241bf42d6..97a5131260 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -451,6 +451,7 @@ public: private: friend class LLDrawable; friend class LLFace; + friend class LLViewerFetchedTexture; bool mFaceMappingChanged; LLFrameTimer mTextureUpdateTimer; -- cgit v1.2.3