aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerdisplay.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llviewerdisplay.cpp95
1 files changed, 30 insertions, 65 deletions
diff --git a/linden/indra/newview/llviewerdisplay.cpp b/linden/indra/newview/llviewerdisplay.cpp
index 627609b..96591a2 100644
--- a/linden/indra/newview/llviewerdisplay.cpp
+++ b/linden/indra/newview/llviewerdisplay.cpp
@@ -4,7 +4,7 @@
4 * 4 *
5 * $LicenseInfo:firstyear=2004&license=viewergpl$ 5 * $LicenseInfo:firstyear=2004&license=viewergpl$
6 * 6 *
7 * Copyright (c) 2004-2008, Linden Research, Inc. 7 * Copyright (c) 2004-2009, Linden Research, Inc.
8 * 8 *
9 * Second Life Viewer Source Code 9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab 10 * The source code in this file ("Source Code") is provided by Linden Lab
@@ -113,7 +113,6 @@ void render_ui_3d();
113void render_ui_2d(); 113void render_ui_2d();
114void render_disconnected_background(); 114void render_disconnected_background();
115void render_hud_elements(); 115void render_hud_elements();
116void process_keystrokes_async();
117 116
118void display_startup() 117void display_startup()
119{ 118{
@@ -248,10 +247,12 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
248 247
249 gViewerWindow->checkSettings(); 248 gViewerWindow->checkSettings();
250 249
251 LLAppViewer::instance()->pingMainloopTimeout("Display:Pick"); 250 {
252 gViewerWindow->performPick(); 251 LLFastTimer ftm(LLFastTimer::FTM_PICK);
252 LLAppViewer::instance()->pingMainloopTimeout("Display:Pick");
253 gViewerWindow->performPick();
254 }
253 255
254
255 LLAppViewer::instance()->pingMainloopTimeout("Display:CheckStates"); 256 LLAppViewer::instance()->pingMainloopTimeout("Display:CheckStates");
256 LLGLState::checkStates(); 257 LLGLState::checkStates();
257 LLGLState::checkTextureChannels(); 258 LLGLState::checkTextureChannels();
@@ -373,6 +374,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
373 gAgent.setTeleportMessage( 374 gAgent.setTeleportMessage(
374 LLAgent::sTeleportProgressMessages["arriving"]); 375 LLAgent::sTeleportProgressMessages["arriving"]);
375 gImageList.mForceResetTextureStats = TRUE; 376 gImageList.mForceResetTextureStats = TRUE;
377 gAgent.resetView(TRUE, TRUE);
376 break; 378 break;
377 379
378 case LLAgent::TELEPORT_ARRIVING: 380 case LLAgent::TELEPORT_ARRIVING:
@@ -680,7 +682,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
680 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); 682 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
681 } 683 }
682 684
683 LLAppViewer::instance()->pingMainloopTimeout("Display:Render"); 685 LLAppViewer::instance()->pingMainloopTimeout("Display:RenderStart");
684 686
685 //// render frontmost floater opaque for occlusion culling purposes 687 //// render frontmost floater opaque for occlusion culling purposes
686 //LLFloater* frontmost_floaterp = gFloaterView->getFrontmost(); 688 //LLFloater* frontmost_floaterp = gFloaterView->getFrontmost();
@@ -690,7 +692,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
690 // glMatrixMode(GL_MODELVIEW); 692 // glMatrixMode(GL_MODELVIEW);
691 // glPushMatrix(); 693 // glPushMatrix();
692 // { 694 // {
693 // LLGLSNoTexture gls_no_texture; 695 // gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
694 696
695 // glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE); 697 // glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
696 // glLoadIdentity(); 698 // glLoadIdentity();
@@ -726,10 +728,13 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
726 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); 728 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
727 gGL.setColorMask(true, false); 729 gGL.setColorMask(true, false);
728 } 730 }
729 731
732 LLAppViewer::instance()->pingMainloopTimeout("Display:RenderGeom");
733
730 if (!(LLAppViewer::instance()->logoutRequestSent() && LLAppViewer::instance()->hasSavedFinalSnapshot()) 734 if (!(LLAppViewer::instance()->logoutRequestSent() && LLAppViewer::instance()->hasSavedFinalSnapshot())
731 && !gRestoreGL) 735 && !gRestoreGL)
732 { 736 {
737
733 gGL.setColorMask(true, false); 738 gGL.setColorMask(true, false);
734 LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater() ? TRUE : FALSE; 739 LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater() ? TRUE : FALSE;
735 gPipeline.renderGeom(*LLViewerCamera::getInstance(), TRUE); 740 gPipeline.renderGeom(*LLViewerCamera::getInstance(), TRUE);
@@ -744,9 +749,12 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
744 } 749 }
745 stop_glerror(); 750 stop_glerror();
746 } 751 }
752
753 LLAppViewer::instance()->pingMainloopTimeout("Display:RenderFlush");
747 754
748 if (to_texture) 755 if (to_texture)
749 { 756 {
757
750 gPipeline.mScreen.flush(); 758 gPipeline.mScreen.flush();
751 } 759 }
752 760
@@ -755,23 +763,20 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
755 /// Using render to texture would be faster/better, but I don't have a 763 /// Using render to texture would be faster/better, but I don't have a
756 /// grasp of their full display stack just yet. 764 /// grasp of their full display stack just yet.
757 // gPostProcess->apply(gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight()); 765 // gPostProcess->apply(gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight());
758 766
767 LLAppViewer::instance()->pingMainloopTimeout("Display:RenderUI");
768
759 if (!for_snapshot) 769 if (!for_snapshot)
760 { 770 {
771 gFrameStats.start(LLFrameStats::RENDER_UI);
761 render_ui(); 772 render_ui();
762 } 773 }
763 774
764 LLSpatialGroup::sNoDelete = FALSE; 775 LLSpatialGroup::sNoDelete = FALSE;
765 } 776 }
766 gFrameStats.start(LLFrameStats::RENDER_UI); 777
767 778 LLAppViewer::instance()->pingMainloopTimeout("Display:FrameStats");
768 if (gHandleKeysAsync) 779
769 {
770 LLAppViewer::instance()->pingMainloopTimeout("Display:Keystrokes");
771 process_keystrokes_async();
772 stop_glerror();
773 }
774
775 gFrameStats.start(LLFrameStats::MISC_END); 780 gFrameStats.start(LLFrameStats::MISC_END);
776 stop_glerror(); 781 stop_glerror();
777 782
@@ -997,8 +1002,8 @@ void render_ui()
997 1002
998void renderCoordinateAxes() 1003void renderCoordinateAxes()
999{ 1004{
1000 LLGLSNoTexture gls_no_texture; 1005 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
1001 gGL.begin(LLVertexBuffer::LINES); 1006 gGL.begin(LLRender::LINES);
1002 gGL.color3f(1.0f, 0.0f, 0.0f); // i direction = X-Axis = red 1007 gGL.color3f(1.0f, 0.0f, 0.0f); // i direction = X-Axis = red
1003 gGL.vertex3f(0.0f, 0.0f, 0.0f); 1008 gGL.vertex3f(0.0f, 0.0f, 0.0f);
1004 gGL.vertex3f(2.0f, 0.0f, 0.0f); 1009 gGL.vertex3f(2.0f, 0.0f, 0.0f);
@@ -1048,10 +1053,10 @@ void renderCoordinateAxes()
1048void draw_axes() 1053void draw_axes()
1049{ 1054{
1050 LLGLSUIDefault gls_ui; 1055 LLGLSUIDefault gls_ui;
1051 LLGLSNoTexture gls_no_texture; 1056 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
1052 // A vertical white line at origin 1057 // A vertical white line at origin
1053 LLVector3 v = gAgent.getPositionAgent(); 1058 LLVector3 v = gAgent.getPositionAgent();
1054 gGL.begin(LLVertexBuffer::LINES); 1059 gGL.begin(LLRender::LINES);
1055 gGL.color3f(1.0f, 1.0f, 1.0f); 1060 gGL.color3f(1.0f, 1.0f, 1.0f);
1056 gGL.vertex3f(0.0f, 0.0f, 0.0f); 1061 gGL.vertex3f(0.0f, 0.0f, 0.0f);
1057 gGL.vertex3f(0.0f, 0.0f, 40.0f); 1062 gGL.vertex3f(0.0f, 0.0f, 40.0f);
@@ -1194,7 +1199,7 @@ void render_disconnected_background()
1194 raw->expandToPowerOfTwo(); 1199 raw->expandToPowerOfTwo();
1195 gDisconnectedImagep->createGLTexture(0, raw); 1200 gDisconnectedImagep->createGLTexture(0, raw);
1196 gStartImageGL = gDisconnectedImagep; 1201 gStartImageGL = gDisconnectedImagep;
1197 LLImageGL::unbindTexture(0, GL_TEXTURE_2D); 1202 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
1198 } 1203 }
1199 1204
1200 // Make sure the progress view always fills the entire window. 1205 // Make sure the progress view always fills the entire window.
@@ -1213,10 +1218,10 @@ void render_disconnected_background()
1213 const LLVector2& display_scale = gViewerWindow->getDisplayScale(); 1218 const LLVector2& display_scale = gViewerWindow->getDisplayScale();
1214 glScalef(display_scale.mV[VX], display_scale.mV[VY], 1.f); 1219 glScalef(display_scale.mV[VX], display_scale.mV[VY], 1.f);
1215 1220
1216 LLViewerImage::bindTexture(gDisconnectedImagep); 1221 gGL.getTexUnit(0)->bind(gDisconnectedImagep);
1217 gGL.color4f(1.f, 1.f, 1.f, 1.f); 1222 gGL.color4f(1.f, 1.f, 1.f, 1.f);
1218 gl_rect_2d_simple_tex(width, height); 1223 gl_rect_2d_simple_tex(width, height);
1219 LLImageGL::unbindTexture(0, GL_TEXTURE_2D); 1224 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
1220 } 1225 }
1221 glPopMatrix(); 1226 glPopMatrix();
1222 } 1227 }
@@ -1227,43 +1232,3 @@ void display_cleanup()
1227{ 1232{
1228 gDisconnectedImagep = NULL; 1233 gDisconnectedImagep = NULL;
1229} 1234}
1230
1231void process_keystrokes_async()
1232{
1233#if LL_WINDOWS
1234 MSG msg;
1235 // look through all input messages, leaving them in the event queue
1236 while( PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE | PM_NOYIELD))
1237 {
1238 // on first mouse message, break out
1239 if (msg.message >= WM_MOUSEFIRST &&
1240 msg.message <= WM_MOUSELAST ||
1241 msg.message == WM_QUIT)
1242 {
1243 break;
1244 }
1245
1246 // this is a message we want to handle now, so remove it from the event queue
1247 PeekMessage(&msg, NULL, msg.message, msg.message, PM_REMOVE | PM_NOYIELD);
1248 // if (msg.message == WM_KEYDOWN)
1249 // {
1250 // llinfos << "Process async key down " << (U32)msg.wParam << llendl;
1251 // }
1252 TranslateMessage(&msg);
1253 DispatchMessage(&msg);
1254 }
1255
1256 // Scan keyboard for movement keys. Command keys and typing
1257 // are handled by windows callbacks. Don't do this until we're
1258 // done initializing. JC
1259 if (gViewerWindow->mWindow->getVisible()
1260 && gViewerWindow->getActive()
1261 && !gViewerWindow->mWindow->getMinimized()
1262 && LLStartUp::getStartupState() == STATE_STARTED
1263 && !gViewerWindow->getShowProgress()
1264 && !gFocusMgr.focusLocked())
1265 {
1266 gKeyboard->scanKeyboard();
1267 }
1268#endif
1269}