diff options
Diffstat (limited to 'indra/newview/llviewertexturelist.cpp')
| -rw-r--r-- | indra/newview/llviewertexturelist.cpp | 31 | 
1 files changed, 27 insertions, 4 deletions
| diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 411190eb67..c2eb8ddd25 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -901,7 +901,6 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag      if (imagep->getBoostLevel() < LLViewerFetchedTexture::BOOST_HIGH)  // don't bother checking face list for boosted textures      { -        static LLCachedControl<F32> bias_distance_scale(gSavedSettings, "TextureBiasDistanceScale", 1.f);          static LLCachedControl<F32> texture_scale_min(gSavedSettings, "TextureScaleMinAreaFactor", 0.04f);          static LLCachedControl<F32> texture_scale_max(gSavedSettings, "TextureScaleMaxAreaFactor", 25.f); @@ -910,7 +909,12 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag          U32 face_count = 0; -        F32 bias = (F32) llroundf(powf(4, LLViewerTexture::sDesiredDiscardBias - 1.f)); +        // get adjusted bias based on image resolution +        F32 max_discard = F32(imagep->getMaxDiscardLevel()); +        F32 bias = llclamp(max_discard - 2.f, 1.f, LLViewerTexture::sDesiredDiscardBias); + +        // convert bias into a vsize scaler +        bias = (F32) llroundf(powf(4, bias - 1.f));          LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;          for (U32 i = 0; i < LLRender::NUM_TEXTURE_CHANNELS; ++i) @@ -924,7 +928,6 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag                      ++face_count;                      F32 radius;                      F32 cos_angle_to_view_dir; -                    static LLCachedControl<F32> bias_unimportant_threshold(gSavedSettings, "TextureBiasUnimportantFactor", 0.25f);                      if ((gFrameCount - face->mLastTextureUpdate) > 10)                      { // only call calcPixelArea at most once every 10 frames for a given face @@ -958,6 +961,13 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag                          vsize /= bias;                      } +                    // boost resolution of textures that are important to the camera +                    if (face->mInFrustum) +                    { +                        static LLCachedControl<F32> texture_camera_boost(gSavedSettings, "TextureCameraBoost", 8.f); +                        vsize *= llmax(face->mImportanceToCamera*texture_camera_boost, 1.f); +                    } +                      max_vsize = llmax(max_vsize, vsize);                  }              } @@ -1066,13 +1076,26 @@ F32 LLViewerTextureList::updateImagesCreateTextures(F32 max_time)      {          LLViewerFetchedTexture* imagep = mCreateTextureList.front();          llassert(imagep->mCreatePending); -        imagep->createTexture(); + +        // desired discard may change while an image is being decoded. If the texture in VRAM is sufficient +        // for the current desired discard level, skip the texture creation.  This happens more often than it probably +        // should +        bool redundant_load = imagep->hasGLTexture() && imagep->getDiscardLevel() <= imagep->getDesiredDiscardLevel(); + +        if (!redundant_load) +        { +           imagep->createTexture(); +        } +          imagep->postCreateTexture();          imagep->mCreatePending = false;          mCreateTextureList.pop();          if (imagep->hasGLTexture() && imagep->getDiscardLevel() < imagep->getDesiredDiscardLevel())          { +            // NOTE: this may happen if the desired discard reduces while a decode is in progress and does not +            // necessarily indicate a problem, but if log occurrences excede that of dsiplay_stats: FPS, +            // something has probably gone wrong.              LL_WARNS_ONCE("Texture") << "Texture will be downscaled immediately after loading." << LL_ENDL;              imagep->scaleDown();          } | 
