aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/viewer.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:58 -0500
committerJacek Antonelli2008-08-15 23:44:58 -0500
commit089fc07d207c71ce1401e72f09c31ad8c45872e2 (patch)
tree0028955add042c6f45b47a7b774adeeac9c592cb /linden/indra/newview/viewer.cpp
parentSecond Life viewer sources 1.16.0.5 (diff)
downloadmeta-impy-089fc07d207c71ce1401e72f09c31ad8c45872e2.zip
meta-impy-089fc07d207c71ce1401e72f09c31ad8c45872e2.tar.gz
meta-impy-089fc07d207c71ce1401e72f09c31ad8c45872e2.tar.bz2
meta-impy-089fc07d207c71ce1401e72f09c31ad8c45872e2.tar.xz
Second Life viewer sources 1.17.0.12
Diffstat (limited to 'linden/indra/newview/viewer.cpp')
-rw-r--r--linden/indra/newview/viewer.cpp81
1 files changed, 46 insertions, 35 deletions
diff --git a/linden/indra/newview/viewer.cpp b/linden/indra/newview/viewer.cpp
index b71c6f2..2f05754 100644
--- a/linden/indra/newview/viewer.cpp
+++ b/linden/indra/newview/viewer.cpp
@@ -1856,7 +1856,44 @@ void main_loop()
1856 { 1856 {
1857 LLFastTimer t2(LLFastTimer::FTM_SLEEP); 1857 LLFastTimer t2(LLFastTimer::FTM_SLEEP);
1858 bool run_multiple_threads = gSavedSettings.getBOOL("RunMultipleThreads"); 1858 bool run_multiple_threads = gSavedSettings.getBOOL("RunMultipleThreads");
1859
1860 // yield some time to the os based on command line option
1861 if(gYieldTime)
1862 {
1863 ms_sleep(gYieldMS);
1864 }
1865
1866 // yield cooperatively when not running as foreground window
1867 if ( gNoRender
1868 || !gViewerWindow->mWindow->getVisible()
1869 || !gFocusMgr.getAppHasFocus())
1870 {
1871 // Sleep if we're not rendering, or the window is minimized.
1872 S32 milliseconds_to_sleep = llclamp(gSavedSettings.getS32("BackgroundYieldTime"), 0, 1000);
1873 // don't sleep when BackgroundYieldTime set to 0, since this will still yield to other threads
1874 // of equal priority on Windows
1875 if (milliseconds_to_sleep > 0)
1876 {
1877 ms_sleep(milliseconds_to_sleep);
1878 // also pause worker threads during this wait period
1879 gTextureCache->pause();
1880 gImageDecodeThread->pause();
1881 }
1882 }
1859 1883
1884 if (gRandomizeFramerate)
1885 {
1886 ms_sleep(rand() % 200);
1887 }
1888
1889 if (gPeriodicSlowFrame
1890 && (gFrameCount % 10 == 0))
1891 {
1892 llinfos << "Periodic slow frame - sleeping 500 ms" << llendl;
1893 ms_sleep(500);
1894 }
1895
1896
1860 const F64 min_frame_time = 0.0; //(.0333 - .0010); // max video frame rate = 30 fps 1897 const F64 min_frame_time = 0.0; //(.0333 - .0010); // max video frame rate = 30 fps
1861 const F64 min_idle_time = 0.0; //(.0010); // min idle time = 1 ms 1898 const F64 min_idle_time = 0.0; //(.0010); // min idle time = 1 ms
1862 const F64 max_idle_time = run_multiple_threads ? min_idle_time : .005; // 5 ms 1899 const F64 max_idle_time = run_multiple_threads ? min_idle_time : .005; // 5 ms
@@ -1874,30 +1911,6 @@ void main_loop()
1874 { 1911 {
1875 ms_sleep(llmin(io_pending/100,100)); // give the vfs some time to catch up 1912 ms_sleep(llmin(io_pending/100,100)); // give the vfs some time to catch up
1876 } 1913 }
1877 if ( gNoRender
1878 || !gViewerWindow->mWindow->getVisible()
1879 || !gViewerWindow->getActive()
1880 || gViewerWindow->mWindow->getMinimized() )
1881 {
1882 // Sleep if we're not rendering, or the window is minimized.
1883 ms_sleep(20);
1884 }
1885 else
1886 {
1887// ms_sleep(1); // sleep at least 1 ms
1888 }
1889
1890 if (gRandomizeFramerate)
1891 {
1892 ms_sleep(rand() % 200);
1893 }
1894
1895 if (gPeriodicSlowFrame
1896 && (gFrameCount % 10 == 0))
1897 {
1898 llinfos << "Periodic slow frame - sleeping 500 ms" << llendl;
1899 ms_sleep(500);
1900 }
1901 1914
1902 F64 frame_time = frameTimer.getElapsedTimeF64(); 1915 F64 frame_time = frameTimer.getElapsedTimeF64();
1903 F64 idle_time = idleTimer.getElapsedTimeF64(); 1916 F64 idle_time = idleTimer.getElapsedTimeF64();
@@ -3957,12 +3970,6 @@ void idle()
3957 gAudiop->idle(max_audio_decode_time); 3970 gAudiop->idle(max_audio_decode_time);
3958 } 3971 }
3959 3972
3960 // yield some time to the os if we are supposed to.
3961 if(gYieldTime)
3962 {
3963 ms_sleep(gYieldMS);
3964 }
3965
3966 // Handle shutdown process, for example, 3973 // Handle shutdown process, for example,
3967 // wait for floaters to close, send quit message, 3974 // wait for floaters to close, send quit message,
3968 // forcibly quit if it has taken too long 3975 // forcibly quit if it has taken too long
@@ -6302,7 +6309,7 @@ void cleanup_app()
6302 6309
6303 llinfos << "Cleaning Up" << llendflush; 6310 llinfos << "Cleaning Up" << llendflush;
6304 6311
6305 LLKeyframeMotion::flushKeyframeCache(); 6312 LLKeyframeDataCache::clear();
6306 6313
6307 // Must clean up texture references before viewer window is destroyed. 6314 // Must clean up texture references before viewer window is destroyed.
6308 LLHUDObject::cleanupHUDObjects(); 6315 LLHUDObject::cleanupHUDObjects();
@@ -6334,6 +6341,8 @@ void cleanup_app()
6334 delete gGlobalEconomy; 6341 delete gGlobalEconomy;
6335 gGlobalEconomy = NULL; 6342 gGlobalEconomy = NULL;
6336 6343
6344 LLNotifyBox::cleanup();
6345
6337 llinfos << "Global stuff deleted" << llendflush; 6346 llinfos << "Global stuff deleted" << llendflush;
6338 6347
6339#if !LL_RELEASE_FOR_DOWNLOAD 6348#if !LL_RELEASE_FOR_DOWNLOAD
@@ -6423,8 +6432,7 @@ void cleanup_app()
6423 6432
6424 // Clean up selection managers after UI is destroyed, as UI 6433 // Clean up selection managers after UI is destroyed, as UI
6425 // may be observing them. 6434 // may be observing them.
6426 delete gSelectMgr; 6435 LLSelectMgr::cleanupGlobals();
6427 gSelectMgr = NULL;
6428 6436
6429 LLViewerObject::cleanupVOClasses(); 6437 LLViewerObject::cleanupVOClasses();
6430 6438
@@ -6445,8 +6453,7 @@ void cleanup_app()
6445 llwarns << "Remaining references in the volume manager!" << llendflush; 6453 llwarns << "Remaining references in the volume manager!" << llendflush;
6446 } 6454 }
6447 6455
6448 delete gParcelMgr; 6456 LLViewerParcelMgr::cleanupGlobals();
6449 gParcelMgr = NULL;
6450 6457
6451 delete gViewerStats; 6458 delete gViewerStats;
6452 gViewerStats = NULL; 6459 gViewerStats = NULL;
@@ -6562,8 +6569,12 @@ void cleanup_app()
6562 delete gVFS; 6569 delete gVFS;
6563 gVFS = NULL; 6570 gVFS = NULL;
6564 6571
6572 LLCurl::cleanup();
6573
6565 // This will eventually be done in LLApp 6574 // This will eventually be done in LLApp
6566 LLCommon::cleanupClass(); 6575 LLCommon::cleanupClass();
6576
6577 end_messaging_system();
6567} 6578}
6568 6579
6569const std::string& getLoginURI() 6580const std::string& getLoginURI()