From e0c4304e4aaebcaaca3897e26232ffa854310b0b Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 19 Apr 2022 21:15:27 +0300 Subject: [PATCH 01/12] Restored SL-15400, it got lost in an automatic merge Pausing clouds should not pause water --- indra/newview/lldrawpoolwater.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index 6762b38c39..a84f62036e 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -624,18 +624,10 @@ void LLDrawPoolWater::renderWater() shader->uniform3fv(LLShaderMgr::WATER_SPECULAR, 1, light_diffuse.mV); shader->uniform1f(LLShaderMgr::WATER_SPECULAR_EXP, light_exp); - if (LLEnvironment::instance().isCloudScrollPaused()) - { - static const std::array zerowave {{0.0f, 0.0f}}; - shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR1, 1, zerowave.data()); - shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR2, 1, zerowave.data()); - } - else - { - shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR1, 1, pwater->getWave1Dir().mV); - shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR2, 1, pwater->getWave2Dir().mV); - } + shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR1, 1, pwater->getWave1Dir().mV); + shader->uniform2fv(LLShaderMgr::WATER_WAVE_DIR2, 1, pwater->getWave2Dir().mV); + shader->uniform3fv(LLShaderMgr::WATER_LIGHT_DIR, 1, light_dir.mV); shader->uniform3fv(LLShaderMgr::WATER_NORM_SCALE, 1, pwater->getNormalScale().mV); From cf7bc4406e983b3779db0bffff8057b36702cf8d Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 20 Apr 2022 23:15:04 +0300 Subject: [PATCH 02/12] SL-17159 Crash initializing LLInstanceTrackerPrivate --- indra/newview/llappviewer.cpp | 30 +++++++++++++++++++++++++----- indra/newview/llappviewer.h | 15 +++++++-------- indra/newview/llstartup.cpp | 14 +------------- 3 files changed, 33 insertions(+), 26 deletions(-) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 787503a6e4..f89ab586d5 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -637,6 +637,7 @@ LLAppViewer::LLAppViewer() mLogoutMarkerFile(), mReportedCrash(false), mNumSessions(0), + mGeneralThreadPool(nullptr), mPurgeCache(false), mPurgeCacheOnExit(false), mPurgeUserDataOnExit(false), @@ -1712,11 +1713,6 @@ void LLAppViewer::flushLFSIO() bool LLAppViewer::cleanup() { - // Since we don't know what functions are going to be queued by - // onCleanup(), we have to assume they might rely on some of the things - // we're about to destroy below. Run them first. - mOnCleanup(); - LLAtmosphere::cleanupClass(); //ditch LLVOAvatarSelf instance @@ -2070,6 +2066,10 @@ bool LLAppViewer::cleanup() sTextureCache->shutdown(); sImageDecodeThread->shutdown(); sPurgeDiskCacheThread->shutdown(); + if (mGeneralThreadPool) + { + mGeneralThreadPool->close(); + } sTextureFetch->shutDownTextureCacheThread() ; sTextureFetch->shutDownImageDecodeThread() ; @@ -2094,6 +2094,8 @@ bool LLAppViewer::cleanup() mFastTimerLogThread = NULL; delete sPurgeDiskCacheThread; sPurgeDiskCacheThread = NULL; + delete mGeneralThreadPool; + mGeneralThreadPool = NULL; if (LLFastTimerView::sAnalyzePerformance) { @@ -2179,6 +2181,24 @@ bool LLAppViewer::cleanup() return true; } +void LLAppViewer::initGeneralThread() +{ + if (mGeneralThreadPool) + { + return; + } + + LLSD poolSizes{ gSavedSettings.getLLSD("ThreadPoolSizes") }; + LLSD sizeSpec{ poolSizes["General"] }; + LLSD::Integer poolSize{ sizeSpec.isInteger() ? sizeSpec.asInteger() : 3 }; + LL_DEBUGS("ThreadPool") << "Instantiating General pool with " + << poolSize << " threads" << LL_ENDL; + // We don't want anyone, especially the main thread, to have to block + // due to this ThreadPool being full. + mGeneralThreadPool = new LL::ThreadPool("General", poolSize, 1024 * 1024); + mGeneralThreadPool->start(); +} + bool LLAppViewer::initThreads() { static const bool enable_threads = true; diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index d807cf9765..a86fa7d873 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -63,6 +63,11 @@ class LLViewerJoystick; class LLPurgeDiskCacheThread; class LLViewerRegion; +namespace LL +{ + class ThreadPool; +} + extern LLTrace::BlockTimerStatHandle FTM_FRAME; class LLAppViewer : public LLApp @@ -201,13 +206,7 @@ public: void addOnIdleCallback(const boost::function& cb); // add a callback to fire (once) when idle - typedef boost::signals2::signal cleanup_signal_t; - cleanup_signal_t mOnCleanup; - boost::signals2::connection onCleanup(const cleanup_signal_t::slot_type& cb) - { - return mOnCleanup.connect(cb); - } - + void initGeneralThread(); void purgeUserDataOnExit() { mPurgeUserDataOnExit = true; } void purgeCache(); // Clear the local cache. void purgeCacheImmediate(); //clear local cache immediately. @@ -269,7 +268,6 @@ private: void idle(); void idleShutdown(); // update avatar SLID and display name caches - void idleExperienceCache(); void idleNameCache(); void idleNetwork(); @@ -298,6 +296,7 @@ private: static LLImageDecodeThread* sImageDecodeThread; static LLTextureFetch* sTextureFetch; static LLPurgeDiskCacheThread* sPurgeDiskCacheThread; + LL::ThreadPool* mGeneralThreadPool; S32 mNumSessions; diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 9782881f0e..8912d1cff1 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1496,19 +1496,7 @@ bool idle_startup() display_startup(); // start up the ThreadPool we'll use for textures et al. - { - LLSD poolSizes{ gSavedSettings.getLLSD("ThreadPoolSizes") }; - LLSD sizeSpec{ poolSizes["General"] }; - LLSD::Integer poolSize{ sizeSpec.isInteger()? sizeSpec.asInteger() : 3 }; - LL_DEBUGS("ThreadPool") << "Instantiating General pool with " - << poolSize << " threads" << LL_ENDL; - // We don't want anyone, especially the main thread, to have to block - // due to this ThreadPool being full. - auto pool = new LL::ThreadPool("General", poolSize, 1024*1024); - pool->start(); - // Once we start shutting down, destroy this ThreadPool. - LLAppViewer::instance()->onCleanup([pool](){ delete pool; }); - } + LLAppViewer::instance()->initGeneralThread(); // Initialize global class data needed for surfaces (i.e. textures) LL_DEBUGS("AppInit") << "Initializing sky..." << LL_ENDL; From ffdc04f5d2b2d952ace912a473b11f4305e9d057 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 21 Apr 2022 22:58:30 +0300 Subject: [PATCH 03/12] SL-17040 Crash due to LLWord not existing LLWord should persist till the end due to wide usage. --- indra/newview/llappviewer.cpp | 3 ++- indra/newview/llstartup.cpp | 2 +- indra/newview/llworld.cpp | 3 +-- indra/newview/llworld.h | 4 +++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index f89ab586d5..a63203f3cb 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -2161,6 +2161,7 @@ bool LLAppViewer::cleanup() LLEnvironment::deleteSingleton(); LLSelectMgr::deleteSingleton(); LLViewerEventRecorder::deleteSingleton(); + LLWorld::deleteSingleton(); // It's not at first obvious where, in this long sequence, a generic cleanup // call OUGHT to go. So let's say this: as we migrate cleanup from @@ -5421,7 +5422,7 @@ void LLAppViewer::disconnectViewer() // Now we just ask the LLWorld singleton to cleanly shut down. if(LLWorld::instanceExists()) { - LLWorld::getInstance()->destroyClass(); + LLWorld::getInstance()->resetClass(); } LLVOCache::deleteSingleton(); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 8912d1cff1..5df8cd9cb0 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -2841,7 +2841,7 @@ void reset_login() gAgentWearables.cleanup(); gAgentCamera.cleanup(); gAgent.cleanup(); - LLWorld::getInstance()->destroyClass(); + LLWorld::getInstance()->resetClass(); if ( gViewerWindow ) { // Hide menus and normal buttons diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 82629fd737..8abb49fba8 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -113,7 +113,7 @@ LLWorld::LLWorld() : } -void LLWorld::destroyClass() +void LLWorld::resetClass() { mHoleWaterObjects.clear(); gObjectList.destroy(); @@ -135,7 +135,6 @@ void LLWorld::destroyClass() LLDrawable::incrementVisible(); LLSceneMonitor::deleteSingleton(); - LLWorld::deleteSingleton(); } diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h index 69f2df4203..5c43cdf4e2 100644 --- a/indra/newview/llworld.h +++ b/indra/newview/llworld.h @@ -64,7 +64,9 @@ class LLWorld : public LLSimpleton public: LLWorld(); - void destroyClass(); + // Clear any objects, regions + // Prepares class to be reused or destroyed + void resetClass(); LLViewerRegion* addRegion(const U64 ®ion_handle, const LLHost &host); // safe to call if already present, does the "right thing" if From 55179387c7481d3b4ae34f3a53e0256d2705733b Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 25 Apr 2022 15:27:39 -0500 Subject: [PATCH 04/12] SL-17236 For real this time, maintain legacy draw order of alpha rigged meshes, batching be damned. --- indra/newview/llvovolume.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 35c415f9db..126a25115d 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -5943,7 +5943,6 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) // for rigged set, add weights and disable alpha sorting (rigged items use depth buffer) extra_mask |= LLVertexBuffer::MAP_WEIGHT4; - alpha_sort = FALSE; rigged = TRUE; } @@ -6198,8 +6197,11 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace if (rigged) { - //sort faces by things that break batches, including avatar and mesh id - std::sort(faces, faces + face_count, CompareBatchBreakerRigged()); + if (!distance_sort) // <--- alpha "sort" rigged faces by maintaining original draw order + { + //sort faces by things that break batches, including avatar and mesh id + std::sort(faces, faces + face_count, CompareBatchBreakerRigged()); + } } else if (!distance_sort) { @@ -6234,11 +6236,6 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace texture_index_channels = gDeferredAlphaProgram.mFeatures.mIndexedTextureChannels; } - if (rigged) - { //don't attempt distance sorting on rigged meshes, not likely to succeed and breaks batches - distance_sort = FALSE; - } - if (distance_sort) { buffer_index = -1; From bafa869c21cb8b329f94be6fa930a43d11699082 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 25 Apr 2022 15:58:07 -0500 Subject: [PATCH 05/12] SL-17239 Override face bounding box with avatar bounding box for rigged meshes when calculating virtual size. --- indra/newview/llface.cpp | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index b4f4d52014..d1e2b8b93d 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -2364,14 +2364,35 @@ F32 LLFace::getTextureVirtualSize() BOOL LLFace::calcPixelArea(F32& cos_angle_to_view_dir, F32& radius) { - LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE + LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE; //VECTORIZE THIS //get area of circle around face - LLVector4a center; - center.load3(getPositionAgent().mV); - LLVector4a size; - size.setSub(mExtents[1], mExtents[0]); + + LLVector4a center; + LLVector4a size; + + + if (isState(LLFace::RIGGED)) + { + //override with avatar bounding box + LLVOAvatar* avatar = mVObjp->getAvatar(); + if (avatar) + { + center.load3(avatar->getPositionAgent().mV); + const LLVector4a* exts = avatar->mDrawable->getSpatialExtents(); + size.setSub(exts[1], exts[0]); + } + else + { + return false; + } + } + else + { + center.load3(getPositionAgent().mV); + size.setSub(mExtents[1], mExtents[0]); + } size.mul(0.5f); LLViewerCamera* camera = LLViewerCamera::getInstance(); From 436544a51a99da007cdb702cee338ffb85da85a5 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 26 Apr 2022 14:43:55 -0500 Subject: [PATCH 06/12] SL-17086 Fix for bad lighting in upload preview render. --- indra/newview/app_settings/settings.xml | 6 ++-- .../shaders/class1/objects/previewV.glsl | 29 ++----------------- 2 files changed, 6 insertions(+), 29 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index a6dce3cceb..1a75456725 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -8110,9 +8110,9 @@ Color4 Value - 1.0 - 1.0 - 1.0 + 0.33 + 0.33 + 0.33 1.0 diff --git a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl index 4bb588335a..5886f47cbc 100644 --- a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl @@ -51,30 +51,6 @@ float calcDirectionalLight(vec3 n, vec3 l) return a; } - -float calcLocalLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight) -{ - //get light vector - vec3 lv = lp.xyz-v; - - //get distance - float d = length(lv); - - //normalize light vector - lv *= 1.0/d; - - //distance attenuation - float da = clamp(1.0/(la * d), 0.0, 1.0); - - // spotlight coefficient. - float spot = max(dot(-ln, lv), is_pointlight); - da *= spot*spot; // GL_SPOT_EXPONENT=2 - - //angular attenuation - da *= calcDirectionalLight(n, lv); - - return da; -} //==================================================================================================== @@ -91,7 +67,8 @@ void main() // Collect normal lights (need to be divided by two, as we later multiply by 2) col.rgb += light_diffuse[1].rgb * calcDirectionalLight(norm, light_position[1].xyz); - col.rgb += light_diffuse[2].rgb*calcLocalLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].z); - col.rgb += light_diffuse[3].rgb*calcLocalLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].z); + col.rgb += light_diffuse[2].rgb * calcDirectionalLight(norm, light_position[2].xyz); + col.rgb += light_diffuse[3].rgb * calcDirectionalLight(norm, light_position[3].xyz); + vertex_color = col*color; } From a00a569ac85b5a9e3198444eee9919af4e7e4a72 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 26 Apr 2022 16:38:47 -0500 Subject: [PATCH 07/12] SL-17276 Potential fix for crash on shutdown on mac. --- indra/newview/llspatialpartition.cpp | 1 + indra/newview/llvieweroctree.cpp | 10 ++++++++-- indra/newview/llvieweroctree.h | 4 ++++ indra/newview/llvocache.cpp | 7 +++++++ indra/newview/llvocache.h | 1 + 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 5c648c11e1..0d53950889 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -852,6 +852,7 @@ LLSpatialPartition::LLSpatialPartition(U32 data_mask, BOOL render_by_group, U32 LLSpatialPartition::~LLSpatialPartition() { + cleanup(); } LLSpatialGroup *LLSpatialPartition::put(LLDrawable *drawablep, BOOL was_visible) diff --git a/indra/newview/llvieweroctree.cpp b/indra/newview/llvieweroctree.cpp index 5eda75753e..87e296012d 100644 --- a/indra/newview/llvieweroctree.cpp +++ b/indra/newview/llvieweroctree.cpp @@ -1325,8 +1325,13 @@ LLViewerOctreePartition::LLViewerOctreePartition() : LLViewerOctreePartition::~LLViewerOctreePartition() { - delete mOctree; - mOctree = NULL; + cleanup(); +} + +void LLViewerOctreePartition::cleanup() +{ + delete mOctree; + mOctree = nullptr; } BOOL LLViewerOctreePartition::isOcclusionEnabled() @@ -1334,6 +1339,7 @@ BOOL LLViewerOctreePartition::isOcclusionEnabled() return mOcclusionEnabled || LLPipeline::sUseOcclusion > 2; } + //----------------------------------------------------------------------------------- //class LLViewerOctreeCull definitions //----------------------------------------------------------------------------------- diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index 11ba7e4f1e..e6974b0f84 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -352,6 +352,10 @@ public: virtual S32 cull(LLCamera &camera, bool do_occlusion) = 0; BOOL isOcclusionEnabled(); +protected: + // MUST call from destructor of any derived classes (SL-17276) + void cleanup(); + public: U32 mPartitionType; U32 mDrawableType; diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index e10a9f9bcb..db8ad183f0 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -632,6 +632,13 @@ LLVOCachePartition::LLVOCachePartition(LLViewerRegion* regionp) new LLVOCacheGroup(mOctree, this); } +LLVOCachePartition::~LLVOCachePartition() +{ + // SL-17276 make sure to do base class cleanup while this instance + // can still be treated as an LLVOCachePartition + cleanup(); +} + bool LLVOCachePartition::addEntry(LLViewerOctreeEntry* entry) { llassert(entry->hasVOCacheEntry()); diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index c510ff77fc..55a13d934d 100644 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -189,6 +189,7 @@ class LLVOCachePartition : public LLViewerOctreePartition { public: LLVOCachePartition(LLViewerRegion* regionp); + virtual ~LLVOCachePartition(); bool addEntry(LLViewerOctreeEntry* entry); void removeEntry(LLViewerOctreeEntry* entry); From 9c0ebc5469f8b98fdcbddd087666b38b88e88c22 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Thu, 28 Apr 2022 11:39:58 +0300 Subject: [PATCH 08/12] SL-17301 FIXED Friends are not showing in friendslist --- indra/newview/llcallingcard.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp index bddbc79df4..8d1e9a438e 100644 --- a/indra/newview/llcallingcard.cpp +++ b/indra/newview/llcallingcard.cpp @@ -257,6 +257,7 @@ S32 LLAvatarTracker::addBuddyList(const LLAvatarTracker::buddy_map_t& buds) LLAvatarName av_name; LLAvatarNameCache::get(agent_id, &av_name); + addChangedMask(LLFriendObserver::ADD, agent_id); LL_DEBUGS() << "Added buddy " << agent_id << ", " << (mBuddyInfo[agent_id]->isOnline() ? "Online" : "Offline") << ", TO: " << mBuddyInfo[agent_id]->getRightsGrantedTo() From ac0c9a7412334ebda49467c14b3916618b56a8dc Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 28 Apr 2022 23:03:19 +0300 Subject: [PATCH 09/12] SL-16721 Crash at LLVOAvatar::idleUpdateMisc --- indra/newview/llvoavatar.cpp | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index cb50390f60..ccb1662139 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2819,22 +2819,22 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update) attachment_iter != attachment->mAttachedObjects.end(); ++attachment_iter) { - LLViewerObject* attached_object = attachment_iter->get(); - BOOL visibleAttachment = visible || (attached_object && attached_object->mDrawable.notNull() && - !(attached_object->mDrawable->getSpatialBridge() && - attached_object->mDrawable->getSpatialBridge()->getRadius() < 2.0)); - - if (visibleAttachment - && attached_object - && !attached_object->isDead() - && attachment->getValid() - && attached_object->mDrawable.notNull()) - { + LLViewerObject* attached_object = attachment_iter->get(); + if (!attached_object + || attached_object->isDead() + || !attachment->getValid() + || attached_object->mDrawable.isNull()) + { + continue; + } + LLSpatialBridge* bridge = attached_object->mDrawable->getSpatialBridge(); + + if (visible || !(bridge && bridge->getRadius() < 2.0)) + { //override rigged attachments' octree spatial extents with this avatar's bounding box - LLSpatialBridge* bridge = attached_object->mDrawable->getSpatialBridge(); bool rigged = false; - if (bridge && !bridge->isDead()) + if (bridge) { //transform avatar bounding box into attachment's coordinate frame LLVector4a extents[2]; @@ -2850,8 +2850,12 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update) attached_object->mDrawable->makeActive(); attached_object->mDrawable->updateXform(TRUE); - - if (bridge && !bridge->isDead()) + + // override_bbox calls movePartition() and getSpatialPartition(), + // so bridge might no longer be valid, get it again. + // ex: animesh stops being an animesh + bridge = attached_object->mDrawable->getSpatialBridge(); + if (bridge) { if (!rigged) { From 904b16a0a7fddb1cd36de8a33d5475df93d9cabe Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 29 Sep 2020 23:39:00 +0300 Subject: [PATCH 10/12] SL-17124 switchContext and loadShaderFile crashes - Do not try initializing shaders if requirements are not met or if window does not exist - Warn user before closing window. Situation is unexpected, there is chance of more issues, like a freeze or a crash on close() - mHasMultitexture is a solid requirement, if it is not present, we won't be able to run --- indra/llrender/llgl.cpp | 31 ++++++++++--------- indra/llwindow/llwindowwin32.cpp | 26 ++++++++-------- indra/newview/llappviewer.cpp | 8 +---- indra/newview/llviewershadermgr.cpp | 7 +++++ indra/newview/llviewerwindow.cpp | 12 +++---- .../skins/default/xui/en/notifications.xml | 12 ------- 6 files changed, 44 insertions(+), 52 deletions(-) diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 639d1fba32..18168d1c3f 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -722,20 +722,23 @@ bool LLGLManager::initGL() glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &num_tex_image_units); mNumTextureImageUnits = llmin(num_tex_image_units, 32); - if (LLRender::sGLCoreProfile) - { - mNumTextureUnits = llmin(mNumTextureImageUnits, MAX_GL_TEXTURE_UNITS); - } - else if (mHasMultitexture) - { - GLint num_tex_units; - glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &num_tex_units); - mNumTextureUnits = llmin(num_tex_units, (GLint)MAX_GL_TEXTURE_UNITS); - if (mIsIntel) - { - mNumTextureUnits = llmin(mNumTextureUnits, 2); - } - } + if (mHasMultitexture) + { + if (LLRender::sGLCoreProfile) + { + mNumTextureUnits = llmin(mNumTextureImageUnits, MAX_GL_TEXTURE_UNITS); + } + else + { + GLint num_tex_units; + glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &num_tex_units); + mNumTextureUnits = llmin(num_tex_units, (GLint)MAX_GL_TEXTURE_UNITS); + if (mIsIntel) + { + mNumTextureUnits = llmin(mNumTextureUnits, 2); + } + } + } else { mHasRequirements = FALSE; diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 33b4257706..ddf6658ece 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -1251,9 +1251,9 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO if (!DescribePixelFormat(mhDC, pixel_format, sizeof(PIXELFORMATDESCRIPTOR), &pfd)) { - close(); OSMessageBox(mCallbacks->translateString("MBPixelFmtDescErr"), mCallbacks->translateString("MBError"), OSMB_OK); + close(); return FALSE; } @@ -1290,42 +1290,42 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO if (pfd.cColorBits < 32) { - close(); OSMessageBox(mCallbacks->translateString("MBTrueColorWindow"), mCallbacks->translateString("MBError"), OSMB_OK); + close(); return FALSE; } if (pfd.cAlphaBits < 8) { - close(); OSMessageBox(mCallbacks->translateString("MBAlpha"), mCallbacks->translateString("MBError"), OSMB_OK); + close(); return FALSE; } if (!SetPixelFormat(mhDC, pixel_format, &pfd)) { - close(); OSMessageBox(mCallbacks->translateString("MBPixelFmtSetErr"), mCallbacks->translateString("MBError"), OSMB_OK); + close(); return FALSE; } if (!(mhRC = SafeCreateContext(mhDC))) { - close(); OSMessageBox(mCallbacks->translateString("MBGLContextErr"), mCallbacks->translateString("MBError"), OSMB_OK); + close(); return FALSE; } if (!wglMakeCurrent(mhDC, mhRC)) { - close(); OSMessageBox(mCallbacks->translateString("MBGLContextActErr"), mCallbacks->translateString("MBError"), OSMB_OK); + close(); return FALSE; } @@ -1532,16 +1532,16 @@ const S32 max_format = (S32)num_formats - 1; if (!mhDC) { - close(); OSMessageBox(mCallbacks->translateString("MBDevContextErr"), mCallbacks->translateString("MBError"), OSMB_OK); + close(); return FALSE; } if (!SetPixelFormat(mhDC, pixel_format, &pfd)) { - close(); OSMessageBox(mCallbacks->translateString("MBPixelFmtSetErr"), mCallbacks->translateString("MBError"), OSMB_OK); + close(); return FALSE; } @@ -1577,8 +1577,8 @@ const S32 max_format = (S32)num_formats - 1; if (!DescribePixelFormat(mhDC, pixel_format, sizeof(PIXELFORMATDESCRIPTOR), &pfd)) { - close(); OSMessageBox(mCallbacks->translateString("MBPixelFmtDescErr"), mCallbacks->translateString("MBError"), OSMB_OK); + close(); return FALSE; } @@ -1590,15 +1590,15 @@ const S32 max_format = (S32)num_formats - 1; // make sure we have 32 bits per pixel if (pfd.cColorBits < 32 || GetDeviceCaps(mhDC, BITSPIXEL) < 32) { - close(); OSMessageBox(mCallbacks->translateString("MBTrueColorWindow"), mCallbacks->translateString("MBError"), OSMB_OK); + close(); return FALSE; } if (pfd.cAlphaBits < 8) { - close(); OSMessageBox(mCallbacks->translateString("MBAlpha"), mCallbacks->translateString("MBError"), OSMB_OK); + close(); return FALSE; } @@ -1614,8 +1614,8 @@ const S32 max_format = (S32)num_formats - 1; if (!wglMakeCurrent(mhDC, mhRC)) { - close(); OSMessageBox(mCallbacks->translateString("MBGLContextActErr"), mCallbacks->translateString("MBError"), OSMB_OK); + close(); return FALSE; } @@ -1623,8 +1623,8 @@ const S32 max_format = (S32)num_formats - 1; if (!gGLManager.initGL()) { - close(); OSMessageBox(mCallbacks->translateString("MBVideoDrvErr"), mCallbacks->translateString("MBError"), OSMB_OK); + close(); return FALSE; } diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index a63203f3cb..8255eb882c 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -957,13 +957,7 @@ bool LLAppViewer::init() // If we don't have the right GL requirements, exit. if (!gGLManager.mHasRequirements) { - // can't use an alert here since we're exiting and - // all hell breaks lose. - LLUIString details = LLNotifications::instance().getGlobalString("UnsupportedGLRequirements"); - OSMessageBox( - details.getString(), - LLStringUtil::null, - OSMB_OK); + // already handled with a MBVideoDrvErr return 0; } diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 1cb2c6b9ee..086b433c72 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -426,6 +426,13 @@ void LLViewerShaderMgr::setShaders() return; } + if (!gGLManager.mHasRequirements) + { + // Viewer will show 'hardware requirements' warning later + LL_INFOS("ShaderLoading") << "Not supported hardware/software" << LL_ENDL; + return; + } + static LLCachedControl max_texture_index(gSavedSettings, "RenderMaxTextureIndex", 16); LLGLSLShader::sIndexedTextureChannels = llmax(llmin(gGLManager.mNumTextureImageUnits, (S32) max_texture_index), 1); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 42e21f7130..8e565bbdca 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1914,12 +1914,6 @@ LLViewerWindow::LLViewerWindow(const Params& p) p.ignore_pixel_depth, gSavedSettings.getBOOL("RenderDeferred") ? 0 : gSavedSettings.getU32("RenderFSAASamples")); //don't use window level anti-aliasing if FBOs are enabled - if (!LLViewerShaderMgr::sInitialized) - { //immediately initialize shaders - LLViewerShaderMgr::sInitialized = TRUE; - LLViewerShaderMgr::instance()->setShaders(); - } - if (NULL == mWindow) { LLSplashScreen::update(LLTrans::getString("StartupRequireDriverUpdate")); @@ -1938,6 +1932,12 @@ LLViewerWindow::LLViewerWindow(const Params& p) #endif LLAppViewer::instance()->fastQuit(1); } + else if (!LLViewerShaderMgr::sInitialized) + { + //immediately initialize shaders + LLViewerShaderMgr::sInitialized = TRUE; + LLViewerShaderMgr::instance()->setShaders(); + } if (!LLAppViewer::instance()->restoreErrorTrap()) { diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index e1f6dde6ff..3add211247 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -9634,18 +9634,6 @@ Do you wish to continue? yestext="OK"/> - -You do not appear to meet the hardware requirements for [APP_NAME]. [APP_NAME] requires OpenGL 2.0 or later shader support. If this is the case, you may want to make sure that you have the latest drivers for your graphics card, and service packs and patches for your operating system. - -If you continue to have problems, please visit the [SUPPORT_SITE]. - - - -You do not appear to have the proper hardware requirements for [APP_NAME]. [APP_NAME] requires an OpenGL graphics card that has multitexture support. If this is the case, you may want to make sure that you have the latest drivers for your graphics card, and service packs and patches for your operating system. - -If you continue to have problems, please visit the [SUPPORT_SITE]. - - The installed Intel graphics driver for [GPUNAME], version [VERSION], is significantly out of date and is known to cause excessive rates of program crashes. You are strongly advised to update to a current Intel driver From da6f4204b7b4887d519f66d586b2782fb6beff2e Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 29 Apr 2022 22:13:16 +0300 Subject: [PATCH 11/12] SL-17124 make sure window thread wakes up to proces 'quit' message --- indra/llwindow/llwindowwin32.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index ddf6658ece..1f3823509c 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -907,6 +907,10 @@ void LLWindowWin32::close() } }); + // Window thread might be waiting for a getMessage(), give it + // a push to enshure it will process destroy_window_handler + kickWindowThread(); + // Even though the above lambda might not yet have run, we've already // bound mWindowHandle into it by value, which should suffice for the // operations we're asking. That's the last time WE should touch it. From 1a6eee4ea27923016fac790b47161ce00f2c9b4f Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 2 May 2022 11:52:45 -0500 Subject: [PATCH 12/12] SL-17321 Fix for some particle systems with custom blend functions not rendering. --- indra/newview/lldrawpoolalpha.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index eebd89f77f..e674707c01 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -717,6 +717,16 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged) LLGLEnableFunc stencil_test(GL_STENCIL_TEST, params.mSelected, &LLGLCommonFunc::selected_stencil_test); gGL.blendFunc((LLRender::eBlendFactor) params.mBlendFuncSrc, (LLRender::eBlendFactor) params.mBlendFuncDst, mAlphaSFactor, mAlphaDFactor); + + bool reset_minimum_alpha = false; + if (!LLPipeline::sImpostorRender && + params.mBlendFuncDst != LLRender::BF_SOURCE_ALPHA && + params.mBlendFuncSrc != LLRender::BF_SOURCE_ALPHA) + { // this draw call has a custom blend function that may require rendering of "invisible" fragments + current_shader->setMinimumAlpha(0.f); + reset_minimum_alpha = true; + } + U32 drawMask = mask; if (params.mFullbright) { @@ -729,6 +739,11 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged) params.mVertexBuffer->setBufferFast(drawMask); params.mVertexBuffer->drawRangeFast(params.mDrawMode, params.mStart, params.mEnd, params.mCount, params.mOffset); + + if (reset_minimum_alpha) + { + current_shader->setMinimumAlpha(MINIMUM_ALPHA); + } } // If this alpha mesh has glow, then draw it a second time to add the destination-alpha (=glow). Interleaving these state-changing calls is expensive, but glow must be drawn Z-sorted with alpha.