SL-3278 Compensate for randomly-switching textures

meow-7.2.2
Andrey Kleshchev 2020-09-08 21:41:53 +03:00
parent 76ee89fb50
commit dceab3c78b
1 changed files with 19 additions and 1 deletions

View File

@ -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));
}
}