diff options
Diffstat (limited to 'indra/newview/llvovolume.cpp')
-rw-r--r-- | indra/newview/llvovolume.cpp | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 95cfe29a80..2f88a44308 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3988,7 +3988,25 @@ U32 LLVOVolume::getRenderCost(texture_cost_t &textures) const { if (textures.find(img->getID()) == textures.end()) { - S32 texture_cost = 256 + (S32)(ARC_TEXTURE_COST * (img->getFullHeight() / 128.f + img->getFullWidth() / 128.f)); + S32 texture_cost = 0; + S8 type = img->getType(); + if (type == LLViewerTexture::FETCHED_TEXTURE || type == LLViewerTexture::LOD_TEXTURE) + { + const LLViewerFetchedTexture* fetched_texturep = static_cast<const LLViewerFetchedTexture*>(img); + if (fetched_texturep + && fetched_texturep->getFTType() == FTT_LOCAL_FILE + && (img->getID() == IMG_ALPHA_GRAD_2D || img->getID() == IMG_ALPHA_GRAD) + ) + { + // These two textures appear to switch between each other, but are of different sizes (4x256 and 256x256). + // Hardcode cost from larger one to not cause random complexity changes + texture_cost = 320; + } + } + if (texture_cost == 0) + { + texture_cost = 256 + (S32)(ARC_TEXTURE_COST * (img->getFullHeight() / 128.f + img->getFullWidth() / 128.f)); + } textures.insert(texture_cost_t::value_type(img->getID(), texture_cost)); } } @@ -5451,8 +5469,8 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) U32 useage = group->getSpatialPartition()->mBufferUsage; - LLCachedControl<S32> max_vbo_size(gSavedSettings, "RenderMaxVBOSize", 512); - LLCachedControl<S32> max_node_size(gSavedSettings, "RenderMaxNodeSize", 65536); + static LLCachedControl<S32> max_vbo_size(gSavedSettings, "RenderMaxVBOSize", 512); + static LLCachedControl<S32> max_node_size(gSavedSettings, "RenderMaxNodeSize", 65536); U32 max_vertices = (max_vbo_size * 1024)/LLVertexBuffer::calcVertexSize(group->getSpatialPartition()->mVertexDataMask); U32 max_total = (max_node_size * 1024) / LLVertexBuffer::calcVertexSize(group->getSpatialPartition()->mVertexDataMask); max_vertices = llmin(max_vertices, (U32) 65535); @@ -6218,7 +6236,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace #endif //calculate maximum number of vertices to store in a single buffer - LLCachedControl<S32> max_vbo_size(gSavedSettings, "RenderMaxVBOSize", 512); + static LLCachedControl<S32> max_vbo_size(gSavedSettings, "RenderMaxVBOSize", 512); U32 max_vertices = (max_vbo_size * 1024)/LLVertexBuffer::calcVertexSize(group->getSpatialPartition()->mVertexDataMask); max_vertices = llmin(max_vertices, (U32) 65535); |