From b4e106ec35920fdc7aa3c98d7de1778ed309c906 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 5 Dec 2011 17:07:40 -0500 Subject: SH-2747 FIX --- indra/newview/llavatariconctrl.cpp | 3 +++ 1 file changed, 3 insertions(+) mode change 100644 => 100755 indra/newview/llavatariconctrl.cpp (limited to 'indra') diff --git a/indra/newview/llavatariconctrl.cpp b/indra/newview/llavatariconctrl.cpp old mode 100644 new mode 100755 index 42e7decec1..b539ac38ed --- a/indra/newview/llavatariconctrl.cpp +++ b/indra/newview/llavatariconctrl.cpp @@ -75,6 +75,9 @@ void LLAvatarIconIDCache::load () LLUUID icon_id; LLDate date; + if (line.length()<=uuid_len*2) + continue; // short line, bail out to prevent substr calls throwing exception. + std::string avatar_id_str = line.substr(0,uuid_len); std::string icon_id_str = line.substr(uuid_len,uuid_len); -- cgit v1.2.3 From 01d68a9f1572fba971ace6944a91a85e7c379d1e Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 5 Dec 2011 16:28:13 -0700 Subject: call LLViewerTexture::isMemoryForTextureLow() less often and only for ATI cards. --- indra/newview/llviewertexture.cpp | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index f4bbc2b067..addf1147f2 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -420,8 +420,17 @@ F32 texmem_middle_bound_scale = 0.925f; //static bool LLViewerTexture::isMemoryForTextureLow() { - const static S32 MIN_FREE_TEXTURE_MEMORY = 5 ; //MB - const static S32 MIN_FREE_MAIN_MEMORy = 100 ; //MB + const F32 WAIT_TIME = 1.0f ; //second + static LLFrameTimer timer ; + + if(timer.getElapsedTimeF32() < WAIT_TIME) //call this once per second. + { + return false; + } + timer.reset() ; + + const S32 MIN_FREE_TEXTURE_MEMORY = 5 ; //MB + const S32 MIN_FREE_MAIN_MEMORy = 100 ; //MB bool low_mem = false ; if (gGLManager.mHasATIMemInfo) @@ -433,6 +442,15 @@ bool LLViewerTexture::isMemoryForTextureLow() { low_mem = true ; } + + if(!low_mem) //check main memory, only works for windows. + { + LLMemory::updateMemoryInfo() ; + if(LLMemory::getAvailableMemKB() / 1024 < MIN_FREE_MAIN_MEMORy) + { + low_mem = true ; + } + } } #if 0 //ignore nVidia cards else if (gGLManager.mHasNVXMemInfo) @@ -445,16 +463,7 @@ bool LLViewerTexture::isMemoryForTextureLow() low_mem = true ; } } -#endif - - if(!low_mem) //check main memory, only works for windows. - { - LLMemory::updateMemoryInfo() ; - if(LLMemory::getAvailableMemKB() / 1024 < MIN_FREE_MAIN_MEMORy) - { - low_mem = true ; - } - } +#endif return low_mem ; } -- cgit v1.2.3 From 78233d1bf9930575ee7250257ac68603f41f568a Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 5 Dec 2011 17:55:40 -0600 Subject: SH-2652 WIP -- Add timers to relevant areas, pause render pipeline while occlusion queries from previous frame are still pending and perform texture decode work. --- indra/llcommon/llqueuedthread.cpp | 4 ++-- indra/llcommon/llqueuedthread.h | 4 ++-- indra/llcommon/llworkerthread.cpp | 2 +- indra/llcommon/llworkerthread.h | 2 +- indra/llimage/llimageworker.cpp | 2 +- indra/llimage/llimageworker.h | 2 +- indra/llmessage/llcurl.cpp | 2 +- indra/llmessage/llcurl.h | 2 +- indra/newview/llappviewer.cpp | 8 +++++--- indra/newview/llspatialpartition.cpp | 26 ++++++++++++++++++++++++++ indra/newview/llspatialpartition.h | 2 ++ indra/newview/lltexturecache.cpp | 2 +- indra/newview/lltexturecache.h | 2 +- indra/newview/lltexturefetch.cpp | 2 +- indra/newview/lltexturefetch.h | 2 +- indra/newview/llviewertexture.cpp | 14 +++++++++++++- 16 files changed, 60 insertions(+), 18 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llqueuedthread.cpp b/indra/llcommon/llqueuedthread.cpp index 5dee7a3541..1738c16dea 100644 --- a/indra/llcommon/llqueuedthread.cpp +++ b/indra/llcommon/llqueuedthread.cpp @@ -109,7 +109,7 @@ void LLQueuedThread::shutdown() // MAIN THREAD // virtual -S32 LLQueuedThread::update(U32 max_time_ms) +S32 LLQueuedThread::update(F32 max_time_ms) { if (!mStarted) { @@ -122,7 +122,7 @@ S32 LLQueuedThread::update(U32 max_time_ms) return updateQueue(max_time_ms); } -S32 LLQueuedThread::updateQueue(U32 max_time_ms) +S32 LLQueuedThread::updateQueue(F32 max_time_ms) { F64 max_time = (F64)max_time_ms * .001; LLTimer timer; diff --git a/indra/llcommon/llqueuedthread.h b/indra/llcommon/llqueuedthread.h index 499d13a792..d3704b0fe2 100644 --- a/indra/llcommon/llqueuedthread.h +++ b/indra/llcommon/llqueuedthread.h @@ -173,8 +173,8 @@ protected: public: bool waitForResult(handle_t handle, bool auto_complete = true); - virtual S32 update(U32 max_time_ms); - S32 updateQueue(U32 max_time_ms); + virtual S32 update(F32 max_time_ms); + S32 updateQueue(F32 max_time_ms); void waitOnPending(); void printQueueStats(); diff --git a/indra/llcommon/llworkerthread.cpp b/indra/llcommon/llworkerthread.cpp index 4988bdf570..3d05a30ac2 100644 --- a/indra/llcommon/llworkerthread.cpp +++ b/indra/llcommon/llworkerthread.cpp @@ -81,7 +81,7 @@ void LLWorkerThread::clearDeleteList() } // virtual -S32 LLWorkerThread::update(U32 max_time_ms) +S32 LLWorkerThread::update(F32 max_time_ms) { S32 res = LLQueuedThread::update(max_time_ms); // Delete scheduled workers diff --git a/indra/llcommon/llworkerthread.h b/indra/llcommon/llworkerthread.h index 78a4781d15..be46394d6e 100644 --- a/indra/llcommon/llworkerthread.h +++ b/indra/llcommon/llworkerthread.h @@ -86,7 +86,7 @@ public: LLWorkerThread(const std::string& name, bool threaded = true, bool should_pause = false); ~LLWorkerThread(); - /*virtual*/ S32 update(U32 max_time_ms); + /*virtual*/ S32 update(F32 max_time_ms); handle_t addWorkRequest(LLWorkerClass* workerclass, S32 param, U32 priority = PRIORITY_NORMAL); diff --git a/indra/llimage/llimageworker.cpp b/indra/llimage/llimageworker.cpp index 28dc3bd313..ad2eb0f69c 100644 --- a/indra/llimage/llimageworker.cpp +++ b/indra/llimage/llimageworker.cpp @@ -46,7 +46,7 @@ LLImageDecodeThread::~LLImageDecodeThread() // MAIN THREAD // virtual -S32 LLImageDecodeThread::update(U32 max_time_ms) +S32 LLImageDecodeThread::update(F32 max_time_ms) { LLMutexLock lock(mCreationMutex); for (creation_list_t::iterator iter = mCreationList.begin(); diff --git a/indra/llimage/llimageworker.h b/indra/llimage/llimageworker.h index c684222fa5..1bfb0ddfd3 100644 --- a/indra/llimage/llimageworker.h +++ b/indra/llimage/llimageworker.h @@ -78,7 +78,7 @@ public: handle_t decodeImage(LLImageFormatted* image, U32 priority, S32 discard, BOOL needs_aux, Responder* responder); - S32 update(U32 max_time_ms); + S32 update(F32 max_time_ms); // Used by unit tests to check the consistency of the thread instance S32 tut_size(); diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp index 7ca25d07fc..ce0632668c 100644 --- a/indra/llmessage/llcurl.cpp +++ b/indra/llmessage/llcurl.cpp @@ -841,7 +841,7 @@ LLCurlThread::~LLCurlThread() { } -S32 LLCurlThread::update(U32 max_time_ms) +S32 LLCurlThread::update(F32 max_time_ms) { return LLQueuedThread::update(max_time_ms); } diff --git a/indra/llmessage/llcurl.h b/indra/llmessage/llcurl.h index a275db3e53..2c95279438 100644 --- a/indra/llmessage/llcurl.h +++ b/indra/llmessage/llcurl.h @@ -344,7 +344,7 @@ public: LLCurlThread(bool threaded = true) ; virtual ~LLCurlThread() ; - S32 update(U32 max_time_ms); + S32 update(F32 max_time_ms); void addMulti(LLCurl::Multi* multi) ; void killMulti(LLCurl::Multi* multi) ; diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index e80475f096..9455bf9875 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1345,17 +1345,19 @@ bool LLAppViewer::mainLoop() { S32 work_pending = 0; S32 io_pending = 0; + F32 max_time = llmin(gFrameIntervalSeconds*10.f, 1.f); + { LLFastTimer ftm(FTM_TEXTURE_CACHE); - work_pending += LLAppViewer::getTextureCache()->update(1); // unpauses the texture cache thread + work_pending += LLAppViewer::getTextureCache()->update(max_time); // unpauses the texture cache thread } { LLFastTimer ftm(FTM_DECODE); - work_pending += LLAppViewer::getImageDecodeThread()->update(1); // unpauses the image thread + work_pending += LLAppViewer::getImageDecodeThread()->update(max_time); // unpauses the image thread } { LLFastTimer ftm(FTM_DECODE); - work_pending += LLAppViewer::getTextureFetch()->update(1); // unpauses the texture fetch thread + work_pending += LLAppViewer::getTextureFetch()->update(max_time); // unpauses the texture fetch thread } { diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 3e16ccf3da..fb107a302a 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -28,6 +28,10 @@ #include "llspatialpartition.h" +#include "llappviewer.h" +#include "lltexturecache.h" +#include "lltexturefetch.h" +#include "llimageworker.h" #include "llviewerwindow.h" #include "llviewerobjectlist.h" #include "llvovolume.h" @@ -1221,6 +1225,7 @@ LLSpatialGroup::LLSpatialGroup(OctreeNode* node, LLSpatialPartition* part) : for (U32 i = 0; i < LLViewerCamera::NUM_CAMERAS; i++) { mOcclusionQuery[i] = 0; + mOcclusionIssued[i] = 0; mOcclusionState[i] = parent ? SG_STATE_INHERIT_MASK & parent->mOcclusionState[i] : 0; mVisible[i] = 0; } @@ -1543,6 +1548,8 @@ BOOL LLSpatialGroup::rebound() } static LLFastTimer::DeclareTimer FTM_OCCLUSION_READBACK("Readback Occlusion"); +static LLFastTimer::DeclareTimer FTM_OCCLUSION_WAIT("Wait"); + void LLSpatialGroup::checkOcclusion() { if (LLPipeline::sUseOcclusion > 1) @@ -1560,6 +1567,22 @@ void LLSpatialGroup::checkOcclusion() if (mOcclusionQuery[LLViewerCamera::sCurCameraID]) { glGetQueryObjectuivARB(mOcclusionQuery[LLViewerCamera::sCurCameraID], GL_QUERY_RESULT_AVAILABLE_ARB, &available); + + if (mOcclusionIssued[LLViewerCamera::sCurCameraID] < gFrameCount) + { //query was issued last frame, wait until it's available + S32 max_loop = 1024; + LLFastTimer t(FTM_OCCLUSION_WAIT); + while (!available && max_loop-- > 0) + { + F32 max_time = llmin(gFrameIntervalSeconds*10.f, 1.f); + //do some usefu work while we wait + LLAppViewer::getTextureCache()->update(max_time); // unpauses the texture cache thread + LLAppViewer::getImageDecodeThread()->update(max_time); // unpauses the image thread + LLAppViewer::getTextureFetch()->update(max_time); // unpauses the texture fetch thread + + glGetQueryObjectuivARB(mOcclusionQuery[LLViewerCamera::sCurCameraID], GL_QUERY_RESULT_AVAILABLE_ARB, &available); + } + } } else { @@ -1679,6 +1702,9 @@ void LLSpatialGroup::doOcclusion(LLCamera* camera) { LLFastTimer t(FTM_PUSH_OCCLUSION_VERTS); + //store which frame this query was issued on + mOcclusionIssued[LLViewerCamera::sCurCameraID] = gFrameCount; + { LLFastTimer t(FTM_OCCLUSION_BEGIN_QUERY); glBeginQueryARB(mode, mOcclusionQuery[LLViewerCamera::sCurCameraID]); diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h index f0c8a372ee..899547ae4d 100644 --- a/indra/newview/llspatialpartition.h +++ b/indra/newview/llspatialpartition.h @@ -396,6 +396,8 @@ protected: U32 mState; U32 mOcclusionState[LLViewerCamera::NUM_CAMERAS]; + U32 mOcclusionIssued[LLViewerCamera::NUM_CAMERAS]; + S32 mLODHash; static S32 sLODSeed; diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index e7a176f4f9..8632890bbb 100644 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -760,7 +760,7 @@ LLTextureCache::~LLTextureCache() ////////////////////////////////////////////////////////////////////////////// //virtual -S32 LLTextureCache::update(U32 max_time_ms) +S32 LLTextureCache::update(F32 max_time_ms) { static LLFrameTimer timer ; static const F32 MAX_TIME_INTERVAL = 300.f ; //seconds. diff --git a/indra/newview/lltexturecache.h b/indra/newview/lltexturecache.h index 64e3a2658c..dd0cc9b4bd 100644 --- a/indra/newview/lltexturecache.h +++ b/indra/newview/lltexturecache.h @@ -101,7 +101,7 @@ public: LLTextureCache(bool threaded); ~LLTextureCache(); - /*virtual*/ S32 update(U32 max_time_ms); + /*virtual*/ S32 update(F32 max_time_ms); void purgeCache(ELLPath location); void setReadOnly(BOOL read_only) ; diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 56dfb61c4f..f18aa8b4e6 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -2204,7 +2204,7 @@ void LLTextureFetch::commonUpdate() // MAIN THREAD //virtual -S32 LLTextureFetch::update(U32 max_time_ms) +S32 LLTextureFetch::update(F32 max_time_ms) { static LLCachedControl band_width(gSavedSettings,"ThrottleBandwidthKBPS"); diff --git a/indra/newview/lltexturefetch.h b/indra/newview/lltexturefetch.h index d101da1f4b..35df7d816f 100644 --- a/indra/newview/lltexturefetch.h +++ b/indra/newview/lltexturefetch.h @@ -55,7 +55,7 @@ public: class TFRequest; - /*virtual*/ S32 update(U32 max_time_ms); + /*virtual*/ S32 update(F32 max_time_ms); void shutDownTextureCacheThread() ; //called in the main thread after the TextureCacheThread shuts down. void shutDownImageDecodeThread() ; //called in the main thread after the ImageDecodeThread shuts down. diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index b0f5361a79..1863992a22 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -417,9 +417,13 @@ const S32 min_non_tex_system_mem = (128<<20); // 128 MB F32 texmem_lower_bound_scale = 0.85f; F32 texmem_middle_bound_scale = 0.925f; +static LLFastTimer::DeclareTimer FTM_TEXTURE_MEMORY_CHECK("Memory Check"); + //static bool LLViewerTexture::isMemoryForTextureLow() { + LLFastTimer t(FTM_TEXTURE_MEMORY_CHECK); + const static S32 MIN_FREE_TEXTURE_MEMORY = 5 ; //MB const static S32 MIN_FREE_MAIN_MEMORy = 100 ; //MB @@ -459,6 +463,9 @@ bool LLViewerTexture::isMemoryForTextureLow() return low_mem ; } +static LLFastTimer::DeclareTimer FTM_TEXTURE_UPDATE_MEDIA("Media"); +static LLFastTimer::DeclareTimer FTM_TEXTURE_UPDATE_TEST("Test"); + //static void LLViewerTexture::updateClass(const F32 velocity, const F32 angular_velocity) { @@ -467,9 +474,14 @@ void LLViewerTexture::updateClass(const F32 velocity, const F32 angular_velocity LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName); if (tester) { + LLFastTimer t(FTM_TEXTURE_UPDATE_TEST); tester->update() ; } - LLViewerMediaTexture::updateClass() ; + + { + LLFastTimer t(FTM_TEXTURE_UPDATE_MEDIA); + LLViewerMediaTexture::updateClass() ; + } sBoundTextureMemoryInBytes = LLImageGL::sBoundTextureMemoryInBytes;//in bytes sTotalTextureMemoryInBytes = LLImageGL::sGlobalTextureMemoryInBytes;//in bytes -- cgit v1.2.3 From 1a93abb9013d6960f1ff9eb491480f547c780ff0 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 5 Dec 2011 18:55:01 -0600 Subject: SH-2652 Bump fast timer location. --- indra/newview/llviewertexture.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 2e1dc95483..126d0f75e8 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -423,7 +423,6 @@ static LLFastTimer::DeclareTimer FTM_TEXTURE_MEMORY_CHECK("Memory Check"); bool LLViewerTexture::isMemoryForTextureLow() { const F32 WAIT_TIME = 1.0f ; //second - LLFastTimer t(FTM_TEXTURE_MEMORY_CHECK); static LLFrameTimer timer ; if(timer.getElapsedTimeF32() < WAIT_TIME) //call this once per second. @@ -432,6 +431,8 @@ bool LLViewerTexture::isMemoryForTextureLow() } timer.reset() ; + LLFastTimer t(FTM_TEXTURE_MEMORY_CHECK); + const S32 MIN_FREE_TEXTURE_MEMORY = 5 ; //MB const S32 MIN_FREE_MAIN_MEMORy = 100 ; //MB -- cgit v1.2.3 From 22e46e4be76a448a27c59fedfeb84081d6624df8 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 6 Dec 2011 12:57:57 -0600 Subject: Fix for RenderResolutionDivisor no longer working correctly. --- indra/newview/pipeline.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'indra') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 657cdc0e07..00acc3e511 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -6333,17 +6333,10 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); } - U32 res_mod = RenderResolutionDivisor; - LLVector2 tc1(0,0); LLVector2 tc2((F32) mScreen.getWidth()*2, (F32) mScreen.getHeight()*2); - if (res_mod > 1) - { - tc2 /= (F32) res_mod; - } - LLFastTimer ftm(FTM_RENDER_BLOOM); gGL.color4f(1,1,1,1); LLGLDepthTest depth(GL_FALSE); @@ -6807,7 +6800,13 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) mFXAABuffer.bindTexture(0, channel); gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); } - + + gGLViewport[0] = gViewerWindow->getWorldViewRectRaw().mLeft; + gGLViewport[1] = gViewerWindow->getWorldViewRectRaw().mBottom; + gGLViewport[2] = gViewerWindow->getWorldViewRectRaw().getWidth(); + gGLViewport[3] = gViewerWindow->getWorldViewRectRaw().getHeight(); + glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]); + F32 scale_x = (F32) width/mFXAABuffer.getWidth(); F32 scale_y = (F32) height/mFXAABuffer.getHeight(); shader->uniform2f(LLShaderMgr::FXAA_TC_SCALE, scale_x, scale_y); @@ -6827,11 +6826,6 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) } else { - if (res_mod > 1) - { - tc2 /= (F32) res_mod; - } - U32 mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD1; LLPointer buff = new LLVertexBuffer(mask, 0); buff->allocateBuffer(3,0,TRUE); -- cgit v1.2.3 From 1a18184f50a3c98573ceb06d6ff3ca7bd42f6fc3 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 6 Dec 2011 16:45:30 -0700 Subject: fix for SH-2526: Second Life client quickly allocates all available RAM and crashes --- indra/llaudio/llaudioengine.cpp | 23 +++++++++++++++++++---- indra/llaudio/llaudioengine.h | 1 + 2 files changed, 20 insertions(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/llaudio/llaudioengine.cpp b/indra/llaudio/llaudioengine.cpp index 5e540ad8c5..5fa28cb902 100644 --- a/indra/llaudio/llaudioengine.cpp +++ b/indra/llaudio/llaudioengine.cpp @@ -1264,6 +1264,7 @@ LLAudioSource::LLAudioSource(const LLUUID& id, const LLUUID& owner_id, const F32 mSyncSlave(false), mQueueSounds(false), mPlayedOnce(false), + mCorrupted(false), mType(type), mChannelp(NULL), mCurrentDatap(NULL), @@ -1296,16 +1297,25 @@ void LLAudioSource::setChannel(LLAudioChannel *channelp) void LLAudioSource::update() { + if(mCorrupted) + { + return ; //no need to update + } + if (!getCurrentBuffer()) { if (getCurrentData()) { // Hack - try and load the sound. Will do this as a callback // on decode later. - if (getCurrentData()->load()) + if (getCurrentData()->load() && getCurrentData()->getBuffer()) { play(getCurrentData()->getID()); - } + } + else + { + mCorrupted = true ; + } } } } @@ -1421,6 +1431,11 @@ bool LLAudioSource::play(const LLUUID &audio_uuid) bool LLAudioSource::isDone() const { + if(mCorrupted) + { + return true ; + } + const F32 MAX_AGE = 60.f; const F32 MAX_UNPLAYED_AGE = 15.f; const F32 MAX_MUTED_AGE = 11.f; @@ -1736,7 +1751,7 @@ LLAudioData::LLAudioData(const LLUUID &uuid) : } } - +//return false when the audio file is corrupted. bool LLAudioData::load() { // For now, just assume we're going to use one buffer per audiodata. @@ -1752,7 +1767,7 @@ bool LLAudioData::load() { // No free buffers, abort. llinfos << "Not able to allocate a new audio buffer, aborting." << llendl; - return false; + return true; } std::string uuid_str; diff --git a/indra/llaudio/llaudioengine.h b/indra/llaudio/llaudioengine.h index 30d2490635..a47ee7ca7c 100644 --- a/indra/llaudio/llaudioengine.h +++ b/indra/llaudio/llaudioengine.h @@ -334,6 +334,7 @@ protected: bool mSyncSlave; bool mQueueSounds; bool mPlayedOnce; + bool mCorrupted; S32 mType; LLVector3d mPositionGlobal; LLVector3 mVelocity; -- cgit v1.2.3 From f9f247c5a6f2f7d3b730244f8fc10c880cdb1bed Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 7 Dec 2011 16:36:26 -0600 Subject: SH-2084 Don't error out on framebuffer mismatch -- probably causing a crash when some post-snapshot or minimize/restore operation gets out of phase. --- indra/llrender/llrendertarget.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index 1aa12614ea..ef2a7395da 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -457,7 +457,8 @@ void LLRenderTarget::copyContents(LLRenderTarget& source, S32 srcX0, S32 srcY0, gGL.flush(); if (!source.mFBO || !mFBO) { - llerrs << "Cannot copy framebuffer contents for non FBO render targets." << llendl; + llwarns << "Cannot copy framebuffer contents for non FBO render targets." << llendl; + return; } -- cgit v1.2.3 From e0a994d1f298b109dfac4cfd592e631d453f3045 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 7 Dec 2011 15:48:57 -0700 Subject: fix for SH-2516: Full Bright Geometry Rendering Increases Rapidly, Destroying Frame Rate. --- indra/newview/llviewertexture.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 126d0f75e8..61236edc86 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -3163,8 +3163,13 @@ void LLViewerLODTexture::processTextureStats() S32 current_discard = getDiscardLevel(); if (sDesiredDiscardBias > 0.0f && mBoostLevel < LLViewerTexture::BOOST_SCULPTED && current_discard >= 0) { + if(desired_discard_bias_max <= sDesiredDiscardBias && !mForceToSaveRawImage) + { + //needs to release texture memory urgently + scaleDown() ; + } // Limit the amount of GL memory bound each frame - if ( BYTES_TO_MEGA_BYTES(sBoundTextureMemoryInBytes) > sMaxBoundTextureMemInMegaBytes * texmem_middle_bound_scale && + else if ( BYTES_TO_MEGA_BYTES(sBoundTextureMemoryInBytes) > sMaxBoundTextureMemInMegaBytes * texmem_middle_bound_scale && (!getBoundRecently() || mDesiredDiscardLevel >= mCachedRawDiscardLevel)) { scaleDown() ; -- cgit v1.2.3 From ca4eab69b9b1ed42f3128635ef1f278600b59118 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 8 Dec 2011 17:49:56 -0600 Subject: SH-2680 Bring back blurred edges on objects closer than the near focal plane. --- .../app_settings/shaders/class1/deferred/cofF.glsl | 7 ++-- .../shaders/class1/deferred/dofCombineF.glsl | 2 +- .../shaders/class1/deferred/postDeferredF.glsl | 40 +++++++++++++++++++--- 3 files changed, 41 insertions(+), 8 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl index 88fe3c3dee..e612efba61 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl @@ -57,7 +57,7 @@ float getDepth(vec2 pos_screen) float calc_cof(float depth) { - float sc = abs(depth-focal_distance)/-depth*blur_constant; + float sc = (depth-focal_distance)/-depth*blur_constant; sc /= magnification; @@ -79,9 +79,10 @@ void main() vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy); float sc = calc_cof(depth); - sc = min(abs(sc), max_cof); + sc = min(sc, max_cof); + sc = max(sc, -max_cof); vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res); gl_FragColor.rgb = diff.rgb + bloom.rgb; - gl_FragColor.a = sc/max_cof; + gl_FragColor.a = sc/max_cof*0.5+0.5; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl b/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl index 21453aefaa..01e3505359 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl @@ -48,7 +48,7 @@ void main() vec4 diff = texture2DRect(lightMap, vary_fragcoord.xy); - float a = min(diff.a * max_cof*res_scale*res_scale, 1.0); + float a = min(abs(diff.a*2.0-1.0) * max_cof*res_scale*res_scale, 1.0); if (a > 0.25 && a < 0.75) { //help out the transition a bit diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl index 4603d99c5e..18d451bf87 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl @@ -42,7 +42,7 @@ void dofSample(inout vec4 diff, inout float w, float min_sc, vec2 tc) { vec4 s = texture2DRect(diffuseRect, tc); - float sc = s.a*max_cof; + float sc = abs(s.a*2.0-1.0)*max_cof; if (sc > min_sc) //sampled pixel is more "out of focus" than current sample radius { @@ -57,6 +57,20 @@ void dofSample(inout vec4 diff, inout float w, float min_sc, vec2 tc) } } +void dofSampleNear(inout vec4 diff, inout float w, float min_sc, vec2 tc) +{ + vec4 s = texture2DRect(diffuseRect, tc); + + float wg = 0.25; + + // de-weight dull areas to make highlights 'pop' + wg += s.r+s.g+s.b; + + diff += wg*s; + + w += wg; +} + void main() { vec2 tc = vary_fragcoord.xy; @@ -66,12 +80,30 @@ void main() { float w = 1.0; - float sc = diff.a*max_cof; - + float sc = (diff.a*2.0-1.0)*max_cof; + float PI = 3.14159265358979323846264; // sample quite uniformly spaced points within a circle, for a circular 'bokeh' + if (sc > 0.5) + { + while (sc > 0.5) + { + int its = int(max(1.0,(sc*3.7))); + for (int i=0; i 0.5) { int its = int(max(1.0,(sc*3.7))); @@ -86,7 +118,7 @@ void main() sc -= 1.0; } } - + diff /= w; } -- cgit v1.2.3 From 723ce604560f71622d0381e47230b87f07262d99 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 9 Dec 2011 12:23:04 -0600 Subject: Backed out changeset fafd857891b1 --- indra/llcommon/llthread.h | 11 ++-------- indra/llmessage/llcurl.cpp | 54 +++++++++++++++++++++++++--------------------- 2 files changed, 31 insertions(+), 34 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h index b0a1c9e12b..40291a2569 100644 --- a/indra/llcommon/llthread.h +++ b/indra/llcommon/llthread.h @@ -187,18 +187,11 @@ public: LLMutexLock(LLMutex* mutex) { mMutex = mutex; - - if(mMutex) - { - mMutex->lock(); - } + mMutex->lock(); } ~LLMutexLock() { - if(mMutex) - { - mMutex->unlock(); - } + mMutex->unlock(); } private: LLMutex* mMutex; diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp index 228f039132..7ca25d07fc 100644 --- a/indra/llmessage/llcurl.cpp +++ b/indra/llmessage/llcurl.cpp @@ -585,30 +585,37 @@ void LLCurl::Multi::unlock() void LLCurl::Multi::markDead() { - LLMutexLock lock(mDeletionMutexp) ; - + if(mDeletionMutexp) + { + mDeletionMutexp->lock() ; + } + mDead = TRUE ; + + if(mDeletionMutexp) + { + mDeletionMutexp->unlock() ; + } } void LLCurl::Multi::setState(LLCurl::Multi::ePerformState state) { - LLMutexLock lock(mMutexp) ; - + lock() ; mState = state ; if(mState == STATE_READY) { LLCurl::getCurlThread()->setPriority(mHandle, LLQueuedThread::PRIORITY_NORMAL) ; } + unlock() ; } LLCurl::Multi::ePerformState LLCurl::Multi::getState() { ePerformState state ; - { - LLMutexLock lock(mMutexp) ; - state = mState ; - } + lock() ; + state = mState ; + unlock() ; return state ; } @@ -628,15 +635,13 @@ bool LLCurl::Multi::waitToComplete() bool completed ; + lock() ; + completed = (STATE_COMPLETED == mState) ; + if(!completed) { - LLMutexLock lock(mMutexp) ; - - completed = (STATE_COMPLETED == mState) ; - if(!completed) - { - LLCurl::getCurlThread()->setPriority(mHandle, LLQueuedThread::PRIORITY_URGENT) ; - } + LLCurl::getCurlThread()->setPriority(mHandle, LLQueuedThread::PRIORITY_URGENT) ; } + unlock() ; return completed; } @@ -650,8 +655,10 @@ CURLMsg* LLCurl::Multi::info_read(S32* msgs_in_queue) //return true if dead bool LLCurl::Multi::doPerform() { - LLMutexLock lock(mDeletionMutexp) ; - + if(mDeletionMutexp) + { + mDeletionMutexp->lock() ; + } bool dead = mDead ; if(mDead) @@ -668,8 +675,6 @@ bool LLCurl::Multi::doPerform() call_count < MULTI_PERFORM_CALL_REPEAT; call_count++) { - LLMutexLock lock(mMutexp) ; - CURLMcode code = curl_multi_perform(mCurlMultiHandle, &q); if (CURLM_CALL_MULTI_PERFORM != code || q == 0) { @@ -683,6 +688,11 @@ bool LLCurl::Multi::doPerform() setState(STATE_COMPLETED) ; } + if(mDeletionMutexp) + { + mDeletionMutexp->unlock() ; + } + return dead ; } @@ -754,8 +764,6 @@ LLCurl::Easy* LLCurl::Multi::allocEasy() bool LLCurl::Multi::addEasy(Easy* easy) { - LLMutexLock lock(mMutexp) ; - CURLMcode mcode = curl_multi_add_handle(mCurlMultiHandle, easy->getCurlHandle()); check_curl_multi_code(mcode); //if (mcode != CURLM_OK) @@ -768,8 +776,6 @@ bool LLCurl::Multi::addEasy(Easy* easy) void LLCurl::Multi::easyFree(Easy* easy) { - LLMutexLock lock(mMutexp) ; - mEasyActiveList.erase(easy); mEasyActiveMap.erase(easy->getCurlHandle()); if (mEasyFreeList.size() < EASY_HANDLE_POOL_SIZE) @@ -785,8 +791,6 @@ void LLCurl::Multi::easyFree(Easy* easy) void LLCurl::Multi::removeEasy(Easy* easy) { - LLMutexLock lock(mMutexp) ; - check_curl_multi_code(curl_multi_remove_handle(mCurlMultiHandle, easy->getCurlHandle())); easyFree(easy); } -- cgit v1.2.3 From 2b2a03b3c5e983f6dee85602a41acaf4d515a4db Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 12 Dec 2011 17:12:47 -0600 Subject: SH-2511 Fix for bumpmapped objects flickering. --- indra/newview/lldrawpoolbump.cpp | 79 +++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 41 deletions(-) (limited to 'indra') diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index b696b90d84..b58efe62ab 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -1036,51 +1036,48 @@ LLViewerTexture* LLBumpImageList::getBrightnessDarknessImage(LLViewerFetchedText llassert( (bump_code == BE_BRIGHTNESS) || (bump_code == BE_DARKNESS) ); LLViewerTexture* bump = NULL; - const F32 BRIGHTNESS_DARKNESS_PIXEL_AREA_THRESHOLD = 1000; - if( src_image->getMaxVirtualSize() > BRIGHTNESS_DARKNESS_PIXEL_AREA_THRESHOLD ) - { - bump_image_map_t* entries_list = NULL; - void (*callback_func)( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ) = NULL; + + bump_image_map_t* entries_list = NULL; + void (*callback_func)( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ) = NULL; - switch( bump_code ) - { - case BE_BRIGHTNESS: - entries_list = &mBrightnessEntries; - callback_func = LLBumpImageList::onSourceBrightnessLoaded; - break; - case BE_DARKNESS: - entries_list = &mDarknessEntries; - callback_func = LLBumpImageList::onSourceDarknessLoaded; - break; - default: - llassert(0); - return NULL; - } + switch( bump_code ) + { + case BE_BRIGHTNESS: + entries_list = &mBrightnessEntries; + callback_func = LLBumpImageList::onSourceBrightnessLoaded; + break; + case BE_DARKNESS: + entries_list = &mDarknessEntries; + callback_func = LLBumpImageList::onSourceDarknessLoaded; + break; + default: + llassert(0); + return NULL; + } - bump_image_map_t::iterator iter = entries_list->find(src_image->getID()); - if (iter != entries_list->end() && iter->second.notNull()) - { - bump = iter->second; - } - else - { - LLPointer raw = new LLImageRaw(1,1,1); - raw->clear(0x77, 0x77, 0xFF, 0xFF); + bump_image_map_t::iterator iter = entries_list->find(src_image->getID()); + if (iter != entries_list->end() && iter->second.notNull()) + { + bump = iter->second; + } + else + { + LLPointer raw = new LLImageRaw(1,1,1); + raw->clear(0x77, 0x77, 0xFF, 0xFF); - (*entries_list)[src_image->getID()] = LLViewerTextureManager::getLocalTexture( raw.get(), TRUE); - bump = (*entries_list)[src_image->getID()]; // In case callback was called immediately and replaced the image - } + (*entries_list)[src_image->getID()] = LLViewerTextureManager::getLocalTexture( raw.get(), TRUE); + bump = (*entries_list)[src_image->getID()]; // In case callback was called immediately and replaced the image + } - if (!src_image->hasCallbacks()) - { //if image has no callbacks but resolutions don't match, trigger raw image loaded callback again - if (src_image->getWidth() != bump->getWidth() || - src_image->getHeight() != bump->getHeight())// || - //(LLPipeline::sRenderDeferred && bump->getComponents() != 4)) - { - src_image->setBoostLevel(LLViewerTexture::BOOST_BUMP) ; - src_image->setLoadedCallback( callback_func, 0, TRUE, FALSE, new LLUUID(src_image->getID()), NULL ); - src_image->forceToSaveRawImage(0) ; - } + if (!src_image->hasCallbacks()) + { //if image has no callbacks but resolutions don't match, trigger raw image loaded callback again + if (src_image->getWidth() != bump->getWidth() || + src_image->getHeight() != bump->getHeight())// || + //(LLPipeline::sRenderDeferred && bump->getComponents() != 4)) + { + src_image->setBoostLevel(LLViewerTexture::BOOST_BUMP) ; + src_image->setLoadedCallback( callback_func, 0, TRUE, FALSE, new LLUUID(src_image->getID()), NULL ); + src_image->forceToSaveRawImage(0) ; } } -- cgit v1.2.3 From 4e92846cd5ca304537ef3105a880f0c14ba02e3c Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 13 Dec 2011 14:37:20 -0600 Subject: SH-1427 Fix for redundantly applying light intensity to deferred lights. --- indra/newview/pipeline.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'indra') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 00acc3e511..8449e74fb6 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -7452,8 +7452,7 @@ void LLPipeline::renderDeferredLighting() F32 s = volume->getLightRadius()*1.5f; LLColor3 col = volume->getLightColor(); - col *= volume->getLightIntensity(); - + if (col.magVecSquared() < 0.001f) { continue; @@ -7566,8 +7565,7 @@ void LLPipeline::renderDeferredLighting() setupSpotLight(gDeferredSpotLightProgram, drawablep); LLColor3 col = volume->getLightColor(); - col *= volume->getLightIntensity(); - + //vertex positions are encoded so the 3 bits of their vertex index //correspond to their axis facing, with bit position 3,2,1 matching //axis facing x,y,z, bit set meaning positive facing, bit clear @@ -7676,8 +7674,7 @@ void LLPipeline::renderDeferredLighting() setupSpotLight(gDeferredMultiSpotLightProgram, drawablep); LLColor3 col = volume->getLightColor(); - col *= volume->getLightIntensity(); - + gDeferredMultiSpotLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, tc.v); gDeferredMultiSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s*s); gDeferredMultiSpotLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV); -- cgit v1.2.3 From 2dc7df91ade45d8952473f7de5068e8705440e29 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 13 Dec 2011 15:23:55 -0600 Subject: SH-2743 Fix for shader compiler error on some GL 3.x implementations. --- indra/llrender/llshadermgr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index ac9dc9544d..85c4bab7a9 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -579,7 +579,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade text[count++] = strdup("#define ATTRIBUTE attribute\n"); text[count++] = strdup("#define VARYING varying\n"); } - else if (version < 3.f) + else if (version < 3.3f) { //set version to 1.20 text[count++] = strdup("#version 120\n"); -- cgit v1.2.3 From 9fa68f0da363cd3c20dbb079f5d2901a45dfea5f Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 14 Dec 2011 17:55:36 -0600 Subject: SH-2743 Fix for shader compiler error on some GL 3.x implementations. --- indra/llrender/llglslshader.cpp | 2 +- indra/llrender/llglslshader.h | 1 + indra/llrender/llshadermgr.cpp | 18 ++++++++++++------ .../shaders/class1/deferred/alphaSkinnedV.glsl | 3 --- indra/newview/llviewershadermgr.cpp | 5 ++++- 5 files changed, 18 insertions(+), 11 deletions(-) (limited to 'indra') diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 5a6f3d8292..6b2852670a 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -66,7 +66,7 @@ BOOL shouldChange(const LLVector4& v1, const LLVector4& v2) LLShaderFeatures::LLShaderFeatures() : calculatesLighting(false), isShiny(false), isFullbright(false), hasWaterFog(false), hasTransport(false), hasSkinning(false), hasObjectSkinning(false), hasAtmospherics(false), isSpecular(false), -hasGamma(false), hasLighting(false), calculatesAtmospherics(false), mIndexedTextureChannels(0), disableTextureIndex(false), +hasGamma(false), hasLighting(false), isAlphaLighting(false), calculatesAtmospherics(false), mIndexedTextureChannels(0), disableTextureIndex(false), hasAlphaMask(false) { } diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index 2a6c050eac..00b4b0dbd4 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -36,6 +36,7 @@ public: bool calculatesLighting; bool calculatesAtmospherics; bool hasLighting; // implies no transport (it's possible to have neither though) + bool isAlphaLighting; // indicates lighting shaders need not be linked in (lighting performed directly in alpha shader to match deferred lighting functions) bool isShiny; bool isFullbright; // implies no lighting bool isSpecular; diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 85c4bab7a9..1a03aeebb7 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -107,10 +107,13 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) { return FALSE; } - - if (!shader->attachObject("lighting/sumLightsSpecularV.glsl")) + + if (!features->isAlphaLighting) { - return FALSE; + if (!shader->attachObject("lighting/sumLightsSpecularV.glsl")) + { + return FALSE; + } } if (!shader->attachObject("lighting/lightSpecularV.glsl")) @@ -125,9 +128,12 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) return FALSE; } - if (!shader->attachObject("lighting/sumLightsV.glsl")) + if (!features->isAlphaLighting) { - return FALSE; + if (!shader->attachObject("lighting/sumLightsV.glsl")) + { + return FALSE; + } } if (!shader->attachObject("lighting/lightV.glsl")) @@ -296,7 +302,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) } shader->mFeatures.mIndexedTextureChannels = llmax(LLGLSLShader::sIndexedTextureChannels-1, 1); } - } + } } // NOTE order of shader object attaching is VERY IMPORTANT!!! diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl index b09441f7eb..0170ad4b55 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl @@ -30,7 +30,6 @@ ATTRIBUTE vec3 normal; ATTRIBUTE vec4 diffuse_color; ATTRIBUTE vec2 texcoord0; -vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); mat4 getObjectSkinnedTransform(); void calcAtmospherics(vec3 inPositionEye); @@ -38,8 +37,6 @@ float calcDirectionalLight(vec3 n, vec3 l); vec3 atmosAmbient(vec3 light); vec3 atmosAffectDirectionalLight(float lightIntensity); -vec3 scaleDownLight(vec3 light); -vec3 scaleUpLight(vec3 light); VARYING vec3 vary_position; VARYING vec3 vary_ambient; diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index bddc07b395..5de363e03c 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -1103,11 +1103,12 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() { gDeferredSkinnedAlphaProgram.mName = "Deferred Skinned Alpha Shader"; gDeferredSkinnedAlphaProgram.mFeatures.hasObjectSkinning = true; - gDeferredSkinnedAlphaProgram.mFeatures.calculatesLighting = true; gDeferredSkinnedAlphaProgram.mFeatures.calculatesAtmospherics = true; gDeferredSkinnedAlphaProgram.mFeatures.hasGamma = true; gDeferredSkinnedAlphaProgram.mFeatures.hasAtmospherics = true; + gDeferredSkinnedAlphaProgram.mFeatures.calculatesLighting = true; gDeferredSkinnedAlphaProgram.mFeatures.hasLighting = true; + gDeferredSkinnedAlphaProgram.mFeatures.isAlphaLighting = true; gDeferredSkinnedAlphaProgram.mFeatures.disableTextureIndex = true; gDeferredSkinnedAlphaProgram.mShaderFiles.clear(); gDeferredSkinnedAlphaProgram.mShaderFiles.push_back(make_pair("deferred/alphaSkinnedV.glsl", GL_VERTEX_SHADER_ARB)); @@ -1235,6 +1236,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredAlphaProgram.mFeatures.hasGamma = true; gDeferredAlphaProgram.mFeatures.hasAtmospherics = true; gDeferredAlphaProgram.mFeatures.hasLighting = true; + gDeferredAlphaProgram.mFeatures.isAlphaLighting = true; gDeferredAlphaProgram.mFeatures.disableTextureIndex = true; //hack to disable auto-setup of texture channels if (mVertexShaderLevel[SHADER_DEFERRED] < 1) { @@ -1398,6 +1400,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredAvatarAlphaProgram.mFeatures.hasGamma = true; gDeferredAvatarAlphaProgram.mFeatures.hasAtmospherics = true; gDeferredAvatarAlphaProgram.mFeatures.hasLighting = true; + gDeferredAvatarAlphaProgram.mFeatures.isAlphaLighting = true; gDeferredAvatarAlphaProgram.mFeatures.disableTextureIndex = true; gDeferredAvatarAlphaProgram.mShaderFiles.clear(); gDeferredAvatarAlphaProgram.mShaderFiles.push_back(make_pair("deferred/avatarAlphaV.glsl", GL_VERTEX_SHADER_ARB)); -- cgit v1.2.3 From 4ec112bfce19d4bf09ef79b3b3195dda24148730 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 15 Dec 2011 21:39:48 -0700 Subject: fix for SH-2738 and SH-2777, might also help SH-2723: heap corruption SH-2738: Texture fetching freezes due to LLcurl SH-2777: viewer crashed on logout in LLCurl::Easy::releaseEasyHandle --- indra/llcommon/llthread.h | 7 ++++-- indra/llmessage/llcurl.cpp | 63 ++++++++++++++++++++++++++++------------------ indra/llmessage/llcurl.h | 2 ++ 3 files changed, 45 insertions(+), 27 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h index 40291a2569..f0e0de6173 100644 --- a/indra/llcommon/llthread.h +++ b/indra/llcommon/llthread.h @@ -187,11 +187,14 @@ public: LLMutexLock(LLMutex* mutex) { mMutex = mutex; - mMutex->lock(); + + if(mMutex) + mMutex->lock(); } ~LLMutexLock() { - mMutex->unlock(); + if(mMutex) + mMutex->unlock(); } private: LLMutex* mMutex; diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp index ce0632668c..874f4673ca 100644 --- a/indra/llmessage/llcurl.cpp +++ b/indra/llmessage/llcurl.cpp @@ -219,11 +219,15 @@ namespace boost std::set LLCurl::Easy::sFreeHandles; std::set LLCurl::Easy::sActiveHandles; +LLMutex* LLCurl::Easy::sHandleMutexp = NULL ; //static CURL* LLCurl::Easy::allocEasyHandle() { CURL* ret = NULL; + + LLMutexLock lock(sHandleMutexp) ; + if (sFreeHandles.empty()) { ret = curl_easy_init(); @@ -251,6 +255,7 @@ void LLCurl::Easy::releaseEasyHandle(CURL* handle) llerrs << "handle cannot be NULL!" << llendl; } + LLMutexLock lock(sHandleMutexp) ; if (sActiveHandles.find(handle) != sActiveHandles.end()) { sActiveHandles.erase(handle); @@ -519,7 +524,8 @@ LLCurl::Multi::Multi() mState(STATE_READY), mDead(FALSE), mMutexp(NULL), - mDeletionMutexp(NULL) + mDeletionMutexp(NULL), + mEasyMutexp(NULL) { mCurlMultiHandle = curl_multi_init(); if (!mCurlMultiHandle) @@ -534,6 +540,7 @@ LLCurl::Multi::Multi() { mMutexp = new LLMutex(NULL) ; mDeletionMutexp = new LLMutex(NULL) ; + mEasyMutexp = new LLMutex(NULL) ; } LLCurl::getCurlThread()->addMulti(this) ; @@ -563,6 +570,8 @@ LLCurl::Multi::~Multi() mMutexp = NULL ; delete mDeletionMutexp ; mDeletionMutexp = NULL ; + delete mEasyMutexp ; + mEasyMutexp = NULL ; --gCurlMultiCount; } @@ -585,17 +594,9 @@ void LLCurl::Multi::unlock() void LLCurl::Multi::markDead() { - if(mDeletionMutexp) - { - mDeletionMutexp->lock() ; - } - + LLMutexLock lock(mDeletionMutexp) ; + mDead = TRUE ; - - if(mDeletionMutexp) - { - mDeletionMutexp->unlock() ; - } } void LLCurl::Multi::setState(LLCurl::Multi::ePerformState state) @@ -655,10 +656,8 @@ CURLMsg* LLCurl::Multi::info_read(S32* msgs_in_queue) //return true if dead bool LLCurl::Multi::doPerform() { - if(mDeletionMutexp) - { - mDeletionMutexp->lock() ; - } + LLMutexLock lock(mDeletionMutexp) ; + bool dead = mDead ; if(mDead) @@ -675,6 +674,7 @@ bool LLCurl::Multi::doPerform() call_count < MULTI_PERFORM_CALL_REPEAT; call_count++) { + LLMutexLock lock(mMutexp) ; CURLMcode code = curl_multi_perform(mCurlMultiHandle, &q); if (CURLM_CALL_MULTI_PERFORM != code || q == 0) { @@ -688,11 +688,6 @@ bool LLCurl::Multi::doPerform() setState(STATE_COMPLETED) ; } - if(mDeletionMutexp) - { - mDeletionMutexp->unlock() ; - } - return dead ; } @@ -743,19 +738,21 @@ S32 LLCurl::Multi::process() LLCurl::Easy* LLCurl::Multi::allocEasy() { - Easy* easy = 0; + Easy* easy = 0; if (mEasyFreeList.empty()) - { + { easy = Easy::getEasy(); } else { + LLMutexLock lock(mEasyMutexp) ; easy = *(mEasyFreeList.begin()); mEasyFreeList.erase(easy); } if (easy) { + LLMutexLock lock(mEasyMutexp) ; mEasyActiveList.insert(easy); mEasyActiveMap[easy->getCurlHandle()] = easy; } @@ -764,6 +761,7 @@ LLCurl::Easy* LLCurl::Multi::allocEasy() bool LLCurl::Multi::addEasy(Easy* easy) { + LLMutexLock lock(mMutexp) ; CURLMcode mcode = curl_multi_add_handle(mCurlMultiHandle, easy->getCurlHandle()); check_curl_multi_code(mcode); //if (mcode != CURLM_OK) @@ -776,22 +774,30 @@ bool LLCurl::Multi::addEasy(Easy* easy) void LLCurl::Multi::easyFree(Easy* easy) { + mEasyMutexp->lock() ; mEasyActiveList.erase(easy); mEasyActiveMap.erase(easy->getCurlHandle()); + if (mEasyFreeList.size() < EASY_HANDLE_POOL_SIZE) - { - easy->resetState(); + { mEasyFreeList.insert(easy); + mEasyMutexp->unlock() ; + + easy->resetState(); } else { + mEasyMutexp->unlock() ; delete easy; } } void LLCurl::Multi::removeEasy(Easy* easy) { - check_curl_multi_code(curl_multi_remove_handle(mCurlMultiHandle, easy->getCurlHandle())); + { + LLMutexLock lock(mMutexp) ; + check_curl_multi_code(curl_multi_remove_handle(mCurlMultiHandle, easy->getCurlHandle())); + } easyFree(easy); } @@ -1290,6 +1296,10 @@ void LLCurl::initClass(bool multi_threaded) #endif sCurlThread = new LLCurlThread(multi_threaded) ; + if(multi_threaded) + { + Easy::sHandleMutexp = new LLMutex(NULL) ; + } } void LLCurl::cleanupClass() @@ -1319,6 +1329,9 @@ void LLCurl::cleanupClass() Easy::sFreeHandles.clear(); + delete Easy::sHandleMutexp ; + Easy::sHandleMutexp = NULL ; + llassert(Easy::sActiveHandles.empty()); } diff --git a/indra/llmessage/llcurl.h b/indra/llmessage/llcurl.h index 2c95279438..eb814bc608 100644 --- a/indra/llmessage/llcurl.h +++ b/indra/llmessage/llcurl.h @@ -253,6 +253,7 @@ private: static std::set sFreeHandles; static std::set sActiveHandles; + static LLMutex* sHandleMutexp ; }; class LLCurl::Multi @@ -316,6 +317,7 @@ private: BOOL mDead ; LLMutex* mMutexp ; LLMutex* mDeletionMutexp ; + LLMutex* mEasyMutexp ; }; class LLCurlThread : public LLQueuedThread -- cgit v1.2.3 From c0b4ec6fe72d703191b28749cfd30262d131b245 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 16 Dec 2011 17:43:30 -0600 Subject: SH-2694 Fix for FPS drop when mousing over flexi objects (don't use an octree for flexi raycast) --- indra/llmath/lloctree.h | 36 ++++++++------- indra/llmath/llvolume.cpp | 85 +++++++++++++++++++++++++++++++----- indra/newview/llspatialpartition.cpp | 26 ++++++----- 3 files changed, 111 insertions(+), 36 deletions(-) (limited to 'indra') diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h index 3c1ae45d68..1b11e83b4a 100644 --- a/indra/llmath/lloctree.h +++ b/indra/llmath/lloctree.h @@ -80,8 +80,8 @@ public: typedef LLOctreeTraveler oct_traveler; typedef LLTreeTraveler tree_traveler; typedef typename std::set > element_list; - typedef typename std::set >::iterator element_iter; - typedef typename std::set >::const_iterator const_element_iter; + typedef typename element_list::iterator element_iter; + typedef typename element_list::const_iterator const_element_iter; typedef typename std::vector*>::iterator tree_listener_iter; typedef typename std::vector* > child_list; typedef LLTreeNode BaseType; @@ -114,6 +114,8 @@ public: mOctant = ((oct_node*) mParent)->getOctant(mCenter); } + mElementCount = 0; + clearChildren(); } @@ -219,11 +221,11 @@ public: void accept(oct_traveler* visitor) { visitor->visit(this); } virtual bool isLeaf() const { return mChild.empty(); } - U32 getElementCount() const { return mData.size(); } + U32 getElementCount() const { return mElementCount; } element_list& getData() { return mData; } const element_list& getData() const { return mData; } - U32 getChildCount() const { return mChild.size(); } + U32 getChildCount() const { return mChildCount; } oct_node* getChild(U32 index) { return mChild[index]; } const oct_node* getChild(U32 index) const { return mChild[index]; } child_list& getChildren() { return mChild; } @@ -300,17 +302,13 @@ public: if ((getElementCount() < gOctreeMaxCapacity && contains(data->getBinRadius()) || (data->getBinRadius() > getSize()[0] && parent && parent->getElementCount() >= gOctreeMaxCapacity))) { //it belongs here -#if LL_OCTREE_PARANOIA_CHECK //if this is a redundant insertion, error out (should never happen) - if (mData.find(data) != mData.end()) - { - llwarns << "Redundant octree insertion detected. " << data << llendl; - return false; - } -#endif + llassert(mData.find(data) == mData.end()); mData.insert(data); BaseType::insert(data); + + mElementCount = mData.size(); return true; } else @@ -346,6 +344,8 @@ public: { mData.insert(data); BaseType::insert(data); + + mElementCount = mData.size(); return true; } @@ -399,6 +399,7 @@ public: if (mData.find(data) != mData.end()) { //we have data mData.erase(data); + mElementCount = mData.size(); notifyRemoval(data); checkAlive(); return true; @@ -436,6 +437,7 @@ public: if (mData.find(data) != mData.end()) { mData.erase(data); + mElementCount = mData.size(); notifyRemoval(data); llwarns << "FOUND!" << llendl; checkAlive(); @@ -452,7 +454,7 @@ public: void clearChildren() { mChild.clear(); - + mChildCount = 0; U32* foo = (U32*) mChildMap; foo[0] = foo[1] = 0xFFFFFFFF; } @@ -512,9 +514,10 @@ public: } #endif - mChildMap[child->getOctant()] = (U8) mChild.size(); + mChildMap[child->getOctant()] = mChildCount; mChild.push_back(child); + ++mChildCount; child->setParent(this); if (!silent) @@ -534,21 +537,20 @@ public: oct_listener* listener = getOctListener(i); listener->handleChildRemoval(this, getChild(index)); } - - if (destroy) { mChild[index]->destroy(); delete mChild[index]; } mChild.erase(mChild.begin() + index); + --mChildCount; //rebuild child map U32* foo = (U32*) mChildMap; foo[0] = foo[1] = 0xFFFFFFFF; - for (U32 i = 0; i < mChild.size(); ++i) + for (U32 i = 0; i < mChildCount; ++i) { mChildMap[mChild[i]->getOctant()] = i; } @@ -601,8 +603,10 @@ protected: child_list mChild; U8 mChildMap[8]; + U32 mChildCount; element_list mData; + U32 mElementCount; }; diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index da0fa32963..0c6cf1dfae 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -4617,18 +4617,83 @@ S32 LLVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& en genBinormals(i); } - if (!face.mOctree) - { - face.createOctree(); - } - - //LLVector4a* p = (LLVector4a*) face.mPositions; + if (isUnique()) + { //don't bother with an octree for flexi volumes + U32 tri_count = face.mNumIndices/3; + + for (U32 j = 0; j < tri_count; ++j) + { + U16 idx0 = face.mIndices[j*3+0]; + U16 idx1 = face.mIndices[j*3+1]; + U16 idx2 = face.mIndices[j*3+2]; - LLOctreeTriangleRayIntersect intersect(start, dir, &face, &closest_t, intersection, tex_coord, normal, bi_normal); - intersect.traverse(face.mOctree); - if (intersect.mHitFace) + const LLVector4a& v0 = face.mPositions[idx0]; + const LLVector4a& v1 = face.mPositions[idx1]; + const LLVector4a& v2 = face.mPositions[idx2]; + + F32 a,b,t; + + if (LLTriangleRayIntersect(v0, v1, v2, + start, dir, a, b, t)) + { + if ((t >= 0.f) && // if hit is after start + (t <= 1.f) && // and before end + (t < closest_t)) // and this hit is closer + { + closest_t = t; + hit_face = i; + + if (intersection != NULL) + { + LLVector4a intersect = dir; + intersect.mul(closest_t); + intersect.add(start); + intersection->set(intersect.getF32ptr()); + } + + + if (tex_coord != NULL) + { + LLVector2* tc = (LLVector2*) face.mTexCoords; + *tex_coord = ((1.f - a - b) * tc[idx0] + + a * tc[idx1] + + b * tc[idx2]); + + } + + if (normal!= NULL) + { + LLVector4* norm = (LLVector4*) face.mNormals; + + *normal = ((1.f - a - b) * LLVector3(norm[idx0]) + + a * LLVector3(norm[idx1]) + + b * LLVector3(norm[idx2])); + } + + if (bi_normal != NULL) + { + LLVector4* binormal = (LLVector4*) face.mBinormals; + *bi_normal = ((1.f - a - b) * LLVector3(binormal[idx0]) + + a * LLVector3(binormal[idx1]) + + b * LLVector3(binormal[idx2])); + } + } + } + } + } + else { - hit_face = i; + if (!face.mOctree) + { + face.createOctree(); + } + + LLOctreeTriangleRayIntersect intersect(start, dir, &face, &closest_t, intersection, tex_coord, normal, bi_normal); + intersect.traverse(face.mOctree); + if (intersect.mHitFace) + { + hit_face = i; + } } } } diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index fb107a302a..900f126049 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -3775,11 +3775,7 @@ void renderRaycast(LLDrawable* drawablep) for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i) { const LLVolumeFace& face = volume->getVolumeFace(i); - if (!face.mOctree) - { - ((LLVolumeFace*) &face)->createOctree(); - } - + gGL.pushMatrix(); gGL.translatef(trans.mV[0], trans.mV[1], trans.mV[2]); gGL.multMatrix((F32*) vobj->getRelativeXform().mMatrix); @@ -3802,9 +3798,6 @@ void renderRaycast(LLDrawable* drawablep) LLVector4a dir; dir.setSub(enda, starta); - F32 t = 1.f; - - LLRenderOctreeRaycast render(starta, dir, &t); gGL.flush(); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); @@ -3816,8 +3809,21 @@ void renderRaycast(LLDrawable* drawablep) gGL.syncMatrices(); glDrawElements(GL_TRIANGLES, face.mNumIndices, GL_UNSIGNED_SHORT, face.mIndices); } - - render.traverse(face.mOctree); + + if (!volume->isUnique()) + { + F32 t = 1.f; + + if (!face.mOctree) + { + ((LLVolumeFace*) &face)->createOctree(); + } + + LLRenderOctreeRaycast render(starta, dir, &t); + + render.traverse(face.mOctree); + } + gGL.popMatrix(); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); } -- cgit v1.2.3 From 58f9982fbc94ed2f039f0cd32579fa572f87e8ba Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 19 Dec 2011 15:35:38 -0600 Subject: SH-2738 Add comment documenting need to not make main thread wait on curl_multi_perform --- indra/llmessage/llcurl.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra') diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp index 874f4673ca..20f0c6c602 100644 --- a/indra/llmessage/llcurl.cpp +++ b/indra/llmessage/llcurl.cpp @@ -675,6 +675,10 @@ bool LLCurl::Multi::doPerform() call_count++) { LLMutexLock lock(mMutexp) ; + + //WARNING: curl_multi_perform will block for many hundreds of milliseconds + // NEVER call this from the main thread, and NEVER allow the main thread to + // wait on a mutex held by this thread while curl_multi_perform is executing CURLMcode code = curl_multi_perform(mCurlMultiHandle, &q); if (CURLM_CALL_MULTI_PERFORM != code || q == 0) { -- cgit v1.2.3 From 5affaf264da937cdf825bf174c3905a6063b5336 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 19 Dec 2011 16:55:21 -0600 Subject: SH-2738 Don't lock unless we really need to --- indra/llmessage/llcurl.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'indra') diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp index 20f0c6c602..05f3869a11 100644 --- a/indra/llmessage/llcurl.cpp +++ b/indra/llmessage/llcurl.cpp @@ -612,13 +612,7 @@ void LLCurl::Multi::setState(LLCurl::Multi::ePerformState state) LLCurl::Multi::ePerformState LLCurl::Multi::getState() { - ePerformState state ; - - lock() ; - state = mState ; - unlock() ; - - return state ; + return mState; } bool LLCurl::Multi::isCompleted() @@ -636,14 +630,12 @@ bool LLCurl::Multi::waitToComplete() bool completed ; - lock() ; completed = (STATE_COMPLETED == mState) ; if(!completed) { LLCurl::getCurlThread()->setPriority(mHandle, LLQueuedThread::PRIORITY_URGENT) ; } - unlock() ; - + return completed; } -- cgit v1.2.3 From 1620ad6d00a77b2089e0ae5f6de30f9a954c6167 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 20 Dec 2011 11:04:10 -0700 Subject: more tuning of llcurl code targeting crashes like SH-2777. --- indra/llmessage/llcurl.cpp | 43 ++++++++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 11 deletions(-) (limited to 'indra') diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp index 05f3869a11..5027e8fa84 100644 --- a/indra/llmessage/llcurl.cpp +++ b/indra/llmessage/llcurl.cpp @@ -603,11 +603,12 @@ void LLCurl::Multi::setState(LLCurl::Multi::ePerformState state) { lock() ; mState = state ; + unlock() ; + if(mState == STATE_READY) { LLCurl::getCurlThread()->setPriority(mHandle, LLQueuedThread::PRIORITY_NORMAL) ; - } - unlock() ; + } } LLCurl::Multi::ePerformState LLCurl::Multi::getState() @@ -628,9 +629,7 @@ bool LLCurl::Multi::waitToComplete() return true ; } - bool completed ; - - completed = (STATE_COMPLETED == mState) ; + bool completed = (STATE_COMPLETED == mState) ; if(!completed) { LLCurl::getCurlThread()->setPriority(mHandle, LLQueuedThread::PRIORITY_URGENT) ; @@ -641,6 +640,8 @@ bool LLCurl::Multi::waitToComplete() CURLMsg* LLCurl::Multi::info_read(S32* msgs_in_queue) { + LLMutexLock lock(mMutexp) ; + CURLMsg* curlmsg = curl_multi_info_read(mCurlMultiHandle, msgs_in_queue); return curlmsg; } @@ -706,10 +707,19 @@ S32 LLCurl::Multi::process() if (msg->msg == CURLMSG_DONE) { U32 response = 0; - easy_active_map_t::iterator iter = mEasyActiveMap.find(msg->easy_handle); - if (iter != mEasyActiveMap.end()) + Easy* easy = NULL ; + + { + LLMutexLock lock(mEasyMutexp) ; + easy_active_map_t::iterator iter = mEasyActiveMap.find(msg->easy_handle); + if (iter != mEasyActiveMap.end()) + { + easy = iter->second; + } + } + + if(easy) { - Easy* easy = iter->second; response = easy->report(msg->data.result); removeEasy(easy); } @@ -770,20 +780,31 @@ bool LLCurl::Multi::addEasy(Easy* easy) void LLCurl::Multi::easyFree(Easy* easy) { - mEasyMutexp->lock() ; + if(mEasyMutexp) + { + mEasyMutexp->lock() ; + } + mEasyActiveList.erase(easy); mEasyActiveMap.erase(easy->getCurlHandle()); if (mEasyFreeList.size() < EASY_HANDLE_POOL_SIZE) { mEasyFreeList.insert(easy); - mEasyMutexp->unlock() ; + + if(mEasyMutexp) + { + mEasyMutexp->unlock() ; + } easy->resetState(); } else { - mEasyMutexp->unlock() ; + if(mEasyMutexp) + { + mEasyMutexp->unlock() ; + } delete easy; } } -- cgit v1.2.3 From 7fe5cbc5c2c288214a94c2c243cea08f30d815f3 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 22 Dec 2011 10:44:49 -0700 Subject: trivial: some debug code for SH-2623: [PUBLIC_JIRA_USERS][crashhunters] crash at LLViewerTextureList::removeImageFromList(LLViewerFetchedTexture *) --- indra/newview/llviewertexturelist.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra') diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index cddf7dcfea..089f45ca89 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -534,6 +534,7 @@ void LLViewerTextureList::removeImageFromList(LLViewerFetchedTexture *image) S32 count = mImageList.erase(image) ; if(count != 1) { + llinfos << image->getID() << llendl ; llerrs << "Error happens when remove image from mImageList: " << count << llendl ; } @@ -919,6 +920,8 @@ void LLViewerTextureList::decodeAllImages(F32 max_time) image_list.push_back(imagep); imagep->setInImageList(FALSE) ; } + + llassert_always(image_list.size() == mImageList.size()) ; mImageList.clear(); for (std::vector >::iterator iter = image_list.begin(); iter != image_list.end(); ++iter) -- cgit v1.2.3 From 94ad019ce3387b9c5207fe3207933697059dd2dd Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 4 Jan 2012 14:14:23 -0700 Subject: fix for SH-2823 and SH-2824: crash in curl: LLBufferArray::countAfter() and LLBufferArray::copyIntoBuffers reviewed by vir --- indra/llmessage/llurlrequest.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/llmessage/llurlrequest.cpp b/indra/llmessage/llurlrequest.cpp index a3a2b2b1b8..261e57e79e 100644 --- a/indra/llmessage/llurlrequest.cpp +++ b/indra/llmessage/llurlrequest.cpp @@ -64,7 +64,7 @@ public: ~LLURLRequestDetail(); std::string mURL; LLCurlEasyRequest* mCurlRequest; - LLBufferArray* mResponseBuffer; + LLIOPipe::buffer_ptr_t mResponseBuffer; LLChannelDescriptors mChannels; U8* mLastRead; U32 mBodyLimit; @@ -75,7 +75,6 @@ public: LLURLRequestDetail::LLURLRequestDetail() : mCurlRequest(NULL), - mResponseBuffer(NULL), mLastRead(NULL), mBodyLimit(0), mByteAccumulator(0), @@ -90,7 +89,6 @@ LLURLRequestDetail::~LLURLRequestDetail() { LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST); delete mCurlRequest; - mResponseBuffer = NULL; mLastRead = NULL; } @@ -326,7 +324,7 @@ LLIOPipe::EStatus LLURLRequest::process_impl( // *FIX: bit of a hack, but it should work. The configure and // callback method expect this information to be ready. - mDetail->mResponseBuffer = buffer.get(); + mDetail->mResponseBuffer = buffer; mDetail->mChannels = channels; if(!configure()) { -- cgit v1.2.3