diff options
author | Ychebotarev ProductEngine <ychebotarev@productengine.com> | 2010-02-10 20:04:47 +0200 |
---|---|---|
committer | Ychebotarev ProductEngine <ychebotarev@productengine.com> | 2010-02-10 20:04:47 +0200 |
commit | d86c69c7380704a34b22d88511df124ca357d5c1 (patch) | |
tree | 3bc740e62f53b29dab84622a0a8b37dcdeaeaa85 /indra/newview/llviewertexture.cpp | |
parent | e8610200433ef636bbd0b594afe9543cebc06689 (diff) | |
parent | d7140c95e3a667ea5d659802956bc0aa5acfda41 (diff) |
merge
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview/llviewertexture.cpp')
-rw-r--r-- | indra/newview/llviewertexture.cpp | 118 |
1 files changed, 65 insertions, 53 deletions
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 0ad269392d..9893eb5dce 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -715,7 +715,7 @@ void LLViewerTexture::generateGLTexture() LLImageGL* LLViewerTexture::getGLTexture() const { - llassert_always(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()) ; return mGLTexturep ; } @@ -732,7 +732,7 @@ BOOL LLViewerTexture::createGLTexture() BOOL LLViewerTexture::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename, BOOL to_create, S32 category) { - llassert_always(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()) ; BOOL ret = mGLTexturep->createGLTexture(discard_level, imageraw, usename, to_create, category) ; @@ -748,55 +748,55 @@ BOOL LLViewerTexture::createGLTexture(S32 discard_level, const LLImageRaw* image void LLViewerTexture::setExplicitFormat(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, BOOL swap_bytes) { - llassert_always(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()) ; mGLTexturep->setExplicitFormat(internal_format, primary_format, type_format, swap_bytes) ; } void LLViewerTexture::setAddressMode(LLTexUnit::eTextureAddressMode mode) { - llassert_always(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()) ; mGLTexturep->setAddressMode(mode) ; } void LLViewerTexture::setFilteringOption(LLTexUnit::eTextureFilterOptions option) { - llassert_always(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()) ; mGLTexturep->setFilteringOption(option) ; } //virtual S32 LLViewerTexture::getWidth(S32 discard_level) const { - llassert_always(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()) ; return mGLTexturep->getWidth(discard_level) ; } //virtual S32 LLViewerTexture::getHeight(S32 discard_level) const { - llassert_always(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()) ; return mGLTexturep->getHeight(discard_level) ; } S32 LLViewerTexture::getMaxDiscardLevel() const { - llassert_always(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()) ; return mGLTexturep->getMaxDiscardLevel() ; } S32 LLViewerTexture::getDiscardLevel() const { - llassert_always(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()) ; return mGLTexturep->getDiscardLevel() ; } S8 LLViewerTexture::getComponents() const { - llassert_always(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()) ; return mGLTexturep->getComponents() ; } LLGLuint LLViewerTexture::getTexName() const { - llassert_always(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()) ; return mGLTexturep->getTexName() ; } @@ -821,124 +821,124 @@ BOOL LLViewerTexture::getBoundRecently() const LLTexUnit::eTextureType LLViewerTexture::getTarget(void) const { - llassert_always(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()) ; return mGLTexturep->getTarget() ; } BOOL LLViewerTexture::setSubImage(const LLImageRaw* imageraw, S32 x_pos, S32 y_pos, S32 width, S32 height) { - llassert_always(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()) ; return mGLTexturep->setSubImage(imageraw, x_pos, y_pos, width, height) ; } BOOL LLViewerTexture::setSubImage(const U8* datap, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height) { - llassert_always(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()) ; return mGLTexturep->setSubImage(datap, data_width, data_height, x_pos, y_pos, width, height) ; } void LLViewerTexture::setGLTextureCreated (bool initialized) { - llassert_always(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()) ; mGLTexturep->setGLTextureCreated (initialized) ; } void LLViewerTexture::setCategory(S32 category) { - llassert_always(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()) ; mGLTexturep->setCategory(category) ; } LLTexUnit::eTextureAddressMode LLViewerTexture::getAddressMode(void) const { - llassert_always(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()) ; return mGLTexturep->getAddressMode() ; } S32 LLViewerTexture::getTextureMemory() const { - llassert_always(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()) ; return mGLTexturep->mTextureMemory ; } LLGLenum LLViewerTexture::getPrimaryFormat() const { - llassert_always(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()) ; return mGLTexturep->getPrimaryFormat() ; } BOOL LLViewerTexture::getIsAlphaMask() const { - llassert_always(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()) ; return mGLTexturep->getIsAlphaMask() ; } BOOL LLViewerTexture::getMask(const LLVector2 &tc) { - llassert_always(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()) ; return mGLTexturep->getMask(tc) ; } F32 LLViewerTexture::getTimePassedSinceLastBound() { - llassert_always(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()) ; return mGLTexturep->getTimePassedSinceLastBound() ; } BOOL LLViewerTexture::getMissed() const { - llassert_always(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()) ; return mGLTexturep->getMissed() ; } BOOL LLViewerTexture::isJustBound() const { - llassert_always(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()) ; return mGLTexturep->isJustBound() ; } void LLViewerTexture::forceUpdateBindStats(void) const { - llassert_always(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()) ; return mGLTexturep->forceUpdateBindStats() ; } U32 LLViewerTexture::getTexelsInAtlas() const { - llassert_always(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()) ; return mGLTexturep->getTexelsInAtlas() ; } U32 LLViewerTexture::getTexelsInGLTexture() const { - llassert_always(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()) ; return mGLTexturep->getTexelsInGLTexture() ; } BOOL LLViewerTexture::isGLTextureCreated() const { - llassert_always(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()) ; return mGLTexturep->isGLTextureCreated() ; } S32 LLViewerTexture::getDiscardLevelInAtlas() const { - llassert_always(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()) ; return mGLTexturep->getDiscardLevelInAtlas() ; } @@ -974,12 +974,6 @@ void LLViewerTexture::updateBindStatsForTester() //start of LLViewerFetchedTexture //---------------------------------------------------------------------------------------------- -//static -F32 LLViewerFetchedTexture::maxDecodePriority() -{ - return 6000000.f; -} - LLViewerFetchedTexture::LLViewerFetchedTexture(const LLUUID& id, const LLHost& host, BOOL usemipmaps) : LLViewerTexture(id, usemipmaps), mTargetHost(host) @@ -1426,6 +1420,13 @@ void LLViewerFetchedTexture::processTextureStats() } } +const F32 MAX_PRIORITY_PIXEL = 999.f ; //pixel area +const F32 PRIORITY_BOOST_LEVEL_FACTOR = 1000.f ; //boost level +const F32 PRIORITY_DELTA_DISCARD_LEVEL_FACTOR = 100000.f ; //delta discard +const S32 MAX_DELTA_DISCARD_LEVEL_FOR_PRIORITY = 4 ; +const F32 PRIORITY_ADDITIONAL_FACTOR = 1000000.f ; //additional +const S32 MAX_ADDITIONAL_LEVEL_FOR_PRIORITY = 8 ; +const F32 PRIORITY_BOOST_HIGH_FACTOR = 10000000.f ;//boost high F32 LLViewerFetchedTexture::calcDecodePriority() { #ifndef LL_RELEASE_FOR_DOWNLOAD @@ -1453,7 +1454,7 @@ F32 LLViewerFetchedTexture::calcDecodePriority() bool have_all_data = (cur_discard >= 0 && (cur_discard <= mDesiredDiscardLevel)); F32 pixel_priority = fsqrtf(mMaxVirtualSize); - F32 priority; + F32 priority = 0.f; if (mIsMissingAsset) { priority = 0.0f; @@ -1496,8 +1497,8 @@ F32 LLViewerFetchedTexture::calcDecodePriority() static const F64 log_2 = log(2.0); F32 desired = (F32)(log(32.0/pixel_priority) / log_2); S32 ddiscard = MAX_DISCARD_LEVEL - (S32)desired; - ddiscard = llclamp(ddiscard, 0, 4); - priority = (ddiscard+1)*100000.f; + ddiscard = llclamp(ddiscard, 0, MAX_DELTA_DISCARD_LEVEL_FOR_PRIORITY); + priority = (ddiscard + 1) * PRIORITY_DELTA_DISCARD_LEVEL_FACTOR; } else if ((mMinDiscardLevel > 0) && (cur_discard <= mMinDiscardLevel)) { @@ -1523,42 +1524,53 @@ F32 LLViewerFetchedTexture::calcDecodePriority() // We haven't rendered this in a while, de-prioritize it desired_discard += 2; } - //else - //{ - // // We haven't rendered this in the last half second, and we have a cached raw image, leave the desired discard as-is - // desired_discard = cur_discard; - //} + else + { + // We haven't rendered this in the last half second, and we have a cached raw image, leave the desired discard as-is + desired_discard = cur_discard; + } } S32 ddiscard = cur_discard - desired_discard; - ddiscard = llclamp(ddiscard, 0, 4); - priority = (ddiscard+1)*100000.f; + ddiscard = llclamp(ddiscard, 0, MAX_DELTA_DISCARD_LEVEL_FOR_PRIORITY); + priority = (ddiscard + 1) * PRIORITY_DELTA_DISCARD_LEVEL_FACTOR; } // Priority Formula: // BOOST_HIGH + ADDITIONAL PRI + DELTA DISCARD + BOOST LEVEL + PIXELS - // [10,000,000] + [1-9,000,000] + [1-400,000] + [1-20,000] + [0-999] + // [10,000,000] + [1,000,000-9,000,000] + [100,000-500,000] + [1-20,000] + [0-999] if (priority > 0.0f) { - pixel_priority = llclamp(pixel_priority, 0.0f, 999.f); + pixel_priority = llclamp(pixel_priority, 0.0f, MAX_PRIORITY_PIXEL); - priority = pixel_priority + 1000.f * mBoostLevel; + priority += pixel_priority + PRIORITY_BOOST_LEVEL_FACTOR * mBoostLevel; if ( mBoostLevel > BOOST_HIGH) { - priority += 10000000.f; + priority += PRIORITY_BOOST_HIGH_FACTOR; } if(mAdditionalDecodePriority > 0.0f) { - // 1-9 - S32 additional_priority = (S32)(1.0f + mAdditionalDecodePriority*8.0f + .5f); // round - // priority range += 0-9,000,000 - priority += 1000000.f * (F32)additional_priority; + // priority range += 1,000,000.f-9,000,000.f + priority += PRIORITY_ADDITIONAL_FACTOR * (1.0 + mAdditionalDecodePriority * MAX_ADDITIONAL_LEVEL_FOR_PRIORITY); } } return priority; } + +//static +F32 LLViewerFetchedTexture::maxDecodePriority() +{ + static const F32 max_priority = PRIORITY_BOOST_HIGH_FACTOR + //boost_high + PRIORITY_ADDITIONAL_FACTOR * (MAX_ADDITIONAL_LEVEL_FOR_PRIORITY + 1) + //additional (view dependent factors) + PRIORITY_DELTA_DISCARD_LEVEL_FACTOR * (MAX_DELTA_DISCARD_LEVEL_FOR_PRIORITY + 1) + //delta discard + PRIORITY_BOOST_LEVEL_FACTOR * (BOOST_MAX_LEVEL - 1) + //boost level + MAX_PRIORITY_PIXEL + 1.0f ; //pixel area. + + return max_priority ; +} + //============================================================================ void LLViewerFetchedTexture::setDecodePriority(F32 priority) |