From 8fae5d49bf211fbbd58511442f91e09e8c4c0458 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Fri, 7 Jan 2011 18:24:35 -0500 Subject: testing: adding glFlush() each frame for performance testing --- indra/llwindow/llwindowmacosx.cpp | 1 + indra/llwindow/llwindowsdl.cpp | 3 +++ indra/llwindow/llwindowwin32.cpp | 1 + 3 files changed, 5 insertions(+) (limited to 'indra') diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index affd7276cc..fa8ba7bafa 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -1273,6 +1273,7 @@ BOOL LLWindowMacOSX::setSize(const LLCoordScreen size) void LLWindowMacOSX::swapBuffers() { + glFlush(); aglSwapBuffers(mContext); } diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index b65287715c..80566b40c0 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -984,7 +984,10 @@ BOOL LLWindowSDL::setSize(const LLCoordScreen size) void LLWindowSDL::swapBuffers() { if (mWindow) + { + glFlush(); SDL_GL_SwapBuffers(); + } } U32 LLWindowSDL::getFSAASamples() diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index ab089081e6..e457e76f55 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -2858,6 +2858,7 @@ BOOL LLWindowWin32::resetDisplayResolution() void LLWindowWin32::swapBuffers() { + glFlush(); SwapBuffers(mhDC); } -- cgit v1.2.3 From d1683bd65ae2797de9d92658d720b81c3be80fff Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Thu, 13 Jan 2011 13:46:00 -0500 Subject: glFlush != glFinish. doh. --- indra/llwindow/llwindowmacosx.cpp | 2 +- indra/llwindow/llwindowsdl.cpp | 2 +- indra/llwindow/llwindowwin32.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index fa8ba7bafa..db90aaf52a 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -1273,7 +1273,7 @@ BOOL LLWindowMacOSX::setSize(const LLCoordScreen size) void LLWindowMacOSX::swapBuffers() { - glFlush(); + glFinish(); aglSwapBuffers(mContext); } diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index 80566b40c0..e41aa9820f 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -985,7 +985,7 @@ void LLWindowSDL::swapBuffers() { if (mWindow) { - glFlush(); + glFinish(); SDL_GL_SwapBuffers(); } } diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index e457e76f55..aba0dc43eb 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -2858,7 +2858,7 @@ BOOL LLWindowWin32::resetDisplayResolution() void LLWindowWin32::swapBuffers() { - glFlush(); + glFinish(); SwapBuffers(mhDC); } -- cgit v1.2.3 From 01d219ed4c140fbc54069cdcb6d1b671f91e9923 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Tue, 1 Feb 2011 17:26:23 -0500 Subject: removing particle disabling from performance testing so that I can test performance of particles --- indra/newview/llviewercontrol.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 444d5cb902..bc34c369da 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -141,7 +141,6 @@ static bool handleRenderPerfTestChanged(const LLSD& newvalue) LLPipeline::RENDER_TYPE_WATER, LLPipeline::RENDER_TYPE_PASS_GRASS, LLPipeline::RENDER_TYPE_HUD, - LLPipeline::RENDER_TYPE_PARTICLES, LLPipeline::RENDER_TYPE_CLOUDS, LLPipeline::RENDER_TYPE_HUD_PARTICLES, LLPipeline::END_RENDER_TYPES); @@ -157,7 +156,6 @@ static bool handleRenderPerfTestChanged(const LLSD& newvalue) LLPipeline::RENDER_TYPE_WATER, LLPipeline::RENDER_TYPE_PASS_GRASS, LLPipeline::RENDER_TYPE_HUD, - LLPipeline::RENDER_TYPE_PARTICLES, LLPipeline::RENDER_TYPE_CLOUDS, LLPipeline::RENDER_TYPE_HUD_PARTICLES, LLPipeline::END_RENDER_TYPES); -- cgit v1.2.3 From e3816f4577a74bba42ae9091461125ec9698b583 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Tue, 8 Feb 2011 17:00:36 -0500 Subject: adding pausing on startup for windows to help debug application not starting. --- indra/newview/llappviewerwin32.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index d328567a0e..b0bf36f688 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -57,7 +57,7 @@ #include "llcommandlineparser.h" #include "lltrans.h" - +#include "runtimediagnostics.h" #ifndef LL_RELEASE_FOR_DOWNLOAD #include "llwindebug.h" #endif @@ -110,6 +110,7 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) { + RuntimeDiagnostics::CheckPauseOnStartupOption(); LLMemType mt1(LLMemType::MTYPE_STARTUP); const S32 MAX_HEAPS = 255; -- cgit v1.2.3 From 9ef62ba2cecbed3db3eff74a294eb252f018399c Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Wed, 9 Feb 2011 14:01:36 -0500 Subject: forgot to add runtimediagnostics.h. whoops. --- indra/newview/CMakeLists.txt | 1 + indra/newview/runtimediagnostics.h | 256 +++++++++++++++++++++++++++++++++++++ 2 files changed, 257 insertions(+) create mode 100644 indra/newview/runtimediagnostics.h (limited to 'indra') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 8ea0dd1089..ca408d032a 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1136,6 +1136,7 @@ set(viewer_HEADER_FILES macmain.h noise.h pipeline.h + runtimediagnostics.h VertexCache.h VorbisFramework.h ) diff --git a/indra/newview/runtimediagnostics.h b/indra/newview/runtimediagnostics.h new file mode 100644 index 0000000000..b1c2662958 --- /dev/null +++ b/indra/newview/runtimediagnostics.h @@ -0,0 +1,256 @@ + once + + + +#include + + + +/* static*/ class RuntimeDiagnostics + +{ + +public: + + static void CheckPauseOnStartupOption( + + ) + + { + + DWORD dwPause; + + if (GetExecutionOption(TEXT("PauseOnStartup"), &dwPause) == S_OK && dwPause != 0) + + { + + while (true) + + { + + if (IsDebuggerPresent()) + + { + + __debugbreak(); + + break; + + } + + + + Sleep(1000); + + } + + } + + } + + + +private: + + static HRESULT GetExecutionOption( + + LPCTSTR szOptionName, + + DWORD *pValue + + ) + + { + + HRESULT hr; + + DWORD nChar; + + + + *pValue = 0; + + + + CRegKey rkeyExecutionOptions; + + hr = WIN32_ERROR_CALL( rkeyExecutionOptions.Open( + + HKEY_LOCAL_MACHINE, + + TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options"), + + KEY_READ + + ) ); + + + + if (hr == S_OK) + + { + + TCHAR szModPath[MAX_PATH + 1]; + + nChar = GetModuleFileName(NULL, szModPath, ARRAYSIZE(szModPath)); + + hr = WIN32_BOOL_CALL(nChar > 0 && nChar < ARRAYSIZE(szModPath)); + + + + if (hr == S_OK) + + { + + nChar = GetFileNameCharOffset(szModPath); + + + + if (nChar != MAXDWORD) + + { + + CRegKey rkeyExe; + + hr = WIN32_ERROR_CALL( rkeyExe.Open(rkeyExecutionOptions, szModPath + nChar, KEY_QUERY_VALUE) ); + + if (hr == S_OK) + + { + + hr = WIN32_ERROR_CALL( rkeyExe.QueryDWORDValue(szOptionName, *pValue) ); + + } + + } + + else + + { + + hr = E_FAIL; + + } + + } + + } + + + + return hr; + + } + + + + static DWORD GetFileNameCharOffset(LPCTSTR szPath) + + { + + if (!szPath) + + { + + return MAXDWORD; + + } + + + + // Find the last slash + + DWORD dwReturn = 0; + + for (DWORD c = 0; szPath[c] != 0; c++) + + { + + if (c >= INT_MAX) + + { + + return MAXDWORD; // string did not terminate + + } + + + + if (szPath[c] == '\\' || szPath[c] == '/' || (szPath[c] == ':' && c == 1)) + + { + + dwReturn = c + 1; + + } + + } + + + + // Make sure that the string doesn't end at the slash + + if (szPath[dwReturn] == 0) + + { + + dwReturn = MAXDWORD; + + } + + + + return dwReturn; + + } + + + + static inline HRESULT WIN32_ERROR(LONG lError) + + { + + return HRESULT_FROM_WIN32(lError); + + } + + + + static inline HRESULT WIN32_LAST_ERROR() + + { + + return WIN32_ERROR(GetLastError()); + + } + + + + static inline HRESULT WIN32_BOOL_CALL(BOOL rc) + + { + + if (!rc) + + return WIN32_LAST_ERROR(); + + return S_OK; + + } + + + + static inline HRESULT WIN32_ERROR_CALL(LONG lError) + + { + + if (lError != ERROR_SUCCESS) + + return WIN32_ERROR(lError); + + return S_OK; + + } + +}; + -- cgit v1.2.3 From 86a2c4912c72a735f713dfc40a053335a21f3350 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Wed, 9 Feb 2011 16:10:01 -0500 Subject: header got cut off. ugh. --- indra/newview/runtimediagnostics.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/newview/runtimediagnostics.h b/indra/newview/runtimediagnostics.h index b1c2662958..bf385a6361 100644 --- a/indra/newview/runtimediagnostics.h +++ b/indra/newview/runtimediagnostics.h @@ -1,7 +1,4 @@ - once - - - +#pragma once #include -- cgit v1.2.3 From 344ddaf9f5945c63c39774f9619069629430e70b Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Fri, 11 Feb 2011 17:30:09 -0500 Subject: reverting windows debugging commits. --- indra/newview/CMakeLists.txt | 1 - indra/newview/llappviewerwin32.cpp | 3 +- indra/newview/runtimediagnostics.h | 253 ------------------------------------- 3 files changed, 1 insertion(+), 256 deletions(-) delete mode 100644 indra/newview/runtimediagnostics.h (limited to 'indra') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index ca408d032a..8ea0dd1089 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1136,7 +1136,6 @@ set(viewer_HEADER_FILES macmain.h noise.h pipeline.h - runtimediagnostics.h VertexCache.h VorbisFramework.h ) diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index b0bf36f688..d328567a0e 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -57,7 +57,7 @@ #include "llcommandlineparser.h" #include "lltrans.h" -#include "runtimediagnostics.h" + #ifndef LL_RELEASE_FOR_DOWNLOAD #include "llwindebug.h" #endif @@ -110,7 +110,6 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) { - RuntimeDiagnostics::CheckPauseOnStartupOption(); LLMemType mt1(LLMemType::MTYPE_STARTUP); const S32 MAX_HEAPS = 255; diff --git a/indra/newview/runtimediagnostics.h b/indra/newview/runtimediagnostics.h deleted file mode 100644 index bf385a6361..0000000000 --- a/indra/newview/runtimediagnostics.h +++ /dev/null @@ -1,253 +0,0 @@ -#pragma once -#include - - - -/* static*/ class RuntimeDiagnostics - -{ - -public: - - static void CheckPauseOnStartupOption( - - ) - - { - - DWORD dwPause; - - if (GetExecutionOption(TEXT("PauseOnStartup"), &dwPause) == S_OK && dwPause != 0) - - { - - while (true) - - { - - if (IsDebuggerPresent()) - - { - - __debugbreak(); - - break; - - } - - - - Sleep(1000); - - } - - } - - } - - - -private: - - static HRESULT GetExecutionOption( - - LPCTSTR szOptionName, - - DWORD *pValue - - ) - - { - - HRESULT hr; - - DWORD nChar; - - - - *pValue = 0; - - - - CRegKey rkeyExecutionOptions; - - hr = WIN32_ERROR_CALL( rkeyExecutionOptions.Open( - - HKEY_LOCAL_MACHINE, - - TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options"), - - KEY_READ - - ) ); - - - - if (hr == S_OK) - - { - - TCHAR szModPath[MAX_PATH + 1]; - - nChar = GetModuleFileName(NULL, szModPath, ARRAYSIZE(szModPath)); - - hr = WIN32_BOOL_CALL(nChar > 0 && nChar < ARRAYSIZE(szModPath)); - - - - if (hr == S_OK) - - { - - nChar = GetFileNameCharOffset(szModPath); - - - - if (nChar != MAXDWORD) - - { - - CRegKey rkeyExe; - - hr = WIN32_ERROR_CALL( rkeyExe.Open(rkeyExecutionOptions, szModPath + nChar, KEY_QUERY_VALUE) ); - - if (hr == S_OK) - - { - - hr = WIN32_ERROR_CALL( rkeyExe.QueryDWORDValue(szOptionName, *pValue) ); - - } - - } - - else - - { - - hr = E_FAIL; - - } - - } - - } - - - - return hr; - - } - - - - static DWORD GetFileNameCharOffset(LPCTSTR szPath) - - { - - if (!szPath) - - { - - return MAXDWORD; - - } - - - - // Find the last slash - - DWORD dwReturn = 0; - - for (DWORD c = 0; szPath[c] != 0; c++) - - { - - if (c >= INT_MAX) - - { - - return MAXDWORD; // string did not terminate - - } - - - - if (szPath[c] == '\\' || szPath[c] == '/' || (szPath[c] == ':' && c == 1)) - - { - - dwReturn = c + 1; - - } - - } - - - - // Make sure that the string doesn't end at the slash - - if (szPath[dwReturn] == 0) - - { - - dwReturn = MAXDWORD; - - } - - - - return dwReturn; - - } - - - - static inline HRESULT WIN32_ERROR(LONG lError) - - { - - return HRESULT_FROM_WIN32(lError); - - } - - - - static inline HRESULT WIN32_LAST_ERROR() - - { - - return WIN32_ERROR(GetLastError()); - - } - - - - static inline HRESULT WIN32_BOOL_CALL(BOOL rc) - - { - - if (!rc) - - return WIN32_LAST_ERROR(); - - return S_OK; - - } - - - - static inline HRESULT WIN32_ERROR_CALL(LONG lError) - - { - - if (lError != ERROR_SUCCESS) - - return WIN32_ERROR(lError); - - return S_OK; - - } - -}; - -- cgit v1.2.3 From 4046a9082d793e71cac26a31d44c127decd6821f Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Fri, 11 Feb 2011 17:37:07 -0500 Subject: re-applying render cost changes for experimentations --- indra/newview/llfloatertools.cpp | 32 +----- indra/newview/llfloatertools.h | 1 - indra/newview/llselectmgr.cpp | 4 +- indra/newview/llvoavatar.cpp | 16 ++- indra/newview/llvovolume.cpp | 237 ++++++++++++++++++++++++++++++--------- indra/newview/llvovolume.h | 5 +- 6 files changed, 198 insertions(+), 97 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index bef830a93e..ceaf3c1449 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -476,7 +476,8 @@ void LLFloaterTools::refresh() if (sShowObjectCost) { std::string prim_cost_string; - LLResMgr::getInstance()->getIntegerString(prim_cost_string, calcRenderCost()); + S32 cost = LLSelectMgr::getInstance()->getSelection()->getSelectedObjectRenderCost(); + LLResMgr::getInstance()->getIntegerString(prim_cost_string, cost); getChild("RenderingCost")->setTextArg("[COUNT]", prim_cost_string); } @@ -1037,35 +1038,6 @@ void LLFloaterTools::onClickGridOptions() //floaterp->addDependentFloater(LLFloaterBuildOptions::getInstance(), FALSE); } -S32 LLFloaterTools::calcRenderCost() -{ - S32 cost = 0; - std::set textures; - - for (LLObjectSelection::iterator selection_iter = LLSelectMgr::getInstance()->getSelection()->begin(); - selection_iter != LLSelectMgr::getInstance()->getSelection()->end(); - ++selection_iter) - { - LLSelectNode *select_node = *selection_iter; - if (select_node) - { - LLViewerObject *vobj = select_node->getObject(); - if (vobj->getVolume()) - { - LLVOVolume* volume = (LLVOVolume*) vobj; - - cost += volume->getRenderCost(textures); - cost += textures.size() * LLVOVolume::ARC_TEXTURE_COST; - textures.clear(); - } - } - } - - - return cost; -} - - // static void LLFloaterTools::setEditTool(void* tool_pointer) { diff --git a/indra/newview/llfloatertools.h b/indra/newview/llfloatertools.h index 87c3d2ab47..d5595445e0 100644 --- a/indra/newview/llfloatertools.h +++ b/indra/newview/llfloatertools.h @@ -114,7 +114,6 @@ private: static bool multipleFacesSelectedConfirm(const LLSD& notification, const LLSD& response); static void setObjectType( LLPCode pcode ); void onClickGridOptions(); - S32 calcRenderCost(); public: LLButton *mBtnFocus; diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 93c9131424..90c2cf1eb4 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -6391,7 +6391,7 @@ U32 LLObjectSelection::getSelectedObjectTriangleCount() return count; } -/*S32 LLObjectSelection::getSelectedObjectRenderCost() +S32 LLObjectSelection::getSelectedObjectRenderCost() { S32 cost = 0; LLVOVolume::texture_cost_t textures; @@ -6415,7 +6415,7 @@ U32 LLObjectSelection::getSelectedObjectTriangleCount() return cost; -}*/ +} //----------------------------------------------------------------------------- diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index a257703b24..950d050f26 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -8241,7 +8241,7 @@ void LLVOAvatar::getImpostorValues(LLVector4a* extents, LLVector3& angle, F32& d void LLVOAvatar::idleUpdateRenderCost() { - static const U32 ARC_BODY_PART_COST = 20; + static const U32 ARC_BODY_PART_COST = 200; static const U32 ARC_LIMIT = 2048; static std::set all_textures; @@ -8252,7 +8252,7 @@ void LLVOAvatar::idleUpdateRenderCost() } U32 cost = 0; - std::set textures; + LLVOVolume::texture_cost_t textures; for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++) { @@ -8293,15 +8293,21 @@ void LLVOAvatar::idleUpdateRenderCost() } + for (LLVOVolume::texture_cost_t::iterator iter = textures.begin(); iter != textures.end(); ++iter) + { + // add the cost of each individual texture in the linkset + cost += iter->second; + } + // Diagnostic output to identify all avatar-related textures. // Does not affect rendering cost calculation. // Could be wrapped in a debug option if output becomes problematic. if (isSelf()) { // print any attachment textures we didn't already know about. - for (std::set::iterator it = textures.begin(); it != textures.end(); ++it) + for (LLVOVolume::texture_cost_t::iterator it = textures.begin(); it != textures.end(); ++it) { - LLUUID image_id = *it; + LLUUID image_id = it->first; if( image_id.isNull() || image_id == IMG_DEFAULT || image_id == IMG_DEFAULT_AVATAR) continue; if (all_textures.find(image_id) == all_textures.end()) @@ -8333,8 +8339,6 @@ void LLVOAvatar::idleUpdateRenderCost() } } - cost += textures.size() * LLVOVolume::ARC_TEXTURE_COST; - setDebugText(llformat("%d", cost)); F32 green = 1.f-llclamp(((F32) cost-(F32)ARC_LIMIT)/(F32)ARC_LIMIT, 0.f, 1.f); F32 red = llmin((F32) cost/(F32)ARC_LIMIT, 1.f); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index be987a2310..01027e6a11 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -2931,24 +2931,35 @@ const LLMatrix4 LLVOVolume::getRenderMatrix() const // total cost is returned value + 5 * size of the resulting set. // Cannot include cost of textures, as they may be re-used in linked // children, and cost should only be increased for unique textures -Nyx -U32 LLVOVolume::getRenderCost(std::set &textures) const +U32 LLVOVolume::getRenderCost(texture_cost_t &textures) const { - // base cost of each prim should be 10 points - static const U32 ARC_PRIM_COST = 10; + // Get access to params we'll need at various points. + // Skip if this is object doesn't have a volume (e.g. is an avatar). + BOOL has_volume = (getVolume() != NULL); + LLVolumeParams volume_params; + LLPathParams path_params; + LLProfileParams profile_params; + + U32 num_triangles = 0; + // per-prim costs - static const U32 ARC_INVISI_COST = 1; - static const U32 ARC_SHINY_COST = 1; - static const U32 ARC_GLOW_COST = 1; - static const U32 ARC_FLEXI_COST = 8; - static const U32 ARC_PARTICLE_COST = 16; - static const U32 ARC_BUMP_COST = 4; + static const U32 ARC_PARTICLE_COST = 1; + static const U32 ARC_PARTICLE_MAX = 2048; + static const U32 ARC_TEXTURE_COST = 5; - // per-face costs - static const U32 ARC_PLANAR_COST = 1; - static const U32 ARC_ANIM_TEX_COST = 4; - static const U32 ARC_ALPHA_COST = 4; + // per-prim multipliers + static const F32 ARC_GLOW_MULT = 1.5f; // tested based on performance + static const F32 ARC_BUMP_MULT = 1.25f; // tested based on performance + static const F32 ARC_FLEXI_MULT = 4; + static const F32 ARC_SHINY_MULT = 1.6f; // tested based on performance + static const F32 ARC_INVISI_COST = 1.2f; // tested based on performance + static const F32 ARC_WEIGHTED_MESH = 1.2f; - U32 shame = ARC_PRIM_COST; + static const F32 ARC_PLANAR_COST = 1.2f; // 1.2x max + static const F32 ARC_ANIM_TEX_COST = 1.4f; // 1.4x max + static const F32 ARC_ALPHA_COST = 4.f; // 4x max + + F32 shame = 0; U32 invisi = 0; U32 shiny = 0; @@ -2957,9 +2968,87 @@ U32 LLVOVolume::getRenderCost(std::set &textures) const U32 flexi = 0; U32 animtex = 0; U32 particles = 0; - U32 scale = 0; U32 bump = 0; U32 planar = 0; + U32 weighted_mesh = 0; + + // these multipliers are variable and can be floating point + F32 scale = 0.f; + + const LLDrawable* drawablep = mDrawable; + U32 num_faces = drawablep->getNumFaces(); + + if (has_volume) + { + volume_params = getVolume()->getParams(); + path_params = volume_params.getPathParams(); + profile_params = volume_params.getProfileParams(); + + F32 radius = getVolume()->mLODScaleBias.scaledVec(getScale()).length(); + S32 default_detail = llclamp((S32) (sqrtf(radius)*LLVOVolume::sLODFactor*4.f), 0, 3); + if (default_detail == getLOD()) + { + num_triangles = getTriangleCount(); + } + else + { + LLVolume* default_volume = LLPrimitive::getVolumeManager()->refVolume(volume_params, default_detail); + if(default_volume != NULL) + { + num_triangles = default_volume->getNumTriangles(); + LLPrimitive::getVolumeManager()->unrefVolume(default_volume); + default_volume = NULL; + } + else + { + has_volume = false; + } + } + } + + if (isSculpted()) + { + if (isMesh()) + { + // base cost is dependent on mesh complexity + // note that 3 is the highest LOD as of the time of this coding. + S32 size = gMeshRepo.getMeshSize(volume_params.getSculptID(),3); + if ( size > 0) + { + num_triangles = (U32)(size / 10.f); // avg 1 triangle per 10 bytes + if (gMeshRepo.getSkinInfo(volume_params.getSculptID())) + { + // weighted attachment - 1 point for every 3 bytes + weighted_mesh = 1; + } + + if (num_triangles == 0) + { + // someone made a really tiny mesh. Approximate with a tetrahedron. + num_triangles = 4; + } + } + else + { + // something went wrong - user should know their content isn't render-free + return 0; + } + } + else + { + const LLSculptParams *sculpt_params = (LLSculptParams *) getParameterEntry(LLNetworkData::PARAMS_SCULPT); + LLUUID sculpt_id = sculpt_params->getSculptTexture(); + if (textures.find(sculpt_id) == textures.end()) + { + LLViewerFetchedTexture *texture = LLViewerTextureManager::getFetchedTexture(sculpt_id); + if (texture) + { + S32 texture_cost = (S32)(ARC_TEXTURE_COST * (texture->getFullHeight() / 128.f + texture->getFullWidth() / 128.f + 1)); + textures.insert(texture_cost_t::value_type(sculpt_id, texture_cost)); + } + } + } + } if (isFlexible()) { @@ -2971,18 +3060,12 @@ U32 LLVOVolume::getRenderCost(std::set &textures) const } const LLVector3& sc = getScale(); - scale += (U32) sc.mV[0] + (U32) sc.mV[1] + (U32) sc.mV[2]; - - const LLDrawable* drawablep = mDrawable; + scale += (sc.mV[0] + sc.mV[1] + sc.mV[2]) / 4.f; // scale to 1/4 the sum of the size + // enforce scale multiplier to be in the range [1,7] (7 was determined to experimentally be a reasonable max) + scale = scale > 7.f ? 7.f : scale; + scale = scale < 1.f ? 1.f : scale; - if (isSculpted()) - { - const LLSculptParams *sculpt_params = (LLSculptParams *) getParameterEntry(LLNetworkData::PARAMS_SCULPT); - LLUUID sculpt_id = sculpt_params->getSculptTexture(); - textures.insert(sculpt_id); - } - - for (S32 i = 0; i < drawablep->getNumFaces(); ++i) + for (S32 i = 0; i < num_faces; ++i) { const LLFace* face = drawablep->getFace(i); const LLTextureEntry* te = face->getTextureEntry(); @@ -2990,12 +3073,16 @@ U32 LLVOVolume::getRenderCost(std::set &textures) const if (img) { - textures.insert(img->getID()); + if (textures.find(img->getID()) == textures.end()) + { + S32 texture_cost = (S32)(ARC_TEXTURE_COST * (img->getFullHeight() / 128.f + img->getFullWidth() / 128.f + 1)); + textures.insert(texture_cost_t::value_type(img->getID(), texture_cost)); + } } if (face->getPoolType() == LLDrawPool::POOL_ALPHA) { - alpha++; + alpha = 1; } else if (img && img->getPrimaryFormat() == GL_ALPHA) { @@ -3006,58 +3093,98 @@ U32 LLVOVolume::getRenderCost(std::set &textures) const { if (te->getBumpmap()) { + // bump is a multiplier, don't add per-face bump = 1; } if (te->getShiny()) { + // shiny is a multiplier, don't add per-face shiny = 1; } if (te->getGlow() > 0.f) { + // glow is a multiplier, don't add per-face glow = 1; } if (face->mTextureMatrix != NULL) { - animtex++; + animtex = 1; } if (te->getTexGen()) { - planar++; + planar = 1; } } } + // shame currently has the "base" cost of 1 point per 50 triangles, min 2. + shame = num_triangles / 50.f; + shame = shame < 2.f ? 2.f : shame; - shame += invisi * ARC_INVISI_COST; - shame += shiny * ARC_SHINY_COST; - shame += glow * ARC_GLOW_COST; - shame += alpha * ARC_ALPHA_COST; - shame += flexi * ARC_FLEXI_COST; - shame += animtex * ARC_ANIM_TEX_COST; - shame += particles * ARC_PARTICLE_COST; - shame += bump * ARC_BUMP_COST; - shame += planar * ARC_PLANAR_COST; - shame += scale; + // factor in scale + shame *= scale; - LLViewerObject::const_child_list_t& child_list = getChildren(); - for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); - iter != child_list.end(); - ++iter) + // multiply by per-face modifiers + if (planar) { - const LLViewerObject* child_objectp = *iter; - const LLDrawable* child_drawablep = child_objectp->mDrawable; - if (child_drawablep) - { - const LLVOVolume* child_volumep = child_drawablep->getVOVolume(); - if (child_volumep) - { - shame += child_volumep->getRenderCost(textures); - } - } + shame *= planar * ARC_PLANAR_COST; + } + + if (animtex) + { + shame *= animtex * ARC_ANIM_TEX_COST; + } + + if (alpha) + { + shame *= alpha * ARC_ALPHA_COST; + } + + if(invisi) + { + shame *= invisi * ARC_INVISI_COST; + } + + if (glow) + { + shame *= glow * ARC_GLOW_MULT; + } + + if (bump) + { + shame *= bump * ARC_BUMP_MULT; + } + + if (shiny) + { + shame *= shiny * ARC_SHINY_MULT; } - return shame; + // multiply shame by multipliers + if (weighted_mesh) + { + shame *= weighted_mesh * ARC_WEIGHTED_MESH; + } + + if (flexi) + { + shame *= flexi * ARC_FLEXI_MULT; + } + + + // add additional costs + if (particles) + { + const LLPartSysData *part_sys_data = &(mPartSourcep->mPartSysData); + const LLPartData *part_data = &(part_sys_data->mPartData); + U32 num_particles = (U32)(part_sys_data->mBurstPartCount * llceil( part_data->mMaxAge / part_sys_data->mBurstRate)); + num_particles = num_particles > ARC_PARTICLE_MAX ? ARC_PARTICLE_MAX : num_particles; + F32 part_size = (llmax(part_data->mStartScale[0], part_data->mEndScale[0]) + llmax(part_data->mStartScale[1], part_data->mEndScale[1])) / 2.f; + shame += num_particles * part_size * ARC_PARTICLE_COST; + } + + return (U32)shame; } F32 LLVOVolume::getStreamingCost() diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index 0c12f14832..e02a5d5675 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -129,7 +129,8 @@ public: const LLMatrix4& getRelativeXform() const { return mRelativeXform; } const LLMatrix3& getRelativeXformInvTrans() const { return mRelativeXformInvTrans; } /*virtual*/ const LLMatrix4 getRenderMatrix() const; - U32 getRenderCost(std::set &textures) const; + typedef std::map texture_cost_t; + U32 getRenderCost(texture_cost_t &textures) const; /*virtual*/ F32 getStreamingCost(); /*virtual*/ U32 getTriangleCount() const; /*virtual*/ BOOL lineSegmentIntersect(const LLVector3& start, const LLVector3& end, @@ -358,8 +359,6 @@ public: static LLPointer sObjectMediaClient; static LLPointer sObjectMediaNavigateClient; - static const U32 ARC_TEXTURE_COST = 5; - protected: static S32 sNumLODChanges; -- cgit v1.2.3 From c10494e370f6399deea835964760628b14f7e299 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Wed, 16 Feb 2011 15:32:48 -0500 Subject: SH-997 FIX verify texture performance stats Got some better, reproducible numbers, which puts 32x32 textures at 538 points and 1024x1024 textures at 1024 points. --- indra/newview/llfloatertools.cpp | 3 ++- indra/newview/llvovolume.cpp | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index ceaf3c1449..1410facb53 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -427,7 +427,8 @@ void LLFloaterTools::refresh() if (sShowObjectCost) { std::string prim_cost_string; - LLResMgr::getInstance()->getIntegerString(prim_cost_string, calcRenderCost()); + S32 cost = LLSelectMgr::getInstance()->getSelection()->getSelectedObjectRenderCost(); + LLResMgr::getInstance()->getIntegerString(prim_cost_string, cost); getChild("RenderingCost")->setTextArg("[COUNT]", prim_cost_string); } diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 01027e6a11..7703019f99 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -2945,7 +2945,7 @@ U32 LLVOVolume::getRenderCost(texture_cost_t &textures) const // per-prim costs static const U32 ARC_PARTICLE_COST = 1; static const U32 ARC_PARTICLE_MAX = 2048; - static const U32 ARC_TEXTURE_COST = 5; + static const U32 ARC_TEXTURE_COST = 32; // per-prim multipliers static const F32 ARC_GLOW_MULT = 1.5f; // tested based on performance @@ -3043,7 +3043,7 @@ U32 LLVOVolume::getRenderCost(texture_cost_t &textures) const LLViewerFetchedTexture *texture = LLViewerTextureManager::getFetchedTexture(sculpt_id); if (texture) { - S32 texture_cost = (S32)(ARC_TEXTURE_COST * (texture->getFullHeight() / 128.f + texture->getFullWidth() / 128.f + 1)); + S32 texture_cost = 512 + (S32)(ARC_TEXTURE_COST * (texture->getFullHeight() / 128.f + texture->getFullWidth() / 128.f)); textures.insert(texture_cost_t::value_type(sculpt_id, texture_cost)); } } @@ -3075,7 +3075,7 @@ U32 LLVOVolume::getRenderCost(texture_cost_t &textures) const { if (textures.find(img->getID()) == textures.end()) { - S32 texture_cost = (S32)(ARC_TEXTURE_COST * (img->getFullHeight() / 128.f + img->getFullWidth() / 128.f + 1)); + S32 texture_cost = 512 + (S32)(ARC_TEXTURE_COST * (img->getFullHeight() / 128.f + img->getFullWidth() / 128.f)); textures.insert(texture_cost_t::value_type(img->getID(), texture_cost)); } } -- cgit v1.2.3 From 24c353a1ad00366b9f4ce57492059ce8caf84ba0 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Tue, 22 Feb 2011 17:29:38 -0500 Subject: first pass at clouding avatars that are too complex --- indra/newview/llviewercontrol.cpp | 6 ++++++ indra/newview/llvoavatar.cpp | 16 ++++++++++++++++ indra/newview/llvoavatar.h | 2 ++ indra/newview/llvovolume.cpp | 10 +++++----- 4 files changed, 29 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index e319eba0ee..d99f3b6c88 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -165,6 +165,11 @@ static bool handleRenderPerfTestChanged(const LLSD& newvalue) return true; } +bool handleRenderAvatarComplexityLimitChanged(const LLSD& newvalue) +{ + return true; +} + bool handleRenderTransparentWaterChanged(const LLSD& newvalue) { LLWorld::getInstance()->updateWaterObjects(); @@ -586,6 +591,7 @@ void settings_setup_listeners() gSavedSettings.getControl("WindLightUseAtmosShaders")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); gSavedSettings.getControl("RenderGammaFull")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); gSavedSettings.getControl("RenderAvatarMaxVisible")->getSignal()->connect(boost::bind(&handleAvatarMaxVisibleChanged, _2)); + gSavedSettings.getControl("RenderAvatarComplexityLimit")->getSignal()->connect(boost::bind(&handleRenderAvatarComplexityLimitChanged, _2)); gSavedSettings.getControl("RenderVolumeLODFactor")->getSignal()->connect(boost::bind(&handleVolumeLODChanged, _2)); gSavedSettings.getControl("RenderAvatarLODFactor")->getSignal()->connect(boost::bind(&handleAvatarLODChanged, _2)); gSavedSettings.getControl("RenderTerrainLODFactor")->getSignal()->connect(boost::bind(&handleTerrainLODChanged, _2)); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 856c068a44..be65af1e71 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6307,6 +6307,11 @@ BOOL LLVOAvatar::getIsCloud() { return TRUE; } + + if (isTooComplex()) + { + return TRUE; + } return FALSE; } @@ -6401,6 +6406,16 @@ BOOL LLVOAvatar::isFullyLoaded() const return mFullyLoaded; } +bool LLVOAvatar::isTooComplex() const +{ + if (gSavedSettings.getS32("RenderAvatarComplexityLimit") > 0 && mVisualComplexity >= gSavedSettings.getS32("RenderAvatarComplexityLimit")) + { + return true; + } + + return false; +} + //----------------------------------------------------------------------------- // findMotion() @@ -8338,6 +8353,7 @@ void LLVOAvatar::idleUpdateRenderCost() } setDebugText(llformat("%d", cost)); + mVisualComplexity = cost; F32 green = 1.f-llclamp(((F32) cost-(F32)ARC_LIMIT)/(F32)ARC_LIMIT, 0.f, 1.f); F32 red = llmin((F32) cost/(F32)ARC_LIMIT, 1.f); mText->setColor(LLColor4(red,green,0,1)); diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 1152475383..f41c385894 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -263,6 +263,7 @@ public: //-------------------------------------------------------------------- public: BOOL isFullyLoaded() const; + bool isTooComplex() const; bool visualParamWeightsAreDefault(); protected: virtual BOOL getIsCloud(); @@ -275,6 +276,7 @@ private: BOOL mPreviousFullyLoaded; BOOL mFullyLoadedInitialized; S32 mFullyLoadedFrameCounter; + S32 mVisualComplexity; LLFrameTimer mFullyLoadedTimer; LLFrameTimer mRuthTimer; protected: diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index e3dea5c788..f5b31d25ac 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -2943,9 +2943,9 @@ U32 LLVOVolume::getRenderCost(texture_cost_t &textures) const U32 num_triangles = 0; // per-prim costs - static const U32 ARC_PARTICLE_COST = 1; - static const U32 ARC_PARTICLE_MAX = 2048; - static const U32 ARC_TEXTURE_COST = 32; + static const U32 ARC_PARTICLE_COST = 1; // determined experimentally + static const U32 ARC_PARTICLE_MAX = 2048; // default values + static const U32 ARC_TEXTURE_COST = 32; // multiplier for texture resolution - performance tested // per-prim multipliers static const F32 ARC_GLOW_MULT = 1.5f; // tested based on performance @@ -2955,9 +2955,9 @@ U32 LLVOVolume::getRenderCost(texture_cost_t &textures) const static const F32 ARC_INVISI_COST = 1.2f; // tested based on performance static const F32 ARC_WEIGHTED_MESH = 1.2f; - static const F32 ARC_PLANAR_COST = 1.2f; // 1.2x max + static const F32 ARC_PLANAR_COST = 1.0f; // tested based on performance to have negligible impact static const F32 ARC_ANIM_TEX_COST = 1.4f; // 1.4x max - static const F32 ARC_ALPHA_COST = 4.f; // 4x max + static const F32 ARC_ALPHA_COST = 4.f; // 4x max - based on performance F32 shame = 0; -- cgit v1.2.3 From d06cab548d7e4daa7a120692f64c10c05927143f Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Wed, 23 Feb 2011 12:56:05 -0500 Subject: forgot to add the new setting to settings.xml --- indra/newview/app_settings/settings.xml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index d71b84739c..1bae39d5d7 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -7046,7 +7046,18 @@ Value 1 - RenderAvatarLODFactor + RenderAvatarComplexityLimit + + Comment + Max visual complexity of avatars in a scens + Persist + 1 + Type + S32 + Value + -1 + + RenderAvatarLODFactor Comment Controls level of detail of avatars (multiplier for current screen area when calculated level of detail) -- cgit v1.2.3 From 77fff26431671ffef8cf482044b1fcd98262d3e0 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Wed, 23 Feb 2011 17:21:54 -0500 Subject: suppressing particles in overly complex avatars when clouding - they should appear as white spheres. --- indra/newview/llvoavatar.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index be65af1e71..7dadf34a2a 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2716,7 +2716,10 @@ void LLVOAvatar::idleUpdateLoadingEffect() LLPartData::LL_PART_EMISSIVE_MASK | // LLPartData::LL_PART_FOLLOW_SRC_MASK | LLPartData::LL_PART_TARGET_POS_MASK ); - setParticleSource(particle_parameters, getID()); + if (!isTooComplex()) // do not generate particles for overly-complex avatars + { + setParticleSource(particle_parameters, getID()); + } } } } -- cgit v1.2.3 From 29dc641fbe7ab77f77fe19e2e7976980f0649b5b Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Tue, 22 Mar 2011 20:39:31 -0400 Subject: initial effort to enable a debug display to show render complexity. Using for internal demo, will get it code reviewed if it merges in. --- indra/newview/llspatialpartition.cpp | 38 ++++++++++++++++++++++ indra/newview/llviewermenu.cpp | 4 +++ indra/newview/llviewerobjectlist.cpp | 4 +++ indra/newview/llvovolume.cpp | 18 ++++++++-- indra/newview/llvovolume.h | 10 +++++- indra/newview/pipeline.h | 1 + indra/newview/skins/default/xui/en/menu_viewer.xml | 10 ++++++ .../skins/default/xui/en/panel_region_terrain.xml | 34 +++++++++++++++++++ 8 files changed, 116 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 5e7af6bbb3..b604908474 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -2792,6 +2792,40 @@ void renderUpdateType(LLDrawable* drawablep) } } +void renderComplexityDisplay(LLDrawable* drawablep) +{ + LLViewerObject* vobj = drawablep->getVObj(); + if (!vobj) + { + return; + } + + LLVOVolume *voVol = dynamic_cast(vobj); + + if (!voVol) + { + return; + } + + LLVOVolume::texture_cost_t textures; + F32 cost = (F32) voVol->getRenderCost(textures) / (F32) LLVOVolume::getRenderComplexityMax(); + + LLGLEnable blend(GL_BLEND); + + F32 red = cost; + F32 green = 1.0f - cost; + + glColor4f(red,green,0,0.5f); + + S32 num_faces = drawablep->getNumFaces(); + if (num_faces) + { + for (S32 i = 0; i < num_faces; ++i) + { + pushVerts(drawablep->getFace(i), LLVertexBuffer::MAP_VERTEX); + } + } +} void renderBoundingBox(LLDrawable* drawable, BOOL set_color = TRUE) { @@ -3906,6 +3940,10 @@ public: { renderUpdateType(drawable); } + if(gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_RENDER_COMPLEXITY)) + { + renderComplexityDisplay(drawable); + } LLVOAvatar* avatar = dynamic_cast(drawable->getVObj().get()); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index f5b0857425..30be2fb8e0 100755 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -993,6 +993,10 @@ U32 info_display_from_string(std::string info_display) { return LLPipeline::RENDER_DEBUG_AGENT_TARGET; } + else if ("" == info_display) + { + return LLPipeline::RENDER_DEBUG_RENDER_COMPLEXITY; + } else { return 0; diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 0071753831..2e8eb9f4a8 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -58,6 +58,7 @@ #include "llviewerregion.h" #include "llviewerstats.h" #include "llviewerstatsrecorder.h" +#include "llvovolume.h" #include "llvoavatarself.h" #include "lltoolmgr.h" #include "lltoolpie.h" @@ -997,6 +998,9 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world) mNumSizeCulled = 0; mNumVisCulled = 0; + // update max computed render cost + LLVOVolume::updateRenderComplexity(); + // compute all sorts of time-based stats // don't factor frames that were paused into the stats if (! mWasPaused) diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index e2d1850e58..7c772ce835 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -87,6 +87,8 @@ F32 LLVOVolume::sLODFactor = 1.f; F32 LLVOVolume::sLODSlopDistanceFactor = 0.5f; //Changing this to zero, effectively disables the LOD transition slop F32 LLVOVolume::sDistanceFactor = 1.0f; S32 LLVOVolume::sNumLODChanges = 0; +S32 LLVOVolume::mRenderComplexity_last = 0; +S32 LLVOVolume::mRenderComplexity_current = 0; LLPointer LLVOVolume::sObjectMediaClient = NULL; LLPointer LLVOVolume::sObjectMediaNavigateClient = NULL; @@ -3206,6 +3208,11 @@ U32 LLVOVolume::getRenderCost(texture_cost_t &textures) const shame += num_particles * part_size * ARC_PARTICLE_COST; } + if (shame > mRenderComplexity_current) + { + mRenderComplexity_current = (S32)shame; + } + return (U32)shame; } @@ -3223,7 +3230,14 @@ F32 LLVOVolume::getStreamingCost() return 0.f; } -U32 LLVOVolume::getTriangleCount() +//static +void LLVOVolume::updateRenderComplexity() +{ + mRenderComplexity_last = mRenderComplexity_current; + mRenderComplexity_current = 0; +} + +U32 LLVOVolume::getTriangleCount() const { U32 count = 0; LLVolume* volume = getVolume(); @@ -4068,7 +4082,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) if ( bindCnt > 0 ) { const int jointCnt = pSkinData->mJointNames.size(); - const int pelvisZOffset = pSkinData->mPelvisOffset; + const int pelvisZOffset = (int)pSkinData->mPelvisOffset; bool fullRig = (jointCnt>=20) ? true : false; if ( fullRig ) { diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index 5af88c6cbd..57faee556f 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -132,7 +132,7 @@ public: typedef std::map texture_cost_t; U32 getRenderCost(texture_cost_t &textures) const; /*virtual*/ F32 getStreamingCost(); - /*virtual*/ U32 getTriangleCount(); + /*virtual*/ U32 getTriangleCount() const; /*virtual*/ BOOL lineSegmentIntersect(const LLVector3& start, const LLVector3& end, S32 face = -1, // which face to check, -1 = ALL_SIDES BOOL pick_transparent = FALSE, @@ -320,11 +320,19 @@ protected: LLFace* addFace(S32 face_index); void updateTEData(); + // stats tracking for render complexity + static S32 mRenderComplexity_last; + static S32 mRenderComplexity_current; + void requestMediaDataUpdate(bool isNew); void cleanUpMediaImpls(); void addMediaImpl(LLViewerMediaImpl* media_impl, S32 texture_index) ; void removeMediaImpl(S32 texture_index) ; public: + + static S32 getRenderComplexityMax() {return mRenderComplexity_last;} + static void updateRenderComplexity(); + LLViewerTextureAnim *mTextureAnimp; U8 mTexAnimMode; private: diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index be58af947c..02bb6d618e 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -448,6 +448,7 @@ public: RENDER_DEBUG_PHYSICS_SHAPES = 0x1000000, RENDER_DEBUG_NORMALS = 0x2000000, RENDER_DEBUG_LOD_INFO = 0x4000000, + RENDER_DEBUG_RENDER_COMPLEXITY = 0x8000000 }; public: diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index ea40a08c95..7a227fb5f9 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -2338,6 +2338,16 @@ function="Advanced.ToggleInfoDisplay" parameter="raycast" /> + + + + + + +