summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2020-09-08 21:41:53 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2020-09-08 21:43:13 +0300
commitdceab3c78bb49eab28d1307bb7544e4b2b7763f0 (patch)
tree92b1d11be1146aac8c70349fd7d645b5297ac022 /indra
parent76ee89fb50e394bdaa1cfc85d57d76666beca7fb (diff)
SL-3278 Compensate for randomly-switching textures
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llvovolume.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 98eb2d3cdc..4799fb467f 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -3972,7 +3972,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 = dynamic_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));
}
}