summaryrefslogtreecommitdiff
path: root/indra/newview/llappviewer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r--indra/newview/llappviewer.cpp61
1 files changed, 38 insertions, 23 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 2fad71a686..7d5432904b 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -75,6 +75,7 @@
#include "llteleporthistory.h"
#include "lllocationhistory.h"
#include "llfasttimerview.h"
+
#include "llweb.h"
#include "llsecondlifeurls.h"
@@ -771,6 +772,7 @@ bool LLAppViewer::init()
//
// Initialize the window
//
+ gGLActive = TRUE;
initWindow();
// call all self-registered classes
@@ -875,7 +877,7 @@ bool LLAppViewer::init()
gSimFrames = (F32)gFrameCount;
LLViewerJoystick::getInstance()->init(false);
-
+ gGLActive = FALSE;
if (gSavedSettings.getBOOL("QAMode") && gSavedSettings.getS32("QAModeEventHostPort") > 0)
{
loadEventHostModule(gSavedSettings.getS32("QAModeEventHostPort"));
@@ -886,6 +888,10 @@ bool LLAppViewer::init()
static LLFastTimer::DeclareTimer FTM_MESSAGES("System Messages");
static LLFastTimer::DeclareTimer FTM_SLEEP("Sleep");
+static LLFastTimer::DeclareTimer FTM_TEXTURE_CACHE("Texture Cache");
+static LLFastTimer::DeclareTimer FTM_DECODE("Image Decode");
+static LLFastTimer::DeclareTimer FTM_VFS("VFS Thread");
+static LLFastTimer::DeclareTimer FTM_PAUSE_THREADS("Pause Threads");
static LLFastTimer::DeclareTimer FTM_IDLE("Idle");
static LLFastTimer::DeclareTimer FTM_PUMP("Pump");
@@ -925,6 +931,7 @@ bool LLAppViewer::mainLoop()
while (!LLApp::isExiting())
{
LLFastTimer::nextFrame(); // Should be outside of any timer instances
+
try
{
pingMainloopTimeout("Main:MiscNativeWindowEvents");
@@ -934,7 +941,7 @@ bool LLAppViewer::mainLoop()
LLFastTimer t2(FTM_MESSAGES);
gViewerWindow->mWindow->processMiscNativeEvents();
}
-
+
pingMainloopTimeout("Main:GatherInput");
if (gViewerWindow)
@@ -1018,10 +1025,11 @@ bool LLAppViewer::mainLoop()
if (!LLApp::isExiting())
{
pingMainloopTimeout("Main:Display");
+ gGLActive = TRUE;
display();
-
pingMainloopTimeout("Main:Snapshot");
LLFloaterSnapshot::update(); // take snapshots
+ gGLActive = FALSE;
}
}
@@ -1081,11 +1089,24 @@ bool LLAppViewer::mainLoop()
{
S32 work_pending = 0;
S32 io_pending = 0;
- work_pending += LLAppViewer::getTextureCache()->update(1); // unpauses the texture cache thread
- work_pending += LLAppViewer::getImageDecodeThread()->update(1); // unpauses the image thread
- work_pending += LLAppViewer::getTextureFetch()->update(1); // unpauses the texture fetch thread
- io_pending += LLVFSThread::updateClass(1);
- io_pending += LLLFSThread::updateClass(1);
+ {
+ LLFastTimer ftm(FTM_TEXTURE_CACHE);
+ work_pending += LLAppViewer::getTextureCache()->update(1); // unpauses the texture cache thread
+ }
+ {
+ LLFastTimer ftm(FTM_DECODE);
+ work_pending += LLAppViewer::getImageDecodeThread()->update(1); // unpauses the image thread
+ }
+ {
+ LLFastTimer ftm(FTM_DECODE);
+ work_pending += LLAppViewer::getTextureFetch()->update(1); // unpauses the texture fetch thread
+ }
+
+ {
+ LLFastTimer ftm(FTM_VFS);
+ io_pending += LLVFSThread::updateClass(1);
+ }
+
if (io_pending > 1000)
{
ms_sleep(llmin(io_pending/100,100)); // give the vfs some time to catch up
@@ -1111,6 +1132,8 @@ bool LLAppViewer::mainLoop()
// if (LLThread::processorCount()==1) //pause() should only be required when on a single processor client...
if (run_multiple_threads == FALSE)
{
+ LLFastTimer ftm(FTM_PAUSE_THREADS);
+
LLAppViewer::getTextureCache()->pause();
LLAppViewer::getImageDecodeThread()->pause();
// LLAppViewer::getTextureFetch()->pause(); // Don't pause the fetch (IO) thread
@@ -3342,10 +3365,13 @@ void LLAppViewer::idle()
if (LLStartUp::getStartupState() < STATE_STARTED)
{
// Skip rest if idle startup returns false (essentially, no world yet)
+ gGLActive = TRUE;
if (!idle_startup())
{
+ gGLActive = FALSE;
return;
}
+ gGLActive = FALSE;
}
@@ -3444,10 +3470,8 @@ void LLAppViewer::idle()
// floating throughout the various object lists.
//
- stop_glerror();
idleNetwork();
- stop_glerror();
-
+
// Check for away from keyboard, kick idle agents.
idle_afk_check();
@@ -3537,8 +3561,6 @@ void LLAppViewer::idle()
LLHUDManager::getInstance()->sendEffects();
}
- stop_glerror();
-
////////////////////////////////////////
//
// Unpack layer data that we've received
@@ -3594,7 +3616,6 @@ void LLAppViewer::idle()
gWindVec.setVec(0.0f, 0.0f, 0.0f);
}
}
- stop_glerror();
//////////////////////////////////////
//
@@ -3609,7 +3630,6 @@ void LLAppViewer::idle()
LLWorld::getInstance()->updateParticles();
}
- stop_glerror();
if (LLViewerJoystick::getInstance()->getOverrideCamera())
{
@@ -3654,10 +3674,9 @@ void LLAppViewer::idle()
// forcibly quit if it has taken too long
if (mQuitRequested)
{
+ gGLActive = TRUE;
idleShutdown();
}
-
- stop_glerror();
}
void LLAppViewer::idleShutdown()
@@ -3807,7 +3826,6 @@ void LLAppViewer::idleNetwork()
llpushcallstacks ;
LLTimer check_message_timer;
// Read all available packets from network
- stop_glerror();
const S64 frame_count = gFrameCount; // U32->S64
F32 total_time = 0.0f;
@@ -3820,8 +3838,7 @@ void LLAppViewer::idleNetwork()
// server going down, so this is OK.
break;
}
- stop_glerror();
-
+
total_decoded++;
gPacketsIn++;
@@ -3861,9 +3878,7 @@ void LLAppViewer::idleNetwork()
// we want to clear the control after sending out all necessary agent updates
gAgent.resetControlFlags();
- stop_glerror();
-
-
+
// Decode enqueued messages...
S32 remaining_possible_decodes = MESSAGE_MAX_PER_FRAME - total_decoded;