Merge branch 'release/2024.12-ForeverFPS' of https://github.com/secondlife/viewer

# Conflicts:
#	indra/llrender/llfontfreetype.h
master
Ansariel 2025-02-26 10:04:47 +01:00
commit e518cba882
16 changed files with 45 additions and 22 deletions

View File

@ -23,4 +23,4 @@ jobs:
path-to-signatures: signatures.json
remote-organization-name: secondlife
remote-repository-name: cla-signatures
allowlist: callum@mbp.localdomain
allowlist: callum@mbp.localdomain,rye@lindenlab.com

View File

@ -141,6 +141,7 @@ bool LLFontBitmapCache::nextOpenPos(S32 width, S32& pos_x, S32& pos_y, EFontGlyp
bitmap_num = getNumBitmaps(bitmap_type) - 1;
mCurrentOffsetX[bitmap_idx] += width + 1;
mGeneration++;
return true;
}
@ -168,6 +169,7 @@ void LLFontBitmapCache::reset()
mBitmapWidth = 0;
mBitmapHeight = 0;
mGeneration++;
}
//static

View File

@ -63,6 +63,7 @@ public:
U32 getNumBitmaps(EFontGlyphType bitmapType) const { return (bitmapType < EFontGlyphType::Count) ? static_cast<U32>(mImageRawVec[static_cast<U32>(bitmapType)].size()) : 0U; }
S32 getBitmapWidth() const { return mBitmapWidth; }
S32 getBitmapHeight() const { return mBitmapHeight; }
S32 getCacheGeneration() const { return mGeneration; }
protected:
static U32 getNumComponents(EFontGlyphType bitmap_type);
@ -74,6 +75,7 @@ private:
S32 mCurrentOffsetY[static_cast<U32>(EFontGlyphType::Count)] = { 1 };
S32 mMaxCharWidth = 0;
S32 mMaxCharHeight = 0;
S32 mGeneration = 0;
std::vector<LLPointer<LLImageRaw>> mImageRawVec[static_cast<U32>(EFontGlyphType::Count)];
std::vector<LLPointer<LLImageGL>> mImageGLVec[static_cast<U32>(EFontGlyphType::Count)];
};

View File

@ -149,7 +149,6 @@ LLFontFreetype::LLFontFreetype()
mIsFallback(false),
mFTFace(NULL),
mRenderGlyphCount(0),
mAddGlyphCount(0),
mStyle(0),
mPointSize(0)
{
@ -671,7 +670,6 @@ LLFontGlyphInfo* LLFontFreetype::addGlyphFromFont(const LLFontFreetype *fontp, l
S32 pos_x, pos_y;
U32 bitmap_num;
mFontBitmapCachep->nextOpenPos(width, pos_x, pos_y, bitmap_glyph_type, bitmap_num);
mAddGlyphCount++;
LLFontGlyphInfo* gi = new LLFontGlyphInfo(glyph_index, requested_glyph_type);
gi->mXBitmapOffset = pos_x;

View File

@ -166,7 +166,6 @@ public:
void setStyle(U8 style);
U8 getStyle() const;
S32 getAddedGlyphs() const { return mAddGlyphCount; }
private:
void resetBitmapCache();
@ -206,7 +205,6 @@ private:
mutable LLFontBitmapCache* mFontBitmapCachep;
mutable S32 mRenderGlyphCount;
mutable S32 mAddGlyphCount;
// <FS:ND> Save X-kerning data, so far only for all glyphs with index small than 256 (to not waste too much memory)
// right now it is 256 slots with 256 glyphs each, maybe consider splitting it into smaller slices to use less memory if we

View File

@ -110,9 +110,10 @@ S32 LLFontGL::getNumFaces(const std::string& filename)
return mFontFreetype->getNumFaces(filename);
}
S32 LLFontGL::getKnownGlyphCount() const
S32 LLFontGL::getCacheGeneration() const
{
return mFontFreetype ? mFontFreetype->getAddedGlyphs() : 0;
const LLFontBitmapCache* font_bitmap_cache = mFontFreetype->getFontBitmapCache();
return font_bitmap_cache->getCacheGeneration();
}
S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, const LLRect& rect, const LLColor4 &color, HAlign halign, VAlign valign, U8 style,

View File

@ -90,7 +90,7 @@ public:
bool loadFace(const std::string& filename, F32 point_size, const F32 vert_dpi, const F32 horz_dpi, bool is_fallback, S32 face_n);
S32 getNumFaces(const std::string& filename);
S32 getKnownGlyphCount() const;
S32 getCacheGeneration() const;
S32 render(const LLWString &text, S32 begin_offset,
const LLRect& rect,

View File

@ -148,7 +148,7 @@ S32 LLFontVertexBuffer::render(
|| mLastHorizDPI != LLFontGL::sHorizDPI
|| mLastOrigin != LLFontGL::sCurOrigin
|| mLastResGeneration != LLFontGL::sResolutionGeneration
|| mLastFontGlyphCount != fontp->getKnownGlyphCount())
|| mLastFontCacheGen != fontp->getCacheGeneration())
{
genBuffers(fontp, text, begin_offset, x, y, color, halign, valign,
style, shadow, max_chars, max_pixels, right_x, use_ellipses, use_color);
@ -180,6 +180,9 @@ void LLFontVertexBuffer::genBuffers(
{
// todo: add a debug build assert if this triggers too often for to long?
mBufferList.clear();
// Save before rendreing, it can change mid-render,
// so will need to rerender previous characters
mLastFontCacheGen = fontp->getCacheGeneration();
gGL.beginList(&mBufferList);
mChars = fontp->render(text, begin_offset, x, y, color, halign, valign,
@ -204,7 +207,6 @@ void LLFontVertexBuffer::genBuffers(
mLastHorizDPI = LLFontGL::sHorizDPI;
mLastOrigin = LLFontGL::sCurOrigin;
mLastResGeneration = LLFontGL::sResolutionGeneration;
mLastFontGlyphCount = fontp->getKnownGlyphCount();
if (right_x)
{

View File

@ -122,7 +122,7 @@ private:
// Adding new characters to bitmap cache can alter value from getBitmapWidth();
// which alters whole string. So rerender when new characters were added to cache.
S32 mLastFontGlyphCount = 0;
S32 mLastFontCacheGen = 0;
static bool sEnableBufferCollection;
};

View File

@ -2105,7 +2105,7 @@ void LLFolderView::onIdleUpdateMenu(void* user_data)
self->updateMenuOptions(menu);
menu->needsArrange(); // update menu height if needed
}
gIdleCallbacks.deleteFunction(onIdleUpdateMenu, NULL);
gIdleCallbacks.deleteFunction(onIdleUpdateMenu, self);
}
bool LLFolderView::isFolderSelected()

View File

@ -255,7 +255,7 @@ void main()
shadow = sampleDirectionalShadow(pos.xyz, norm.xyz, distort);
#endif
vec3 sunlit_linear = srgb_to_linear(sunlit);
vec3 sunlit_linear = sunlit;
float fade = 1;
#ifdef TRANSPARENT_WATER
float depth = texture(depthMap, distort).r;
@ -317,7 +317,7 @@ void main()
pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, normalize(wavef+up*max(dist, 32.0)/32.0*(1.0-vdu)), v, normalize(light_dir), nl, diffPunc, specPunc);
vec3 punctual = clamp(nl * (diffPunc + specPunc), vec3(0), vec3(10)) * sunlit_linear * shadow;
vec3 punctual = clamp(nl * (diffPunc + specPunc), vec3(0), vec3(10)) * sunlit_linear * shadow * atten;
radiance *= df2.y;
//radiance = toneMapNoExposure(radiance);
vec3 color = vec3(0);

View File

@ -356,8 +356,9 @@ void GLTFSceneManager::addGLTFObject(LLViewerObject* obj, LLUUID gltf_id)
llassert(obj->getVolume()->getParams().getSculptID() == gltf_id);
llassert(obj->getVolume()->getParams().getSculptType() == LL_SCULPT_TYPE_GLTF);
if (obj->mGLTFAsset)
{ // object already has a GLTF asset, don't reload it
if (obj->mGLTFAsset || obj->mIsGLTFAssetMissing )
{
// object already has a GLTF asset or load failed, don't reload it
// TODO: below assertion fails on dupliate requests for assets -- possibly need to touch up asset loading state machine
// llassert(std::find(mObjects.begin(), mObjects.end(), obj) != mObjects.end());
@ -398,16 +399,19 @@ void GLTFSceneManager::onGLTFBinLoadComplete(const LLUUID& id, LLAssetType::ETyp
}
else
{
LL_WARNS("GLTF") << "Failed to prepare GLTF asset: " << id << LL_ENDL;
LL_WARNS("GLTF") << "Failed to prepare GLTF asset: " << id << ". Marking as missing." << LL_ENDL;
obj->mIsGLTFAssetMissing = true;
obj->mGLTFAsset = nullptr;
}
}
}
obj->unref(); // todo: use LLPointer
}
}
else
{
LL_WARNS("GLTF") << "Failed to load GLTF asset: " << id << LL_ENDL;
LL_WARNS("GLTF") << "Failed to load GLTF asset: " << id << ". Marking as missing." << LL_ENDL;
obj->mIsGLTFAssetMissing = true;
obj->unref();
}
});
@ -446,7 +450,8 @@ void GLTFSceneManager::onGLTFLoadComplete(const LLUUID& id, LLAssetType::EType a
}
else
{
LL_WARNS("GLTF") << "Buffer URI is not a valid UUID: " << buffer.mUri << LL_ENDL;
LL_WARNS("GLTF") << "Buffer URI is not a valid UUID: " << buffer.mUri << " for asset id: " << id << ". Marking as missing." << LL_ENDL;
obj->mIsGLTFAssetMissing = true;
obj->unref();
return;
}
@ -455,7 +460,8 @@ void GLTFSceneManager::onGLTFLoadComplete(const LLUUID& id, LLAssetType::EType a
}
else
{
LL_WARNS("GLTF") << "Failed to load GLTF asset: " << id << LL_ENDL;
LL_WARNS("GLTF") << "Failed to load GLTF asset: " << id << ". Marking as missing." << LL_ENDL;
obj->mIsGLTFAssetMissing = true;
obj->unref();
}
}
@ -517,6 +523,7 @@ void GLTFSceneManager::update()
if (mUploadingObject)
{
mUploadingObject->mGLTFAsset = nullptr;
mUploadingObject->mIsGLTFAssetMissing = false;
mUploadingObject->setGLTFAsset(assetId);
mUploadingObject->markForUpdate();
mUploadingObject = nullptr;

View File

@ -226,7 +226,7 @@ void LLDrawPoolWater::renderPostDeferred(S32 pass)
else if (tex_b && !tex_a)
{
shader->bindTexture(LLViewerShaderMgr::BUMP_MAP, tex_b);
tex_a->setFilteringOption(filter_mode);
tex_b->setFilteringOption(filter_mode);
blend_factor = 0; // only one tex provided, no blending
}
else if (tex_b != tex_a)

View File

@ -80,6 +80,17 @@ void LLHeroProbeManager::update()
return;
}
// Part of a hacky workaround to fix #3331.
// For some reason clearing shaders will cause mirrors to actually work.
// There's likely some deeper state issue that needs to be resolved.
// - Geenz 2025-02-25
if (!mInitialized && LLStartUp::getStartupState() > STATE_PRECACHE)
{
LLViewerShaderMgr::instance()->clearShaderCache();
LLViewerShaderMgr::instance()->setShaders();
mInitialized = true;
}
LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY;
llassert(!gCubeSnapshot); // assert a snapshot is not in progress
if (LLAppViewer::instance()->logoutRequestSent())

View File

@ -144,6 +144,7 @@ private:
std::vector<LLPointer<LLVOVolume>> mHeroVOList;
LLPointer<LLVOVolume> mNearestHero;
// Part of a hacky workaround to fix #3331.
bool mInitialized = false;
};

View File

@ -779,6 +779,7 @@ public:
// Associated GLTF Asset
std::shared_ptr<LL::GLTF::Asset> mGLTFAsset;
bool mIsGLTFAssetMissing = false;
// Pipeline classes
LLPointer<LLDrawable> mDrawable;