From 53187303436d06038e40c5938219863c0d75ae5f Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Tue, 16 Aug 2011 17:51:11 -0400 Subject: FIX SH-859, SH-1274 - added fix for determining triangle count and performance tested impact of animated textures Also did some cleanup to ensure branch built and ran properly after last merge. --- indra/newview/llfloatertools.cpp | 3 ++- indra/newview/llmeshrepository.cpp | 9 ++++++-- indra/newview/llmeshrepository.h | 4 ++-- indra/newview/llvovolume.cpp | 44 +++++++++++++------------------------- indra/newview/llvovolume.h | 2 +- 5 files changed, 27 insertions(+), 35 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index c3b5cd4260..e748802738 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -453,6 +453,7 @@ void LLFloaterTools::refresh() F32 link_cost = LLSelectMgr::getInstance()->getSelection()->getSelectedLinksetCost(); S32 prim_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); S32 link_count = LLSelectMgr::getInstance()->getSelection()->getRootObjectCount(); + S32 draw_weight = LLSelectMgr::getInstance()->getSelection()->getSelectedObjectRenderCost(); LLStringUtil::format_map_t selection_args; selection_args["OBJ_COUNT"] = llformat("%.1d", link_count); @@ -481,7 +482,7 @@ void LLFloaterTools::refresh() selection_info << ","; childSetTextArg("selection_weight", "[PHYS_WEIGHT]", llformat("%.1f", link_phys_cost)); - childSetTextArg("selection_weight", "[DISP_WEIGHT]", llformat("%.1d", calcRenderCost())); + childSetTextArg("selection_weight", "[DISP_WEIGHT]", llformat("%.1d", draw_weight)); } else { diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 2b6b2a84e1..fd66d7c515 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -2509,7 +2509,7 @@ S32 LLMeshRepository::getActualMeshLOD(const LLVolumeParams& mesh_params, S32 lo return mThread->getActualMeshLOD(mesh_params, lod); } -const LLMeshSkinInfo* LLMeshRepository::getSkinInfo(const LLUUID& mesh_id, LLVOVolume* requesting_obj) +const LLMeshSkinInfo* LLMeshRepository::getSkinInfo(const LLUUID& mesh_id, const LLVOVolume* requesting_obj) { if (mesh_id.notNull()) { @@ -2765,7 +2765,7 @@ void LLMeshRepository::uploadError(LLSD& args) } //static -F32 LLMeshRepository::getStreamingCost(LLSD& header, F32 radius, S32* bytes, S32* bytes_visible, S32 lod) +F32 LLMeshRepository::getStreamingCost(LLSD& header, F32 radius, S32* bytes, S32* bytes_visible, S32 lod, F32 *unscaled_value) { F32 max_distance = 512.f; @@ -2854,6 +2854,11 @@ F32 LLMeshRepository::getStreamingCost(LLSD& header, F32 radius, S32* bytes, S32 triangles_low*low_area + triangles_lowest*lowest_area; + if (unscaled_value) + { + *unscaled_value = weighted_avg; + } + return weighted_avg/gSavedSettings.getU32("MeshTriangleBudget")*15000.f; } diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h index 35a7314cd5..31b84ea0d9 100755 --- a/indra/newview/llmeshrepository.h +++ b/indra/newview/llmeshrepository.h @@ -445,7 +445,7 @@ public: static U32 sCacheBytesWritten; static U32 sPeakKbps; - static F32 getStreamingCost(LLSD& header, F32 radius, S32* bytes = NULL, S32* visible_bytes = NULL, S32 detail = -1); + static F32 getStreamingCost(LLSD& header, F32 radius, S32* bytes = NULL, S32* visible_bytes = NULL, S32 detail = -1, F32 *unscaled_value = NULL); LLMeshRepository(); @@ -464,7 +464,7 @@ public: S32 getActualMeshLOD(const LLVolumeParams& mesh_params, S32 lod); static S32 getActualMeshLOD(LLSD& header, S32 lod); - const LLMeshSkinInfo* getSkinInfo(const LLUUID& mesh_id, LLVOVolume* requesting_obj); + const LLMeshSkinInfo* getSkinInfo(const LLUUID& mesh_id, const LLVOVolume* requesting_obj); LLModel::Decomposition* getDecomposition(const LLUUID& mesh_id); void fetchPhysicsShape(const LLUUID& mesh_id); bool hasPhysicsShape(const LLUUID& mesh_id); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 2882e644c8..373b7f372b 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -2995,7 +2995,7 @@ U32 LLVOVolume::getRenderCost(texture_cost_t &textures) const static const F32 ARC_WEIGHTED_MESH = 1.2f; // tested based on performance 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_ANIM_TEX_COST = 4.f; // tested based on performance static const F32 ARC_ALPHA_COST = 4.f; // 4x max - based on performance F32 shame = 0; @@ -3023,28 +3023,20 @@ U32 LLVOVolume::getRenderCost(texture_cost_t &textures) const 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 + F32 weighted_triangles = -1.0; + getStreamingCost(NULL, NULL, &weighted_triangles); + + if (weighted_triangles > 0.0) { - 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; - } + num_triangles = (U32)weighted_triangles; } } + if (num_triangles == 0) + { + num_triangles = 4; + } + if (isSculpted()) { if (isMesh()) @@ -3054,18 +3046,12 @@ U32 LLVOVolume::getRenderCost(texture_cost_t &textures) const 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())) + if (gMeshRepo.getSkinInfo(volume_params.getSculptID(), this)) { // 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 { @@ -3231,7 +3217,7 @@ U32 LLVOVolume::getRenderCost(texture_cost_t &textures) const return (U32)shame; } -F32 LLVOVolume::getStreamingCost(S32* bytes, S32* visible_bytes) +F32 LLVOVolume::getStreamingCost(S32* bytes, S32* visible_bytes, F32* unscaled_value) const { F32 radius = getScale().length()*0.5f; @@ -3239,7 +3225,7 @@ F32 LLVOVolume::getStreamingCost(S32* bytes, S32* visible_bytes) { LLSD& header = gMeshRepo.getMeshHeader(getVolume()->getParams().getSculptID()); - return LLMeshRepository::getStreamingCost(header, radius, bytes, visible_bytes, mLOD); + return LLMeshRepository::getStreamingCost(header, radius, bytes, visible_bytes, mLOD, unscaled_value); } else { @@ -3253,7 +3239,7 @@ F32 LLVOVolume::getStreamingCost(S32* bytes, S32* visible_bytes) header["medium_lod"]["size"] = counts[2] * 10; header["high_lod"]["size"] = counts[3] * 10; - return LLMeshRepository::getStreamingCost(header, radius); + return LLMeshRepository::getStreamingCost(header, radius, NULL, NULL, -1, unscaled_value); } } diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index 6e9c0fbcb0..556497f0fa 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -131,7 +131,7 @@ public: /*virtual*/ const LLMatrix4 getRenderMatrix() const; typedef std::map texture_cost_t; U32 getRenderCost(texture_cost_t &textures) const; - /*virtual*/ F32 getStreamingCost(S32* bytes = NULL, S32* visible_bytes = NULL); + /*virtual*/ F32 getStreamingCost(S32* bytes = NULL, S32* visible_bytes = NULL, F32* unscaled_value = NULL) const; /*virtual*/ U32 getTriangleCount() const; /*virtual*/ U32 getHighLODTriangleCount(); -- cgit v1.2.3