From c0ba626c8009b22310b3923e8170e5db2a021253 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 15 Oct 2012 21:34:29 -0600 Subject: For SH-3333: Design and implement a new object cache system on viewer side --- indra/newview/app_settings/settings.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'indra/newview/app_settings/settings.xml') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 7497a273ea..13c95c2381 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -6400,6 +6400,17 @@ Value 1 + ObjectCacheViewCullingEnabled + + Comment + Enable the object cache view culling. Needs to restart viewer. + Persist + 1 + Type + Boolean + Value + 1 + OpenDebugStatAdvanced Comment -- cgit v1.3 From c180fe2ae2b5d2e00149f9902717e02ed7042143 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 19 Nov 2012 22:28:12 -0700 Subject: for SH-3561: capture the frame buffer contents and compare pixel differences between frames. --- indra/llui/llui.cpp | 28 +- indra/llui/llui.h | 4 +- indra/newview/CMakeLists.txt | 2 + indra/newview/app_settings/settings.xml | 14 +- indra/newview/lldebugview.cpp | 10 +- indra/newview/llscenemonitor.cpp | 358 +++++++++++++++++++++ indra/newview/llscenemonitor.h | 87 +++++ indra/newview/llviewerdisplay.cpp | 8 + indra/newview/llviewermenu.cpp | 10 +- indra/newview/llviewertexture.cpp | 6 + indra/newview/llviewertexture.h | 1 + indra/newview/llvoavatar.cpp | 6 + indra/newview/llworld.cpp | 4 +- indra/newview/skins/default/xui/en/menu_viewer.xml | 10 + 14 files changed, 536 insertions(+), 12 deletions(-) create mode 100644 indra/newview/llscenemonitor.cpp create mode 100644 indra/newview/llscenemonitor.h (limited to 'indra/newview/app_settings/settings.xml') diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 87bf518aa1..1dac622f32 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -724,9 +724,14 @@ void gl_draw_rotated_image(S32 x, S32 y, F32 degrees, LLTexture* image, const LL gl_draw_scaled_rotated_image( x, y, image->getWidth(0), image->getHeight(0), degrees, image, color, uv_rect ); } -void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degrees, LLTexture* image, const LLColor4& color, const LLRectf& uv_rect) +void gl_draw_scaled_target(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* target, const LLColor4& color, const LLRectf& uv_rect) { - if (NULL == image) + gl_draw_scaled_rotated_image(x, y, width, height, 0.f, NULL, color, uv_rect, target); +} + +void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degrees, LLTexture* image, const LLColor4& color, const LLRectf& uv_rect, LLRenderTarget* target) +{ + if (!image && !target) { llwarns << "image == NULL; aborting function" << llendl; return; @@ -734,8 +739,14 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre LLGLSUIDefault gls_ui; - - gGL.getTexUnit(0)->bind(image, true); + if(image != NULL) + { + gGL.getTexUnit(0)->bind(image, true); + } + else + { + gGL.getTexUnit(0)->bind(target); + } gGL.color4fv(color.mV); @@ -788,7 +799,14 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre LLMatrix3 quat(0.f, 0.f, degrees*DEG_TO_RAD); - gGL.getTexUnit(0)->bind(image, true); + if(image != NULL) + { + gGL.getTexUnit(0)->bind(image, true); + } + else + { + gGL.getTexUnit(0)->bind(target); + } gGL.color4fv(color.mV); diff --git a/indra/llui/llui.h b/indra/llui/llui.h index 28e84fa444..d3c88cfb5f 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -58,6 +58,7 @@ class LLUUID; class LLWindow; class LLView; class LLHelp; +class LLRenderTarget; // UI colors extern const LLColor4 UI_VERTEX_COLOR; @@ -93,8 +94,9 @@ void gl_washer_segment_2d(F32 outer_radius, F32 inner_radius, F32 start_radians, void gl_draw_image(S32 x, S32 y, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); void gl_draw_scaled_image(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); +void gl_draw_scaled_target(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* target, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); void gl_draw_rotated_image(S32 x, S32 y, F32 degrees, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); -void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degrees,LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); +void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degrees,LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), LLRenderTarget* target = NULL); void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), const LLRectf& scale_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index c81ade6937..377075ffd5 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -459,6 +459,7 @@ set(viewer_SOURCE_FILES llremoteparcelrequest.cpp llsavedsettingsglue.cpp llsaveoutfitcombobtn.cpp + llscenemonitor.cpp llsceneview.cpp llscreenchannel.cpp llscriptfloater.cpp @@ -1025,6 +1026,7 @@ set(viewer_HEADER_FILES llrootview.h llsavedsettingsglue.h llsaveoutfitcombobtn.h + llscenemonitor.h llsceneview.h llscreenchannel.h llscriptfloater.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 13c95c2381..c6cfe3b616 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -9469,6 +9469,17 @@ Value 0 + SceneLoadingMonitorEnabled + + Comment + Enabled scene loading monitor if set + Persist + 0 + Type + Boolean + Value + 0 + ScriptHelpFollowsCursor Comment @@ -10864,7 +10875,7 @@ Type F32 Value - 0.0 + 0.0 TextureFetchUpdateSkipLowPriority @@ -12492,6 +12503,7 @@ Type LLSD Value + VFSOldSize diff --git a/indra/newview/lldebugview.cpp b/indra/newview/lldebugview.cpp index aeecf054b8..86f0213282 100644 --- a/indra/newview/lldebugview.cpp +++ b/indra/newview/lldebugview.cpp @@ -40,7 +40,7 @@ #include "llsceneview.h" #include "llviewertexture.h" #include "llfloaterreg.h" - +#include "llscenemonitor.h" // // Globals // @@ -66,6 +66,7 @@ LLDebugView::~LLDebugView() gDebugView = NULL; gTextureView = NULL; gSceneView = NULL; + gSceneMonitorView = NULL; } void LLDebugView::init() @@ -98,6 +99,13 @@ void LLDebugView::init() gSceneView->setVisible(FALSE); addChild(gSceneView); gSceneView->setRect(rect); + + gSceneMonitorView = new LLSceneMonitorView(r); + gSceneMonitorView->setFollowsTop(); + gSceneMonitorView->setFollowsLeft(); + gSceneMonitorView->setVisible(FALSE); + addChild(gSceneMonitorView); + gSceneMonitorView->setRect(rect); r.setLeftTopAndSize(25, rect.getHeight() - 50, (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.75f), (S32) (gViewerWindow->getWindowRectScaled().getHeight() * 0.75f)); diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp new file mode 100644 index 0000000000..8597767c61 --- /dev/null +++ b/indra/newview/llscenemonitor.cpp @@ -0,0 +1,358 @@ +/** + * @file llscenemonitor.cpp + * @brief monitor the scene loading process. + * + * $LicenseInfo:firstyear=2003&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llrendertarget.h" +#include "llscenemonitor.h" +#include "llviewerwindow.h" +#include "llviewerdisplay.h" +#include "llviewercontrol.h" +#include "llviewershadermgr.h" +#include "llui.h" +#include "llstartup.h" +#include "llappviewer.h" +#include "llwindow.h" +#include "llpointer.h" + +LLSceneMonitorView* gSceneMonitorView = NULL; + +LLSceneMonitor::LLSceneMonitor() : mEnabled(false), mDiff(NULL), mNeedsUpdateDiff(FALSE) +{ + mFrames[0] = NULL; + mFrames[1] = NULL; +} + +LLSceneMonitor::~LLSceneMonitor() +{ + destroyClass(); +} + +void LLSceneMonitor::destroyClass() +{ + reset(); +} + +void LLSceneMonitor::reset() +{ + delete mFrames[0]; + delete mFrames[1]; + delete mDiff; + + mFrames[0] = NULL; + mFrames[1] = NULL; + mDiff = NULL; +} + +void LLSceneMonitor::setEnabled(bool enabled) +{ + if(enabled == (bool)gSavedSettings.getBOOL("SceneLoadingMonitorEnabled")) + { + return; + } + gSavedSettings.setBOOL("SceneLoadingMonitorEnabled", enabled); +} + +bool LLSceneMonitor::preCapture() +{ + static LLCachedControl enabled(gSavedSettings,"SceneLoadingMonitorEnabled"); + static LLFrameTimer timer; + + mCurTarget = NULL; + if (!LLGLSLShader::sNoFixedFunction) + { + return false; + } + if(mEnabled != (BOOL)enabled) + { + if(mEnabled) + { + reset(); + unfreezeScene(); + } + else + { + freezeScene(); + } + + mEnabled = (BOOL)enabled; + } + + if(!mEnabled) + { + return false; + } + + if (LLStartUp::getStartupState() < STATE_STARTED) + { + return false; + } + + if(LLAppViewer::instance()->logoutRequestSent()) + { + return false; + } + + if(gWindowResized || gHeadlessClient || gTeleportDisplay || gRestoreGL || gDisconnected) + { + return false; + } + + if ( !gViewerWindow->getActive() + || !gViewerWindow->getWindow()->getVisible() + || gViewerWindow->getWindow()->getMinimized() ) + { + return false; + } + + if(timer.getElapsedTimeF32() < 1.0f) + { + return false; + } + timer.reset(); + + S32 width = gViewerWindow->getWorldViewWidthRaw(); + S32 height = gViewerWindow->getWorldViewHeightRaw(); + + if(!mFrames[0]) + { + mFrames[0] = new LLRenderTarget(); + mFrames[0]->allocate(width, height, GL_RGB, false, false, LLTexUnit::TT_TEXTURE, true); + gGL.getTexUnit(0)->bind(mFrames[0]); + gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + + mCurTarget = mFrames[0]; + } + else if(!mFrames[1]) + { + mFrames[1] = new LLRenderTarget(); + mFrames[1]->allocate(width, height, GL_RGB, false, false, LLTexUnit::TT_TEXTURE, true); + gGL.getTexUnit(0)->bind(mFrames[1]); + gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + + mCurTarget = mFrames[1]; + } + else //swap + { + mCurTarget = mFrames[0]; + mFrames[0] = mFrames[1]; + mFrames[1] = mCurTarget; + } + + if(mCurTarget->getWidth() != width || mCurTarget->getHeight() != height) //size changed + { + mCurTarget->resize(width, height, GL_RGB); + } + + return true; +} + +void LLSceneMonitor::postCapture() +{ + mCurTarget = NULL; + mNeedsUpdateDiff = TRUE; +} + +void LLSceneMonitor::freezeAvatar(LLCharacter* avatarp) +{ + mAvatarPauseHandles.push_back(avatarp->requestPause()); +} + +void LLSceneMonitor::freezeScene() +{ + //freeze all avatars + for (std::vector::iterator iter = LLCharacter::sInstances.begin(); + iter != LLCharacter::sInstances.end(); ++iter) + { + freezeAvatar((LLCharacter*)(*iter)); + } + + // freeze everything else + gSavedSettings.setBOOL("FreezeTime", TRUE); +} + +void LLSceneMonitor::unfreezeScene() +{ + //thaw all avatars + mAvatarPauseHandles.clear(); + + // thaw everything else + gSavedSettings.setBOOL("FreezeTime", FALSE); +} + +LLRenderTarget* LLSceneMonitor::getDiffTarget() const +{ + return mDiff; +} + +void LLSceneMonitor::capture() +{ + static U32 count = 0; + if(count == gFrameCount) + { + return; + } + count = gFrameCount; + + preCapture(); + + if(!mCurTarget) + { + return; + } + + U32 old_FBO = LLRenderTarget::sCurFBO; + + gGL.getTexUnit(0)->bind(mCurTarget); + glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); //point to the main frame buffer. + + glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, mCurTarget->getWidth(), mCurTarget->getHeight()); //copy the content + + glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); + glBindFramebuffer(GL_FRAMEBUFFER, old_FBO); + + postCapture(); +} + +void LLSceneMonitor::compare() +{ + if(!mNeedsUpdateDiff) + { + return; + } + + if(!mFrames[0] || !mFrames[1]) + { + return; + } + if(mFrames[0]->getWidth() != mFrames[1]->getWidth() || mFrames[0]->getHeight() != mFrames[1]->getHeight()) + { + return; //size does not match + } + + if (!LLGLSLShader::sNoFixedFunction) + { + return; + } + + S32 width = mFrames[0]->getWidth(); + S32 height = mFrames[0]->getHeight(); + if(!mDiff) + { + mDiff = new LLRenderTarget(); + mDiff->allocate(width, height, GL_RGBA, false, false, LLTexUnit::TT_TEXTURE, true); + } + else if(mDiff->getWidth() != width || mDiff->getHeight() != height) + { + mDiff->resize(width, height, GL_RGBA); + } + mDiff->bindTarget(); + mDiff->clear(); + + gTwoTextureCompareProgram.bind(); + + gGL.getTexUnit(0)->activate(); + gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(0)->bind(mFrames[0]); + gGL.getTexUnit(0)->activate(); + + gGL.getTexUnit(1)->activate(); + gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(1)->bind(mFrames[1]); + gGL.getTexUnit(1)->activate(); + + gl_rect_2d_simple_tex(width, height); + + gGL.flush(); + mDiff->flush(); + + gTwoTextureCompareProgram.unbind(); + + gGL.getTexUnit(0)->disable(); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(1)->disable(); + gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); + + mNeedsUpdateDiff = FALSE; +} + +//------------------------------------------------------------------------------------------------------------- +//definition of class LLSceneMonitorView +//------------------------------------------------------------------------------------------------------------- +LLSceneMonitorView::LLSceneMonitorView(const LLRect& rect) + : LLFloater(LLSD()) +{ + setRect(rect); + setVisible(FALSE); + + setCanMinimize(false); + setCanClose(true); +} + +void LLSceneMonitorView::onClickCloseBtn() +{ + setVisible(false); +} + +void LLSceneMonitorView::setVisible(BOOL visible) +{ + if(visible != (BOOL)LLSceneMonitor::getInstance()->isEnabled()) + { + LLSceneMonitor::getInstance()->setEnabled(visible); + } + + LLView::setVisible(visible); +} + +void LLSceneMonitorView::draw() +{ + if (!LLGLSLShader::sNoFixedFunction) + { + return; + } + LLRenderTarget* target = LLSceneMonitor::getInstance()->getDiffTarget(); + if(!target) + { + return; + } + + S32 height = (S32) (gViewerWindow->getWindowRectScaled().getHeight()*0.75f); + S32 width = (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.75f); + + LLRect new_rect; + new_rect.setLeftTopAndSize(getRect().mLeft, getRect().mTop, width, height); + setRect(new_rect); + + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4(0.f, 0.f, 0.f, 0.25f)); + + gl_draw_scaled_target(0, 0, getRect().getWidth(), getRect().getHeight(), target);//, LLColor4(0.f, 0.f, 0.f, 0.25f)); + + LLView::draw(); +} + diff --git a/indra/newview/llscenemonitor.h b/indra/newview/llscenemonitor.h new file mode 100644 index 0000000000..941039cefd --- /dev/null +++ b/indra/newview/llscenemonitor.h @@ -0,0 +1,87 @@ +/** + * @file llscenemonitor.h + * @brief monitor the process of scene loading + * + * $LicenseInfo:firstyear=2003&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLSCENE_MONITOR_H +#define LL_LLSCENE_MONITOR_H + +#include "llsingleton.h" +#include "llmath.h" +#include "llfloater.h" +#include "llcharacter.h" + +class LLCharacter; +class LLRenderTarget; + +class LLSceneMonitor : public LLSingleton +{ +public: + LLSceneMonitor(); + ~LLSceneMonitor(); + + void destroyClass(); + + void freezeAvatar(LLCharacter* avatarp); + void setEnabled(bool enabled); + + void capture(); //capture the main frame buffer + void compare(); //compare the stored two buffers. + + LLRenderTarget* getDiffTarget() const; + bool isEnabled()const {return mEnabled;} + +private: + void freezeScene(); + void unfreezeScene(); + void reset(); + bool preCapture(); + void postCapture(); + +private: + BOOL mEnabled; + BOOL mNeedsUpdateDiff; + LLRenderTarget* mFrames[2]; + LLRenderTarget* mDiff; + LLRenderTarget* mCurTarget; + + std::vector mAvatarPauseHandles; +}; + +class LLSceneMonitorView : public LLFloater +{ +public: + LLSceneMonitorView(const LLRect& rect); + + virtual void draw(); + virtual void setVisible(BOOL visible); + +protected: + virtual void onClickCloseBtn(); +}; + +extern LLSceneMonitorView* gSceneMonitorView; + +#endif + diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index ffeea2f4df..c12144df6f 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -77,6 +77,7 @@ #include "llwlparammanager.h" #include "llwaterparammanager.h" #include "llpostprocess.h" +#include "llscenemonitor.h" extern LLPointer gStartTexture; extern bool gShiftFrame; @@ -989,6 +990,11 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) LLPipeline::sUnderWaterRender = FALSE; + { + //capture the frame buffer. + LLSceneMonitor::getInstance()->capture(); + } + LLAppViewer::instance()->pingMainloopTimeout("Display:RenderUI"); if (!for_snapshot) { @@ -1403,6 +1409,8 @@ void render_ui_2d() // Menu overlays, HUD, etc gViewerWindow->setup2DRender(); + LLSceneMonitor::getInstance()->compare(); + F32 zoom_factor = LLViewerCamera::getInstance()->getZoomFactor(); S16 sub_region = LLViewerCamera::getInstance()->getZoomSubRegion(); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 4ec498dc33..4dfcf1efce 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -121,6 +121,7 @@ #include "llwindow.h" #include "llpathfindingmanager.h" #include "boost/unordered_map.hpp" +#include "llscenemonitor.h" using namespace LLVOAvatarDefines; @@ -528,7 +529,10 @@ class LLAdvancedToggleConsole : public view_listener_t { toggle_visibility( (void*)gSceneView); } - + else if ("scene monitor" == console_type) + { + toggle_visibility( (void*)gSceneMonitorView); + } #if MEM_TRACK_MEM else if ("memory view" == console_type) { @@ -556,9 +560,9 @@ class LLAdvancedCheckConsole : public view_listener_t { new_value = LLFloaterReg::instanceVisible("fast_timers"); } - else if ("scene view" == console_type) + else if ("scene monitor" == console_type) { - new_value = get_visibility( (void*) gSceneView); + new_value = get_visibility( (void*) gSceneMonitorView); } #if MEM_TRACK_MEM else if ("memory view" == console_type) diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index b0f8f60d1e..45b6bf2828 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -953,6 +953,12 @@ void LLViewerTexture::setCachedRawImage(S32 discard_level, LLImageRaw* imageraw) //nothing here. } +BOOL LLViewerTexture::setSubImageFromFrameBuffer(S32 fb_x, S32 fb_y, S32 x_pos, S32 y_pos, S32 width, S32 height) +{ + llassert(mGLTexturep.notNull()) ; + return mGLTexturep->setSubImageFromFrameBuffer(fb_x, fb_y, x_pos, y_pos, width, height); +} + void LLViewerTexture::setExplicitFormat(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, BOOL swap_bytes) { llassert(mGLTexturep.notNull()) ; diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index 2ea9a07e9a..7095e97b39 100755 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -211,6 +211,7 @@ public: BOOL createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename = 0, BOOL to_create = TRUE, S32 category = LLViewerTexture::OTHER); virtual void setCachedRawImage(S32 discard_level, LLImageRaw* imageraw) ; + BOOL setSubImageFromFrameBuffer(S32 fb_x, S32 fb_y, S32 x_pos, S32 y_pos, S32 width, S32 height); void setFilteringOption(LLTexUnit::eTextureFilterOptions option); void setExplicitFormat(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format = 0, BOOL swap_bytes = FALSE); void setAddressMode(LLTexUnit::eTextureAddressMode mode); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index d366455a62..1fab3b68d5 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -102,6 +102,7 @@ #include "lldebugmessagebox.h" #include "llsdutil.h" +#include "llscenemonitor.h" extern F32 SPEED_ADJUST_MAX; extern F32 SPEED_ADJUST_MAX_SEC; @@ -771,6 +772,11 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mLastPelvisToFoot = 0.0f; mPelvisFixup = 0.0f; mLastPelvisFixup = 0.0f; + + if(LLSceneMonitor::getInstance()->isEnabled()) + { + LLSceneMonitor::getInstance()->freezeAvatar((LLCharacter*)this); + } } std::string LLVOAvatar::avString() const diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 0a622997f7..aed2835e4a 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -55,7 +55,7 @@ #include "message.h" #include "pipeline.h" #include "llappviewer.h" // for do_disconnect() - +#include "llscenemonitor.h" #include #include #include @@ -136,6 +136,8 @@ void LLWorld::destroyClass() //make all visible drawbles invisible. LLDrawable::incrementVisible(); + + LLSceneMonitor::getInstance()->destroyClass(); } diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index c6d9f9ef8f..7923cc9f62 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -1981,6 +1981,16 @@ function="Advanced.ToggleConsole" parameter="scene view" /> + + + + Date: Wed, 21 Nov 2012 13:29:15 -0700 Subject: more for SH-3571: display frame-to-frame pixel differences on screen --- indra/newview/app_settings/settings.xml | 2 +- .../class1/interface/twotexturecompareF.glsl | 2 +- indra/newview/llscenemonitor.cpp | 43 +++++++++++----------- indra/newview/llscenemonitor.h | 4 +- indra/newview/llviewerdisplay.cpp | 9 ++++- 5 files changed, 33 insertions(+), 27 deletions(-) (limited to 'indra/newview/app_settings/settings.xml') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index c6cfe3b616..7fc7a7ad3b 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -9474,7 +9474,7 @@ Comment Enabled scene loading monitor if set Persist - 0 + 1 Type Boolean Value diff --git a/indra/newview/app_settings/shaders/class1/interface/twotexturecompareF.glsl b/indra/newview/app_settings/shaders/class1/interface/twotexturecompareF.glsl index 92aa7602a4..336ca21b96 100644 --- a/indra/newview/app_settings/shaders/class1/interface/twotexturecompareF.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/twotexturecompareF.glsl @@ -51,5 +51,5 @@ void main() { frag_color[2] = -frag_color[2]; } - frag_color[3] = 1.f; + frag_color[3] = 0.95f; } diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 8597767c61..0730281d85 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -39,7 +39,12 @@ LLSceneMonitorView* gSceneMonitorView = NULL; -LLSceneMonitor::LLSceneMonitor() : mEnabled(false), mDiff(NULL), mNeedsUpdateDiff(FALSE) +LLSceneMonitor::LLSceneMonitor() : + mEnabled(FALSE), + mDiff(NULL), + mCurTarget(NULL), + mNeedsUpdateDiff(FALSE), + mDebugViewerVisible(FALSE) { mFrames[0] = NULL; mFrames[1] = NULL; @@ -66,18 +71,14 @@ void LLSceneMonitor::reset() mDiff = NULL; } -void LLSceneMonitor::setEnabled(bool enabled) +void LLSceneMonitor::setDebugViewerVisible(BOOL visible) { - if(enabled == (bool)gSavedSettings.getBOOL("SceneLoadingMonitorEnabled")) - { - return; - } - gSavedSettings.setBOOL("SceneLoadingMonitorEnabled", enabled); + mDebugViewerVisible = visible; } bool LLSceneMonitor::preCapture() { - static LLCachedControl enabled(gSavedSettings,"SceneLoadingMonitorEnabled"); + static LLCachedControl monitor_enabled(gSavedSettings,"SceneLoadingMonitorEnabled"); static LLFrameTimer timer; mCurTarget = NULL; @@ -85,7 +86,9 @@ bool LLSceneMonitor::preCapture() { return false; } - if(mEnabled != (BOOL)enabled) + + BOOL enabled = (BOOL)monitor_enabled || mDebugViewerVisible; + if(mEnabled != enabled) { if(mEnabled) { @@ -97,7 +100,7 @@ bool LLSceneMonitor::preCapture() freezeScene(); } - mEnabled = (BOOL)enabled; + mEnabled = enabled; } if(!mEnabled) @@ -260,8 +263,8 @@ void LLSceneMonitor::compare() return; } - S32 width = mFrames[0]->getWidth(); - S32 height = mFrames[0]->getHeight(); + S32 width = gViewerWindow->getWindowWidthRaw(); + S32 height = gViewerWindow->getWindowHeightRaw(); if(!mDiff) { mDiff = new LLRenderTarget(); @@ -288,7 +291,6 @@ void LLSceneMonitor::compare() gl_rect_2d_simple_tex(width, height); - gGL.flush(); mDiff->flush(); gTwoTextureCompareProgram.unbind(); @@ -321,10 +323,7 @@ void LLSceneMonitorView::onClickCloseBtn() void LLSceneMonitorView::setVisible(BOOL visible) { - if(visible != (BOOL)LLSceneMonitor::getInstance()->isEnabled()) - { - LLSceneMonitor::getInstance()->setEnabled(visible); - } + LLSceneMonitor::getInstance()->setDebugViewerVisible(visible); LLView::setVisible(visible); } @@ -341,17 +340,17 @@ void LLSceneMonitorView::draw() return; } - S32 height = (S32) (gViewerWindow->getWindowRectScaled().getHeight()*0.75f); - S32 width = (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.75f); + S32 height = (S32) (gViewerWindow->getWindowRectScaled().getHeight()*0.5f); + S32 width = (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.5f); LLRect new_rect; new_rect.setLeftTopAndSize(getRect().mLeft, getRect().mTop, width, height); setRect(new_rect); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4(0.f, 0.f, 0.f, 0.25f)); + //gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + //gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4(0.f, 0.f, 0.f, 0.25f)); - gl_draw_scaled_target(0, 0, getRect().getWidth(), getRect().getHeight(), target);//, LLColor4(0.f, 0.f, 0.f, 0.25f)); + gl_draw_scaled_target(0, 0, getRect().getWidth(), getRect().getHeight(), target); LLView::draw(); } diff --git a/indra/newview/llscenemonitor.h b/indra/newview/llscenemonitor.h index 941039cefd..648429f97b 100644 --- a/indra/newview/llscenemonitor.h +++ b/indra/newview/llscenemonitor.h @@ -44,7 +44,7 @@ public: void destroyClass(); void freezeAvatar(LLCharacter* avatarp); - void setEnabled(bool enabled); + void setDebugViewerVisible(BOOL visible); void capture(); //capture the main frame buffer void compare(); //compare the stored two buffers. @@ -62,6 +62,8 @@ private: private: BOOL mEnabled; BOOL mNeedsUpdateDiff; + BOOL mDebugViewerVisible; + LLRenderTarget* mFrames[2]; LLRenderTarget* mDiff; LLRenderTarget* mCurTarget; diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index c12144df6f..270ab26149 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -1228,6 +1228,13 @@ void render_ui(F32 zoom_factor, int subfield) glh_set_current_modelview(glh_copy_matrix(gGLLastModelView)); } + { + gGL.pushMatrix(); + gViewerWindow->setup2DRender(); + LLSceneMonitor::getInstance()->compare(); + gGL.popMatrix(); + } + { BOOL to_texture = gPipeline.canUseVertexShaders() && LLPipeline::sRenderGlow; @@ -1409,8 +1416,6 @@ void render_ui_2d() // Menu overlays, HUD, etc gViewerWindow->setup2DRender(); - LLSceneMonitor::getInstance()->compare(); - F32 zoom_factor = LLViewerCamera::getInstance()->getZoomFactor(); S16 sub_region = LLViewerCamera::getInstance()->getZoomSubRegion(); -- cgit v1.3 From 43f063fe2c814e28da69f2f5c373497a6d621460 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 9 May 2013 17:19:05 -0700 Subject: SH-4080 WIP interesting: random crash on Mac added controls for curtain delay --- indra/newview/app_settings/settings.xml | 24 +++++++++++++++++++++++- indra/newview/llviewerdisplay.cpp | 10 ++++------ indra/newview/llvieweroctree.cpp | 2 +- 3 files changed, 28 insertions(+), 8 deletions(-) (limited to 'indra/newview/app_settings/settings.xml') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 94a8550938..8a1c37d242 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -19,7 +19,7 @@ Time before automatically setting AFK (away from keyboard) mode (seconds, 0=never). Valid values are: 0, 120, 300, 600, 1800 - + Persist 1 Type @@ -14117,5 +14117,27 @@ Value 0 + TeleportArrivalDelay + + Comment + Time to wait before displaying world during teleport (seconds) + Persist + 1 + Type + F32 + Value + 2 + + TeleportLocalDelay + + Comment + Delay to prevent teleports after starting an in-sim teleport. (seconds) + Persist + 1 + Type + F32 + Value + 1 + diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 0889c3ec6c..970862892c 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -85,9 +85,6 @@ extern bool gShiftFrame; LLPointer gDisconnectedImagep = NULL; // used to toggle renderer back on after teleport -const F32 TELEPORT_RENDER_DELAY = 20.f; // Max time a teleport is allowed to take before we raise the curtain -const F32 TELEPORT_ARRIVAL_DELAY = 2.f; // Time to preload the world before raising the curtain after we've actually already arrived. -const F32 TELEPORT_LOCAL_DELAY = 1.0f; // Delay to prevent teleports after starting an in-sim teleport. BOOL gTeleportDisplay = FALSE; LLFrameTimer gTeleportDisplayTimer; LLFrameTimer gTeleportArrivalTimer; @@ -373,7 +370,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) { LLFastTimer t(FTM_TELEPORT_DISPLAY); LLAppViewer::instance()->pingMainloopTimeout("Display:Teleport"); - const F32 TELEPORT_ARRIVAL_DELAY = 2.f; // Time to preload the world before raising the curtain after we've actually already arrived. + static LLCachedControl teleport_arrival_delay(gSavedSettings, "TeleportArrivalDelay"); + static LLCachedControl teleport_local_delay(gSavedSettings, "TeleportLocalDelay"); S32 attach_count = 0; if (isAgentAvatarValid()) @@ -441,7 +439,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) case LLAgent::TELEPORT_ARRIVING: // Make the user wait while content "pre-caches" { - F32 arrival_fraction = (gTeleportArrivalTimer.getElapsedTimeF32() / TELEPORT_ARRIVAL_DELAY); + F32 arrival_fraction = (gTeleportArrivalTimer.getElapsedTimeF32() / teleport_arrival_delay()); if( arrival_fraction > 1.f ) { arrival_fraction = 1.f; @@ -458,7 +456,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) // Short delay when teleporting in the same sim (progress screen active but not shown - did not // fall-through from TELEPORT_START) { - if( gTeleportDisplayTimer.getElapsedTimeF32() > TELEPORT_LOCAL_DELAY ) + if( gTeleportDisplayTimer.getElapsedTimeF32() > teleport_local_delay() ) { //LLFirstUse::useTeleport(); gAgent.setTeleportState( LLAgent::TELEPORT_NONE ); diff --git a/indra/newview/llvieweroctree.cpp b/indra/newview/llvieweroctree.cpp index 0eb1745cd5..0fa1f5bef3 100644 --- a/indra/newview/llvieweroctree.cpp +++ b/indra/newview/llvieweroctree.cpp @@ -331,7 +331,7 @@ LLviewerOctreeGroup::~LLviewerOctreeGroup() { LLViewerRegion::sCurRegionp->clearVisibleGroup(this); } - llassert(LLViewerRegion::sCurRegionp->hasVisibleGroup(this) == false); + llassert(!LLViewerRegion::sCurRegionp || LLViewerRegion::sCurRegionp->hasVisibleGroup(this) == false); } LLviewerOctreeGroup::LLviewerOctreeGroup(OctreeNode* node) : -- cgit v1.3 From 3a0e45ff088278cba5314974be6539b05009b8da Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 10 May 2013 17:57:12 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics renamed LLView::handleVisibilityChange to onVisibilityChange to reflect standard naming conventions for handlers vs. reactors --- indra/newview/app_settings/settings.xml | 11 ++ indra/newview/llagent.cpp | 8 -- indra/newview/llagent.h | 1 - indra/newview/llfloaterbuyland.cpp | 4 +- indra/newview/llfloaterland.cpp | 4 +- indra/newview/llfloaterland.h | 2 +- indra/newview/llimfloater.cpp | 2 +- indra/newview/llimfloater.h | 2 +- indra/newview/llmediactrl.cpp | 4 +- indra/newview/llmediactrl.h | 2 +- indra/newview/llpaneloutfitedit.cpp | 4 +- indra/newview/llpaneloutfitedit.h | 2 +- indra/newview/llpaneltopinfobar.cpp | 4 +- indra/newview/llpaneltopinfobar.h | 2 +- indra/newview/llpreviewgesture.cpp | 4 +- indra/newview/llpreviewgesture.h | 2 +- indra/newview/llscenemonitor.cpp | 183 +++++++++++++++----------------- indra/newview/llscenemonitor.h | 22 ++-- indra/newview/llsidepanelappearance.cpp | 4 +- indra/newview/llsidepanelappearance.h | 2 +- 20 files changed, 128 insertions(+), 141 deletions(-) (limited to 'indra/newview/app_settings/settings.xml') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 8a1c37d242..ed8d0bf10d 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -9469,6 +9469,17 @@ Value 0 + SceneLoadingMonitorSampleTime + + Comment + Time between screen samples when monitor scene load (seconds) + Persist + 1 + Type + F32 + Value + 1 + ScriptHelpFollowsCursor Comment diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 2e0fc039c4..6b996edb76 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -1046,14 +1046,6 @@ const LLVector3d &LLAgent::getPositionGlobal() const return mPositionGlobal; } -bool LLAgent::isPositionChanged() const -{ - LLVector3d diff; - diff = mPositionGlobal - mLastPositionGlobal; - - return diff.lengthSquared() > 1.0; -} - //----------------------------------------------------------------------------- // getPositionAgent() //----------------------------------------------------------------------------- diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index f8dcfb9789..46dad1dc20 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -252,7 +252,6 @@ public: const LLVector3d &getLastPositionGlobal() const { return mLastPositionGlobal; } void setLastPositionGlobal(const LLVector3d &pos) { mLastPositionGlobal = pos; } - bool isPositionChanged() const; private: std::set mRegionsVisited; // Stat - what distinct regions has the avatar been to? F64 mDistanceTraveled; // Stat - how far has the avatar moved? diff --git a/indra/newview/llfloaterbuyland.cpp b/indra/newview/llfloaterbuyland.cpp index 8223e89b64..c1cea58801 100644 --- a/indra/newview/llfloaterbuyland.cpp +++ b/indra/newview/llfloaterbuyland.cpp @@ -202,7 +202,7 @@ public: virtual void draw(); virtual BOOL canClose(); - void onVisibilityChange ( const LLSD& new_visibility ); + void onVisibilityChanged ( const LLSD& new_visibility ); }; @@ -1008,7 +1008,7 @@ BOOL LLFloaterBuyLandUI::canClose() return can_close; } -void LLFloaterBuyLandUI::onVisibilityChange ( const LLSD& new_visibility ) +void LLFloaterBuyLandUI::onVisibilityChanged ( const LLSD& new_visibility ) { if (new_visibility.asBoolean()) { diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index be743d57d2..a2675d6d3e 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -225,7 +225,7 @@ void LLFloaterLand::onOpen(const LLSD& key) refresh(); } -void LLFloaterLand::onVisibilityChange(const LLSD& visible) +void LLFloaterLand::onVisibilityChanged(const LLSD& visible) { if (!visible.asBoolean()) { @@ -255,7 +255,7 @@ LLFloaterLand::LLFloaterLand(const LLSD& seed) BOOL LLFloaterLand::postBuild() { - setVisibleCallback(boost::bind(&LLFloaterLand::onVisibilityChange, this, _2)); + setVisibleCallback(boost::bind(&LLFloaterLand::onVisibilityChanged, this, _2)); LLTabContainer* tab = getChild("landtab"); diff --git a/indra/newview/llfloaterland.h b/indra/newview/llfloaterland.h index 4f1c10274a..dccdfc9acb 100644 --- a/indra/newview/llfloaterland.h +++ b/indra/newview/llfloaterland.h @@ -88,7 +88,7 @@ private: LLFloaterLand(const LLSD& seed); virtual ~LLFloaterLand(); - void onVisibilityChange(const LLSD& visible); + void onVisibilityChanged(const LLSD& visible); protected: diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index f68012e306..f27eaba760 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -165,7 +165,7 @@ void LLIMFloater::newIMCallback(const LLSD& data){ } } -void LLIMFloater::onVisibilityChange(const LLSD& new_visibility) +void LLIMFloater::onVisibilityChanged(const LLSD& new_visibility) { bool visible = new_visibility.asBoolean(); diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h index f7cd35b5eb..9bdcc113d6 100644 --- a/indra/newview/llimfloater.h +++ b/indra/newview/llimfloater.h @@ -88,7 +88,7 @@ public: // called when docked floater's position has been set by chiclet void setPositioned(bool b) { mPositioned = b; }; - void onVisibilityChange(const LLSD& new_visibility); + void onVisibilityChanged(const LLSD& new_visibility); void processIMTyping(const LLIMInfo* im_info, BOOL typing); void processAgentListUpdates(const LLSD& body); void processSessionUpdate(const LLSD& session_update); diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index b67ddf9b25..baf5a3a839 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -392,7 +392,7 @@ BOOL LLMediaCtrl::postBuild () mContextMenu = LLUICtrlFactory::getInstance()->createFromFile( "menu_media_ctrl.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance()); - setVisibleCallback(boost::bind(&LLMediaCtrl::onVisibilityChange, this, _2)); + setVisibleCallback(boost::bind(&LLMediaCtrl::onVisibilityChanged, this, _2)); return TRUE; } @@ -450,7 +450,7 @@ BOOL LLMediaCtrl::handleUnicodeCharHere(llwchar uni_char) //////////////////////////////////////////////////////////////////////////////// // -void LLMediaCtrl::onVisibilityChange ( const LLSD& new_visibility ) +void LLMediaCtrl::onVisibilityChanged ( const LLSD& new_visibility ) { // set state of frequent updates automatically if visibility changes if ( new_visibility.asBoolean() ) diff --git a/indra/newview/llmediactrl.h b/indra/newview/llmediactrl.h index 964ae08530..db501cdb8c 100644 --- a/indra/newview/llmediactrl.h +++ b/indra/newview/llmediactrl.h @@ -171,7 +171,7 @@ public: void convertInputCoords(S32& x, S32& y); private: - void onVisibilityChange ( const LLSD& new_visibility ); + void onVisibilityChanged ( const LLSD& new_visibility ); void onPopup(const LLSD& notification, const LLSD& response); const S32 mTextureDepthBytes; diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index 36234b9536..26496ec9e2 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -488,7 +488,7 @@ BOOL LLPanelOutfitEdit::postBuild() childSetCommitCallback("shop_btn_1", boost::bind(&LLPanelOutfitEdit::onShopButtonClicked, this), NULL); childSetCommitCallback("shop_btn_2", boost::bind(&LLPanelOutfitEdit::onShopButtonClicked, this), NULL); - setVisibleCallback(boost::bind(&LLPanelOutfitEdit::onVisibilityChange, this, _2)); + setVisibleCallback(boost::bind(&LLPanelOutfitEdit::onVisibilityChanged, this, _2)); mWearablesGearMenuBtn = getChild("wearables_gear_menu_btn"); mGearMenuBtn = getChild("gear_menu_btn"); @@ -774,7 +774,7 @@ void LLPanelOutfitEdit::onPlusBtnClicked(void) } } -void LLPanelOutfitEdit::onVisibilityChange(const LLSD &in_visible_chain) +void LLPanelOutfitEdit::onVisibilityChanged(const LLSD &in_visible_chain) { showAddWearablesPanel(false); mWearableItemsList->resetSelection(); diff --git a/indra/newview/llpaneloutfitedit.h b/indra/newview/llpaneloutfitedit.h index 5d4b8d4644..30870daf40 100644 --- a/indra/newview/llpaneloutfitedit.h +++ b/indra/newview/llpaneloutfitedit.h @@ -145,7 +145,7 @@ public: void updatePlusButton(); void onPlusBtnClicked(void); - void onVisibilityChange(const LLSD &in_visible_chain); + void onVisibilityChanged(const LLSD &in_visible_chain); void applyFolderViewFilter(EFolderViewItemType type); void applyListViewFilter(EListViewItemType type); diff --git a/indra/newview/llpaneltopinfobar.cpp b/indra/newview/llpaneltopinfobar.cpp index 1830086da2..fa371bd0ca 100644 --- a/indra/newview/llpaneltopinfobar.cpp +++ b/indra/newview/llpaneltopinfobar.cpp @@ -169,7 +169,7 @@ BOOL LLPanelTopInfoBar::postBuild() mParcelMgrConnection = LLViewerParcelMgr::getInstance()->addAgentParcelChangedCallback( boost::bind(&LLPanelTopInfoBar::onAgentParcelChange, this)); - setVisibleCallback(boost::bind(&LLPanelTopInfoBar::onVisibilityChange, this, _2)); + setVisibleCallback(boost::bind(&LLPanelTopInfoBar::onVisibilityChanged, this, _2)); return TRUE; } @@ -186,7 +186,7 @@ void LLPanelTopInfoBar::onNavBarShowParcelPropertiesCtrlChanged() // when panel is shown, all minimized floaters should be shifted downwards to prevent overlapping of // PanelTopInfoBar. See EXT-7951. -void LLPanelTopInfoBar::onVisibilityChange(const LLSD& show) +void LLPanelTopInfoBar::onVisibilityChanged(const LLSD& show) { // this height is used as a vertical offset for ALREADY MINIMIZED floaters // when PanelTopInfoBar visibility changes diff --git a/indra/newview/llpaneltopinfobar.h b/indra/newview/llpaneltopinfobar.h index d58d95be90..f37bd9c048 100644 --- a/indra/newview/llpaneltopinfobar.h +++ b/indra/newview/llpaneltopinfobar.h @@ -57,7 +57,7 @@ public: /** * Called when the top info bar gets shown or hidden */ - void onVisibilityChange(const LLSD& show); + void onVisibilityChanged(const LLSD& show); boost::signals2::connection setResizeCallback( const resize_signal_t::slot_type& cb ); diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp index cbb4d5f964..bda603262d 100644 --- a/indra/newview/llpreviewgesture.cpp +++ b/indra/newview/llpreviewgesture.cpp @@ -253,7 +253,7 @@ void LLPreviewGesture::onUpdateSucceeded() refresh(); } -void LLPreviewGesture::onVisibilityChange ( const LLSD& new_visibility ) +void LLPreviewGesture::onVisibilityChanged ( const LLSD& new_visibility ) { if (new_visibility.asBoolean()) { @@ -333,7 +333,7 @@ LLPreviewGesture::~LLPreviewGesture() BOOL LLPreviewGesture::postBuild() { - setVisibleCallback(boost::bind(&LLPreviewGesture::onVisibilityChange, this, _2)); + setVisibleCallback(boost::bind(&LLPreviewGesture::onVisibilityChanged, this, _2)); LLLineEditor* edit; LLComboBox* combo; diff --git a/indra/newview/llpreviewgesture.h b/indra/newview/llpreviewgesture.h index fd4fcf9d8f..7ce5706a0d 100644 --- a/indra/newview/llpreviewgesture.h +++ b/indra/newview/llpreviewgesture.h @@ -102,7 +102,7 @@ protected: // "Sound", "Chat", or "Wait" LLScrollListItem* addStep(const enum EStepType step_type); - void onVisibilityChange ( const LLSD& new_visibility ); + void onVisibilityChanged ( const LLSD& new_visibility ); static std::string getLabel(std::vector labels); static void updateLabel(LLScrollListItem* item); diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 7f7e61cc88..5a5fd6f333 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -56,18 +56,16 @@ LLSceneMonitorView* gSceneMonitorView = NULL; // LLSceneMonitor::LLSceneMonitor() : - mEnabled(FALSE), + mEnabled(false), mDiff(NULL), mDiffResult(0.f), mDiffTolerance(0.1f), - mCurTarget(NULL), - mNeedsUpdateDiff(FALSE), - mHasNewDiff(FALSE), - mHasNewQueryResult(FALSE), - mDebugViewerVisible(FALSE), - mQuitting(FALSE), + mNeedsUpdateDiff(false), + mHasNewDiff(false), + mHasNewQueryResult(false), + mDebugViewerVisible(false), + mQuitting(false), mQueryObject(0), - mSamplingTime(1.0f), mDiffPixelRatio(0.5f) { mFrames[0] = NULL; @@ -79,7 +77,7 @@ LLSceneMonitor::LLSceneMonitor() : LLSceneMonitor::~LLSceneMonitor() { - mQuitting = TRUE; + mQuitting = true; destroyClass(); } @@ -101,7 +99,6 @@ void LLSceneMonitor::reset() mFrames[0] = NULL; mFrames[1] = NULL; mDiff = NULL; - mCurTarget = NULL; unfreezeScene(); @@ -173,54 +170,15 @@ void LLSceneMonitor::generateDitheringTexture(S32 width, S32 height) mDitherScaleT = (F32)height / mDitherMatrixWidth; } -void LLSceneMonitor::setDebugViewerVisible(BOOL visible) +void LLSceneMonitor::setDebugViewerVisible(bool visible) { mDebugViewerVisible = visible; } -bool LLSceneMonitor::preCapture() +LLRenderTarget& LLSceneMonitor::getCaptureTarget() { - static LLCachedControl monitor_enabled(gSavedSettings,"SceneLoadingMonitorEnabled"); - static LLFrameTimer timer; - - mCurTarget = NULL; - if (!LLGLSLShader::sNoFixedFunction) - { - return false; - } - - BOOL enabled = (BOOL)monitor_enabled || mDebugViewerVisible; - if(mEnabled != enabled) - { - if(mEnabled) - { - reset(); - unfreezeScene(); - } - else - { - freezeScene(); - } - - mEnabled = enabled; - } - - if(!mEnabled) - { - return false; - } - - if(gAgent.isPositionChanged()) - { - mRecording->reset(); - } + LLRenderTarget* cur_target = NULL; - if(timer.getElapsedTimeF32() < mSamplingTime) - { - return false; - } - timer.reset(); - S32 width = gViewerWindow->getWorldViewWidthRaw(); S32 height = gViewerWindow->getWorldViewHeightRaw(); @@ -232,7 +190,7 @@ bool LLSceneMonitor::preCapture() gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - mCurTarget = mFrames[0]; + cur_target = mFrames[0]; } else if(!mFrames[1]) { @@ -242,21 +200,22 @@ bool LLSceneMonitor::preCapture() gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - mCurTarget = mFrames[1]; + cur_target = mFrames[1]; } else //swap { - mCurTarget = mFrames[0]; + cur_target = mFrames[0]; mFrames[0] = mFrames[1]; - mFrames[1] = mCurTarget; + mFrames[1] = cur_target; } - if(mCurTarget->getWidth() != width || mCurTarget->getHeight() != height) //size changed + if(cur_target->getWidth() != width || cur_target->getHeight() != height) //size changed { - mCurTarget->resize(width, height, GL_RGB); + cur_target->resize(width, height, GL_RGB); } - return true; + // we're promising the target exists + return *cur_target; } void LLSceneMonitor::freezeAvatar(LLCharacter* avatarp) @@ -308,33 +267,56 @@ void LLSceneMonitor::unfreezeScene() void LLSceneMonitor::capture() { static U32 last_capture_time = 0; + static LLCachedControl monitor_enabled(gSavedSettings,"SceneLoadingMonitorEnabled"); + static LLCachedControl scene_load_sample_time(gSavedSettings, "SceneLoadingMonitorSampleTime"); + static LLFrameTimer timer; - if(last_capture_time == gFrameCount) + LLTrace::Recording* last_frame_recording = LLTrace::get_frame_recording()->getPrevRecording(); + if (last_frame_recording->getMax(LLViewerCamera::getVelocityStat()) > 0.001f + || last_frame_recording->getMax(LLViewerCamera::getAngularVelocityStat() > 0.01f) { - return; + mRecording->reset(); } - last_capture_time = gFrameCount; - preCapture(); - - if(!mCurTarget) + bool enabled = monitor_enabled || mDebugViewerVisible; + if(mEnabled != enabled) { - return; + if(mEnabled) + { + reset(); + unfreezeScene(); + } + else + { + freezeScene(); + } + + mEnabled = enabled; } - - U32 old_FBO = LLRenderTarget::sCurFBO; - gGL.getTexUnit(0)->bind(mCurTarget); - glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); //point to the main frame buffer. + if(timer.getElapsedTimeF32() > scene_load_sample_time() + && mEnabled + && LLGLShader::sNoFixedFunction + && last_capture_time != gFrameCount) + { + timer.reset(); + last_capture_time = gFrameCount; + + LLRenderTarget& cur_target = getCaptureTarget(); + + U32 old_FBO = LLRenderTarget::sCurFBO; + + gGL.getTexUnit(0)->bind(&cur_target); + glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); //point to the main frame buffer. - glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, mCurTarget->getWidth(), mCurTarget->getHeight()); //copy the content + glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, cur_target.getWidth(), cur_target.getHeight()); //copy the content - glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); - glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); - glBindFramebuffer(GL_FRAMEBUFFER, old_FBO); + glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); + glBindFramebuffer(GL_FRAMEBUFFER, old_FBO); - mCurTarget = NULL; - mNeedsUpdateDiff = TRUE; + mNeedsUpdateDiff = true; + } } bool LLSceneMonitor::needsUpdate() const @@ -342,27 +324,33 @@ bool LLSceneMonitor::needsUpdate() const return mNeedsUpdateDiff; } +static LLFastTimer::DeclareTimer FTM_GENERATE_SCENE_LOAD_DITHER_TEXTURE("Generate Scene Load Dither Texture"); +static LLFastTimer::DeclareTimer FTM_SCENE_LOAD_IMAGE_DIFF("Scene Load Image Diff"); + void LLSceneMonitor::compare() { if(!mNeedsUpdateDiff) { return; } - mNeedsUpdateDiff = FALSE; + mNeedsUpdateDiff = false; if(!mFrames[0] || !mFrames[1]) { return; } if(mFrames[0]->getWidth() != mFrames[1]->getWidth() || mFrames[0]->getHeight() != mFrames[1]->getHeight()) - { - return; //size does not match + { //size does not match + return; } + LLFastTimer _(FTM_SCENE_LOAD_IMAGE_DIFF); + S32 width = gViewerWindow->getWindowWidthRaw(); S32 height = gViewerWindow->getWindowHeightRaw(); if(!mDiff) { + LLFastTimer _(FTM_GENERATE_SCENE_LOAD_DITHER_TEXTURE); mDiff = new LLRenderTarget(); mDiff->allocate(width, height, GL_RGBA, false, false, LLTexUnit::TT_TEXTURE, true); @@ -370,6 +358,7 @@ void LLSceneMonitor::compare() } else if(mDiff->getWidth() != width || mDiff->getHeight() != height) { + LLFastTimer _(FTM_GENERATE_SCENE_LOAD_DITHER_TEXTURE); mDiff->resize(width, height, GL_RGBA); generateDitheringTexture(width, height); } @@ -411,9 +400,8 @@ void LLSceneMonitor::compare() gGL.getTexUnit(2)->disable(); gGL.getTexUnit(2)->unbind(LLTexUnit::TT_TEXTURE); - mHasNewDiff = TRUE; + mHasNewDiff = true; - //send out the query request. queryDiff(); } @@ -430,6 +418,8 @@ void LLSceneMonitor::queryDiff() //calculate Diff aggregate information in GPU, and enable gl occlusion query to capture it. void LLSceneMonitor::calcDiffAggregate() { + LLFastTimer _(FTM_SCENE_LOAD_IMAGE_DIFF); + if(!mHasNewDiff && !mDebugViewerVisible) { return; @@ -462,8 +452,8 @@ void LLSceneMonitor::calcDiffAggregate() if(mHasNewDiff) { glEndQueryARB(GL_SAMPLES_PASSED_ARB); - mHasNewDiff = FALSE; - mHasNewQueryResult = TRUE; + mHasNewDiff = false; + mHasNewQueryResult = true; } gOneTextureFilterProgram.unbind(); @@ -482,11 +472,13 @@ void LLSceneMonitor::calcDiffAggregate() static LLTrace::MeasurementStatHandle<> sFramePixelDiff("FramePixelDifference"); void LLSceneMonitor::fetchQueryResult() { + LLFastTimer _(FTM_SCENE_LOAD_IMAGE_DIFF); + if(!mHasNewQueryResult) { return; } - mHasNewQueryResult = FALSE; + mHasNewQueryResult = false; GLuint available = 0; glGetQueryObjectuivARB(mQueryObject, GL_QUERY_RESULT_AVAILABLE_ARB, &available); @@ -500,25 +492,22 @@ void LLSceneMonitor::fetchQueryResult() mDiffResult = count * 0.5f / (mDiff->getWidth() * mDiff->getHeight() * mDiffPixelRatio * mDiffPixelRatio); //0.5 -> (front face + back face) - addMonitorResult(); -} + sample(sFramePixelDiff, mDiffResult); -void LLSceneMonitor::addMonitorResult() -{ const F32 diff_threshold = 0.001f; - if(mDiffResult < diff_threshold) + if(mDiffResult > diff_threshold) { - return; - } - mRecording->extend(); - sample(sFramePixelDiff, mDiffResult); + } +} +void LLSceneMonitor::addMonitorResult() +{ ll_monitor_result_t result; result.mTimeStamp = LLImageGL::sLastFrameTime; result.mDiff = mDiffResult; mMonitorResults.push_back(result); - } +} //dump results to a file _scene_monitor_results.csv void LLSceneMonitor::dumpToFile(std::string file_name) @@ -563,12 +552,10 @@ void LLSceneMonitorView::onClickCloseBtn() setVisible(false); } -void LLSceneMonitorView::setVisible(BOOL visible) +void LLSceneMonitorView::onVisibilityChange(BOOL visible) { visible = visible && LLGLSLShader::sNoFixedFunction; LLSceneMonitor::getInstance()->setDebugViewerVisible(visible); - - LLView::setVisible(visible); } void LLSceneMonitorView::draw() @@ -608,7 +595,7 @@ void LLSceneMonitorView::draw() LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, 5, getRect().getHeight() - line_height * lines, color, LLFontGL::LEFT, LLFontGL::TOP); lines++; - num_str = llformat("Sampling time: %.3f seconds", LLSceneMonitor::getInstance()->getSamplingTime()); + num_str = llformat("Sampling time: %.3f seconds", gSavedSettings->getF32("SceneLoadingMonitorSampleTime")); LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, 5, getRect().getHeight() - line_height * lines, color, LLFontGL::LEFT, LLFontGL::TOP); lines++; diff --git a/indra/newview/llscenemonitor.h b/indra/newview/llscenemonitor.h index 45a5241924..08d2335a90 100644 --- a/indra/newview/llscenemonitor.h +++ b/indra/newview/llscenemonitor.h @@ -46,7 +46,7 @@ public: void destroyClass(); void freezeAvatar(LLCharacter* avatarp); - void setDebugViewerVisible(BOOL visible); + void setDebugViewerVisible(bool visible); void capture(); //capture the main frame buffer void compare(); //compare the stored two buffers. @@ -58,7 +58,6 @@ public: const LLRenderTarget* getDiffTarget() const {return mDiff;} F32 getDiffTolerance() const {return mDiffTolerance;} F32 getDiffResult() const { return mDiffResult;} - F32 getSamplingTime() const { return mSamplingTime;} F32 getDiffPixelRatio() const { return mDiffPixelRatio;} bool isEnabled()const {return mEnabled;} bool needsUpdate() const; @@ -71,27 +70,25 @@ private: void freezeScene(); void unfreezeScene(); void reset(); - bool preCapture(); + LLRenderTarget& getCaptureTarget(); void generateDitheringTexture(S32 width, S32 height); void addMonitorResult(); private: - BOOL mEnabled; - BOOL mNeedsUpdateDiff; - BOOL mHasNewDiff; - BOOL mHasNewQueryResult; - BOOL mDebugViewerVisible; - BOOL mQuitting; + bool mEnabled; + bool mNeedsUpdateDiff; + bool mHasNewDiff; + bool mHasNewQueryResult; + bool mDebugViewerVisible; + bool mQuitting; LLRenderTarget* mFrames[2]; LLRenderTarget* mDiff; - LLRenderTarget* mCurTarget; GLuint mQueryObject; //used for glQuery F32 mDiffResult; //aggregate results of mDiff. F32 mDiffTolerance; //pixels are filtered out when R+G+B < mDiffTolerance - F32 mSamplingTime; //time interval to capture frames, in seconds F32 mDiffPixelRatio; //ratio of pixels used for comparison against the original mDiff size along one dimension LLPointer mDitheringTexture; @@ -119,7 +116,8 @@ public: LLSceneMonitorView(const LLRect& rect); virtual void draw(); - virtual void setVisible(BOOL visible); + + virtual void onVisibilityChange(BOOL visible); protected: virtual void onClickCloseBtn(); diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index d909a218e3..e0fb09d86d 100644 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -142,7 +142,7 @@ BOOL LLSidepanelAppearance::postBuild() mCurrOutfitPanel = getChild("panel_currentlook"); - setVisibleCallback(boost::bind(&LLSidepanelAppearance::onVisibilityChange,this,_2)); + setVisibleCallback(boost::bind(&LLSidepanelAppearance::onVisibilityChanged,this,_2)); return TRUE; } @@ -181,7 +181,7 @@ void LLSidepanelAppearance::onOpen(const LLSD& key) mOpened = true; } -void LLSidepanelAppearance::onVisibilityChange(const LLSD &new_visibility) +void LLSidepanelAppearance::onVisibilityChanged(const LLSD &new_visibility) { LLSD visibility; visibility["visible"] = new_visibility.asBoolean(); diff --git a/indra/newview/llsidepanelappearance.h b/indra/newview/llsidepanelappearance.h index 6dd3520266..8564827a17 100644 --- a/indra/newview/llsidepanelappearance.h +++ b/indra/newview/llsidepanelappearance.h @@ -67,7 +67,7 @@ public: private: void onFilterEdit(const std::string& search_string); - void onVisibilityChange ( const LLSD& new_visibility ); + void onVisibilityChanged ( const LLSD& new_visibility ); void onOpenOutfitButtonClicked(); void onEditAppearanceButtonClicked(); -- cgit v1.3 From 12c34dc30f0cb6270c11e100fcaceb3fa6b27e81 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 16 May 2013 00:53:01 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics renamed LLView::handleVisibilityChange to onVisibilityChange to reflect cleaned up scene monitor stats recording, now all trace stats dumped to csv also fixed extendablerecording, periodicrecording, etc. to properly implement start/stop/etc --- indra/llcommon/lltracerecording.cpp | 228 ++++++++++---------------------- indra/llcommon/lltracerecording.h | 73 +++++----- indra/newview/app_settings/settings.xml | 25 +++- indra/newview/llappviewer.cpp | 11 +- indra/newview/llscenemonitor.cpp | 196 +++++++++++++++++++-------- indra/newview/llscenemonitor.h | 15 ++- indra/newview/llstartup.cpp | 6 +- indra/newview/llworld.cpp | 2 +- 8 files changed, 297 insertions(+), 259 deletions(-) (limited to 'indra/newview/app_settings/settings.xml') diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp index e562f2bce2..6b5c6c7d3e 100644 --- a/indra/llcommon/lltracerecording.cpp +++ b/indra/llcommon/lltracerecording.cpp @@ -179,8 +179,6 @@ void Recording::handleStop() void Recording::handleSplitTo(Recording& other) { - stop(); - other.restart(); handOffTo(other); } @@ -375,94 +373,86 @@ PeriodicRecording::PeriodicRecording( U32 num_periods, EPlayState state) void PeriodicRecording::nextPeriod() { - EPlayState play_state = getPlayState(); - Recording& old_recording = getCurRecording(); if (mAutoResize) { mRecordingPeriods.push_back(Recording()); } - U32 num_periods = mRecordingPeriods.size(); - mCurPeriod = (num_periods > 0) - ? (mCurPeriod + 1) % num_periods - : mCurPeriod + 1; - old_recording.splitTo(getCurRecording()); - switch(play_state) - { - case STOPPED: - getCurRecording().stop(); - break; - case PAUSED: - getCurRecording().pause(); - break; - case STARTED: - break; - } + Recording& old_recording = getCurRecording(); + + mCurPeriod = mRecordingPeriods.empty() + ? mCurPeriod + 1 + : (mCurPeriod + 1) % mRecordingPeriods.size(); + old_recording.splitTo(getCurRecording()); } void PeriodicRecording::appendPeriodicRecording( PeriodicRecording& other ) { - if (other.mRecordingPeriods.size() < 2) return; + if (other.mRecordingPeriods.empty()) return; EPlayState play_state = getPlayState(); - pause(); + stop(); EPlayState other_play_state = other.getPlayState(); other.pause(); - if (mAutoResize) - { - // copy everything after current period of other recording to end of buffer - // this will only apply if other recording is using a fixed circular buffer - if (other.mCurPeriod < other.mRecordingPeriods.size() - 1) - { - std::copy( other.mRecordingPeriods.begin() + other.mCurPeriod + 1, - other.mRecordingPeriods.end(), - std::back_inserter(mRecordingPeriods)); - } + U32 other_recording_count = other.mRecordingPeriods.size(); - // copy everything from beginning of other recording's buffer up to, but not including - // current period - std::copy( other.mRecordingPeriods.begin(), - other.mRecordingPeriods.begin() + other.mCurPeriod, - std::back_inserter(mRecordingPeriods)); + Recording& other_oldest_recording = other.mRecordingPeriods[(other.mCurPeriod + 1) % other.mRecordingPeriods.size()]; - mCurPeriod = mRecordingPeriods.size() - 1; + // if I have a recording of any length, then close it off and start a fresh one + if (getCurRecording().getDuration().value()) + { + nextPeriod(); } - else + getCurRecording().appendRecording(other_oldest_recording); + + if (other_recording_count > 1) { - size_t num_to_copy = llmin( mRecordingPeriods.size(), other.mRecordingPeriods.size() ); - std::vector::iterator src_it = other.mRecordingPeriods.begin() - + ( (other.mCurPeriod + 1) // cur period - + (other.mRecordingPeriods.size() - num_to_copy) // minus room for copy - % other.mRecordingPeriods.size()); - std::vector::iterator dest_it = mRecordingPeriods.begin() + ((mCurPeriod + 1) % mRecordingPeriods.size()); - - for(S32 i = 0; i < num_to_copy; i++) + if (mAutoResize) { - *dest_it = *src_it; - - if (++src_it == other.mRecordingPeriods.end()) + for (S32 other_index = (other.mCurPeriod + 2) % other_recording_count; + other_index != other.mCurPeriod; + other_index = (other_index + 1) % other_recording_count) { - src_it = other.mRecordingPeriods.begin(); + llassert(other.mRecordingPeriods[other_index].getDuration() != 0.f + && (mRecordingPeriods.empty() + || other.mRecordingPeriods[other_index].getDuration() != mRecordingPeriods.back().getDuration())); + mRecordingPeriods.push_back(other.mRecordingPeriods[other_index]); } - if (++dest_it == mRecordingPeriods.end()) + mCurPeriod = mRecordingPeriods.size() - 1; + } + else + { + size_t num_to_copy = llmin( mRecordingPeriods.size(), other.mRecordingPeriods.size() - 1); + std::vector::iterator src_it = other.mRecordingPeriods.begin() + + ( (other.mCurPeriod + 1 // oldest period + + (other.mRecordingPeriods.size() - num_to_copy)) // minus room for copy + % other.mRecordingPeriods.size()); + std::vector::iterator dest_it = mRecordingPeriods.begin() + ((mCurPeriod + 1) % mRecordingPeriods.size()); + + for(S32 i = 0; i < num_to_copy; i++) { - dest_it = mRecordingPeriods.begin(); + *dest_it = *src_it; + + if (++src_it == other.mRecordingPeriods.end()) + { + src_it = other.mRecordingPeriods.begin(); + } + + if (++dest_it == mRecordingPeriods.end()) + { + dest_it = mRecordingPeriods.begin(); + } } - } - mCurPeriod = (mCurPeriod + num_to_copy) % mRecordingPeriods.size(); + mCurPeriod = (mCurPeriod + num_to_copy) % mRecordingPeriods.size(); + } } - // if copying from periodic recording that wasn't active advance our period to the next available one - // otherwise continue recording on top of the last period of data received from the other recording - if (other_play_state != STARTED) - { - nextPeriod(); - } + nextPeriod(); setPlayState(play_state); other.setPlayState(other_play_state); @@ -524,47 +514,28 @@ const Recording& PeriodicRecording::getPrevRecording( U32 offset ) const return mRecordingPeriods[(mCurPeriod + num_periods - offset) % num_periods]; } -void PeriodicRecording::start() +void PeriodicRecording::handleStart() { getCurRecording().start(); } -void PeriodicRecording::stop() -{ - getCurRecording().stop(); -} - -void PeriodicRecording::pause() +void PeriodicRecording::handleStop() { getCurRecording().pause(); } -void PeriodicRecording::resume() -{ - getCurRecording().resume(); -} - -void PeriodicRecording::restart() +void PeriodicRecording::handleReset() { - getCurRecording().restart(); + mRecordingPeriods.clear(); + mRecordingPeriods.push_back(Recording()); + mCurPeriod = 0; } -void PeriodicRecording::reset() +void PeriodicRecording::handleSplitTo(PeriodicRecording& other) { - getCurRecording().reset(); + getCurRecording().handOffTo(other.getCurRecording()); } -void PeriodicRecording::splitTo(PeriodicRecording& other) -{ - getCurRecording().splitTo(other.getCurRecording()); -} - -void PeriodicRecording::splitFrom(PeriodicRecording& other) -{ - getCurRecording().splitFrom(other.getCurRecording()); -} - - /////////////////////////////////////////////////////////////////////// // ExtendableRecording /////////////////////////////////////////////////////////////////////// @@ -581,55 +552,27 @@ void ExtendableRecording::extend() mPotentialRecording.setPlayState(getPlayState()); } -void ExtendableRecording::start() +void ExtendableRecording::handleStart() { - LLStopWatchControlsMixin::start(); mPotentialRecording.start(); } -void ExtendableRecording::stop() -{ - LLStopWatchControlsMixin::stop(); - mPotentialRecording.stop(); -} - -void ExtendableRecording::pause() +void ExtendableRecording::handleStop() { - LLStopWatchControlsMixin::pause(); mPotentialRecording.pause(); } -void ExtendableRecording::resume() -{ - LLStopWatchControlsMixin::resume(); - mPotentialRecording.resume(); -} - -void ExtendableRecording::restart() -{ - LLStopWatchControlsMixin::restart(); - mAcceptedRecording.reset(); - mPotentialRecording.restart(); -} - -void ExtendableRecording::reset() +void ExtendableRecording::handleReset() { - LLStopWatchControlsMixin::reset(); mAcceptedRecording.reset(); mPotentialRecording.reset(); } -void ExtendableRecording::splitTo(ExtendableRecording& other) +void ExtendableRecording::handleSplitTo(ExtendableRecording& other) { - LLStopWatchControlsMixin::splitTo(other); - mPotentialRecording.splitTo(other.mPotentialRecording); + mPotentialRecording.handOffTo(other.mPotentialRecording); } -void ExtendableRecording::splitFrom(ExtendableRecording& other) -{ - LLStopWatchControlsMixin::splitFrom(other); - mPotentialRecording.splitFrom(other.mPotentialRecording); -} /////////////////////////////////////////////////////////////////////// // ExtendablePeriodicRecording @@ -639,13 +582,13 @@ void ExtendableRecording::splitFrom(ExtendableRecording& other) ExtendablePeriodicRecording::ExtendablePeriodicRecording() : mAcceptedRecording(0), mPotentialRecording(0) -{ -} +{} void ExtendablePeriodicRecording::extend() { + llassert(mPotentialRecording.getPlayState() == getPlayState()); // stop recording to get latest data - mPotentialRecording.stop(); + mPotentialRecording.pause(); // push the data back to accepted recording mAcceptedRecording.appendPeriodicRecording(mPotentialRecording); // flush data, so we can start from scratch @@ -654,55 +597,28 @@ void ExtendablePeriodicRecording::extend() mPotentialRecording.setPlayState(getPlayState()); } -void ExtendablePeriodicRecording::start() -{ - LLStopWatchControlsMixin::start(); - mPotentialRecording.start(); -} -void ExtendablePeriodicRecording::stop() +void ExtendablePeriodicRecording::handleStart() { - LLStopWatchControlsMixin::stop(); - mPotentialRecording.stop(); + mPotentialRecording.start(); } -void ExtendablePeriodicRecording::pause() +void ExtendablePeriodicRecording::handleStop() { - LLStopWatchControlsMixin::pause(); mPotentialRecording.pause(); } -void ExtendablePeriodicRecording::resume() -{ - LLStopWatchControlsMixin::resume(); - mPotentialRecording.resume(); -} - -void ExtendablePeriodicRecording::restart() -{ - LLStopWatchControlsMixin::restart(); - mAcceptedRecording.reset(); - mPotentialRecording.restart(); -} - -void ExtendablePeriodicRecording::reset() +void ExtendablePeriodicRecording::handleReset() { - LLStopWatchControlsMixin::reset(); mAcceptedRecording.reset(); mPotentialRecording.reset(); } -void ExtendablePeriodicRecording::splitTo(ExtendablePeriodicRecording& other) +void ExtendablePeriodicRecording::handleSplitTo(ExtendablePeriodicRecording& other) { - LLStopWatchControlsMixin::splitTo(other); mPotentialRecording.splitTo(other.mPotentialRecording); } -void ExtendablePeriodicRecording::splitFrom(ExtendablePeriodicRecording& other) -{ - LLStopWatchControlsMixin::splitFrom(other); - mPotentialRecording.splitFrom(other.mPotentialRecording); -} PeriodicRecording& get_frame_recording() { diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 84006a10b8..be8618a299 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -46,12 +46,12 @@ public: STARTED }; - virtual void start(); - virtual void stop(); - virtual void pause(); - virtual void resume(); - virtual void restart(); - virtual void reset(); + void start(); + void stop(); + void pause(); + void resume(); + void restart(); + void reset(); bool isStarted() const { return mPlayState == STARTED; } bool isPaused() const { return mPlayState == PAUSED; } @@ -67,11 +67,11 @@ protected: private: // trigger active behavior (without reset) - virtual void handleStart(){}; + virtual void handleStart() = 0; // stop active behavior - virtual void handleStop(){}; + virtual void handleStop() = 0; // clear accumulated state, can be called while started - virtual void handleReset(){}; + virtual void handleReset() = 0; EPlayState mPlayState; }; @@ -84,7 +84,13 @@ public: typedef LLStopWatchControlsMixin self_t; virtual void splitTo(DERIVED& other) { + EPlayState play_state = getPlayState(); + stop(); + other.reset(); + handleSplitTo(other); + + other.setPlayState(play_state); } virtual void splitFrom(DERIVED& other) @@ -124,7 +130,9 @@ namespace LLTrace LLCopyOnWritePointer > mMemStats; }; - class Recording : public LLStopWatchControlsMixin, public RecordingBuffers + class Recording + : public LLStopWatchControlsMixin, + public RecordingBuffers { public: Recording(); @@ -367,15 +375,12 @@ namespace LLTrace return mean; } + private: // implementation for LLStopWatchControlsMixin - /*virtual*/ void start(); - /*virtual*/ void stop(); - /*virtual*/ void pause(); - /*virtual*/ void resume(); - /*virtual*/ void restart(); - /*virtual*/ void reset(); - /*virtual*/ void splitTo(PeriodicRecording& other); - /*virtual*/ void splitFrom(PeriodicRecording& other); + /*virtual*/ void handleStart(); + /*virtual*/ void handleStop(); + /*virtual*/ void handleReset(); + /*virtual*/ void handleSplitTo(PeriodicRecording& other); private: std::vector mRecordingPeriods; @@ -395,15 +400,15 @@ namespace LLTrace Recording& getAcceptedRecording() { return mAcceptedRecording; } const Recording& getAcceptedRecording() const {return mAcceptedRecording;} + Recording& getPotentialRecording() { return mPotentialRecording; } + const Recording& getPotentialRecording() const { return mPotentialRecording;} + + private: // implementation for LLStopWatchControlsMixin - /*virtual*/ void start(); - /*virtual*/ void stop(); - /*virtual*/ void pause(); - /*virtual*/ void resume(); - /*virtual*/ void restart(); - /*virtual*/ void reset(); - /*virtual*/ void splitTo(ExtendableRecording& other); - /*virtual*/ void splitFrom(ExtendableRecording& other); + /*virtual*/ void handleStart(); + /*virtual*/ void handleStop(); + /*virtual*/ void handleReset(); + /*virtual*/ void handleSplitTo(ExtendableRecording& other); private: Recording mAcceptedRecording; @@ -419,16 +424,16 @@ namespace LLTrace PeriodicRecording& getAcceptedRecording() { return mAcceptedRecording; } const PeriodicRecording& getAcceptedRecording() const {return mAcceptedRecording;} + + PeriodicRecording& getPotentialRecording() { return mPotentialRecording; } + const PeriodicRecording& getPotentialRecording() const {return mPotentialRecording;} + private: // implementation for LLStopWatchControlsMixin - /*virtual*/ void start(); - /*virtual*/ void stop(); - /*virtual*/ void pause(); - /*virtual*/ void resume(); - /*virtual*/ void restart(); - /*virtual*/ void reset(); - /*virtual*/ void splitTo(ExtendablePeriodicRecording& other); - /*virtual*/ void splitFrom(ExtendablePeriodicRecording& other); + /*virtual*/ void handleStart(); + /*virtual*/ void handleStop(); + /*virtual*/ void handleReset(); + /*virtual*/ void handleSplitTo(ExtendablePeriodicRecording& other); private: PeriodicRecording mAcceptedRecording; diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index ed8d0bf10d..94f032be67 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -6847,6 +6847,17 @@ F32 Value 6.0 + + ClothingLoadingDelay + + Comment + Time to wait for avatar appearance to resolve before showing world (seconds) + Persist + 1 + Type + F32 + Value + 10.0 PreferredMaturity @@ -7403,7 +7414,6 @@ Value 1 - OctreeMaxNodeCapacity Comment @@ -9478,7 +9488,18 @@ Type F32 Value - 1 + 0.25 + + SceneLoadingPixelDiffThreshold + + Comment + Amount of pixels changed required to consider the scene as still loading (fraction of pixels on screen) + Persist + 1 + Type + F32 + Value + 0.0003 ScriptHelpFollowsCursor diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 0b0db432c8..3a3fe2b656 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1203,6 +1203,8 @@ LLFastTimer::DeclareTimer FTM_FRAME("Frame", true); bool LLAppViewer::mainLoop() { + llinfos << "***********************Entering main_loop***********************" << llendflush; + mMainloopTimeout = new LLWatchdogTimeout(); //------------------------------------------- @@ -1539,7 +1541,7 @@ bool LLAppViewer::mainLoop() destroyMainloopTimeout(); - llinfos << "Exiting main_loop" << llendflush; + llinfos << "***********************Exiting main_loop***********************" << llendflush; return true; } @@ -1568,11 +1570,9 @@ bool LLAppViewer::cleanup() LLEventPumps::instance().reset(); //dump scene loading monitor results - if(LLSceneMonitor::getInstance()->hasResults()) + if(LLSceneMonitor::instance().hasResults()) { - std::string file_name = "scene_monitor_results.csv"; - LLSceneMonitor::getInstance()->dumpToFile( - gDirUtilp->getExpandedFilename(LL_PATH_LOGS, file_name)); + LLSceneMonitor::instance().dumpToFile(gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "scene_monitor_results.csv")); } if (LLFastTimerView::sAnalyzePerformance) @@ -4257,6 +4257,7 @@ void LLAppViewer::idle() { if (gRenderStartTime.getElapsedTimeF32() > qas) { + llinfos << "Quitting after " << qas << " seconds. See setting \"QuitAfterSeconds\"." << llendl; LLAppViewer::instance()->forceQuit(); } } diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 3d8e1513dd..c101fe7deb 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -60,11 +60,8 @@ LLSceneMonitor::LLSceneMonitor() : mDiff(NULL), mDiffResult(0.f), mDiffTolerance(0.1f), - mNeedsUpdateDiff(false), - mHasNewDiff(false), - mHasNewQueryResult(false), + mDiffState(WAITING_FOR_NEXT_DIFF), mDebugViewerVisible(false), - mQuitting(false), mQueryObject(0), mDiffPixelRatio(0.5f) { @@ -72,12 +69,11 @@ LLSceneMonitor::LLSceneMonitor() : mFrames[1] = NULL; mRecording = new LLTrace::ExtendablePeriodicRecording(); - mRecording->start(); } LLSceneMonitor::~LLSceneMonitor() { - mQuitting = true; + mDiffState = VIEWER_QUITTING; destroyClass(); } @@ -100,6 +96,8 @@ void LLSceneMonitor::reset() mFrames[1] = NULL; mDiff = NULL; + mRecording->reset(); + unfreezeScene(); if(mQueryObject > 0) @@ -248,7 +246,7 @@ void LLSceneMonitor::unfreezeScene() //thaw all avatars mAvatarPauseHandles.clear(); - if(mQuitting) + if(mDiffState == VIEWER_QUITTING) { return; //we are quitting viewer. } @@ -267,7 +265,7 @@ void LLSceneMonitor::unfreezeScene() void LLSceneMonitor::capture() { static U32 last_capture_time = 0; - static LLCachedControl monitor_enabled(gSavedSettings,"SceneLoadingMonitorEnabled"); + static LLCachedControl monitor_enabled(gSavedSettings, "SceneLoadingMonitorEnabled"); static LLCachedControl scene_load_sample_time(gSavedSettings, "SceneLoadingMonitorSampleTime"); static LLFrameTimer timer; @@ -275,7 +273,7 @@ void LLSceneMonitor::capture() if (last_frame_recording.getSum(*LLViewerCamera::getVelocityStat()) > 0.001f || last_frame_recording.getSum(*LLViewerCamera::getAngularVelocityStat()) > 0.01f) { - mRecording->reset(); + reset(); } bool enabled = monitor_enabled || mDebugViewerVisible; @@ -283,11 +281,11 @@ void LLSceneMonitor::capture() { if(mEnabled) { - reset(); unfreezeScene(); } else { + reset(); freezeScene(); } @@ -299,7 +297,10 @@ void LLSceneMonitor::capture() && LLGLSLShader::sNoFixedFunction && last_capture_time != gFrameCount) { + mRecording->resume(); + timer.reset(); + last_capture_time = gFrameCount; LLRenderTarget& cur_target = getCaptureTarget(); @@ -315,13 +316,13 @@ void LLSceneMonitor::capture() glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); glBindFramebuffer(GL_FRAMEBUFFER, old_FBO); - mNeedsUpdateDiff = true; + mDiffState = NEED_DIFF; } } bool LLSceneMonitor::needsUpdate() const { - return mNeedsUpdateDiff; + return mDiffState == NEED_DIFF; } static LLFastTimer::DeclareTimer FTM_GENERATE_SCENE_LOAD_DITHER_TEXTURE("Generate Scene Load Dither Texture"); @@ -329,11 +330,10 @@ static LLFastTimer::DeclareTimer FTM_SCENE_LOAD_IMAGE_DIFF("Scene Load Image Dif void LLSceneMonitor::compare() { - if(!mNeedsUpdateDiff) + if(mDiffState != NEED_DIFF) { return; } - mNeedsUpdateDiff = false; if(!mFrames[0] || !mFrames[1]) { @@ -345,6 +345,7 @@ void LLSceneMonitor::compare() } LLFastTimer _(FTM_SCENE_LOAD_IMAGE_DIFF); + mDiffState = EXECUTE_DIFF; S32 width = gViewerWindow->getWindowWidthRaw(); S32 height = gViewerWindow->getWindowHeightRaw(); @@ -400,8 +401,6 @@ void LLSceneMonitor::compare() gGL.getTexUnit(2)->disable(); gGL.getTexUnit(2)->unbind(LLTexUnit::TT_TEXTURE); - mHasNewDiff = true; - if (!mDebugViewerVisible) { calcDiffAggregate(); @@ -413,7 +412,7 @@ void LLSceneMonitor::calcDiffAggregate() { LLFastTimer _(FTM_SCENE_LOAD_IMAGE_DIFF); - if(!mHasNewDiff && !mDebugViewerVisible) + if(mDiffState != EXECUTE_DIFF && !mDebugViewerVisible) { return; } @@ -435,18 +434,17 @@ void LLSceneMonitor::calcDiffAggregate() gOneTextureFilterProgram.bind(); gOneTextureFilterProgram.uniform1f("tolerance", mDiffTolerance); - if(mHasNewDiff) + if(mDiffState == EXECUTE_DIFF) { glBeginQueryARB(GL_SAMPLES_PASSED_ARB, mQueryObject); } gl_draw_scaled_target(0, 0, S32(mDiff->getWidth() * mDiffPixelRatio), S32(mDiff->getHeight() * mDiffPixelRatio), mDiff); - if(mHasNewDiff) + if(mDiffState == EXECUTE_DIFF) { glEndQueryARB(GL_SAMPLES_PASSED_ARB); - mHasNewDiff = false; - mHasNewQueryResult = true; + mDiffState = WAIT_ON_RESULT; } gOneTextureFilterProgram.unbind(); @@ -467,31 +465,30 @@ void LLSceneMonitor::fetchQueryResult() { LLFastTimer _(FTM_SCENE_LOAD_IMAGE_DIFF); - if(!mHasNewQueryResult) - { - return; - } - mHasNewQueryResult = false; - - GLuint available = 0; - glGetQueryObjectuivARB(mQueryObject, GL_QUERY_RESULT_AVAILABLE_ARB, &available); - if(!available) + if(mDiffState == WAIT_ON_RESULT) { - return; - } + mDiffState = WAITING_FOR_NEXT_DIFF; - GLuint count = 0; - glGetQueryObjectuivARB(mQueryObject, GL_QUERY_RESULT_ARB, &count); + GLuint available = 0; + glGetQueryObjectuivARB(mQueryObject, GL_QUERY_RESULT_AVAILABLE_ARB, &available); + if(available) + { + GLuint count = 0; + glGetQueryObjectuivARB(mQueryObject, GL_QUERY_RESULT_ARB, &count); - mDiffResult = count * 0.5f / (mDiff->getWidth() * mDiff->getHeight() * mDiffPixelRatio * mDiffPixelRatio); //0.5 -> (front face + back face) + mDiffResult = count * 0.5f / (mDiff->getWidth() * mDiff->getHeight() * mDiffPixelRatio * mDiffPixelRatio); //0.5 -> (front face + back face) - LL_DEBUGS("SceneMonitor") << "Frame difference: " << std::setprecision(4) << mDiffResult << LL_ENDL; - sample(sFramePixelDiff, mDiffResult); + LL_DEBUGS("SceneMonitor") << "Frame difference: " << std::setprecision(4) << mDiffResult << LL_ENDL; + sample(sFramePixelDiff, mDiffResult); - const F32 diff_threshold = 0.001f; - if(mDiffResult > diff_threshold) - { - mRecording->extend(); + mRecording->getPotentialRecording().nextPeriod(); + + static LLCachedControl diff_threshold(gSavedSettings,"SceneLoadingPixelDiffThreshold"); + if(mDiffResult > diff_threshold()) + { + mRecording->extend(); + } + } } } @@ -503,29 +500,124 @@ void LLSceneMonitor::addMonitorResult() mMonitorResults.push_back(result); } -//dump results to a file _scene_monitor_results.csv +//dump results to a file _scene_xmonitor_results.csv void LLSceneMonitor::dumpToFile(std::string file_name) { - if(mMonitorResults.empty() || !getRecording()) - { - return; //nothing to dump - } + LL_INFOS("SceneMonitor") << "Saving scene load stats to " << file_name << LL_ENDL; std::ofstream os(file_name.c_str()); //total scene loading time - os << llformat("Scene Loading time: %.4f seconds\n", (F32)getRecording()->getAcceptedRecording().getDuration().value()); + os << std::setprecision(4); + + LLTrace::PeriodicRecording& scene_load_recording = mRecording->getAcceptedRecording(); + U32 frame_count = scene_load_recording.getNumPeriods(); + + LLUnit frame_time; + + os << "Stat"; + for (S32 frame = 0; frame < frame_count; frame++) + { + frame_time += scene_load_recording.getPrevRecording(frame_count - frame).getDuration(); + os << ", " << frame_time.value(); + } + os << std::endl; + + for (LLTrace::CountStatHandle::instance_iter it = LLTrace::CountStatHandle::beginInstances(), end_it = LLTrace::CountStatHandle::endInstances(); + it != end_it; + ++it) + { + std::ostringstream row; + row << it->getName(); + + S32 samples = 0; + + for (S32 i = frame_count - 1; i >= 0; --i) + { + samples += scene_load_recording.getPrevRecording(i).getSampleCount(*it); + row << ", " << scene_load_recording.getPrevRecording(i).getSum(*it); + } + + row << std::endl; + + if (samples > 0) + { + os << row.str(); + } + } + + for (LLTrace::CountStatHandle::instance_iter it = LLTrace::CountStatHandle::beginInstances(), end_it = LLTrace::CountStatHandle::endInstances(); + it != end_it; + ++it) + { + std::ostringstream row; + row << it->getName(); + + S32 samples = 0; + + for (S32 i = frame_count - 1; i >= 0; --i) + { + samples += scene_load_recording.getPrevRecording(i).getSampleCount(*it); + row << ", " << scene_load_recording.getPrevRecording(i).getSum(*it); + } + + row << std::endl; + + if (samples > 0) + { + os << row.str(); + } + } + + for (LLTrace::MeasurementStatHandle::instance_iter it = LLTrace::MeasurementStatHandle::beginInstances(), end_it = LLTrace::MeasurementStatHandle::endInstances(); + it != end_it; + ++it) + { + std::ostringstream row; + row << it->getName(); + + S32 samples = 0; - S32 num_results = mMonitorResults.size(); - for(S32 i = 0; i < num_results; i++) + for (S32 i = frame_count - 1; i >= 0; --i) + { + samples += scene_load_recording.getPrevRecording(i).getSampleCount(*it); + row << ", " << scene_load_recording.getPrevRecording(i).getMean(*it); + } + + row << std::endl; + + if (samples > 0) + { + os << row.str(); + } + } + + for (LLTrace::MeasurementStatHandle::instance_iter it = LLTrace::MeasurementStatHandle::beginInstances(), end_it = LLTrace::MeasurementStatHandle::endInstances(); + it != end_it; + ++it) { - os << llformat("%.4f %.4f\n", mMonitorResults[i].mTimeStamp, mMonitorResults[i].mDiff); + std::ostringstream row; + row << it->getName(); + + S32 samples = 0; + + for (S32 i = frame_count - 1; i >= 0; --i) + { + samples += scene_load_recording.getPrevRecording(i).getSampleCount(*it); + row << ", " << scene_load_recording.getPrevRecording(i).getMean(*it); + } + + row << std::endl; + + if (samples > 0) + { + os << row.str(); + } } os.flush(); os.close(); - mMonitorResults.clear(); } //------------------------------------------------------------------------------------------------------------- @@ -563,8 +655,6 @@ void LLSceneMonitorView::draw() F32 ratio = LLSceneMonitor::getInstance()->getDiffPixelRatio(); S32 height = (S32)(target->getHeight() * ratio); S32 width = (S32)(target->getWidth() * ratio); - //S32 height = (S32) (gViewerWindow->getWindowRectScaled().getHeight()*0.5f); - //S32 width = (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.5f); LLRect new_rect; new_rect.setLeftTopAndSize(getRect().mLeft, getRect().mTop, width, height); diff --git a/indra/newview/llscenemonitor.h b/indra/newview/llscenemonitor.h index 6dccbbe335..f43c455f2f 100644 --- a/indra/newview/llscenemonitor.h +++ b/indra/newview/llscenemonitor.h @@ -64,7 +64,7 @@ public: LLTrace::ExtendablePeriodicRecording* getRecording() const {return mRecording;} void dumpToFile(std::string file_name); - bool hasResults() const { return !mMonitorResults.empty();} + bool hasResults() const { return mRecording->getAcceptedRecording().getDuration() != 0;} private: void freezeScene(); @@ -76,11 +76,16 @@ private: void addMonitorResult(); private: bool mEnabled; - bool mNeedsUpdateDiff; - bool mHasNewDiff; - bool mHasNewQueryResult; bool mDebugViewerVisible; - bool mQuitting; + + enum EDiffState + { + WAITING_FOR_NEXT_DIFF, + NEED_DIFF, + EXECUTE_DIFF, + WAIT_ON_RESULT, + VIEWER_QUITTING + } mDiffState; LLRenderTarget* mFrames[2]; LLRenderTarget* mDiff; diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index cf2b491d6c..f748344cc8 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -2048,7 +2048,7 @@ bool idle_startup() static LLFrameTimer wearables_timer; const F32 wearables_time = wearables_timer.getElapsedTimeF32(); - const F32 MAX_WEARABLES_TIME = 10.f; + static LLCachedControl max_wearables_time(gSavedSettings, "ClothingLoadingDelay"); if (!gAgent.isGenderChosen() && isAgentAvatarValid()) { @@ -2068,7 +2068,7 @@ bool idle_startup() display_startup(); - if (wearables_time > MAX_WEARABLES_TIME) + if (wearables_time > max_wearables_time()) { LLNotificationsUtil::add("ClothingLoading"); add(LLStatViewer::LOADING_WEARABLES_LONG_DELAY, 1); @@ -2102,7 +2102,7 @@ bool idle_startup() display_startup(); update_texture_fetch(); display_startup(); - set_startup_status(0.9f + 0.1f * wearables_time / MAX_WEARABLES_TIME, + set_startup_status(0.9f + 0.1f * wearables_time / max_wearables_time(), LLTrans::getString("LoginDownloadingClothing").c_str(), gAgent.mMOTD.c_str()); display_startup(); diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index a123c12811..c88df93119 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -135,7 +135,7 @@ void LLWorld::destroyClass() //make all visible drawbles invisible. LLDrawable::incrementVisible(); - LLSceneMonitor::getInstance()->destroyClass(); + LLSceneMonitor::deleteSingleton(); } -- cgit v1.3 From b5f98560c796d62e45ebd0e410254b79958c7f47 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 23 May 2013 23:21:41 -0600 Subject: add a debug setting "UseObjectCacheOcclusion" to enable/disable object cache occlusion culling --- indra/newview/app_settings/settings.xml | 11 ++++++++ indra/newview/llvocache.cpp | 50 ++++++++++++++++++++------------- 2 files changed, 41 insertions(+), 20 deletions(-) (limited to 'indra/newview/app_settings/settings.xml') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 94f032be67..8efc4a80e6 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -12405,6 +12405,17 @@ Value 1 + UseObjectCacheOcclusion + + Comment + Enable object cache level object culling based on occlusion (coverage) by other objects + Persist + 1 + Type + Boolean + Value + 1 + RenderSynchronousOcclusion Comment diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 1a6ad90a78..fdb14aa8d2 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -397,28 +397,33 @@ void LLVOCachePartition::removeEntry(LLViewerOctreeEntry* entry) class LLVOCacheOctreeCull : public LLViewerOctreeCull { public: - LLVOCacheOctreeCull(LLCamera* camera, LLViewerRegion* regionp, const LLVector3& shift) : LLViewerOctreeCull(camera), mRegionp(regionp) + LLVOCacheOctreeCull(LLCamera* camera, LLViewerRegion* regionp, const LLVector3& shift, bool use_object_cache_occlusion) + : LLViewerOctreeCull(camera), + mRegionp(regionp) { mLocalShift = shift; + mUseObjectCacheOcclusion = (use_object_cache_occlusion && LLPipeline::sUseOcclusion); } virtual bool earlyFail(LLviewerOctreeGroup* base_group) { - LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)base_group; - if(group->needsUpdate()) + if( mUseObjectCacheOcclusion && + base_group->getOctreeNode()->getParent()) //never occlusion cull the root node { - return false; //needs to issue new occlusion culling check. - } + LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)base_group; + if(group->needsUpdate()) + { + return false; //needs to issue new occlusion culling check. + } - group->checkOcclusion(); + group->checkOcclusion(); - if (group->getOctreeNode()->getParent() && //never occlusion cull the root node - LLPipeline::sUseOcclusion && //ignore occlusion if disabled - group->isOcclusionState(LLSpatialGroup::OCCLUDED)) - { - return true; + if (group->isOcclusionState(LLSpatialGroup::OCCLUDED)) + { + return true; + } } - + return false; } @@ -448,24 +453,29 @@ public: virtual void processGroup(LLviewerOctreeGroup* base_group) { - LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)base_group; - if (group->needsUpdate() || group->mVisible[LLViewerCamera::sCurCameraID] < LLDrawable::getCurrentFrame() - 1) + if(mUseObjectCacheOcclusion && base_group->getOctreeNode()->getParent()) { - ((LLOcclusionCullingGroup*)group)->doOcclusion(mCamera); - group->setVisible(); - return; //wait for occlusion culling results + LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)base_group; + if (group->needsUpdate() || group->mVisible[LLViewerCamera::sCurCameraID] < LLDrawable::getCurrentFrame() - 1) + { + ((LLOcclusionCullingGroup*)group)->doOcclusion(mCamera); + group->setVisible(); + return; //wait for occlusion culling results + } } - - mRegionp->addVisibleGroup(group); + mRegionp->addVisibleGroup(base_group); } private: LLViewerRegion* mRegionp; LLVector3 mLocalShift; //shift vector from agent space to local region space. + bool mUseObjectCacheOcclusion; }; S32 LLVOCachePartition::cull(LLCamera &camera) { + static LLCachedControl use_object_cache_occlusion(gSavedSettings,"UseObjectCacheOcclusion"); + if(!LLViewerRegion::sVOCacheCullingEnabled) { return 0; @@ -477,7 +487,7 @@ S32 LLVOCachePartition::cull(LLCamera &camera) LLVector3 region_agent = mRegionp->getOriginAgent(); camera.calcRegionFrustumPlanes(region_agent); - LLVOCacheOctreeCull culler(&camera, mRegionp, region_agent); + LLVOCacheOctreeCull culler(&camera, mRegionp, region_agent, use_object_cache_occlusion); culler.traverse(mOctree); return 0; -- cgit v1.3 From 9ed2f4d3cb02d5161bd8bb77cb7befa7feedf2d9 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 17 Jun 2013 15:24:15 -0600 Subject: add a debug setting "InvisibleObjectsInMemoryTime" to adjust the time invisible objects stay in memory. --- indra/newview/app_settings/settings.xml | 11 +++++++++++ indra/newview/lldrawable.cpp | 4 ++-- indra/newview/lldrawable.h | 2 +- indra/newview/llvieweroctree.h | 2 +- indra/newview/llvocache.cpp | 20 ++++++++++++++------ indra/newview/llvocache.h | 7 +++++-- 6 files changed, 34 insertions(+), 12 deletions(-) (limited to 'indra/newview/app_settings/settings.xml') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 4d5b0c62e4..29427bbaa3 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -4590,6 +4590,17 @@ Value 0 + InvisibleObjectsInMemoryTime + + Comment + Number of frames invisible objects stay in memory before being removed. 0 means never to remove. + Persist + 1 + Type + U32 + Value + 64 + JoystickAvatarEnabled Comment diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 22a7c350d6..30d1b7fdba 100755 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -1098,9 +1098,9 @@ LLSpatialPartition* LLDrawable::getSpatialPartition() } //virtual -S32 LLDrawable::getMinFrameRange() const +U32 LLDrawable::getMinFrameRange() const { -const S32 MIN_VIS_FRAME_RANGE = 2 ; //two frames:the current one and the last one. + const U32 MIN_VIS_FRAME_RANGE = 2 ; //two frames:the current one and the last one. return MIN_VIS_FRAME_RANGE ; } diff --git a/indra/newview/lldrawable.h b/indra/newview/lldrawable.h index 98f0b51a97..ebda188618 100755 --- a/indra/newview/lldrawable.h +++ b/indra/newview/lldrawable.h @@ -193,7 +193,7 @@ public: LLSpatialPartition* getSpatialPartition(); - virtual S32 getMinFrameRange()const; + virtual U32 getMinFrameRange()const; void removeFromOctree(); void setSpatialBridge(LLSpatialBridge* bridge) { mSpatialBridge = (LLDrawable*) bridge; } diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index 0a96676be1..7f2ca6ed2d 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -149,7 +149,7 @@ public: virtual void setOctreeEntry(LLViewerOctreeEntry* entry); - virtual S32 getMinFrameRange()const = 0; + virtual U32 getMinFrameRange()const = 0; F32 getBinRadius() const {return mEntry->getBinRadius();} const LLVector4a* getSpatialExtents() const; diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 68f21ed2b3..93daf2e171 100755 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -50,6 +50,14 @@ BOOL check_write(LLAPRFile* apr_file, void* src, S32 n_bytes) //--------------------------------------------------------------------------- // LLVOCacheEntry //--------------------------------------------------------------------------- +//return number of frames invisible objects should stay in memory +//static +U32 LLVOCacheEntry::getInvisibleObjectsLiveTime() +{ + static LLCachedControl inv_obj_time(gSavedSettings,"InvisibleObjectsInMemoryTime"); + + return inv_obj_time - 1; //make 0 to be the maximum +} LLVOCacheEntry::LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer &dp) : LLViewerOctreeEntryData(LLViewerOctreeEntry::LLVOCACHEENTRY), @@ -60,7 +68,6 @@ LLVOCacheEntry::LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer & mDupeCount(0), mCRCChangeCount(0), mState(INACTIVE), - mMinFrameRange(64), mSceneContrib(0.f), mTouched(TRUE), mParentID(0) @@ -68,6 +75,7 @@ LLVOCacheEntry::LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer & mBuffer = new U8[dp.getBufferSize()]; mDP.assignBuffer(mBuffer, dp.getBufferSize()); mDP = dp; + mMinFrameRange = getInvisibleObjectsLiveTime(); } LLVOCacheEntry::LLVOCacheEntry() @@ -80,12 +88,12 @@ LLVOCacheEntry::LLVOCacheEntry() mCRCChangeCount(0), mBuffer(NULL), mState(INACTIVE), - mMinFrameRange(64), mSceneContrib(0.f), mTouched(TRUE), mParentID(0) { mDP.assignBuffer(mBuffer, 0); + mMinFrameRange = getInvisibleObjectsLiveTime(); } LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file) @@ -93,7 +101,6 @@ LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file) mBuffer(NULL), mUpdateFlags(-1), mState(INACTIVE), - mMinFrameRange(64), mSceneContrib(0.f), mTouched(FALSE), mParentID(0) @@ -101,6 +108,7 @@ LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file) S32 size = -1; BOOL success; + mMinFrameRange = getInvisibleObjectsLiveTime(); mDP.assignBuffer(mBuffer, 0); success = check_read(apr_file, &mLocalID, sizeof(U32)); @@ -218,17 +226,17 @@ void LLVOCacheEntry::setState(U32 state) if(getVisible() - last_visible < MIN_REAVTIVE_INTERVAL + mMinFrameRange) { - mMinFrameRange = llmin(mMinFrameRange * 2, 2048); + mMinFrameRange = llmin(mMinFrameRange * 2, getInvisibleObjectsLiveTime() * 32); } else { - mMinFrameRange = 64; //reset + mMinFrameRange = getInvisibleObjectsLiveTime(); //reset } } } //virtual -S32 LLVOCacheEntry::getMinFrameRange()const +U32 LLVOCacheEntry::getMinFrameRange()const { return mMinFrameRange; } diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index e46fec9dc3..b8a7ccac99 100755 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -88,7 +88,7 @@ public: U32 getCRC() const { return mCRC; } S32 getHitCount() const { return mHitCount; } S32 getCRCChangeCount() const { return mCRCChangeCount; } - S32 getMinFrameRange()const; + U32 getMinFrameRange()const; void calcSceneContribution(const LLVector3& camera_origin, bool needs_update, U32 last_update); void setSceneContribution(F32 scene_contrib) {mSceneContrib = scene_contrib;} @@ -121,6 +121,9 @@ public: void setUpdateFlags(U32 flags) {mUpdateFlags = flags;} U32 getUpdateFlags() const {return mUpdateFlags;} +private: + static U32 getInvisibleObjectsLiveTime(); + public: typedef std::map > vocache_entry_map_t; typedef std::set vocache_entry_set_t; @@ -138,7 +141,7 @@ protected: U8 *mBuffer; F32 mSceneContrib; //projected scene contributuion of this object. - S32 mMinFrameRange; + U32 mMinFrameRange; U32 mState; //high 16 bits reserved for special use. std::vector mChildrenList; //children entries in a linked set. -- cgit v1.3 From bd078122e3a87e958fb6b0ea9caeef885298d527 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 15 Jul 2013 21:00:19 -0700 Subject: SH-4299 FIX: Interesting: High fps shown temporarily off scale in statistics console timing of scene load recording extension now guaranteed > requested time step removed double add of recorded data removed spam --- indra/llcommon/lltracerecording.cpp | 3 --- indra/newview/app_settings/settings.xml | 4 ++-- indra/newview/llscenemonitor.cpp | 11 +++++++---- indra/newview/llviewerassetstats.cpp | 1 - 4 files changed, 9 insertions(+), 10 deletions(-) (limited to 'indra/newview/app_settings/settings.xml') diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp index 875c371068..5d43771cb2 100644 --- a/indra/llcommon/lltracerecording.cpp +++ b/indra/llcommon/lltracerecording.cpp @@ -367,9 +367,6 @@ void PeriodicRecording::appendPeriodicRecording( PeriodicRecording& other ) if (mAutoResize) { - // append first recording into our current slot - getCurRecording().appendRecording(other.mRecordingPeriods[other_oldest_recording_index]); - // push back recordings for everything in the middle U32 other_index = (other_oldest_recording_index + 1) % other_recording_slots; while (other_index != other_current_recording_index) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index a255793017..5bbe56bc0e 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -9844,13 +9844,13 @@ SceneLoadingPixelDiffThreshold Comment - Amount of pixels changed required to consider the scene as still loading (fraction of pixels on screen) + Amount of pixels changed required to consider the scene as still loading (square root of fraction of pixels on screen) Persist 1 Type F32 Value - 0.0003 + 0.02 ScriptHelpFollowsCursor diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index eec4a703a1..2f48be12fb 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -290,7 +290,6 @@ void LLSceneMonitor::capture() if((timer.getElapsedTimeF32() > scene_load_sample_time() || force_capture) - && mDiffState == WAITING_FOR_NEXT_DIFF && mEnabled && LLGLSLShader::sNoFixedFunction && last_capture_frame != gFrameCount) @@ -470,7 +469,8 @@ void LLSceneMonitor::fetchQueryResult() static LLCachedControl scene_load_sample_time(gSavedSettings, "SceneLoadingMonitorSampleTime"); static LLFrameTimer timer; - if(mDiffState == WAIT_ON_RESULT && timer.getElapsedTimeF32() > scene_load_sample_time) + F32 elapsed_time = timer.getElapsedTimeF32(); + if(mDiffState == WAIT_ON_RESULT && elapsed_time > scene_load_sample_time) { mDiffState = WAITING_FOR_NEXT_DIFF; @@ -481,21 +481,24 @@ void LLSceneMonitor::fetchQueryResult() GLuint count = 0; glGetQueryObjectuivARB(mQueryObject, GL_QUERY_RESULT_ARB, &count); - mDiffResult = count * 0.5f / (mDiff->getWidth() * mDiff->getHeight() * mDiffPixelRatio * mDiffPixelRatio); //0.5 -> (front face + back face) + mDiffResult = sqrtf(count * 0.5f / (mDiff->getWidth() * mDiff->getHeight() * mDiffPixelRatio * mDiffPixelRatio)); //0.5 -> (front face + back face) LL_DEBUGS("SceneMonitor") << "Frame difference: " << std::setprecision(4) << mDiffResult << LL_ENDL; - record(sFramePixelDiff, sqrtf(mDiffResult)); + record(sFramePixelDiff, mDiffResult); static LLCachedControl diff_threshold(gSavedSettings,"SceneLoadingPixelDiffThreshold"); if(mDiffResult > diff_threshold()) { mSceneLoadRecording.extend(); + llassert(mSceneLoadRecording.getResults().getLastRecording().getDuration() > scene_load_sample_time); } else { mSceneLoadRecording.nextPeriod(); } } + + timer.reset(); } } diff --git a/indra/newview/llviewerassetstats.cpp b/indra/newview/llviewerassetstats.cpp index 5f11a2b519..579567bb14 100755 --- a/indra/newview/llviewerassetstats.cpp +++ b/indra/newview/llviewerassetstats.cpp @@ -526,7 +526,6 @@ void record_enqueue(LLViewerAssetType::EType at, bool with_http, bool is_temp) { const EViewerAssetCategories eac(asset_type_to_category(at, with_http, is_temp)); - llinfos << "enqueue " << int(eac) << llendl; add(*sEnqueued[int(eac)], 1); } -- cgit v1.3 From 15fe4b3bbaf139960f934b629c236092182ed297 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 30 Jul 2013 22:05:12 -0600 Subject: fix for SH-4297: interesting: viewer-interesting starts loading cached scene late --- indra/newview/app_settings/settings.xml | 11 ++++++ indra/newview/llviewerregion.cpp | 64 ++++++++++++++++++++++++--------- indra/newview/llviewerregion.h | 4 +-- indra/newview/llvocache.cpp | 10 ++++-- 4 files changed, 69 insertions(+), 20 deletions(-) (limited to 'indra/newview/app_settings/settings.xml') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index f0be4e394e..2a4e10fb6f 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -6295,6 +6295,17 @@ Value 130 + NewObjectCreationThrottle + + Comment + maximum number of new objects created per frame, -1 to disable this throttle + Persist + 1 + Type + S32 + Value + 64 + NextOwnerCopy Comment diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index cd8466d948..65e190a927 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -71,6 +71,7 @@ #include "llviewercontrol.h" #include "llsdserialize.h" #include "llvieweroctree.h" +#include "llviewerdisplay.h" #ifdef LL_WINDOWS #pragma warning(disable:4355) @@ -992,8 +993,7 @@ void LLViewerRegion::removeFromVOCacheTree(LLVOCacheEntry* entry) return; } - mImpl->mVOCachePartition->removeEntry(entry->getEntry()); - entry->mLastCameraUpdated = sLastCameraUpdated; + mImpl->mVOCachePartition->removeEntry(entry->getEntry()); } //add the visible entries @@ -1128,7 +1128,7 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) return 2.0f * max_time - update_timer.getElapsedTimeF32(); } -F32 LLViewerRegion::createVisibleObjects(F32 max_time) +F32 LLViewerRegion::createVisibleObjects(F32 max_time, S32 throttle) { if(mDead) { @@ -1139,8 +1139,7 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time) return max_time; } - LLTimer update_timer; - S32 max_num_objects = 64; //minimum number of new objects to be added + LLTimer update_timer; for(LLVOCacheEntry::vocache_entry_priority_list_t::iterator iter = mImpl->mWaitingList.begin(); iter != mImpl->mWaitingList.end(); ++iter) { @@ -1149,7 +1148,7 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time) if(vo_entry->getState() < LLVOCacheEntry::WAITING) { addNewObject(vo_entry); - if(max_num_objects-- < 0 && update_timer.getElapsedTimeF32() > max_time) + if(throttle > 0 && !(--throttle) && update_timer.getElapsedTimeF32() > max_time) { break; } @@ -1161,6 +1160,8 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time) BOOL LLViewerRegion::idleUpdate(F32 max_update_time) { + static LLCachedControl new_object_creation_throttle(gSavedSettings,"NewObjectCreationThrottle"); + LLTimer update_timer; // did_update returns TRUE if we did at least one significant update @@ -1171,23 +1172,54 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) // Hopefully not a significant time sink... mParcelOverlay->idleUpdate(); } + + if(!sVOCacheCullingEnabled) + { + return did_update; + } + if(mImpl->mCacheMap.empty()) + { + return did_update; + } + + max_update_time -= update_timer.getElapsedTimeF32(); - max_update_time -= update_timer.getElapsedTimeF32(); - if(max_update_time < 0.f || mImpl->mCacheMap.empty()) + //update the throttling number + static S32 throttle = new_object_creation_throttle; + if(LLStartUp::getStartupState() < STATE_STARTED || gTeleportDisplay) { - return did_update; -} + throttle = -1; //cancel the throttling - if(!sVOCacheCullingEnabled) + S32 occlusion = LLPipeline::sUseOcclusion; + LLPipeline::sUseOcclusion = 0; //disable occlusion + + //apply octree cullings here to pick up visible objects because rendering pipeline stops view culling at this moment + mImpl->mVOCachePartition->cull(*LLViewerCamera::getInstance()); + + LLPipeline::sUseOcclusion = occlusion; + } + else if(throttle < 0) //just recoved from the login/teleport screen + { + if(new_object_creation_throttle > 0) + { + throttle = 4096; //a big number + } + } + else + { + throttle = llmax((S32)new_object_creation_throttle, (S32)(throttle >> 1)); + } + + if(max_update_time < 0.f && throttle > 0 && throttle < new_object_creation_throttle * 2) { return did_update; } //kill invisible objects - max_update_time = killInvisibleObjects(max_update_time); + max_update_time = killInvisibleObjects(max_update_time, throttle); max_update_time = updateVisibleEntries(max_update_time); - createVisibleObjects(max_update_time); + createVisibleObjects(max_update_time, throttle); mImpl->mWaitingList.clear(); mImpl->mVisibleGroups.clear(); @@ -1195,7 +1227,7 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) return did_update; } -F32 LLViewerRegion::killInvisibleObjects(F32 max_time) +F32 LLViewerRegion::killInvisibleObjects(F32 max_time, S32 throttle) { #if 1 if(!sVOCacheCullingEnabled) @@ -1209,7 +1241,7 @@ F32 LLViewerRegion::killInvisibleObjects(F32 max_time) static LLVOCacheEntry* last_visited_entry = NULL; - const size_t MAX_UPDATE = 32; + const size_t MAX_UPDATE = throttle < 0 ? mImpl->mActiveSet.size() : 64; std::vector delete_list; S32 update_counter = llmin(MAX_UPDATE, mImpl->mActiveSet.size()); LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.upper_bound(last_visited_entry); @@ -1823,7 +1855,7 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) else if(entry->getGroup() != NULL) { return; //already in octree, no post processing. - } + } LLVector3 pos; LLVector3 scale; diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index 2ac934d19c..366462e22f 100755 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -370,8 +370,8 @@ private: void replaceVisibleCacheEntry(LLVOCacheEntry* old_entry, LLVOCacheEntry* new_entry); void killCacheEntry(LLVOCacheEntry* entry); //physically delete the cache entry - F32 killInvisibleObjects(F32 max_time); - F32 createVisibleObjects(F32 max_time); + F32 killInvisibleObjects(F32 max_time, S32 throttle); + F32 createVisibleObjects(F32 max_time, S32 throttle); F32 updateVisibleEntries(F32 max_time); //update visible entries void addCacheMiss(U32 id, LLViewerRegion::eCacheMissType miss_type); diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 6e0243e985..d1c27edce7 100755 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -219,15 +219,21 @@ void LLVOCacheEntry::setState(U32 state) if(getState() == ACTIVE) { - const S32 MIN_REAVTIVE_INTERVAL = 128; + const S32 MIN_INTERVAL = 64 + mMinFrameRange; U32 last_visible = getVisible(); setVisible(); - if(getVisible() - last_visible > MIN_REAVTIVE_INTERVAL + mMinFrameRange) + U32 cur_visible = getVisible(); + if(cur_visible - last_visible > MIN_INTERVAL || + cur_visible < MIN_INTERVAL) { mLastCameraUpdated = 0; //reset } + else + { + mLastCameraUpdated = LLViewerRegion::sLastCameraUpdated; + } } } -- cgit v1.3 From b1297dce44ccf4b4875ec9ce0d9d78d563d877ee Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 27 Aug 2013 19:33:03 -0700 Subject: SH-4453 Interesting: SceneLoadingMonitorEnabled does not work until the camera turns made sceneloadingmonitor setting not persist --- indra/newview/app_settings/settings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/app_settings/settings.xml') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 015c307afc..b2e3c8b683 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -9846,7 +9846,7 @@ Comment Enabled scene loading monitor if set Persist - 1 + 0 Type Boolean Value -- cgit v1.3 From 1751650dbcad4ea66b2c3779aa52960ec1640466 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 29 Aug 2013 13:14:56 -0600 Subject: add some debug settings for easier tuning up performance. --- indra/newview/app_settings/settings.xml | 33 +++++++++++++++++++++++++++++++++ indra/newview/llviewerregion.cpp | 13 ++++++++++--- indra/newview/llvocache.cpp | 24 ++++++++++++++++++++---- indra/newview/llvocache.h | 5 +++++ 4 files changed, 68 insertions(+), 7 deletions(-) (limited to 'indra/newview/app_settings/settings.xml') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index b2e3c8b683..93cc605be0 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -721,6 +721,17 @@ 0 + BackDistanceFactor + + Comment + Keep invisible objects in memory which are in the distance range (the factor * draw_distance) to the camera + Persist + 1 + Type + F32 + Value + 0.125 + BackgroundYieldTime Comment @@ -732,6 +743,17 @@ Value 40 + BackProjectionAngleSquared + + Comment + squared tan(object bbox projection angle). that of invisible objects greater than this threshold are kept in memory + Persist + 1 + Type + F32 + Value + 0.0311 + BottomPanelNew Comment @@ -6306,6 +6328,17 @@ Value 64 + NewObjectCreationThrottleDelayTime + + Comment + time in seconds NewObjectCreationThrottle to take effect after the progress screen is lifted + Persist + 1 + Type + F32 + Value + 2.0 + NextOwnerCopy Comment diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index da01c0406a..9c038d54d5 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1233,6 +1233,7 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) void LLViewerRegion::calcNewObjectCreationThrottle() { static LLCachedControl new_object_creation_throttle(gSavedSettings,"NewObjectCreationThrottle"); + static LLCachedControl throttle_delay_time(gSavedSettings,"NewObjectCreationThrottleDelayTime"); static LLFrameTimer timer; // @@ -1243,16 +1244,20 @@ void LLViewerRegion::calcNewObjectCreationThrottle() //>0: valid throttling number // - if(gViewerWindow->getProgressView()->getVisible()) + if(gViewerWindow->getProgressView()->getVisible() && throttle_delay_time > 0.f) { sNewObjectCreationThrottle = -2; //cancel the throttling timer.reset(); } - else if(sNewObjectCreationThrottle < 0) //just recoved from the login/teleport screen + else if(sNewObjectCreationThrottle < -1) //just recoved from the login/teleport screen { - if(new_object_creation_throttle > 0 && timer.getElapsedTimeF32() > 2.0f) //wait for two seconds to reset the throttle + if(timer.getElapsedTimeF32() > throttle_delay_time) //wait for throttle_delay_time to reset the throttle { sNewObjectCreationThrottle = new_object_creation_throttle; //reset + if(sNewObjectCreationThrottle < -1) + { + sNewObjectCreationThrottle = -1; + } } } } @@ -1285,6 +1290,8 @@ F32 LLViewerRegion::killInvisibleObjects(F32 max_time) S32 update_counter = llmin(max_update, mImpl->mActiveSet.size()); LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.upper_bound(mLastVisitedEntry); + LLVOCacheEntry::updateBackCullingFactors(); + for(; update_counter > 0; --update_counter, ++iter) { if(iter == mImpl->mActiveSet.end()) diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index dcd1ae391d..1cfda038a8 100755 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -33,7 +33,10 @@ #include "lldrawable.h" #include "llviewerregion.h" #include "pipeline.h" +#include "llagentcamera.h" +F32 LLVOCacheEntry::sBackDistanceSquared = 0.f; +F32 LLVOCacheEntry::sBackAngleTanSquared = 0.f; BOOL LLVOCachePartition::sNeedsOcclusionCheck = FALSE; LLTrace::MemStatHandle LLVOCachePartition::sMemStat("LLVOCachePartition"); @@ -353,6 +356,21 @@ BOOL LLVOCacheEntry::writeToFile(LLAPRFile* apr_file) const return success ; } +//static +void LLVOCacheEntry::updateBackCullingFactors() +{ + //distance to keep objects = back_dist_factor * draw_distance + static LLCachedControl back_dist_factor(gSavedSettings,"BackDistanceFactor"); + + //squared tan(projection angle of the bbox), default is 10 (degree) + static LLCachedControl squared_back_angle(gSavedSettings,"BackProjectionAngleSquared"); + + sBackDistanceSquared = back_dist_factor * gAgentCamera.mDrawDistance; + sBackDistanceSquared *= sBackDistanceSquared; + + sBackAngleTanSquared = squared_back_angle; +} + bool LLVOCacheEntry::isRecentlyVisible() const { bool vis = LLViewerOctreeEntryData::isRecentlyVisible(); @@ -363,12 +381,10 @@ bool LLVOCacheEntry::isRecentlyVisible() const } //combination of projected area and squared distance - if(!vis && !mParentID && mSceneContrib > 0.0311f) //projection angle > 10 (degree) + if(!vis && !mParentID && mSceneContrib > sBackAngleTanSquared) { - //squared distance - const F32 SQUARED_CUT_OFF_DIST = 256.0; //16m F32 rad = getBinRadius(); - vis = (rad * rad / mSceneContrib < SQUARED_CUT_OFF_DIST); + vis = (rad * rad / mSceneContrib < sBackDistanceSquared); } return vis; diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index a385610a10..52b25b7f91 100755 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -123,6 +123,8 @@ public: void setUpdateFlags(U32 flags) {mUpdateFlags = flags;} U32 getUpdateFlags() const {return mUpdateFlags;} + static void updateBackCullingFactors(); + private: static U32 getInvisibleObjectsLiveTime(); @@ -151,6 +153,9 @@ protected: std::vector mChildrenList; //children entries in a linked set. BOOL mTouched; //if set, this entry is valid, otherwise it is invalid. + + static F32 sBackDistanceSquared; + static F32 sBackAngleTanSquared; }; class LLVOCachePartition : public LLViewerOctreePartition, public LLTrace::MemTrackable -- cgit v1.3 From 754e8752a9b9a2e75d425a10cb8a0a6f85ad4bf5 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 3 Oct 2013 14:30:34 -0700 Subject: added initial memory usage tracking for lltrace --- indra/llcommon/lltrace.cpp | 2 + indra/llcommon/lltrace.h | 16 +++--- indra/llcommon/lltraceaccumulators.cpp | 20 ++++++- indra/llcommon/lltraceaccumulators.h | 6 +++ indra/llcommon/lltracerecording.cpp | 19 ++++++- indra/llcommon/lltracerecording.h | 3 +- indra/llcommon/lltracethreadrecorder.cpp | 62 ++++++++++++++-------- indra/llcommon/lltracethreadrecorder.h | 2 +- indra/llrender/llvertexbuffer.cpp | 6 +-- indra/newview/app_settings/settings.xml | 11 ++++ indra/newview/llappviewer.cpp | 22 ++++++-- indra/newview/llviewerobject.cpp | 2 +- .../newview/skins/default/xui/en/floater_stats.xml | 3 ++ 13 files changed, 132 insertions(+), 42 deletions(-) (limited to 'indra/newview/app_settings/settings.xml') diff --git a/indra/llcommon/lltrace.cpp b/indra/llcommon/lltrace.cpp index e4a6f4c902..73846ba900 100644 --- a/indra/llcommon/lltrace.cpp +++ b/indra/llcommon/lltrace.cpp @@ -33,6 +33,8 @@ namespace LLTrace { +MemStatHandle gTraceMemStat("LLTrace"); + TraceBase::TraceBase( const char* name, const char* description ) : mName(name), mDescription(description ? description : "") diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h index 226f64d0c7..421ec3bda5 100644 --- a/indra/llcommon/lltrace.h +++ b/indra/llcommon/lltrace.h @@ -320,7 +320,7 @@ struct MeasureMem, IS_MEM_TRACKABLE, IS_BYTES> template -inline void claim_footprint(MemStatHandle& measurement, const T& value) +inline void claim_alloc(MemStatHandle& measurement, const T& value) { S32 size = MeasureMem::measureFootprint(value); if(size == 0) return; @@ -330,7 +330,7 @@ inline void claim_footprint(MemStatHandle& measurement, const T& value) } template -inline void disclaim_footprint(MemStatHandle& measurement, const T& value) +inline void disclaim_alloc(MemStatHandle& measurement, const T& value) { S32 size = MeasureMem::measureFootprint(value); if(size == 0) return; @@ -370,25 +370,25 @@ public: void* operator new(size_t size) { - claim_footprint(sMemStat, size); + claim_alloc(sMemStat, size); return ll_aligned_malloc(ALIGNMENT, size); } void operator delete(void* ptr, size_t size) { - disclaim_footprint(sMemStat, size); + disclaim_alloc(sMemStat, size); ll_aligned_free(ALIGNMENT, ptr); } void* operator new [](size_t size) { - claim_footprint(sMemStat, size); + claim_alloc(sMemStat, size); return ll_aligned_malloc(ALIGNMENT, size); } void operator delete[](void* ptr, size_t size) { - disclaim_footprint(sMemStat, size); + disclaim_alloc(sMemStat, size); ll_aligned_free(ALIGNMENT, ptr); } @@ -397,7 +397,7 @@ public: void claimMem(const CLAIM_T& value) const { S32 size = MeasureMem::measureFootprint(value); - claim_footprint(sMemStat, size); + claim_alloc(sMemStat, size); mMemFootprint += size; } @@ -406,7 +406,7 @@ public: void disclaimMem(const CLAIM_T& value) const { S32 size = MeasureMem::measureFootprint(value); - disclaim_footprint(sMemStat, size); + disclaim_alloc(sMemStat, size); mMemFootprint -= size; } diff --git a/indra/llcommon/lltraceaccumulators.cpp b/indra/llcommon/lltraceaccumulators.cpp index f5f2e7df1c..9f270e60b9 100644 --- a/indra/llcommon/lltraceaccumulators.cpp +++ b/indra/llcommon/lltraceaccumulators.cpp @@ -26,18 +26,36 @@ #include "linden_common.h" #include "lltraceaccumulators.h" +#include "lltrace.h" #include "lltracethreadrecorder.h" namespace LLTrace { +extern MemStatHandle gTraceMemStat; + /////////////////////////////////////////////////////////////////////// // AccumulatorBufferGroup /////////////////////////////////////////////////////////////////////// AccumulatorBufferGroup::AccumulatorBufferGroup() -{} +{ + /*claim_alloc(gTraceMemStat, mCounts.capacity() * sizeof(CountAccumulator)); + claim_alloc(gTraceMemStat, mSamples.capacity() * sizeof(SampleAccumulator)); + claim_alloc(gTraceMemStat, mEvents.capacity() * sizeof(EventAccumulator)); + claim_alloc(gTraceMemStat, mStackTimers.capacity() * sizeof(TimeBlockAccumulator)); + claim_alloc(gTraceMemStat, mMemStats.capacity() * sizeof(MemStatAccumulator));*/ +} + +AccumulatorBufferGroup::~AccumulatorBufferGroup() +{ + /*disclaim_alloc(gTraceMemStat, mCounts.capacity() * sizeof(CountAccumulator)); + disclaim_alloc(gTraceMemStat, mSamples.capacity() * sizeof(SampleAccumulator)); + disclaim_alloc(gTraceMemStat, mEvents.capacity() * sizeof(EventAccumulator)); + disclaim_alloc(gTraceMemStat, mStackTimers.capacity() * sizeof(TimeBlockAccumulator)); + disclaim_alloc(gTraceMemStat, mMemStats.capacity() * sizeof(MemStatAccumulator));*/ +} void AccumulatorBufferGroup::handOffTo(AccumulatorBufferGroup& other) { diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h index ecc569f5d6..d03c6ce5c0 100644 --- a/indra/llcommon/lltraceaccumulators.h +++ b/indra/llcommon/lltraceaccumulators.h @@ -188,6 +188,11 @@ namespace LLTrace return getNumIndices(); } + size_t capacity() const + { + return mStorageSize; + } + static size_t getNumIndices() { return sNextStorageSlot; @@ -536,6 +541,7 @@ namespace LLTrace struct AccumulatorBufferGroup : public LLRefCount { AccumulatorBufferGroup(); + ~AccumulatorBufferGroup(); void handOffTo(AccumulatorBufferGroup& other); void makeCurrent(); diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp index ce4a433cca..c33d9aedcc 100644 --- a/indra/llcommon/lltracerecording.cpp +++ b/indra/llcommon/lltracerecording.cpp @@ -25,15 +25,18 @@ #include "linden_common.h" +#include "lltracerecording.h" + #include "lltrace.h" #include "llfasttimer.h" -#include "lltracerecording.h" #include "lltracethreadrecorder.h" #include "llthread.h" namespace LLTrace { - + +extern MemStatHandle gTraceMemStat; + /////////////////////////////////////////////////////////////////////// // Recording /////////////////////////////////////////////////////////////////////// @@ -42,12 +45,15 @@ Recording::Recording(EPlayState state) : mElapsedSeconds(0), mInHandOff(false) { + claim_alloc(gTraceMemStat, sizeof(*this)); mBuffers = new AccumulatorBufferGroup(); + claim_alloc(gTraceMemStat, mBuffers); setPlayState(state); } Recording::Recording( const Recording& other ) { + claim_alloc(gTraceMemStat, sizeof(*this)); *this = other; } @@ -73,6 +79,9 @@ Recording& Recording::operator = (const Recording& other) Recording::~Recording() { + disclaim_alloc(gTraceMemStat, sizeof(*this)); + disclaim_alloc(gTraceMemStat, mBuffers); + if (isStarted() && LLTrace::get_thread_recorder().notNull()) { LLTrace::get_thread_recorder()->deactivate(mBuffers.write()); @@ -330,6 +339,12 @@ PeriodicRecording::PeriodicRecording( S32 num_periods, EPlayState state) mRecordingPeriods(num_periods ? num_periods : 1) { setPlayState(state); + claim_alloc(gTraceMemStat, sizeof(*this)); +} + +PeriodicRecording::~PeriodicRecording() +{ + disclaim_alloc(gTraceMemStat, sizeof(*this)); } void PeriodicRecording::nextPeriod() diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 5cf7596966..8bb0b1892f 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -313,7 +313,7 @@ namespace LLTrace class ThreadRecorder* getThreadRecorder(); LLTimer mSamplingTimer; - F64Seconds mElapsedSeconds; + F64Seconds mElapsedSeconds; LLCopyOnWritePointer mBuffers; bool mInHandOff; @@ -324,6 +324,7 @@ namespace LLTrace { public: PeriodicRecording(S32 num_periods, EPlayState state = STOPPED); + ~PeriodicRecording(); void nextPeriod(); S32 getNumRecordedPeriods() { return mNumPeriods; } diff --git a/indra/llcommon/lltracethreadrecorder.cpp b/indra/llcommon/lltracethreadrecorder.cpp index e131af5f16..bf6189dd25 100644 --- a/indra/llcommon/lltracethreadrecorder.cpp +++ b/indra/llcommon/lltracethreadrecorder.cpp @@ -27,9 +27,11 @@ #include "lltracethreadrecorder.h" #include "llfasttimer.h" +#include "lltrace.h" namespace LLTrace { +extern MemStatHandle gTraceMemStat; static ThreadRecorder* sMasterThreadRecorder = NULL; @@ -55,6 +57,7 @@ void ThreadRecorder::init() timer_stack->mActiveTimer = NULL; mNumTimeBlockTreeNodes = AccumulatorBuffer::getDefaultBuffer()->size(); + mTimeBlockTreeNodes = new TimeBlockTreeNode[mNumTimeBlockTreeNodes]; activate(&mThreadRecordingBuffers); @@ -76,10 +79,14 @@ void ThreadRecorder::init() timer_stack->mActiveTimer = mRootTimer; TimeBlock::getRootTimeBlock().getCurrentAccumulator().mActiveCount = 1; + + claim_alloc(gTraceMemStat, sizeof(*this)); + claim_alloc(gTraceMemStat, sizeof(BlockTimer)); + claim_alloc(gTraceMemStat, sizeof(TimeBlockTreeNode) * mNumTimeBlockTreeNodes); } -ThreadRecorder::ThreadRecorder(ThreadRecorder& master) +ThreadRecorder::ThreadRecorder( ThreadRecorder& master ) : mMasterRecorder(&master) { init(); @@ -91,6 +98,10 @@ ThreadRecorder::~ThreadRecorder() { LLThreadLocalSingletonPointer::setInstance(NULL); + disclaim_alloc(gTraceMemStat, sizeof(*this)); + disclaim_alloc(gTraceMemStat, sizeof(BlockTimer)); + disclaim_alloc(gTraceMemStat, sizeof(TimeBlockTreeNode) * mNumTimeBlockTreeNodes); + deactivate(&mThreadRecordingBuffers); delete mRootTimer; @@ -135,9 +146,9 @@ void ThreadRecorder::activate( AccumulatorBufferGroup* recording, bool from_hand mActiveRecordings.back()->mPartialRecording.makeCurrent(); } -ThreadRecorder::active_recording_list_t::reverse_iterator ThreadRecorder::bringUpToDate( AccumulatorBufferGroup* recording ) +ThreadRecorder::active_recording_list_t::iterator ThreadRecorder::bringUpToDate( AccumulatorBufferGroup* recording ) { - if (mActiveRecordings.empty()) return mActiveRecordings.rend(); + if (mActiveRecordings.empty()) return mActiveRecordings.end(); mActiveRecordings.back()->mPartialRecording.sync(); TimeBlock::updateTimes(); @@ -174,15 +185,14 @@ ThreadRecorder::active_recording_list_t::reverse_iterator ThreadRecorder::bringU LL_WARNS() << "Recording not active on this thread" << LL_ENDL; } - return it; + return (++it).base(); } void ThreadRecorder::deactivate( AccumulatorBufferGroup* recording ) { - active_recording_list_t::reverse_iterator it = bringUpToDate(recording); - if (it != mActiveRecordings.rend()) + active_recording_list_t::iterator recording_to_remove = bringUpToDate(recording); + if (recording_to_remove != mActiveRecordings.end()) { - active_recording_list_t::iterator recording_to_remove = (++it).base(); bool was_current = (*recording_to_remove)->mPartialRecording.isCurrent(); llassert((*recording_to_remove)->mTargetRecording == recording); delete *recording_to_remove; @@ -216,25 +226,33 @@ void ThreadRecorder::ActiveRecording::movePartialToTarget() // called by child thread void ThreadRecorder::addChildRecorder( class ThreadRecorder* child ) -{ LLMutexLock lock(&mChildListMutex); - mChildThreadRecorders.push_back(child); +{ + { LLMutexLock lock(&mChildListMutex); + mChildThreadRecorders.push_back(child); + } } // called by child thread void ThreadRecorder::removeChildRecorder( class ThreadRecorder* child ) -{ LLMutexLock lock(&mChildListMutex); - -for (child_thread_recorder_list_t::iterator it = mChildThreadRecorders.begin(), end_it = mChildThreadRecorders.end(); - it != end_it; - ++it) -{ - if ((*it) == child) - { - mChildThreadRecorders.erase(it); - break; +{ + { LLMutexLock lock(&mChildListMutex); + for (child_thread_recorder_list_t::iterator it = mChildThreadRecorders.begin(), end_it = mChildThreadRecorders.end(); + it != end_it; + ++it) + { + if ((*it) == child) + { + // FIXME: this won't do any good, as the child stores the "pushed" values internally + // and it is in the process of being deleted. + // We need a way to finalize the stats from the outgoing thread, but the storage + // for those stats needs to be outside the child's thread recorder + //(*it)->pushToParent(); + mChildThreadRecorders.erase(it); + break; + } + } } } -} void ThreadRecorder::pushToParent() { @@ -269,7 +287,7 @@ void ThreadRecorder::pullFromChildren() } -void set_master_thread_recorder(ThreadRecorder* recorder) +void set_master_thread_recorder( ThreadRecorder* recorder ) { sMasterThreadRecorder = recorder; } @@ -291,7 +309,7 @@ const LLThreadLocalPointer& get_thread_recorder() return get_thread_recorder_ptr(); } -void set_thread_recorder(ThreadRecorder* recorder) +void set_thread_recorder( ThreadRecorder* recorder ) { get_thread_recorder_ptr() = recorder; } diff --git a/indra/llcommon/lltracethreadrecorder.h b/indra/llcommon/lltracethreadrecorder.h index c40228785e..c6afcdac80 100644 --- a/indra/llcommon/lltracethreadrecorder.h +++ b/indra/llcommon/lltracethreadrecorder.h @@ -49,7 +49,7 @@ namespace LLTrace void activate(AccumulatorBufferGroup* recording, bool from_handoff = false); void deactivate(AccumulatorBufferGroup* recording); - active_recording_list_t::reverse_iterator bringUpToDate(AccumulatorBufferGroup* recording); + active_recording_list_t::iterator bringUpToDate(AccumulatorBufferGroup* recording); void addChildRecorder(class ThreadRecorder* child); void removeChildRecorder(class ThreadRecorder* child); diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 0cfc11ef19..968b796d6b 100755 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -1190,7 +1190,7 @@ void LLVertexBuffer::createGLBuffer(U32 size) mMappedData = (U8*)ALLOCATE_MEM(sPrivatePoolp, size); disclaimMem(mSize); mSize = size; - disclaimMem(mSize); + claimMem(mSize); } } @@ -2272,10 +2272,10 @@ void LLVertexBuffer::setBuffer(U32 data_mask) if (unsatisfied_mask & (1 << TYPE_INDEX)) { - llinfos << "Missing indices" << llendl; + LL_INFOS() << "Missing indices" << LL_ENDL; } - llerrs << "Shader consumption mismatches data provision." << llendl; + LL_ERRS() << "Shader consumption mismatches data provision." << LL_ENDL; } } } diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 051cf6d43e..8642114362 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -2983,6 +2983,17 @@ Value Female Shape & Outfit + DefaultLoginLocation + + Comment + Startup destination default (if not specified on command line) + Persist + 1 + Type + String + Value + + DefaultMaleAvatar Comment diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 1ea428ff03..3099a1b74f 100755 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -2653,10 +2653,26 @@ bool LLAppViewer::initConfiguration() // What can happen is that someone can use IE (or potentially // other browsers) and do the rough equivalent of command // injection and steal passwords. Phoenix. SL-55321 - std::string CmdLineLoginLocation(gSavedSettings.getString("CmdLineLoginLocation")); - if(! CmdLineLoginLocation.empty()) + + std::string starting_location; + + std::string cmd_line_login_location(gSavedSettings.getString("CmdLineLoginLocation")); + if(! cmd_line_login_location.empty()) + { + starting_location = cmd_line_login_location; + } + else + { + std::string default_login_location(gSavedSettings.getString("DefaultLoginLocation")); + if (! default_login_location.empty()) + { + starting_location = default_login_location; + } + } + + if (! starting_location.empty()) { - LLSLURL start_slurl(CmdLineLoginLocation); + LLSLURL start_slurl(starting_location); LLStartUp::setStartSLURL(start_slurl); if(start_slurl.getType() == LLSLURL::LOCATION) { diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index dd80a4f65d..f2abadce85 100755 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4756,7 +4756,7 @@ bool LLViewerObject::isImageAlphaBlended(const U8 te) const case GL_RGB: break; default: { - llwarns << "Unexpected tex format in LLViewerObject::isImageAlphaBlended...returning no alpha." << llendl; + LL_WARNS() << "Unexpected tex format in LLViewerObject::isImageAlphaBlended...returning no alpha." << LL_ENDL; } break; } diff --git a/indra/newview/skins/default/xui/en/floater_stats.xml b/indra/newview/skins/default/xui/en/floater_stats.xml index d4decf383d..b2399123be 100755 --- a/indra/newview/skins/default/xui/en/floater_stats.xml +++ b/indra/newview/skins/default/xui/en/floater_stats.xml @@ -110,6 +110,9 @@ + -- cgit v1.3 From c2521e41d794c53cd6f0cedcff17ca97737debe5 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 3 Oct 2013 15:40:09 -0600 Subject: change debug setting name "ObjectCacheViewCullingEnabled" to "RequestFullRegionCache" --- indra/newview/app_settings/settings.xml | 4 ++-- indra/newview/llworld.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/app_settings/settings.xml') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 051cf6d43e..305aaf2a3a 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -6868,10 +6868,10 @@ Value 1 - ObjectCacheViewCullingEnabled + RequestFullRegionCache Comment - Enable the object cache view culling. Needs to restart viewer. + If set, ask sim to send full region object cache. Needs to restart viewer. Persist 1 Type diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index d600abeb0a..f283cdb4b8 100755 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -110,7 +110,7 @@ LLWorld::LLWorld() : gGL.getTexUnit(0)->bind(mDefaultWaterTexturep); mDefaultWaterTexturep->setAddressMode(LLTexUnit::TAM_CLAMP); - LLViewerRegion::sVOCacheCullingEnabled = gSavedSettings.getBOOL("ObjectCacheViewCullingEnabled") && gSavedSettings.getBOOL("ObjectCacheEnabled"); + LLViewerRegion::sVOCacheCullingEnabled = gSavedSettings.getBOOL("RequestFullRegionCache") && gSavedSettings.getBOOL("ObjectCacheEnabled"); } -- cgit v1.3 From 9ae025f8ee8688b25678a243ba19f1398de08060 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 3 Oct 2013 16:21:54 -0600 Subject: add a debug setting: "BackShpereCullingRadius" --- indra/newview/app_settings/settings.xml | 11 +++++++++++ indra/newview/llvocache.cpp | 11 ++++++----- indra/newview/llvocache.h | 2 +- 3 files changed, 18 insertions(+), 6 deletions(-) (limited to 'indra/newview/app_settings/settings.xml') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 305aaf2a3a..14e96a06cc 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -765,6 +765,17 @@ Value 0.0311 + BackShpereCullingRadius + + Comment + Radius of back sphere in meters, objects behind camera but within this radius are loaded for rendering + Persist + 1 + Type + F32 + Value + 20.0 + BottomPanelNew Comment diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 20e69cbea9..ada412be8c 100755 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -640,11 +640,11 @@ private: class LLVOCacheOctreeBackCull : public LLViewerOctreeCull { public: - LLVOCacheOctreeBackCull(LLCamera* camera, const LLVector3& shift, LLViewerRegion* regionp) + LLVOCacheOctreeBackCull(LLCamera* camera, const LLVector3& shift, LLViewerRegion* regionp, F32 back_sphere_radius) : LLViewerOctreeCull(camera), mRegionp(regionp) { mLocalShift = shift; - mSphereRadius = 20.f; //20m + mSphereRadius = back_sphere_radius; } virtual S32 frustumCheck(const LLviewerOctreeGroup* group) @@ -678,7 +678,7 @@ private: LLVector3 mLocalShift; //shift vector from agent space to local region space. }; -void LLVOCachePartition::selectBackObjects(LLCamera &camera) +void LLVOCachePartition::selectBackObjects(LLCamera &camera, F32 back_sphere_radius) { if(LLViewerCamera::sCurCameraID != LLViewerCamera::CAMERA_WORLD) { @@ -699,7 +699,7 @@ void LLVOCachePartition::selectBackObjects(LLCamera &camera) //localize the camera LLVector3 region_agent = mRegionp->getOriginAgent(); - LLVOCacheOctreeBackCull culler(&camera, region_agent, mRegionp); + LLVOCacheOctreeBackCull culler(&camera, region_agent, mRegionp, back_sphere_radius); culler.traverse(mOctree); mBackSlectionEnabled--; @@ -714,6 +714,7 @@ void LLVOCachePartition::selectBackObjects(LLCamera &camera) S32 LLVOCachePartition::cull(LLCamera &camera, bool do_occlusion) { static LLCachedControl use_object_cache_occlusion(gSavedSettings,"UseObjectCacheOcclusion"); + static LLCachedControl back_sphere_radius(gSavedSettings,"BackShpereCullingRadius"); if(!LLViewerRegion::sVOCacheCullingEnabled) { @@ -745,7 +746,7 @@ S32 LLVOCachePartition::cull(LLCamera &camera, bool do_occlusion) } if(LLViewerOctreeEntryData::getCurrentFrame() % seed != mIdleHash) { - selectBackObjects(camera);//process back objects selection + selectBackObjects(camera, back_sphere_radius);//process back objects selection return 0; //nothing changed, reduce frequency of culling } } diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index 16ed05dc94..b58bb3d499 100755 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -186,7 +186,7 @@ public: void removeOccluder(LLVOCacheGroup* group); private: - void selectBackObjects(LLCamera &camera); //select objects behind camera. + void selectBackObjects(LLCamera &camera, F32 back_sphere_radius); //select objects behind camera. public: static BOOL sNeedsOcclusionCheck; -- cgit v1.3 From c8067cfd9708fe30659b1f07f6d035508bea3033 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 9 Oct 2013 21:42:53 -0600 Subject: Enable the debug setting "NonvisibleObjectsInMemoryTime" --- indra/newview/app_settings/settings.xml | 24 ++++++++++++------------ indra/newview/llvocache.cpp | 7 ++++++- 2 files changed, 18 insertions(+), 13 deletions(-) (limited to 'indra/newview/app_settings/settings.xml') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 27342712c6..7bfca2834b 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -4753,18 +4753,7 @@ Boolean Value 0 - - InvisibleObjectsInMemoryTime - - Comment - Number of frames invisible objects stay in memory before being removed. 0 means never to remove. - Persist - 1 - Type - U32 - Value - 64 - + JoystickAvatarEnabled Comment @@ -6581,6 +6570,17 @@ Value 0 + NonvisibleObjectsInMemoryTime + + Comment + Number of frames non-visible objects stay in memory before being removed. 0 means never to remove. + Persist + 1 + Type + U32 + Value + 64 + NoPreload Comment diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 0466dea39d..f16f3507c3 100755 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -347,7 +347,7 @@ void LLVOCacheEntry::updateDebugSettings() static LLCachedControl squared_back_angle(gSavedSettings,"BackProjectionAngleSquared"); //the number of frames invisible objects stay in memory - static LLCachedControl inv_obj_time(gSavedSettings,"InvisibleObjectsInMemoryTime"); + static LLCachedControl inv_obj_time(gSavedSettings,"NonvisibleObjectsInMemoryTime"); sMinFrameRange = inv_obj_time - 1; //make 0 to be the maximum @@ -374,6 +374,11 @@ bool LLVOCacheEntry::isRecentlyVisible() const vis = (rad * rad / mSceneContrib < sBackDistanceSquared); } + if(!vis) + { + vis = (getVisible() + sMinFrameRange > LLViewerOctreeEntryData::getCurrentFrame()); + } + return vis; } -- cgit v1.3 From c8228b65f8a4a94220c92d89d1529ed484f6e84a Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 17 Oct 2013 20:21:17 -0600 Subject: fix for SH-4569: Objects are not culled by size in the distance --- indra/newview/app_settings/settings.xml | 12 +++++++++- indra/newview/llvieweroctree.cpp | 19 +++++++++++++++ indra/newview/llvieweroctree.h | 7 ++++-- indra/newview/llviewerregion.cpp | 12 ++++++++++ indra/newview/llvocache.cpp | 41 +++++++++++++++++++++++++-------- indra/newview/llvocache.h | 2 +- 6 files changed, 80 insertions(+), 13 deletions(-) (limited to 'indra/newview/app_settings/settings.xml') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 7bfca2834b..fb0d9c98d4 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -7114,7 +7114,17 @@ 0.75 - + ObjectProjectionAreaCutOFF + + Comment + Threshold in number of pixels of the projection area in screen of object bounding sphere. Objects smaller than this threshold are not rendered. + Persist + 1 + Type + F32 + Value + 1.0 + ParcelMediaAutoPlayEnable Comment diff --git a/indra/newview/llvieweroctree.cpp b/indra/newview/llvieweroctree.cpp index e390249504..425e7fbd1f 100644 --- a/indra/newview/llvieweroctree.cpp +++ b/indra/newview/llvieweroctree.cpp @@ -1430,6 +1430,25 @@ S32 LLViewerOctreeCull::AABBRegionSphereIntersectObjectExtents(const LLViewerOct return AABBSphereIntersect(group->mObjectExtents[0], group->mObjectExtents[1], mCamera->getOrigin() - shift, mCamera->mFrustumCornerDist); } //------------------------------------------ +//check if the objects projection large enough +bool LLViewerOctreeCull::checkProjectionArea(const LLVector4a& center, const LLVector4a& size, const LLVector3& shift, F32 projection_cutoff) +{ + LLVector3 local_orig = mCamera->getOrigin() - shift; + LLVector4a origin; + origin.load3(local_orig.mV); + + LLVector4a lookAt; + lookAt.setSub(center, origin); + F32 squared_dist = lookAt.dot3(lookAt).getF32(); + F32 squared_rad = size.dot3(size).getF32(); + + if(squared_dist > 0.f) + { + return squared_rad / squared_dist > projection_cutoff; + } + + return true; +} //virtual bool LLViewerOctreeCull::checkObjects(const OctreeNode* branch, const LLViewerOctreeGroup* group) diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index e673bb6349..6ea6130413 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -362,9 +362,11 @@ class LLViewerOctreeCull : public OctreeTraveler public: LLViewerOctreeCull(LLCamera* camera) : mCamera(camera), mRes(0) { } - - virtual bool earlyFail(LLViewerOctreeGroup* group); + virtual void traverse(const OctreeNode* n); + +protected: + virtual bool earlyFail(LLViewerOctreeGroup* group); //agent space group cull S32 AABBInFrustumNoFarClipGroupBounds(const LLViewerOctreeGroup* group); @@ -389,6 +391,7 @@ public: virtual S32 frustumCheck(const LLViewerOctreeGroup* group) = 0; virtual S32 frustumCheckObjects(const LLViewerOctreeGroup* group) = 0; + bool checkProjectionArea(const LLVector4a& center, const LLVector4a& size, const LLVector3& shift, F32 projection_cutoff); virtual bool checkObjects(const OctreeNode* branch, const LLViewerOctreeGroup* group); virtual void preprocess(LLViewerOctreeGroup* group); virtual void processGroup(LLViewerOctreeGroup* group); diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 0ad4402dcc..13a71b17cf 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1157,6 +1157,8 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) F32 LLViewerRegion::createVisibleObjects(F32 max_time) { + static LLCachedControl projection_area_cutoff(gSavedSettings,"ObjectProjectionAreaCutOFF"); + if(mDead) { return max_time; @@ -1166,6 +1168,11 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time) return max_time; } + //object projected area threshold + F32 pixel_meter_ratio = LLViewerCamera::getInstance()->getPixelMeterRatio(); + F32 projection_threshold = pixel_meter_ratio > 0.f ? projection_area_cutoff / pixel_meter_ratio : 0.f; + projection_threshold *= projection_threshold; + S32 throttle = sNewObjectCreationThrottle; LLTimer update_timer; for(LLVOCacheEntry::vocache_entry_priority_list_t::iterator iter = mImpl->mWaitingList.begin(); @@ -1173,6 +1180,11 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time) { LLVOCacheEntry* vo_entry = *iter; + if(vo_entry->getSceneContribution() < projection_threshold) + { + break; + } + if(vo_entry->getState() < LLVOCacheEntry::WAITING) { addNewObject(vo_entry); diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 89a49ff1ed..4d598c8845 100755 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -548,10 +548,11 @@ class LLVOCacheOctreeCull : public LLViewerOctreeCull { public: LLVOCacheOctreeCull(LLCamera* camera, LLViewerRegion* regionp, - const LLVector3& shift, bool use_object_cache_occlusion, LLVOCachePartition* part) + const LLVector3& shift, bool use_object_cache_occlusion, F32 projection_area_cutoff, LLVOCachePartition* part) : LLViewerOctreeCull(camera), mRegionp(regionp), - mPartition(part) + mPartition(part), + mProjectionAreaCutOff(projection_area_cutoff) { mLocalShift = shift; mUseObjectCacheOcclusion = use_object_cache_occlusion; @@ -605,6 +606,14 @@ public: { res = llmin(res, AABBRegionSphereIntersectObjectExtents(group, mLocalShift)); } + + if(res != 0) + { + //check if the objects projection large enough + const LLVector4a* exts = group->getObjectExtents(); + res = checkProjectionArea(exts[0], exts[1], mLocalShift, mProjectionAreaCutOff); + } + return res; } @@ -648,6 +657,7 @@ private: LLVOCachePartition* mPartition; LLViewerRegion* mRegionp; LLVector3 mLocalShift; //shift vector from agent space to local region space. + F32 mProjectionAreaCutOff; bool mUseObjectCacheOcclusion; }; @@ -655,8 +665,8 @@ private: class LLVOCacheOctreeBackCull : public LLViewerOctreeCull { public: - LLVOCacheOctreeBackCull(LLCamera* camera, const LLVector3& shift, LLViewerRegion* regionp, F32 back_sphere_radius) - : LLViewerOctreeCull(camera), mRegionp(regionp) + LLVOCacheOctreeBackCull(LLCamera* camera, const LLVector3& shift, LLViewerRegion* regionp, F32 back_sphere_radius, F32 projection_area_cutoff) + : LLViewerOctreeCull(camera), mRegionp(regionp), mProjectionAreaCutOff(projection_area_cutoff) { mLocalShift = shift; mSphereRadius = back_sphere_radius; @@ -671,7 +681,13 @@ public: virtual S32 frustumCheckObjects(const LLViewerOctreeGroup* group) { const LLVector4a* exts = group->getObjectExtents(); - return backSphereCheck(exts[0], exts[1]); + if(backSphereCheck(exts[0], exts[1])) + { + //check if the objects projection large enough + const LLVector4a* exts = group->getObjectExtents(); + return checkProjectionArea(exts[0], exts[1], mLocalShift, mProjectionAreaCutOff); + } + return false; } virtual void processGroup(LLViewerOctreeGroup* base_group) @@ -691,9 +707,10 @@ private: F32 mSphereRadius; LLViewerRegion* mRegionp; LLVector3 mLocalShift; //shift vector from agent space to local region space. + F32 mProjectionAreaCutOff; }; -void LLVOCachePartition::selectBackObjects(LLCamera &camera, F32 back_sphere_radius) +void LLVOCachePartition::selectBackObjects(LLCamera &camera, F32 back_sphere_radius, F32 projection_area_cutoff) { if(LLViewerCamera::sCurCameraID != LLViewerCamera::CAMERA_WORLD) { @@ -714,7 +731,7 @@ void LLVOCachePartition::selectBackObjects(LLCamera &camera, F32 back_sphere_rad //localize the camera LLVector3 region_agent = mRegionp->getOriginAgent(); - LLVOCacheOctreeBackCull culler(&camera, region_agent, mRegionp, back_sphere_radius); + LLVOCacheOctreeBackCull culler(&camera, region_agent, mRegionp, back_sphere_radius, projection_area_cutoff); culler.traverse(mOctree); mBackSlectionEnabled--; @@ -730,6 +747,7 @@ S32 LLVOCachePartition::cull(LLCamera &camera, bool do_occlusion) { static LLCachedControl use_object_cache_occlusion(gSavedSettings,"UseObjectCacheOcclusion"); static LLCachedControl back_sphere_radius(gSavedSettings,"BackShpereCullingRadius"); + static LLCachedControl projection_area_cutoff(gSavedSettings,"ObjectProjectionAreaCutOFF"); if(!LLViewerRegion::sVOCacheCullingEnabled) { @@ -753,6 +771,11 @@ S32 LLVOCachePartition::cull(LLCamera &camera, bool do_occlusion) } mCulledTime[LLViewerCamera::sCurCameraID] = LLViewerOctreeEntryData::getCurrentFrame(); + //object projected area threshold + F32 pixel_meter_ratio = LLViewerCamera::getInstance()->getPixelMeterRatio(); + F32 projection_threshold = pixel_meter_ratio > 0.f ? projection_area_cutoff / pixel_meter_ratio : 0.f; + projection_threshold *= projection_threshold; + if(!mCullHistory[LLViewerCamera::sCurCameraID] && LLViewerRegion::isViewerCameraStatic()) { U32 seed = llmax(mLODPeriod >> 1, (U32)4); @@ -765,7 +788,7 @@ S32 LLVOCachePartition::cull(LLCamera &camera, bool do_occlusion) } if(LLViewerOctreeEntryData::getCurrentFrame() % seed != mIdleHash) { - selectBackObjects(camera, back_sphere_radius);//process back objects selection + selectBackObjects(camera, back_sphere_radius, projection_threshold);//process back objects selection return 0; //nothing changed, reduce frequency of culling } } @@ -783,7 +806,7 @@ S32 LLVOCachePartition::cull(LLCamera &camera, bool do_occlusion) LLVector3 region_agent = mRegionp->getOriginAgent(); camera.calcRegionFrustumPlanes(region_agent); - LLVOCacheOctreeCull culler(&camera, mRegionp, region_agent, do_occlusion && use_object_cache_occlusion, this); + LLVOCacheOctreeCull culler(&camera, mRegionp, region_agent, do_occlusion && use_object_cache_occlusion, projection_threshold, this); culler.traverse(mOctree); if(mRegionp->getNumOfVisibleGroups() > 0) diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index 21b30f5373..764c06f813 100755 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -186,7 +186,7 @@ public: void removeOccluder(LLVOCacheGroup* group); private: - void selectBackObjects(LLCamera &camera, F32 back_sphere_radius); //select objects behind camera. + void selectBackObjects(LLCamera &camera, F32 back_sphere_radius, F32 projection_area_cutoff); //select objects behind camera. public: static BOOL sNeedsOcclusionCheck; -- cgit v1.3 From dc60a7564abf16cbf269e47cfc33ed00c6bb0870 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 24 Oct 2013 14:37:57 -0700 Subject: SH-4577 WIP Interesting: viewer crashed when clicking a offline Conversation containing a shared object potential fix by making instance tracker allow key collisions for LLToastNotifyPanel changed assertion macro to use original unpreprocessed source code renamed instance tracker behavior macros to use LL prefix added RestoreCameraPosOnLogin setting to optionally restore old camera positioning behavior --- indra/llcommon/llerror.h | 8 +++++--- indra/llcommon/llinstancetracker.h | 8 ++++---- indra/llcommon/llthreadlocalstorage.h | 2 +- indra/llcommon/lltrace.h | 4 ++-- indra/newview/CMakeLists.txt | 18 +++++++++--------- indra/newview/app_settings/settings.xml | 13 ++++++++++++- indra/newview/llstartup.cpp | 7 +++---- indra/newview/lltoastnotifypanel.cpp | 2 +- indra/newview/lltoastnotifypanel.h | 2 +- 9 files changed, 38 insertions(+), 26 deletions(-) (limited to 'indra/newview/app_settings/settings.xml') diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h index 046cd69543..5268cf9a4d 100755 --- a/indra/llcommon/llerror.h +++ b/indra/llcommon/llerror.h @@ -72,11 +72,13 @@ const int LL_ERR_NOERR = 0; #endif // !_DEBUG -#define llassert_always(func) if (LL_UNLIKELY(!(func))) LL_ERRS() << "ASSERT (" << #func << ")" << LL_ENDL; +#define llassert_always_msg(func, msg) if (LL_UNLIKELY(!(func))) LL_ERRS() << "ASSERT (" << msg << ")" << LL_ENDL + +#define llassert_always(func) llassert_always_msg(func, #func) #ifdef SHOW_ASSERT -#define llassert(func) llassert_always(func) -#define llverify(func) llassert_always(func) +#define llassert(func) llassert_always_msg(func, #func) +#define llverify(func) llassert_always_msg(func, #func) #else #define llassert(func) #define llverify(func) do {if (func) {}} while(0) diff --git a/indra/llcommon/llinstancetracker.h b/indra/llcommon/llinstancetracker.h index 3fdb84cfd7..3107415ccf 100755 --- a/indra/llcommon/llinstancetracker.h +++ b/indra/llcommon/llinstancetracker.h @@ -64,8 +64,8 @@ LL_COMMON_API void assert_main_thread(); enum EInstanceTrackerAllowKeyCollisions { - InstanceTrackerAllowKeyCollisions, - InstanceTrackerDisallowKeyCollisions + LLInstanceTrackerAllowKeyCollisions, + LLInstanceTrackerDisallowKeyCollisions }; /// This mix-in class adds support for tracking all instances of the specified class parameter T @@ -73,7 +73,7 @@ enum EInstanceTrackerAllowKeyCollisions /// If KEY is not provided, then instances are stored in a simple set /// @NOTE: see explicit specialization below for default KEY==void case /// @NOTE: this class is not thread-safe unless used as read-only -template +template class LLInstanceTracker : public LLInstanceTrackerBase { typedef LLInstanceTracker self_t; @@ -216,7 +216,7 @@ private: mInstanceKey = key; InstanceMap& map = getMap_(); typename InstanceMap::iterator insertion_point_it = map.lower_bound(key); - if (ALLOW_KEY_COLLISIONS == InstanceTrackerDisallowKeyCollisions + if (ALLOW_KEY_COLLISIONS == LLInstanceTrackerDisallowKeyCollisions && insertion_point_it != map.end() && insertion_point_it->first == key) { diff --git a/indra/llcommon/llthreadlocalstorage.h b/indra/llcommon/llthreadlocalstorage.h index 177e822227..ec3b52c8cb 100644 --- a/indra/llcommon/llthreadlocalstorage.h +++ b/indra/llcommon/llthreadlocalstorage.h @@ -43,7 +43,7 @@ public: } LLThreadLocalPointerBase( const LLThreadLocalPointerBase& other) - : mThreadKey(NULL) + : mThreadKey(NULL) { if (sInitialized) { diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h index b499036af2..8b67dd8f44 100644 --- a/indra/llcommon/lltrace.h +++ b/indra/llcommon/lltrace.h @@ -69,10 +69,10 @@ protected: template class StatType : public StatBase, - public LLInstanceTracker, std::string, InstanceTrackerAllowKeyCollisions> + public LLInstanceTracker, std::string, LLInstanceTrackerAllowKeyCollisions> { public: - typedef LLInstanceTracker, std::string, InstanceTrackerAllowKeyCollisions> instance_tracker_t; + typedef LLInstanceTracker, std::string, LLInstanceTrackerAllowKeyCollisions> instance_tracker_t; StatType(const char* name, const char* description) : instance_tracker_t(name), StatBase(name, description), diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 3e1cbb2ac6..0cf0fc1322 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -238,6 +238,9 @@ set(viewer_SOURCE_FILES llfloaterhelpbrowser.cpp llfloaterhud.cpp llfloaterimagepreview.cpp + llfloaterimsessiontab.cpp + llfloaterimsession.cpp + llfloaterimcontainer.cpp llfloaterinspect.cpp llfloaterinventory.cpp llfloaterjoystick.cpp @@ -320,9 +323,6 @@ set(viewer_SOURCE_FILES llhudrender.cpp llhudtext.cpp llhudview.cpp - llfloaterimsessiontab.cpp - llfloaterimsession.cpp - llfloaterimcontainer.cpp llimhandler.cpp llimview.cpp llinspect.cpp @@ -826,6 +826,12 @@ set(viewer_HEADER_FILES llfloaterhelpbrowser.h llfloaterhud.h llfloaterimagepreview.h + llfloaterimnearbychat.h + llfloaterimnearbychathandler.h + llfloaterimnearbychatlistener.h + llfloaterimsessiontab.h + llfloaterimsession.h + llfloaterimcontainer.h llfloaterinspect.h llfloaterinventory.h llfloaterjoystick.h @@ -907,9 +913,6 @@ set(viewer_HEADER_FILES llhudrender.h llhudtext.h llhudview.h - llfloaterimsessiontab.h - llfloaterimsession.h - llfloaterimcontainer.h llimview.h llinspect.h llinspectavatar.h @@ -961,9 +964,6 @@ set(viewer_HEADER_FILES llnameeditor.h llnamelistctrl.h llnavigationbar.h - llfloaterimnearbychat.h - llfloaterimnearbychathandler.h - llfloaterimnearbychatlistener.h llnetmap.h llnotificationhandler.h llnotificationmanager.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index fb0d9c98d4..09d74a7f5e 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1467,7 +1467,18 @@ 0.0 - CameraPositionSmoothing + RestoreCameraPosOnLogin + + Comment + Reset camera position to location at logout + Persist + 1 + Type + Boolean + Value + 0 + + CameraPositionSmoothing Comment Smooths camera position over time diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 72c76f9424..de3be7f3c5 100755 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1962,10 +1962,9 @@ bool idle_startup() ((start_slurl.getType() == LLSLURL::LAST_LOCATION) && (gAgentStartLocation == "last")) || ((start_slurl.getType() == LLSLURL::HOME_LOCATION) && (gAgentStartLocation == "home"))) { - // Start location is OK - // Disabled code to restore camera location and focus if logging in to default location - static bool samename = false; - if (samename) + if (start_slurl.getType() == LLSLURL::LAST_LOCATION + && gAgentStartLocation == "last" + && gSavedSettings.getBOOL("RestoreCameraPosOnLogin")) { // restore old camera pos gAgentCamera.setFocusOnAvatar(FALSE, FALSE); diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 94d07b37ef..5b110d843d 100755 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -57,7 +57,7 @@ LLToastNotifyPanel::button_click_signal_t LLToastNotifyPanel::sButtonClickSignal LLToastNotifyPanel::LLToastNotifyPanel(const LLNotificationPtr& notification, const LLRect& rect, bool show_images) : LLToastPanel(notification), - LLInstanceTracker(notification->getID()) + LLInstanceTracker(notification->getID()) { init(rect, show_images); } diff --git a/indra/newview/lltoastnotifypanel.h b/indra/newview/lltoastnotifypanel.h index d02171b512..dfd6e110b9 100755 --- a/indra/newview/lltoastnotifypanel.h +++ b/indra/newview/lltoastnotifypanel.h @@ -47,7 +47,7 @@ class LLNotificationForm; * @deprecated this class will be removed after all toast panel types are * implemented in separate classes. */ -class LLToastNotifyPanel: public LLToastPanel, public LLInstanceTracker +class LLToastNotifyPanel: public LLToastPanel, public LLInstanceTracker { public: /** -- cgit v1.3 From c35801ef1c56b6c84063f47b490a8d2220b77ca7 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 5 Nov 2013 19:26:23 -0800 Subject: fixed focus issue on inventory --- indra/llrender/llrender2dutils.cpp | 383 +++++++++++---------- indra/llrender/llrender2dutils.h | 4 +- indra/llrender/lluiimage.cpp | 50 ++- indra/llrender/lluiimage.h | 18 +- indra/llui/lliconctrl.cpp | 26 +- indra/llui/lliconctrl.h | 10 +- indra/llui/lllayoutstack.cpp | 118 +++++-- indra/llui/llresizebar.cpp | 78 +---- indra/llui/llresizebar.h | 15 +- indra/newview/app_settings/settings.xml | 44 --- indra/newview/llavatariconctrl.cpp | 67 ++-- indra/newview/llavatariconctrl.h | 46 ++- indra/newview/llsidepanelinventory.cpp | 2 +- indra/newview/llviewertexturelist.cpp | 51 ++- indra/newview/llviewertexturelist.h | 10 +- indra/newview/skins/default/textures/textures.xml | 10 +- .../textures/widgets/horizontal_drag_handle.png | Bin 197 -> 217 bytes .../textures/widgets/vertical_drag_handle.png | Bin 196 -> 238 bytes .../skins/default/xui/en/panel_main_inventory.xml | 2 - .../skins/default/xui/en/sidepanel_inventory.xml | 105 +++--- .../skins/default/xui/en/widgets/avatar_icon.xml | 12 +- 21 files changed, 543 insertions(+), 508 deletions(-) (limited to 'indra/newview/app_settings/settings.xml') diff --git a/indra/llrender/llrender2dutils.cpp b/indra/llrender/llrender2dutils.cpp index 79db777f4b..df5d79a436 100644 --- a/indra/llrender/llrender2dutils.cpp +++ b/indra/llrender/llrender2dutils.cpp @@ -369,7 +369,7 @@ void gl_draw_scaled_image(S32 x, S32 y, S32 width, S32 height, LLTexture* image, gl_draw_scaled_rotated_image( x, y, width, height, 0.f, image, color, uv_rect ); } -void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLTexture* image, const LLColor4& color, BOOL solid_color, const LLRectf& uv_rect) +void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLTexture* image, const LLColor4& color, BOOL solid_color, const LLRectf& uv_rect, bool scale_inner) { if (NULL == image) { @@ -382,10 +382,10 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border F32 border_height_fraction = (F32)border_height / (F32)image->getHeight(0); LLRectf scale_rect(border_width_fraction, 1.f - border_height_fraction, 1.f - border_width_fraction, border_height_fraction); - gl_draw_scaled_image_with_border(x, y, width, height, image, color, solid_color, uv_rect, scale_rect); + gl_draw_scaled_image_with_border(x, y, width, height, image, color, solid_color, uv_rect, scale_rect, scale_inner); } -void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color, BOOL solid_color, const LLRectf& uv_outer_rect, const LLRectf& center_rect) +void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color, BOOL solid_color, const LLRectf& uv_outer_rect, const LLRectf& center_rect, bool scale_inner) { stop_glerror(); @@ -395,56 +395,6 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex return; } - // add in offset of current image to current UI translation - const LLVector3 ui_scale = gGL.getUIScale(); - const LLVector3 ui_translation = (gGL.getUITranslation() + LLVector3(x, y, 0.f)).scaledVec(ui_scale); - - F32 uv_width = uv_outer_rect.getWidth(); - F32 uv_height = uv_outer_rect.getHeight(); - - // shrink scaling region to be proportional to clipped image region - LLRectf uv_center_rect( - uv_outer_rect.mLeft + (center_rect.mLeft * uv_width), - uv_outer_rect.mBottom + (center_rect.mTop * uv_height), - uv_outer_rect.mLeft + (center_rect.mRight * uv_width), - uv_outer_rect.mBottom + (center_rect.mBottom * uv_height)); - - F32 image_width = image->getWidth(0); - F32 image_height = image->getHeight(0); - - S32 image_natural_width = llround(image_width * uv_width); - S32 image_natural_height = llround(image_height * uv_height); - - LLRectf draw_center_rect( uv_center_rect.mLeft * image_width, - uv_center_rect.mTop * image_height, - uv_center_rect.mRight * image_width, - uv_center_rect.mBottom * image_height); - - { // scale fixed region of image to drawn region - draw_center_rect.mRight += width - image_natural_width; - draw_center_rect.mTop += height - image_natural_height; - - F32 border_shrink_width = llmax(0.f, draw_center_rect.mLeft - draw_center_rect.mRight); - F32 border_shrink_height = llmax(0.f, draw_center_rect.mBottom - draw_center_rect.mTop); - - F32 shrink_width_ratio = center_rect.getWidth() == 1.f ? 0.f : border_shrink_width / ((F32)image_natural_width * (1.f - center_rect.getWidth())); - F32 shrink_height_ratio = center_rect.getHeight() == 1.f ? 0.f : border_shrink_height / ((F32)image_natural_height * (1.f - center_rect.getHeight())); - - F32 shrink_scale = 1.f - llmax(shrink_width_ratio, shrink_height_ratio); - - draw_center_rect.mLeft = llround(ui_translation.mV[VX] + (F32)draw_center_rect.mLeft * shrink_scale * ui_scale.mV[VX]); - draw_center_rect.mTop = llround(ui_translation.mV[VY] + lerp((F32)height, (F32)draw_center_rect.mTop, shrink_scale) * ui_scale.mV[VY]); - draw_center_rect.mRight = llround(ui_translation.mV[VX] + lerp((F32)width, (F32)draw_center_rect.mRight, shrink_scale) * ui_scale.mV[VX]); - draw_center_rect.mBottom = llround(ui_translation.mV[VY] + (F32)draw_center_rect.mBottom * shrink_scale * ui_scale.mV[VY]); - } - - LLRectf draw_outer_rect(ui_translation.mV[VX], - ui_translation.mV[VY] + height * ui_scale.mV[VY], - ui_translation.mV[VX] + width * ui_scale.mV[VX], - ui_translation.mV[VY]); - - LLGLSUIDefault gls_ui; - if (solid_color) { if (LLGLSLShader::sNoFixedFunction) @@ -458,174 +408,247 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex } } - gGL.getTexUnit(0)->bind(image, true); + if (center_rect.mLeft == 0.f + && center_rect.mRight == 1.f + && center_rect.mBottom == 0.f + && center_rect.mTop == 1.f) + { + gl_draw_scaled_image(x, y, width, height, image, color, uv_outer_rect); + } + else + { + // add in offset of current image to current UI translation + const LLVector3 ui_scale = gGL.getUIScale(); + const LLVector3 ui_translation = (gGL.getUITranslation() + LLVector3(x, y, 0.f)).scaledVec(ui_scale); + + F32 uv_width = uv_outer_rect.getWidth(); + F32 uv_height = uv_outer_rect.getHeight(); + + // shrink scaling region to be proportional to clipped image region + LLRectf uv_center_rect( uv_outer_rect.mLeft + (center_rect.mLeft * uv_width), + uv_outer_rect.mBottom + (center_rect.mTop * uv_height), + uv_outer_rect.mLeft + (center_rect.mRight * uv_width), + uv_outer_rect.mBottom + (center_rect.mBottom * uv_height)); + + F32 image_width = image->getWidth(0); + F32 image_height = image->getHeight(0); + + S32 image_natural_width = llround(image_width * uv_width); + S32 image_natural_height = llround(image_height * uv_height); + + LLRectf draw_center_rect( uv_center_rect.mLeft * image_width, + uv_center_rect.mTop * image_height, + uv_center_rect.mRight * image_width, + uv_center_rect.mBottom * image_height); + + if (scale_inner) + { + // scale center region of image to drawn region + draw_center_rect.mRight += width - image_natural_width; + draw_center_rect.mTop += height - image_natural_height; + + const F32 border_shrink_width = llmax(0.f, draw_center_rect.mLeft - draw_center_rect.mRight); + const F32 border_shrink_height = llmax(0.f, draw_center_rect.mBottom - draw_center_rect.mTop); - gGL.color4fv(color.mV); + const F32 shrink_width_ratio = center_rect.getWidth() == 1.f ? 0.f : border_shrink_width / ((F32)image_natural_width * (1.f - center_rect.getWidth())); + const F32 shrink_height_ratio = center_rect.getHeight() == 1.f ? 0.f : border_shrink_height / ((F32)image_natural_height * (1.f - center_rect.getHeight())); + + const F32 border_shrink_scale = 1.f - llmax(shrink_width_ratio, shrink_height_ratio); + draw_center_rect.mLeft *= border_shrink_scale; + draw_center_rect.mTop = lerp((F32)height, (F32)draw_center_rect.mTop, border_shrink_scale); + draw_center_rect.mRight = lerp((F32)width, (F32)draw_center_rect.mRight, border_shrink_scale); + draw_center_rect.mBottom *= border_shrink_scale; + } + else + { + // keep center region of image at fixed scale, but in same relative position + F32 scale_factor = llmin((F32)width / draw_center_rect.getWidth(), (F32)height / draw_center_rect.getHeight(), 1.f); + F32 scaled_width = draw_center_rect.getWidth() * scale_factor; + F32 scaled_height = draw_center_rect.getHeight() * scale_factor; + draw_center_rect.setCenterAndSize(uv_center_rect.getCenterX() * width, uv_center_rect.getCenterY() * height, scaled_width, scaled_height); + } + + draw_center_rect.mLeft = llround(ui_translation.mV[VX] + (F32)draw_center_rect.mLeft * ui_scale.mV[VX]); + draw_center_rect.mTop = llround(ui_translation.mV[VY] + (F32)draw_center_rect.mTop * ui_scale.mV[VY]); + draw_center_rect.mRight = llround(ui_translation.mV[VX] + (F32)draw_center_rect.mRight * ui_scale.mV[VX]); + draw_center_rect.mBottom = llround(ui_translation.mV[VY] + (F32)draw_center_rect.mBottom * ui_scale.mV[VY]); + + LLRectf draw_outer_rect(ui_translation.mV[VX], + ui_translation.mV[VY] + height * ui_scale.mV[VY], + ui_translation.mV[VX] + width * ui_scale.mV[VX], + ui_translation.mV[VY]); + + LLGLSUIDefault gls_ui; + + gGL.getTexUnit(0)->bind(image, true); + + gGL.color4fv(color.mV); - const S32 NUM_VERTICES = 9 * 4; // 9 quads - LLVector2 uv[NUM_VERTICES]; - LLVector3 pos[NUM_VERTICES]; + const S32 NUM_VERTICES = 9 * 4; // 9 quads + LLVector2 uv[NUM_VERTICES]; + LLVector3 pos[NUM_VERTICES]; - S32 index = 0; + S32 index = 0; - gGL.begin(LLRender::QUADS); - { - // draw bottom left - uv[index] = LLVector2(uv_outer_rect.mLeft, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_outer_rect.mBottom, 0.f); - index++; + gGL.begin(LLRender::QUADS); + { + // draw bottom left + uv[index] = LLVector2(uv_outer_rect.mLeft, uv_outer_rect.mBottom); + pos[index] = LLVector3(draw_outer_rect.mLeft, draw_outer_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mBottom, 0.f); + index++; - // draw bottom middle - uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mBottom, 0.f); - index++; + // draw bottom middle + uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); + index++; - // draw bottom right - uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mBottom, 0.f); - index++; + // draw bottom right + uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_outer_rect.mRight, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_outer_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_outer_rect.mRight, uv_outer_rect.mBottom); + pos[index] = LLVector3(draw_outer_rect.mRight, draw_outer_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); + index++; - // draw left - uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mBottom, 0.f); - index++; + // draw left + uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mTop); + pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mTop, 0.f); + index++; - // draw middle - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); - index++; + // draw middle + uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); + index++; - // draw right - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); - index++; + // draw right + uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mTop); + pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); + index++; - // draw top left - uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mTop, 0.f); - index++; + // draw top left + uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mTop); + pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_outer_rect.mLeft, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_outer_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_outer_rect.mLeft, uv_outer_rect.mTop); + pos[index] = LLVector3(draw_outer_rect.mLeft, draw_outer_rect.mTop, 0.f); + index++; - // draw top middle - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); - index++; + // draw top middle + uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mTop, 0.f); + index++; - // draw top right - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); - index++; + // draw top right + uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mTop); + pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_outer_rect.mRight, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_outer_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_outer_rect.mRight, uv_outer_rect.mTop); + pos[index] = LLVector3(draw_outer_rect.mRight, draw_outer_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mTop, 0.f); + index++; - gGL.vertexBatchPreTransformed(pos, uv, NUM_VERTICES); + gGL.vertexBatchPreTransformed(pos, uv, NUM_VERTICES); + } + gGL.end(); } - gGL.end(); if (solid_color) { diff --git a/indra/llrender/llrender2dutils.h b/indra/llrender/llrender2dutils.h index 2b8964742b..cce3b4ed51 100644 --- a/indra/llrender/llrender2dutils.h +++ b/indra/llrender/llrender2dutils.h @@ -75,8 +75,8 @@ void gl_draw_scaled_target(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* void gl_draw_scaled_image(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); void gl_draw_rotated_image(S32 x, S32 y, F32 degrees, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degrees, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), LLRenderTarget* target = NULL); -void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); -void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), const LLRectf& scale_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); +void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), bool scale_inner = true); +void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), const LLRectf& scale_rect = LLRectf(0.f, 1.f, 1.f, 0.f), bool scale_inner = true); void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& color, F32 phase = 0.f ); diff --git a/indra/llrender/lluiimage.cpp b/indra/llrender/lluiimage.cpp index b954b66350..6f1fae92cd 100644 --- a/indra/llrender/lluiimage.cpp +++ b/indra/llrender/lluiimage.cpp @@ -38,11 +38,9 @@ LLUIImage::LLUIImage(const std::string& name, LLPointer image) mImage(image), mScaleRegion(0.f, 1.f, 1.f, 0.f), mClipRegion(0.f, 1.f, 1.f, 0.f), - mUniformScaling(TRUE), - mNoClip(TRUE), - mImageLoaded(NULL) -{ -} + mImageLoaded(NULL), + mScaleStyle(SCALE_INNER) +{} LLUIImage::~LLUIImage() { @@ -52,44 +50,35 @@ LLUIImage::~LLUIImage() void LLUIImage::setClipRegion(const LLRectf& region) { mClipRegion = region; - mNoClip = mClipRegion.mLeft == 0.f - && mClipRegion.mRight == 1.f - && mClipRegion.mBottom == 0.f - && mClipRegion.mTop == 1.f; } void LLUIImage::setScaleRegion(const LLRectf& region) { mScaleRegion = region; - mUniformScaling = mScaleRegion.mLeft == 0.f - && mScaleRegion.mRight == 1.f - && mScaleRegion.mBottom == 0.f - && mScaleRegion.mTop == 1.f; +} + +void LLUIImage::setScaleStyle(LLUIImage::EScaleStyle style) +{ + mScaleStyle = style; } //TODO: move drawing implementation inside class void LLUIImage::draw(S32 x, S32 y, const LLColor4& color) const { - gl_draw_scaled_image(x, y, getWidth(), getHeight(), mImage, color, mClipRegion); + draw(x, y, getWidth(), getHeight(), color); } void LLUIImage::draw(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) const { - if (mUniformScaling) - { - gl_draw_scaled_image(x, y, width, height, mImage, color, mClipRegion); - } - else - { - gl_draw_scaled_image_with_border( - x, y, - width, height, - mImage, - color, - FALSE, - mClipRegion, - mScaleRegion); - } + gl_draw_scaled_image_with_border( + x, y, + width, height, + mImage, + color, + FALSE, + mClipRegion, + mScaleRegion, + mScaleStyle == SCALE_INNER); } void LLUIImage::drawSolid(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) const @@ -101,7 +90,8 @@ void LLUIImage::drawSolid(S32 x, S32 y, S32 width, S32 height, const LLColor4& c color, TRUE, mClipRegion, - mScaleRegion); + mScaleRegion, + mScaleStyle == SCALE_INNER); } void LLUIImage::drawBorder(S32 x, S32 y, S32 width, S32 height, const LLColor4& color, S32 border_width) const diff --git a/indra/llrender/lluiimage.h b/indra/llrender/lluiimage.h index 7817ba1c7b..6f47385eb0 100644 --- a/indra/llrender/lluiimage.h +++ b/indra/llrender/lluiimage.h @@ -42,6 +42,12 @@ extern const LLColor4 UI_VERTEX_COLOR; class LLUIImage : public LLRefCount { public: + enum EScaleStyle + { + SCALE_INNER, + SCALE_OUTER + }; + typedef boost::signals2::signal image_loaded_signal_t; LLUIImage(const std::string& name, LLPointer image); @@ -49,6 +55,7 @@ public: void setClipRegion(const LLRectf& region); void setScaleRegion(const LLRectf& region); + void setScaleStyle(EScaleStyle style); LLPointer getImage() { return mImage; } const LLPointer& getImage() const { return mImage; } @@ -83,12 +90,11 @@ public: protected: image_loaded_signal_t* mImageLoaded; - std::string mName; - LLRectf mScaleRegion; - LLRectf mClipRegion; - LLPointer mImage; - BOOL mUniformScaling; - BOOL mNoClip; + std::string mName; + LLRectf mScaleRegion; + LLRectf mClipRegion; + LLPointer mImage; + EScaleStyle mScaleStyle; }; namespace LLInitParam diff --git a/indra/llui/lliconctrl.cpp b/indra/llui/lliconctrl.cpp index 30b79b4d20..58b66f60ca 100755 --- a/indra/llui/lliconctrl.cpp +++ b/indra/llui/lliconctrl.cpp @@ -42,7 +42,9 @@ LLIconCtrl::Params::Params() : image("image_name"), color("color"), use_draw_context_alpha("use_draw_context_alpha", true), - scale_image("scale_image") + scale_image("scale_image"), + min_width("min_width", 0), + min_height("min_height", 0) {} LLIconCtrl::LLIconCtrl(const LLIconCtrl::Params& p) @@ -51,8 +53,8 @@ LLIconCtrl::LLIconCtrl(const LLIconCtrl::Params& p) mImagep(p.image), mUseDrawContextAlpha(p.use_draw_context_alpha), mPriority(0), - mDrawWidth(0), - mDrawHeight(0) + mMinWidth(p.min_width), + mMinHeight(p.min_height) { if (mImagep.notNull()) { @@ -97,7 +99,13 @@ void LLIconCtrl::setValue(const LLSD& value ) mImagep = LLUI::getUIImage(tvalue.asString(), mPriority); } - setIconImageDrawSize(); + if(mImagep.notNull() + && mImagep->getImage().notNull() + && mMinWidth + && mMinHeight) + { + mImagep->getImage()->setKnownDrawSize(llmax(mMinWidth, mImagep->getWidth()), llmax(mMinHeight, mImagep->getHeight())); + } } std::string LLIconCtrl::getImageName() const @@ -108,14 +116,4 @@ std::string LLIconCtrl::getImageName() const return std::string(); } -void LLIconCtrl::setIconImageDrawSize() -{ - if(mImagep.notNull() && mDrawWidth && mDrawHeight) - { - if(mImagep->getImage().notNull()) - { - mImagep->getImage()->setKnownDrawSize(mDrawWidth, mDrawHeight) ; - } - } -} diff --git a/indra/llui/lliconctrl.h b/indra/llui/lliconctrl.h index a19bb99d9d..8b1092df46 100755 --- a/indra/llui/lliconctrl.h +++ b/indra/llui/lliconctrl.h @@ -49,7 +49,10 @@ public: Optional image; Optional color; Optional use_draw_context_alpha; + Optional min_width, + min_height; Ignored scale_image; + Params(); }; protected: @@ -71,15 +74,12 @@ public: void setImage(LLPointer image) { mImagep = image; } const LLPointer getImage() { return mImagep; } -private: - void setIconImageDrawSize() ; - protected: S32 mPriority; //the output size of the icon image if set. - S32 mDrawWidth ; - S32 mDrawHeight ; + S32 mMinWidth, + mMinHeight; // If set to true (default), use the draw context transparency. // If false, will use transparency returned by getCurrentTransparency(). See STORM-698. diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index b13f61ea7e..c59286fc60 100755 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -33,6 +33,7 @@ #include "lllocalcliprect.h" #include "llpanel.h" #include "llcriticaldamp.h" +#include "lliconctrl.h" #include "boost/foreach.hpp" static const F32 MIN_FRACTIONAL_SIZE = 0.00001f; @@ -268,25 +269,9 @@ void LLLayoutStack::draw() // only force drawing invisible children if visible amount is non-zero drawChild(panelp, 0, 0, !clip_rect.isEmpty()); } - } - - const LLView::child_list_t * child_listp = getChildList(); - BOOST_FOREACH(LLView * childp, * child_listp) - { - LLResizeBar * resize_barp = dynamic_cast(childp); - if (resize_barp && resize_barp->isShowDragHandle() && resize_barp->getVisible() && resize_barp->getRect().isValid()) + if (panelp->getResizeBar()->getVisible()) { - LLRect screen_rect = resize_barp->calcScreenRect(); - if (LLUI::getRootView()->getLocalRect().overlaps(screen_rect) && LLUI::sDirtyRect.overlaps(screen_rect)) - { - LLUI::pushMatrix(); - { - const LLRect& rb_rect(resize_barp->getRect()); - LLUI::translate(rb_rect.mLeft, rb_rect.mBottom); - resize_barp->draw(); - } - LLUI::popMatrix(); - } + drawChild(panelp->getResizeBar()); } } } @@ -351,6 +336,31 @@ void LLLayoutStack::collapsePanel(LLPanel* panel, BOOL collapsed) static LLTrace::BlockTimerStatHandle FTM_UPDATE_LAYOUT("Update LayoutStacks"); +class LLImagePanel : public LLPanel +{ +public: + struct Params : public LLInitParam::Block + { + Optional horizontal; + Params() : horizontal("horizontal", false) {} + }; + LLImagePanel(const Params& p) : LLPanel(p), mHorizontal(p.horizontal) {} + virtual ~LLImagePanel() {} + + void draw() + { + const LLRect& parent_rect = getParent()->getRect(); + const LLRect& rect = getRect(); + LLRect clip_rect( -rect.mLeft, parent_rect.getHeight() - rect.mBottom - 2 + , parent_rect.getWidth() - rect.mLeft - (mHorizontal ? 2 : 0), -rect.mBottom); + LLLocalClipRect clip(clip_rect); + LLPanel::draw(); + } + +private: + bool mHorizontal; +}; + void LLLayoutStack::updateLayout() { LL_RECORD_BLOCK_TIME(FTM_UPDATE_LAYOUT); @@ -435,8 +445,6 @@ void LLLayoutStack::updateLayout() } LLRect resize_bar_rect(panel_rect); - LLResizeBar * resize_barp = panelp->getResizeBar(); - bool show_drag_handle = resize_barp->isShowDragHandle(); F32 panel_spacing = (F32)mPanelSpacing * panelp->getVisibleAmount(); F32 panel_visible_dim = panelp->getVisibleDim(); S32 panel_spacing_round = (S32)(llround(panel_spacing)); @@ -445,7 +453,7 @@ void LLLayoutStack::updateLayout() { cur_pos += panel_visible_dim + panel_spacing; - if (show_drag_handle && panel_spacing_round > mDragHandleThickness) + if (mShowDragHandle && panel_spacing_round > mDragHandleThickness) { resize_bar_rect.mLeft = panel_rect.mRight + mDragHandleShift; resize_bar_rect.mRight = resize_bar_rect.mLeft + mDragHandleThickness; @@ -456,7 +464,7 @@ void LLLayoutStack::updateLayout() resize_bar_rect.mRight = panel_rect.mRight + panel_spacing_round + mResizeBarOverlap; } - if (show_drag_handle) + if (mShowDragHandle) { resize_bar_rect.mBottom += mDragHandleSecondIndent; resize_bar_rect.mTop -= mDragHandleFirstIndent; @@ -467,7 +475,7 @@ void LLLayoutStack::updateLayout() { cur_pos -= panel_visible_dim + panel_spacing; - if (show_drag_handle && panel_spacing_round > mDragHandleThickness) + if (mShowDragHandle && panel_spacing_round > mDragHandleThickness) { resize_bar_rect.mTop = panel_rect.mBottom - mDragHandleShift; resize_bar_rect.mBottom = resize_bar_rect.mTop - mDragHandleThickness; @@ -478,7 +486,7 @@ void LLLayoutStack::updateLayout() resize_bar_rect.mBottom = panel_rect.mBottom - panel_spacing_round - mResizeBarOverlap; } - if (show_drag_handle) + if (mShowDragHandle) { resize_bar_rect.mLeft += mDragHandleFirstIndent; resize_bar_rect.mRight -= mDragHandleSecondIndent; @@ -541,9 +549,69 @@ void LLLayoutStack::createResizeBar(LLLayoutPanel* panelp) resize_params.min_size(lp->getRelevantMinDim()); resize_params.side((mOrientation == HORIZONTAL) ? LLResizeBar::RIGHT : LLResizeBar::BOTTOM); resize_params.snapping_enabled(false); - resize_params.show_drag_handle(mShowDragHandle); LLResizeBar* resize_bar = LLUICtrlFactory::create(resize_params); lp->mResizeBar = resize_bar; + + if (mShowDragHandle) + { + LLPanel::Params resize_bar_bg_panel_p; + resize_bar_bg_panel_p.name = "resize_handle_bg_panel"; + resize_bar_bg_panel_p.rect = lp->mResizeBar->getLocalRect(); + resize_bar_bg_panel_p.follows.flags = FOLLOWS_ALL; + resize_bar_bg_panel_p.tab_stop = false; + resize_bar_bg_panel_p.background_visible = true; + resize_bar_bg_panel_p.bg_alpha_color = LLUIColorTable::instance().getColor("ResizebarBody"); + resize_bar_bg_panel_p.has_border = true; + resize_bar_bg_panel_p.border.border_thickness = 1; + resize_bar_bg_panel_p.border.highlight_light_color = LLUIColorTable::instance().getColor("ResizebarBorderLight"); + resize_bar_bg_panel_p.border.shadow_dark_color = LLUIColorTable::instance().getColor("ResizebarBorderDark"); + + LLPanel* resize_bar_bg_panel = LLUICtrlFactory::create(resize_bar_bg_panel_p); + + LLIconCtrl::Params icon_p; + icon_p.name = "resize_handle_image"; + icon_p.rect = lp->mResizeBar->getLocalRect(); + icon_p.follows.flags = FOLLOWS_ALL; + icon_p.image = LLUI::getUIImage(mOrientation == HORIZONTAL ? "Vertical Drag Handle" : "Horizontal Drag Handle"); + resize_bar_bg_panel->addChild(LLUICtrlFactory::create(icon_p)); + + lp->mResizeBar->addChild(resize_bar_bg_panel); + } + + /*if (mShowDragHandle) + { + LLViewBorder::Params border_params; + border_params.border_thickness = 1; + border_params.highlight_light_color = LLUIColorTable::instance().getColor("ResizebarBorderLight"); + border_params.shadow_dark_color = LLUIColorTable::instance().getColor("ResizebarBorderDark"); + + addBorder(border_params); + setBorderVisible(TRUE); + + LLImagePanel::Params image_panel; + mDragHandleImage = LLUI::getUIImage(LLResizeBar::RIGHT == mSide ? "Vertical Drag Handle" : "Horizontal Drag Handle"); + image_panel.bg_alpha_image = mDragHandleImage; + image_panel.background_visible = true; + image_panel.horizontal = (LLResizeBar::BOTTOM == mSide); + mImagePanel = LLUICtrlFactory::create(image_panel); + setImagePanel(mImagePanel); + }*/ + + //if (mShowDragHandle) + //{ + // setBackgroundVisible(TRUE); + // setTransparentColor(LLUIColorTable::instance().getColor("ResizebarBody")); + //} + + /*if (mShowDragHandle) + { + S32 image_width = mDragHandleImage->getTextureWidth(); + S32 image_height = mDragHandleImage->getTextureHeight(); + const LLRect& panel_rect = getRect(); + S32 image_left = (panel_rect.getWidth() - image_width) / 2 - 1; + S32 image_bottom = (panel_rect.getHeight() - image_height) / 2; + mImagePanel->setRect(LLRect(image_left, image_bottom + image_height, image_left + image_width, image_bottom)); + }*/ LLView::addChild(resize_bar, 0); } } diff --git a/indra/llui/llresizebar.cpp b/indra/llui/llresizebar.cpp index e67b22c977..115c4e23be 100755 --- a/indra/llui/llresizebar.cpp +++ b/indra/llui/llresizebar.cpp @@ -35,46 +35,18 @@ #include "llfocusmgr.h" #include "llwindow.h" -class LLImagePanel : public LLPanel -{ -public: - struct Params : public LLInitParam::Block - { - Optional horizontal; - Params() : horizontal("horizontal", false) {} - }; - LLImagePanel(const Params& p) : LLPanel(p), mHorizontal(p.horizontal) {} - virtual ~LLImagePanel() {} - - void draw() - { - const LLRect& parent_rect = getParent()->getRect(); - const LLRect& rect = getRect(); - LLRect clip_rect( -rect.mLeft, parent_rect.getHeight() - rect.mBottom - 2 - , parent_rect.getWidth() - rect.mLeft - (mHorizontal ? 2 : 0), -rect.mBottom); - LLLocalClipRect clip(clip_rect); - LLPanel::draw(); - } - -private: - bool mHorizontal; -}; - -static LLDefaultChildRegistry::Register t1("resize_bar_image_panel"); - LLResizeBar::Params::Params() : max_size("max_size", S32_MAX), snapping_enabled("snapping_enabled", true), resizing_view("resizing_view"), side("side"), - allow_double_click_snapping("allow_double_click_snapping", true), - show_drag_handle("show_drag_handle", false) + allow_double_click_snapping("allow_double_click_snapping", true) { name = "resize_bar"; } LLResizeBar::LLResizeBar(const LLResizeBar::Params& p) -: LLPanel(p), +: LLView(p), mDragLastScreenX( 0 ), mDragLastScreenY( 0 ), mLastMouseScreenX( 0 ), @@ -86,7 +58,6 @@ LLResizeBar::LLResizeBar(const LLResizeBar::Params& p) mAllowDoubleClickSnapping(p.allow_double_click_snapping), mResizingView(p.resizing_view), mResizeListener(NULL), - mShowDragHandle(p.show_drag_handle), mImagePanel(NULL) { setFollowsNone(); @@ -116,36 +87,6 @@ LLResizeBar::LLResizeBar(const LLResizeBar::Params& p) default: break; } - - if (mShowDragHandle) - { - LLViewBorder::Params border_params; - border_params.border_thickness = 1; - border_params.highlight_light_color = LLUIColorTable::instance().getColor("ResizebarBorderLight"); - border_params.shadow_dark_color = LLUIColorTable::instance().getColor("ResizebarBorderDark"); - - addBorder(border_params); - setBorderVisible(TRUE); - - LLImagePanel::Params image_panel; - mDragHandleImage = LLUI::getUIImage(LLResizeBar::RIGHT == mSide ? "Vertical Drag Handle" : "Horizontal Drag Handle"); - image_panel.bg_alpha_image = mDragHandleImage; - image_panel.background_visible = true; - image_panel.horizontal = (LLResizeBar::BOTTOM == mSide); - mImagePanel = LLUICtrlFactory::create(image_panel); - setImagePanel(mImagePanel); - } -} - -BOOL LLResizeBar::postBuild() -{ - if (mShowDragHandle) - { - setBackgroundVisible(TRUE); - setTransparentColor(LLUIColorTable::instance().getColor("ResizebarBody")); - } - - return LLPanel::postBuild(); } BOOL LLResizeBar::handleMouseDown(S32 x, S32 y, MASK mask) @@ -433,18 +374,3 @@ LLPanel * LLResizeBar::getImagePanel() const { return getChildCount() > 0 ? (LLPanel *)getChildList()->back() : NULL; } - -void LLResizeBar::draw() -{ - if (mShowDragHandle) - { - S32 image_width = mDragHandleImage->getTextureWidth(); - S32 image_height = mDragHandleImage->getTextureHeight(); - const LLRect& panel_rect = getRect(); - S32 image_left = (panel_rect.getWidth() - image_width) / 2 - 1; - S32 image_bottom = (panel_rect.getHeight() - image_height) / 2; - mImagePanel->setRect(LLRect(image_left, image_bottom + image_height, image_left + image_width, image_bottom)); - } - - LLPanel::draw(); -} diff --git a/indra/llui/llresizebar.h b/indra/llui/llresizebar.h index bcf8ea0b40..20a2406484 100755 --- a/indra/llui/llresizebar.h +++ b/indra/llui/llresizebar.h @@ -27,14 +27,14 @@ #ifndef LL_RESIZEBAR_H #define LL_RESIZEBAR_H -#include "llpanel.h" +#include "llview.h" -class LLResizeBar : public LLPanel +class LLResizeBar : public LLView { public: enum Side { LEFT, TOP, RIGHT, BOTTOM }; - struct Params : public LLInitParam::Block + struct Params : public LLInitParam::Block { Mandatory resizing_view; Mandatory side; @@ -43,7 +43,6 @@ public: Optional max_size; Optional snapping_enabled; Optional allow_double_click_snapping; - Optional show_drag_handle; Params(); }; @@ -52,10 +51,8 @@ protected: LLResizeBar(const LLResizeBar::Params& p); friend class LLUICtrlFactory; - /*virtual*/ BOOL postBuild(); public: - virtual void draw(); virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); @@ -66,7 +63,6 @@ public: void setAllowDoubleClickSnapping(BOOL allow) { mAllowDoubleClickSnapping = allow; } bool canResize() { return getEnabled() && mMaxSize > mMinSize; } void setResizeListener(boost::function listener) {mResizeListener = listener;} - BOOL isShowDragHandle() const { return mShowDragHandle; } void setImagePanel(LLPanel * panelp); LLPanel * getImagePanel() const; @@ -79,9 +75,8 @@ private: S32 mMinSize; S32 mMaxSize; const Side mSide; - BOOL mSnappingEnabled; - BOOL mAllowDoubleClickSnapping; - BOOL mShowDragHandle; + bool mSnappingEnabled, + mAllowDoubleClickSnapping; LLView* mResizingView; boost::function mResizeListener; LLPointer mDragHandleImage; diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 09d74a7f5e..df9dd3e1b5 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -12004,50 +12004,6 @@ Value 1 - UIAvatariconctrlSymbolHPad - - Comment - UI Avatar Icon Control Symbol Horizontal Pad - Persist - 1 - Type - S32 - Value - 2 - - UIAvatariconctrlSymbolVPad - - Comment - UI Avatar Icon Control Symbol Vertical Pad - Persist - 1 - Type - S32 - Value - 2 - - UIAvatariconctrlSymbolSize - - Comment - UI Avatar Icon Control Symbol Size - Persist - 1 - Type - S32 - Value - 5 - - UIAvatariconctrlSymbolPosition - - Comment - UI Avatar Icon Control Symbol Position (TopLeft|TopRight|BottomLeft|BottomRight) - Persist - 1 - Type - String - Value - BottomRight - UIButtonOrigHPad Comment diff --git a/indra/newview/llavatariconctrl.cpp b/indra/newview/llavatariconctrl.cpp index 7a49b77490..746b541f9d 100755 --- a/indra/newview/llavatariconctrl.cpp +++ b/indra/newview/llavatariconctrl.cpp @@ -49,6 +49,18 @@ static LLDefaultChildRegistry::Register r("avatar_icon"); +namespace LLInitParam +{ + void TypeValues::declareValues() + { + declare("BottomLeft", LLAvatarIconCtrlEnums::BOTTOM_LEFT); + declare("BottomRight", LLAvatarIconCtrlEnums::BOTTOM_RIGHT); + declare("TopLeft", LLAvatarIconCtrlEnums::TOP_LEFT); + declare("TopRight", LLAvatarIconCtrlEnums::TOP_RIGHT); + } +} + + bool LLAvatarIconIDCache::LLAvatarIconIDCacheItem::expired() { const F64 SEC_PER_DAY_PLUS_HOUR = (24.0 + 1.0) * 60.0 * 60.0; @@ -145,52 +157,63 @@ void LLAvatarIconIDCache::remove (const LLUUID& avatar_id) LLAvatarIconCtrl::Params::Params() : avatar_id("avatar_id"), draw_tooltip("draw_tooltip", true), - default_icon_name("default_icon_name") + default_icon_name("default_icon_name"), + symbol_hpad("symbol_hpad"), + symbol_vpad("symbol_vpad"), + symbol_size("symbol_size", 1), + symbol_pos("symbol_pos", LLAvatarIconCtrlEnums::BOTTOM_RIGHT) { + changeDefault(min_width, 32); + changeDefault(min_height, 32); } LLAvatarIconCtrl::LLAvatarIconCtrl(const LLAvatarIconCtrl::Params& p) - : LLIconCtrl(p), +: LLIconCtrl(p), LLAvatarPropertiesObserver(), mAvatarId(), mFullName(), mDrawTooltip(p.draw_tooltip), mDefaultIconName(p.default_icon_name), - mAvatarNameCacheConnection() + mAvatarNameCacheConnection(), + mSymbolHpad(p.symbol_hpad), + mSymbolVpad(p.symbol_vpad), + mSymbolSize(p.symbol_size), + mSymbolPos(p.symbol_pos) { mPriority = LLViewerFetchedTexture::BOOST_ICON; LLRect rect = p.rect; - mDrawWidth = llmax(32, rect.getWidth()) ; - mDrawHeight = llmax(32, rect.getHeight()) ; - - static LLUICachedControl llavatariconctrl_symbol_hpad("UIAvatariconctrlSymbolHPad", 2); - static LLUICachedControl llavatariconctrl_symbol_vpad("UIAvatariconctrlSymbolVPad", 2); - static LLUICachedControl llavatariconctrl_symbol_size("UIAvatariconctrlSymbolSize", 5); - static LLUICachedControl llavatariconctrl_symbol_pos("UIAvatariconctrlSymbolPosition", "BottomRight"); // BottomRight is the default position - S32 left = rect.getWidth() - llavatariconctrl_symbol_size - llavatariconctrl_symbol_hpad; - S32 bottom = llavatariconctrl_symbol_vpad; + S32 left = rect.getWidth() - mSymbolSize - mSymbolHpad; + S32 bottom = mSymbolVpad; - if ("BottomLeft" == (std::string)llavatariconctrl_symbol_pos) + switch(mSymbolPos) + { + case LLAvatarIconCtrlEnums::BOTTOM_LEFT: { - left = llavatariconctrl_symbol_hpad; - bottom = llavatariconctrl_symbol_vpad; + left = mSymbolHpad; + bottom = mSymbolVpad; } - else if ("TopLeft" == (std::string)llavatariconctrl_symbol_pos) + + case LLAvatarIconCtrlEnums::TOP_LEFT: { - left = llavatariconctrl_symbol_hpad; - bottom = rect.getHeight() - llavatariconctrl_symbol_size - llavatariconctrl_symbol_vpad; + left = mSymbolHpad; + bottom = rect.getHeight() - mSymbolSize - mSymbolVpad; } - else if ("TopRight" == (std::string)llavatariconctrl_symbol_pos) + + case LLAvatarIconCtrlEnums::TOP_RIGHT: { - left = rect.getWidth() - llavatariconctrl_symbol_size - llavatariconctrl_symbol_hpad; - bottom = rect.getHeight() - llavatariconctrl_symbol_size - llavatariconctrl_symbol_vpad; + left = rect.getWidth() - mSymbolSize - mSymbolHpad; + bottom = rect.getHeight() - mSymbolSize - mSymbolVpad; } - rect.setOriginAndSize(left, bottom, llavatariconctrl_symbol_size, llavatariconctrl_symbol_size); + case LLAvatarIconCtrlEnums::BOTTOM_RIGHT: + // fallthrough, is default + default: + rect.setOriginAndSize(left, bottom, mSymbolSize, mSymbolSize); + } if (p.avatar_id.isProvided()) { diff --git a/indra/newview/llavatariconctrl.h b/indra/newview/llavatariconctrl.h index 4929efb7d0..5b5720f4ac 100755 --- a/indra/newview/llavatariconctrl.h +++ b/indra/newview/llavatariconctrl.h @@ -29,7 +29,7 @@ #include -#include "../llui/lliconctrl.h" +#include "lliconctrl.h" #include "llavatarpropertiesprocessor.h" #include "llviewermenu.h" @@ -41,14 +41,14 @@ public: struct LLAvatarIconIDCacheItem { LLUUID icon_id; - LLDate cached_time; + LLDate cached_time; bool expired(); }; - LLAvatarIconIDCache():mFilename("avatar_icons_cache.txt") - { - } + LLAvatarIconIDCache() + : mFilename("avatar_icons_cache.txt") + {} void load (); void save (); @@ -64,15 +64,41 @@ protected: std::map mCache;//we cache only LLUID and time }; +namespace LLAvatarIconCtrlEnums +{ + enum ESymbolPos + { + BOTTOM_LEFT, + BOTTOM_RIGHT, + TOP_LEFT, + TOP_RIGHT + }; +} + + +namespace LLInitParam +{ + template<> + struct TypeValues : public TypeValuesHelper + { + static void declareValues(); + }; +} + class LLAvatarIconCtrl : public LLIconCtrl, public LLAvatarPropertiesObserver { public: struct Params : public LLInitParam::Block { - Optional avatar_id; - Optional draw_tooltip; - Optional default_icon_name; + Optional avatar_id; + Optional draw_tooltip; + Optional default_icon_name; + Optional symbol_hpad, + symbol_vpad, + symbol_size; + Optional symbol_pos; + Params(); }; @@ -98,6 +124,10 @@ protected: std::string mFullName; bool mDrawTooltip; std::string mDefaultIconName; + S32 mSymbolHpad, + mSymbolVpad, + mSymbolSize; + LLAvatarIconCtrlEnums::ESymbolPos mSymbolPos; bool updateFromCache(); diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index d20f89456b..7121822015 100755 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -161,7 +161,7 @@ BOOL LLSidepanelInventory::postBuild() { // UI elements from inventory panel { - mInventoryPanel = getChild("sidepanel__inventory_panel"); + mInventoryPanel = getChild("sidepanel_inventory_panel"); mInfoBtn = mInventoryPanel->getChild("info_btn"); mInfoBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onInfoButtonClicked, this)); diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 2f887d7185..dae76272ec 100755 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -70,6 +70,7 @@ S32 LLViewerTextureList::sNumImages = 0; LLViewerTextureList gTextureList; static LLTrace::BlockTimerStatHandle FTM_PROCESS_IMAGES("Process Images"); + /////////////////////////////////////////////////////////////////////////////// LLViewerTextureList::LLViewerTextureList() @@ -1587,28 +1588,31 @@ LLUIImagePtr LLUIImageList::getUIImage(const std::string& image_name, S32 priori } LLUIImagePtr LLUIImageList::loadUIImageByName(const std::string& name, const std::string& filename, - BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLViewerTexture::EBoostLevel boost_priority ) + BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLViewerTexture::EBoostLevel boost_priority, + LLUIImage::EScaleStyle scale_style) { if (boost_priority == LLGLTexture::BOOST_NONE) { boost_priority = LLGLTexture::BOOST_UI; } LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTextureFromFile(filename, FTT_LOCAL_FILE, MIPMAP_NO, boost_priority); - return loadUIImage(imagep, name, use_mips, scale_rect, clip_rect); + return loadUIImage(imagep, name, use_mips, scale_rect, clip_rect, scale_style); } LLUIImagePtr LLUIImageList::loadUIImageByID(const LLUUID& id, - BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLViewerTexture::EBoostLevel boost_priority) + BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLViewerTexture::EBoostLevel boost_priority, + LLUIImage::EScaleStyle scale_style) { if (boost_priority == LLGLTexture::BOOST_NONE) { boost_priority = LLGLTexture::BOOST_UI; } LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, MIPMAP_NO, boost_priority); - return loadUIImage(imagep, id.asString(), use_mips, scale_rect, clip_rect); + return loadUIImage(imagep, id.asString(), use_mips, scale_rect, clip_rect, scale_style); } -LLUIImagePtr LLUIImageList::loadUIImage(LLViewerFetchedTexture* imagep, const std::string& name, BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect) +LLUIImagePtr LLUIImageList::loadUIImage(LLViewerFetchedTexture* imagep, const std::string& name, BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, + LLUIImage::EScaleStyle scale_style) { if (!imagep) return NULL; @@ -1621,6 +1625,8 @@ LLUIImagePtr LLUIImageList::loadUIImage(LLViewerFetchedTexture* imagep, const st imagep->setNoDelete(); LLUIImagePtr new_imagep = new LLUIImage(name, imagep); + new_imagep->setScaleStyle(scale_style); + mUIImages.insert(std::make_pair(name, new_imagep)); mUITextureList.push_back(imagep); @@ -1639,7 +1645,7 @@ LLUIImagePtr LLUIImageList::loadUIImage(LLViewerFetchedTexture* imagep, const st return new_imagep; } -LLUIImagePtr LLUIImageList::preloadUIImage(const std::string& name, const std::string& filename, BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect) +LLUIImagePtr LLUIImageList::preloadUIImage(const std::string& name, const std::string& filename, BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLUIImage::EScaleStyle scale_style) { // look for existing image uuid_ui_image_map_t::iterator found_it = mUIImages.find(name); @@ -1649,7 +1655,7 @@ LLUIImagePtr LLUIImageList::preloadUIImage(const std::string& name, const std::s LL_ERRS() << "UI Image " << name << " already loaded." << LL_ENDL; } - return loadUIImageByName(name, filename, use_mips, scale_rect, clip_rect); + return loadUIImageByName(name, filename, use_mips, scale_rect, clip_rect, LLGLTexture::BOOST_UI, scale_style); } //static @@ -1709,14 +1715,28 @@ void LLUIImageList::onUIImageLoaded( BOOL success, LLViewerFetchedTexture *src_v } } +namespace LLInitParam +{ + template<> + struct TypeValues : public TypeValuesHelper + { + static void declareValues() + { + declare("scale_inner", LLUIImage::SCALE_INNER); + declare("scale_outer", LLUIImage::SCALE_OUTER); + } + }; +} + struct UIImageDeclaration : public LLInitParam::Block { - Mandatory name; - Optional file_name; - Optional preload; - Optional scale; - Optional clip; - Optional use_mips; + Mandatory name; + Optional file_name; + Optional preload; + Optional scale; + Optional clip; + Optional use_mips; + Optional scale_type; UIImageDeclaration() : name("name"), @@ -1724,7 +1744,8 @@ struct UIImageDeclaration : public LLInitParam::Block preload("preload", false), scale("scale"), clip("clip"), - use_mips("use_mips", false) + use_mips("use_mips", false), + scale_type("scale_type", LLUIImage::SCALE_INNER) {} }; @@ -1812,7 +1833,7 @@ bool LLUIImageList::initFromFile() { continue; } - preloadUIImage(image.name, file_name, image.use_mips, image.scale, image.clip); + preloadUIImage(image.name, file_name, image.use_mips, image.scale, image.clip, image.scale_type); } if (cur_pass == PASS_DECODE_NOW && !gSavedSettings.getBOOL("NoPreload")) diff --git a/indra/newview/llviewertexturelist.h b/indra/newview/llviewertexturelist.h index 9dd3a9ee8b..2f84d0947a 100755 --- a/indra/newview/llviewertexturelist.h +++ b/indra/newview/llviewertexturelist.h @@ -218,20 +218,22 @@ public: bool initFromFile(); - LLPointer preloadUIImage(const std::string& name, const std::string& filename, BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect); + LLPointer preloadUIImage(const std::string& name, const std::string& filename, BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLUIImage::EScaleStyle stype); static void onUIImageLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, BOOL final, void* userdata ); private: LLPointer loadUIImageByName(const std::string& name, const std::string& filename, BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null, const LLRect& clip_rect = LLRect::null, - LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_UI); + LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_UI, + LLUIImage::EScaleStyle = LLUIImage::SCALE_INNER); LLPointer loadUIImageByID(const LLUUID& id, BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null, const LLRect& clip_rect = LLRect::null, - LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_UI); + LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_UI, + LLUIImage::EScaleStyle = LLUIImage::SCALE_INNER); - LLPointer loadUIImage(LLViewerFetchedTexture* imagep, const std::string& name, BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null, const LLRect& clip_rect = LLRect::null); + LLPointer loadUIImage(LLViewerFetchedTexture* imagep, const std::string& name, BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null, const LLRect& clip_rect = LLRect::null, LLUIImage::EScaleStyle = LLUIImage::SCALE_INNER); struct LLUIImageLoadData diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 54f60f4441..ff0a692741 100755 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -29,7 +29,7 @@ with the same filename but different name --> - + @@ -231,8 +231,9 @@ with the same filename but different name + - + @@ -646,8 +647,9 @@ with the same filename but different name + - @@ -775,6 +777,4 @@ with the same filename but different name - - diff --git a/indra/newview/skins/default/textures/widgets/horizontal_drag_handle.png b/indra/newview/skins/default/textures/widgets/horizontal_drag_handle.png index 642eac4065..5f5a33be42 100644 Binary files a/indra/newview/skins/default/textures/widgets/horizontal_drag_handle.png and b/indra/newview/skins/default/textures/widgets/horizontal_drag_handle.png differ diff --git a/indra/newview/skins/default/textures/widgets/vertical_drag_handle.png b/indra/newview/skins/default/textures/widgets/vertical_drag_handle.png index b06b70cf36..2ce5208c21 100644 Binary files a/indra/newview/skins/default/textures/widgets/vertical_drag_handle.png and b/indra/newview/skins/default/textures/widgets/vertical_drag_handle.png differ diff --git a/indra/newview/skins/default/xui/en/panel_main_inventory.xml b/indra/newview/skins/default/xui/en/panel_main_inventory.xml index 1c882bb099..0518688f45 100755 --- a/indra/newview/skins/default/xui/en/panel_main_inventory.xml +++ b/indra/newview/skins/default/xui/en/panel_main_inventory.xml @@ -1,6 +1,5 @@ - - - Purchases from the marketplace will be delivered here. - + +Purchases from the marketplace will be delivered here. + - - - -