From 87eb902f7a583667038f1618d5eb85acd7d7052b Mon Sep 17 00:00:00 2001 From: minerjr Date: Sat, 1 Mar 2025 23:00:46 -0400 Subject: [PATCH] [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer Changed the textures to divide the texture vsize by the Aspect Ratio and Fields of view. to better control when a texture needs to be scaled down. Fixed issue when low screen image size could cause an assert on the on screen console due to negative sizes(Calculated to -30 from the value and code that uses the negative location Updated the logic in LLViewerObjectList to fix the issue of mObjects being modified at possibly any time by the code it calling. --- indra/llui/llconsole.cpp | 7 ++++++- indra/newview/llface.h | 6 +++++- indra/newview/llviewerobjectlist.cpp | 15 ++++++++------- indra/newview/llviewertexturelist.cpp | 11 ++++++++++- indra/newview/llviewertexturelist.h | 5 +++++ indra/newview/llvoavatar.cpp | 11 +++++++++-- 6 files changed, 43 insertions(+), 12 deletions(-) diff --git a/indra/llui/llconsole.cpp b/indra/llui/llconsole.cpp index 82ff89e442..92620270b8 100644 --- a/indra/llui/llconsole.cpp +++ b/indra/llui/llconsole.cpp @@ -566,7 +566,12 @@ void LLConsole::Paragraph::updateLines(F32 screen_width, const LLFontGL* font, L if ( !force_resize ) { if ( mMaxWidth >= 0.0f - && mMaxWidth < screen_width ) + // [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer + //&& mMaxWidth < screen_width) + // If viewer window was made as small as possible with the console enabled, it would cause an assert error + // as the line below can go as small as -38 + && mMaxWidth < screen_width || screen_width <= 30) + // [FIRE-35081] { return; //No resize required. } diff --git a/indra/newview/llface.h b/indra/newview/llface.h index 651a4167e0..20689ee0fb 100644 --- a/indra/newview/llface.h +++ b/indra/newview/llface.h @@ -52,7 +52,11 @@ class LLDrawInfo; class LLMeshSkinInfo; const F32 MIN_ALPHA_SIZE = 1024.f; -const F32 MIN_TEX_ANIM_SIZE = 512.f; +// [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer +//const F32 MIN_TEX_ANIM_SIZE = 512.f; +// Change the min size to +const F32 MIN_TEX_ANIM_SIZE = 64.f; +// [FIRE-35081] const U8 FACE_DO_NOT_BATCH_TEXTURES = 255; class alignas(16) LLFace diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index e3a68ef5a7..45af5f228d 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -889,7 +889,7 @@ void LLViewerObjectList::updateApparentAngles(LLAgent &agent, F32 max_time) max_value = (S32)mObjects.size(); LLTimer timer; // If the number of objects since last being in here has changed (IE objects deleted, then reset the lazy update index) - if (mCurLazyUpdateIndex > max_value) + if (mCurLazyUpdateIndex >= max_value) { mCurLazyUpdateIndex = 0; } @@ -898,6 +898,12 @@ void LLViewerObjectList::updateApparentAngles(LLAgent &agent, F32 max_time) // loop over number of objects in the BIN (128), or below until we run out of time while(num_updates < NUM_BINS) { + // Moved to the first to fix up the issue of access violation if the object list chaanges size during processing. + if (i >= (S32)mObjects.size()) + { + // Reset the index if we go over the max value + i = 0; + } objectp = mObjects[i]; if (objectp != nullptr && !objectp->isDead()) { @@ -906,12 +912,7 @@ void LLViewerObjectList::updateApparentAngles(LLAgent &agent, F32 max_time) objectp->setPixelAreaAndAngle(agent); // Also sets the approx. pixel area objectp->updateTextures(); // Update the image levels of textures for this object. } - i++; - // Reset the index if we go over the max value - if (i == max_value) - { - i = 0; - } + i++; num_updates++; // Escape either if we run out of time, or loop back onto ourselves. diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index edcfdb3c9d..418876aa21 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -980,6 +980,9 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag //F32 vsize = face->getPixelArea(); //on_screen = face->mInFrustum; vsize = face->getPixelArea(); + // Apply the Aspect ratio and field of view to the vsize, this allows the texture to be in the same space as the face, IE the face has + // based around LLCamera::calculateFrustumPlanes + vsize = vsize * mAspectRatioFOVRemove; current_on_screen = face->mInFrustum; // Create a new var to store the current on screen status on_screen_count += current_on_screen; // Count the number of on sceen faces instead of using brach important_to_camera = face->mImportanceToCamera; // Store so we don't have to do 2 indirects later on @@ -1295,7 +1298,13 @@ F32 LLViewerTextureList::updateImagesFetchTextures(F32 max_time) typedef std::vector > entries_list_t; entries_list_t entries; - + // [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer + // Pre-calculate current aspect ratio and FOV so we can use to remove from the Faces used for updating the textures + // This is used per face per texture, so it can cave a bunch of divisions as well as acessing the values from + // the camera singleton. + LLViewerCamera* camera = LLViewerCamera::getInstance(); // Store the + mAspectRatioFOVRemove = 1.0f / (camera->getAspect() * ((F32)tanf(0.5f * camera->getView()))); + // [FIRE-35081] // update N textures at beginning of mImageList U32 update_count = 0; static const S32 MIN_UPDATE_COUNT = gSavedSettings.getS32("TextureFetchUpdateMinCount"); // default: 32 diff --git a/indra/newview/llviewertexturelist.h b/indra/newview/llviewertexturelist.h index 3816c32500..23e73c2ca2 100644 --- a/indra/newview/llviewertexturelist.h +++ b/indra/newview/llviewertexturelist.h @@ -235,6 +235,11 @@ public: // Fast cache stats static U32 sNumFastCacheReads; + // [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer + // Store the camera's aspect ratio and fov + F32 mAspectRatioFOVRemove; + // [FIRE-35081] + private: typedef std::map< LLTextureKey, LLPointer > uuid_map_t; uuid_map_t mUUIDMap; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 40c070515c..35d116589f 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2754,12 +2754,19 @@ LLViewerFetchedTexture *LLVOAvatar::getBakedTextureImage(const U8 te, const LLUU LL_DEBUGS("Avatar") << avString() << "get old-bake image from host " << uuid << LL_ENDL; LLHost host = getObjectHost(); result = LLViewerTextureManager::getFetchedTexture( - uuid, FTT_HOST_BAKE, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); + // [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer + //uuid, FTT_HOST_BAKE, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); + uuid, FTT_HOST_BAKE, true, LLGLTexture::BOOST_AVATAR_BAKED, LLViewerTexture::LOD_TEXTURE, 0, 0, host); + // [FIRE-35081] // [Legacy Bake] } LL_DEBUGS("Avatar") << avString() << "get server-bake image from URL " << url << LL_ENDL; result = LLViewerTextureManager::getFetchedTextureFromUrl( - url, FTT_SERVER_BAKE, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid); + // + //url, FTT_SERVER_BAKE, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid); + // Change the texture from LOD to AVATAR_BAKED. + url, FTT_SERVER_BAKE, true, LLGLTexture::BOOST_AVATAR_BAKED, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid); + // [FIRE-35081] if (result->isMissingAsset()) { result->setIsMissingAsset(false);