diff options
author | Brad Kittenbrink <brad@lindenlab.com> | 2022-04-27 10:27:48 -0700 |
---|---|---|
committer | Brad Kittenbrink <brad@lindenlab.com> | 2022-04-27 10:27:48 -0700 |
commit | a3ffa9f006b008b5faad248f700c8c2fbc6b74fd (patch) | |
tree | f674d4d4e3ab2d4ef4a7419594ea507506238232 /indra/newview/llviewerdisplay.cpp | |
parent | 030d61ac58be38f9f8aafeb68b383d88d670080b (diff) | |
parent | bafa869c21cb8b329f94be6fa930a43d11699082 (diff) |
Merge remote-tracking branch 'origin/DRTVWR-546' into DRTVWR-559
Diffstat (limited to 'indra/newview/llviewerdisplay.cpp')
-rw-r--r-- | indra/newview/llviewerdisplay.cpp | 166 |
1 files changed, 71 insertions, 95 deletions
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 109dc93261..6a2b06d9b5 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -124,7 +124,8 @@ void display_startup() if ( !gViewerWindow || !gViewerWindow->getActive() || !gViewerWindow->getWindow()->getVisible() - || gViewerWindow->getWindow()->getMinimized() ) + || gViewerWindow->getWindow()->getMinimized() + || gNonInteractive) { return; } @@ -165,8 +166,6 @@ void display_startup() if (gViewerWindow) gViewerWindow->setup2DRender(); - gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); - gGL.color4f(1,1,1,1); if (gViewerWindow) gViewerWindow->draw(); @@ -208,9 +207,11 @@ void display_update_camera() // Write some stats to LL_INFOS() void display_stats() { + LL_PROFILE_ZONE_SCOPED F32 fps_log_freq = gSavedSettings.getF32("FPSLogFrequency"); if (fps_log_freq > 0.f && gRecentFPSTime.getElapsedTimeF32() >= fps_log_freq) { + LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("DS - FPS"); F32 fps = gRecentFrameCount / fps_log_freq; LL_INFOS() << llformat("FPS: %.02f", fps) << LL_ENDL; gRecentFrameCount = 0; @@ -219,6 +220,7 @@ void display_stats() F32 mem_log_freq = gSavedSettings.getF32("MemoryLogFrequency"); if (mem_log_freq > 0.f && gRecentMemoryTime.getElapsedTimeF32() >= mem_log_freq) { + LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("DS - Memory"); gMemoryAllocated = U64Bytes(LLMemory::getCurrentRSS()); U32Megabytes memory = gMemoryAllocated; LL_INFOS() << "MEMORY: " << memory << LL_ENDL; @@ -228,6 +230,7 @@ void display_stats() F32 asset_storage_log_freq = gSavedSettings.getF32("AssetStorageLogFrequency"); if (asset_storage_log_freq > 0.f && gAssetStorageLogTime.getElapsedTimeF32() >= asset_storage_log_freq) { + LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("DS - Asset Storage"); gAssetStorageLogTime.reset(); gAssetStorage->logAssetStorageInfo(); } @@ -309,7 +312,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) // Attempting to draw into a minimized window causes a GL error. JC if ( !gViewerWindow->getActive() || !gViewerWindow->getWindow()->getVisible() - || gViewerWindow->getWindow()->getMinimized() ) + || gViewerWindow->getWindow()->getMinimized() + || gNonInteractive) { // Clean up memory the pools may have allocated if (rebuild) @@ -572,8 +576,11 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) // LLAppViewer::instance()->pingMainloopTimeout("Display:Camera"); - LLViewerCamera::getInstance()->setZoomParameters(zoom_factor, subfield); - LLViewerCamera::getInstance()->setNear(MIN_NEAR_PLANE); + if (LLViewerCamera::instanceExists()) + { + LLViewerCamera::getInstance()->setZoomParameters(zoom_factor, subfield); + LLViewerCamera::getInstance()->setNear(MIN_NEAR_PLANE); + } ////////////////////////// // @@ -630,6 +637,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) if (!gDisconnected) { + LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("display - 1"); LLAppViewer::instance()->pingMainloopTimeout("Display:Update"); if (gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_HUD)) { //don't draw hud objects in this frame @@ -641,9 +649,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_HUD_PARTICLES); } - //upkeep gl name pools - LLGLNamePool::upkeepPools(); - stop_glerror(); display_update_camera(); stop_glerror(); @@ -675,21 +680,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) stop_glerror(); - S32 water_clip = 0; - if ((LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_ENVIRONMENT) > 1) && - (gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_WATER) || - gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_VOIDWATER))) - { - if (LLViewerCamera::getInstance()->cameraUnderWater()) - { - water_clip = -1; - } - else - { - water_clip = 1; - } - } - LLAppViewer::instance()->pingMainloopTimeout("Display:Cull"); //Increment drawable frame counter @@ -707,21 +697,20 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) LLGLState::checkStates(); LLGLState::checkTextureChannels(); - LLGLState::checkClientArrays(); static LLCullResult result; LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD; LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater(); - gPipeline.updateCull(*LLViewerCamera::getInstance(), result, water_clip); + gPipeline.updateCull(*LLViewerCamera::getInstance(), result); stop_glerror(); LLGLState::checkStates(); LLGLState::checkTextureChannels(); - LLGLState::checkClientArrays(); - + LLAppViewer::instance()->pingMainloopTimeout("Display:Swap"); { + LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("display - 2") if (gResizeScreenTexture) { gResizeScreenTexture = FALSE; @@ -733,7 +722,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) LLGLState::checkStates(); LLGLState::checkTextureChannels(); - LLGLState::checkClientArrays(); if (!for_snapshot) { @@ -747,7 +735,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) LLGLState::checkStates(); LLGLState::checkTextureChannels(); - LLGLState::checkClientArrays(); glh::matrix4f proj = get_current_projection(); glh::matrix4f mod = get_current_modelview(); @@ -766,17 +753,16 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) LLGLState::checkStates(); LLGLState::checkTextureChannels(); - LLGLState::checkClientArrays(); } glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); } LLGLState::checkStates(); - LLGLState::checkClientArrays(); //if (!for_snapshot) { + LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("display - 3") LLAppViewer::instance()->pingMainloopTimeout("Display:Imagery"); gPipeline.generateWaterReflection(*LLViewerCamera::getInstance()); gPipeline.generateHighlight(*LLViewerCamera::getInstance()); @@ -784,7 +770,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) } LLGLState::checkStates(); - LLGLState::checkClientArrays(); ////////////////////////////////////// // @@ -800,13 +785,11 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) { LL_RECORD_BLOCK_TIME(FTM_IMAGE_UPDATE_CLASS); - LLTrace::CountStatHandle<>* velocity_stat = LLViewerCamera::getVelocityStat(); - LLTrace::CountStatHandle<>* angular_velocity_stat = LLViewerCamera::getAngularVelocityStat(); - LLViewerTexture::updateClass(LLTrace::get_frame_recording().getPeriodMeanPerSec(*velocity_stat), - LLTrace::get_frame_recording().getPeriodMeanPerSec(*angular_velocity_stat)); + LLViewerTexture::updateClass(); } - + LLImageGLThread::updateClass(); + { LL_RECORD_BLOCK_TIME(FTM_IMAGE_UPDATE_BUMP); gBumpImageList.updateImages(); // must be called before gTextureList version so that it's textures are thrown out first. @@ -825,10 +808,9 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) LLImageGL::deleteDeadTextures(); stop_glerror(); }*/ - } + } LLGLState::checkStates(); - LLGLState::checkClientArrays(); /////////////////////////////////// // @@ -840,6 +822,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) // LLAppViewer::instance()->pingMainloopTimeout("Display:StateSort"); { + LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("display - 4") LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD; gPipeline.stateSort(*LLViewerCamera::getInstance(), result); stop_glerror(); @@ -859,13 +842,12 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) LLSceneMonitor::getInstance()->fetchQueryResult(); LLGLState::checkStates(); - LLGLState::checkClientArrays(); LLPipeline::sUseOcclusion = occlusion; { LLAppViewer::instance()->pingMainloopTimeout("Display:Sky"); - LL_RECORD_BLOCK_TIME(FTM_UPDATE_SKY); + LL_PROFILE_ZONE_NAMED_CATEGORY_ENVIRONMENT("update sky"); //LL_RECORD_BLOCK_TIME(FTM_UPDATE_SKY); gSky.updateSky(); } @@ -918,7 +900,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater() ? TRUE : FALSE; LLGLState::checkStates(); - LLGLState::checkClientArrays(); stop_glerror(); @@ -948,9 +929,10 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) if (!(LLAppViewer::instance()->logoutRequestSent() && LLAppViewer::instance()->hasSavedFinalSnapshot()) && !gRestoreGL) { + LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("display - 5") LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD; - if (gSavedSettings.getBOOL("RenderDepthPrePass") && LLGLSLShader::sNoFixedFunction) + if (gSavedSettings.getBOOL("RenderDepthPrePass")) { gGL.setColorMask(false, false); @@ -1259,7 +1241,7 @@ bool setup_hud_matrices(const LLRect& screen_region) void render_ui(F32 zoom_factor, int subfield) { - LL_RECORD_BLOCK_TIME(FTM_RENDER_UI); + LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; //LL_RECORD_BLOCK_TIME(FTM_RENDER_UI); LLGLState::checkStates(); @@ -1274,7 +1256,6 @@ void render_ui(F32 zoom_factor, int subfield) if(LLSceneMonitor::getInstance()->needsUpdate()) { - LL_RECORD_BLOCK_TIME(FTM_RENDER_UI_SCENE_MON); gGL.pushMatrix(); gViewerWindow->setup2DRender(); LLSceneMonitor::getInstance()->compare(); @@ -1282,55 +1263,61 @@ void render_ui(F32 zoom_factor, int subfield) gGL.popMatrix(); } - // Finalize scene - gPipeline.renderFinalize(); - - LL_RECORD_BLOCK_TIME(FTM_RENDER_HUD); - render_hud_elements(); - render_hud_attachments(); + // Finalize scene + gPipeline.renderFinalize(); - LLGLSDefault gls_default; - LLGLSUIDefault gls_ui; { - gPipeline.disableLights(); - } + // SL-15709 + // NOTE: Tracy only allows one ZoneScoped per function. + // Solutions are: + // 1. Use a new scope + // 2. Use named zones + // 3. Use transient zones + LL_PROFILE_ZONE_NAMED_CATEGORY_UI("HUD"); //LL_RECORD_BLOCK_TIME(FTM_RENDER_HUD); + render_hud_elements(); + render_hud_attachments(); + + LLGLSDefault gls_default; + LLGLSUIDefault gls_ui; + { + gPipeline.disableLights(); + } - { - gGL.color4f(1,1,1,1); - if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI)) { - if (!gDisconnected) + gGL.color4f(1,1,1,1); + if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI)) { - LL_RECORD_BLOCK_TIME(FTM_RENDER_UI_3D); - render_ui_3d(); + if (!gDisconnected) + { + LL_PROFILE_ZONE_NAMED_CATEGORY_UI("UI 3D"); //LL_RECORD_BLOCK_TIME(FTM_RENDER_UI_3D); + render_ui_3d(); + LLGLState::checkStates(); + } + else + { + render_disconnected_background(); + } + + LL_PROFILE_ZONE_NAMED_CATEGORY_UI("UI 2D"); //LL_RECORD_BLOCK_TIME(FTM_RENDER_UI_2D); + render_ui_2d(); LLGLState::checkStates(); } - else - { - render_disconnected_background(); - } + gGL.flush(); - LL_RECORD_BLOCK_TIME(FTM_RENDER_UI_2D); - render_ui_2d(); - LLGLState::checkStates(); - } - gGL.flush(); - - { - LL_RECORD_BLOCK_TIME(FTM_RENDER_UI_DEBUG_TEXT); gViewerWindow->setup2DRender(); gViewerWindow->updateDebugText(); gViewerWindow->drawDebugText(); + + LLVertexBuffer::unbind(); } - LLVertexBuffer::unbind(); - } + if (!gSnapshot) + { + set_current_modelview(saved_view); + gGL.popMatrix(); + } - if (!gSnapshot) - { - set_current_modelview(saved_view); - gGL.popMatrix(); - } + } // Tracy integration } static LLTrace::BlockTimerStatHandle FTM_SWAP("Swap"); @@ -1435,10 +1422,7 @@ void render_ui_3d() stop_glerror(); - if (LLGLSLShader::sNoFixedFunction) - { - gUIProgram.bind(); - } + gUIProgram.bind(); // Coordinate axes if (gSavedSettings.getBOOL("ShowAxes")) @@ -1478,7 +1462,6 @@ void render_ui_2d() } stop_glerror(); - //gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); // render outline for HUD if (isAgentAvatarValid() && gAgentCamera.mHUDCurZoom < 0.98f) @@ -1568,10 +1551,7 @@ void render_ui_2d() void render_disconnected_background() { - if (LLGLSLShader::sNoFixedFunction) - { - gUIProgram.bind(); - } + gUIProgram.bind(); gGL.color4f(1,1,1,1); if (!gDisconnectedImagep && gDisconnected) @@ -1643,11 +1623,7 @@ void render_disconnected_background() } gGL.flush(); - if (LLGLSLShader::sNoFixedFunction) - { - gUIProgram.unbind(); - } - + gUIProgram.unbind(); } void display_cleanup() |