From 53c972a521cbb92c6c9390c41b250a41dc22cd5a Mon Sep 17 00:00:00 2001 From: Steve Bennetts Date: Sun, 25 Oct 2009 23:05:15 -0700 Subject: * Changes to enable differentiating between icon texture priority and other UI texture priority. * Still need to only request smaller mip maps of icon textures --- indra/newview/llavatariconctrl.cpp | 2 + indra/newview/llfloaterland.cpp | 6 +-- indra/newview/llviewertexture.cpp | 8 ++-- indra/newview/llviewertexture.h | 8 ++-- indra/newview/llviewertexturelist.cpp | 72 +++++++++++++++++++++-------------- indra/newview/llviewertexturelist.h | 10 +++-- indra/newview/llworldmapview.cpp | 2 +- 7 files changed, 64 insertions(+), 44 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llavatariconctrl.cpp b/indra/newview/llavatariconctrl.cpp index 7ae1b5cd4a..ebcda13dd4 100644 --- a/indra/newview/llavatariconctrl.cpp +++ b/indra/newview/llavatariconctrl.cpp @@ -152,6 +152,8 @@ LLAvatarIconCtrl::LLAvatarIconCtrl(const LLAvatarIconCtrl::Params& p) : LLIconCtrl(p), mDrawTooltip(p.draw_tooltip) { + mPriority = LLViewerFetchedTexture::BOOST_ICON; + LLRect rect = p.rect; static LLUICachedControl llavatariconctrl_symbol_hpad("UIAvatariconctrlSymbolHPad", 2); diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 488d71aa70..bdf9842b01 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -1054,9 +1054,9 @@ BOOL LLPanelLandObjects::postBuild() mBtnReturnOwnerList = getChild("Return objects..."); mBtnReturnOwnerList->setClickedCallback(onClickReturnOwnerList, this); - mIconAvatarOnline = LLUIImageList::getInstance()->getUIImage("icon_avatar_online.tga"); - mIconAvatarOffline = LLUIImageList::getInstance()->getUIImage("icon_avatar_offline.tga"); - mIconGroup = LLUIImageList::getInstance()->getUIImage("icon_group.tga"); + mIconAvatarOnline = LLUIImageList::getInstance()->getUIImage("icon_avatar_online.tga", 0); + mIconAvatarOffline = LLUIImageList::getInstance()->getUIImage("icon_avatar_offline.tga", 0); + mIconGroup = LLUIImageList::getInstance()->getUIImage("icon_group.tga", 0); mOwnerList = getChild("owner list"); mOwnerList->sortByColumnIndex(3, FALSE); diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 95459a7116..e5c53c91c9 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -191,25 +191,25 @@ LLPointer LLViewerTextureManager::getLocalTexture(const U32 wid LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture( const LLUUID &image_id, BOOL usemipmaps, - BOOL level_immediate, + S32 boost_priority, S8 texture_type, LLGLint internal_format, LLGLenum primary_format, LLHost request_from_host) { - return gTextureList.getImage(image_id, usemipmaps, level_immediate, texture_type, internal_format, primary_format, request_from_host) ; + return gTextureList.getImage(image_id, usemipmaps, boost_priority, texture_type, internal_format, primary_format, request_from_host) ; } LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromFile( const std::string& filename, BOOL usemipmaps, - BOOL level_immediate, + S32 boost_priority, S8 texture_type, LLGLint internal_format, LLGLenum primary_format, const LLUUID& force_id) { - return gTextureList.getImageFromFile(filename, usemipmaps, level_immediate, texture_type, internal_format, primary_format, force_id) ; + return gTextureList.getImageFromFile(filename, usemipmaps, boost_priority, texture_type, internal_format, primary_format, force_id) ; } LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromHost(const LLUUID& image_id, LLHost host) diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index 596bfea670..480e1c1cbc 100644 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -118,10 +118,10 @@ public: BOOST_SELECTED = 12, BOOST_HUD = 13, BOOST_AVATAR_BAKED_SELF = 14, - BOOST_UI = 15, - BOOST_PREVIEW = 16, - BOOST_MAP = 17, - BOOST_MAP_LAYER = 18, + BOOST_ICON = 15, + BOOST_UI = 16, + BOOST_PREVIEW = 17, + BOOST_MAP = 18, BOOST_AVATAR_SELF = 19, // needed for baking avatar BOOST_MAX_LEVEL }; diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 4ad4c8e1ea..b5986c70f5 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -111,10 +111,10 @@ void LLViewerTextureList::doPreloadImages() LL_DEBUGS("ViewerImages") << "Preloading images..." << LL_ENDL; // Set the "missing asset" image - LLViewerFetchedTexture::sMissingAssetImagep = LLViewerTextureManager::getFetchedTextureFromFile("missing_asset.tga", MIPMAP_NO, IMMEDIATE_YES); + LLViewerFetchedTexture::sMissingAssetImagep = LLViewerTextureManager::getFetchedTextureFromFile("missing_asset.tga", MIPMAP_NO, LLViewerFetchedTexture::BOOST_UI); // Set the "white" image - LLViewerFetchedTexture::sWhiteImagep = LLViewerTextureManager::getFetchedTextureFromFile("white.tga", MIPMAP_NO, IMMEDIATE_YES); + LLViewerFetchedTexture::sWhiteImagep = LLViewerTextureManager::getFetchedTextureFromFile("white.tga", MIPMAP_NO, LLViewerFetchedTexture::BOOST_UI); LLUIImageList* image_list = LLUIImageList::getInstance(); @@ -131,31 +131,31 @@ void LLViewerTextureList::doPreloadImages() // prefetch specific UUIDs LLViewerTextureManager::getFetchedTexture(IMG_SHOT, TRUE); LLViewerTextureManager::getFetchedTexture(IMG_SMOKE_POOF, TRUE); - LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTextureFromFile("silhouette.j2c", MIPMAP_YES, IMMEDIATE_YES); + LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTextureFromFile("silhouette.j2c", MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI); if (image) { image->setAddressMode(LLTexUnit::TAM_WRAP); mImagePreloads.insert(image); } - image = LLViewerTextureManager::getFetchedTextureFromFile("world/NoEntryLines.png", MIPMAP_YES, IMMEDIATE_YES); + image = LLViewerTextureManager::getFetchedTextureFromFile("world/NoEntryLines.png", MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI); if (image) { image->setAddressMode(LLTexUnit::TAM_WRAP); mImagePreloads.insert(image); } - image = LLViewerTextureManager::getFetchedTextureFromFile("world/NoEntryPassLines.png", MIPMAP_YES, IMMEDIATE_YES); + image = LLViewerTextureManager::getFetchedTextureFromFile("world/NoEntryPassLines.png", MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI); if (image) { image->setAddressMode(LLTexUnit::TAM_WRAP); mImagePreloads.insert(image); } - image = LLViewerTextureManager::getFetchedTexture(DEFAULT_WATER_NORMAL, MIPMAP_YES, IMMEDIATE_YES); + image = LLViewerTextureManager::getFetchedTexture(DEFAULT_WATER_NORMAL, MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI); if (image) { image->setAddressMode(LLTexUnit::TAM_WRAP); mImagePreloads.insert(image); } - image = LLViewerTextureManager::getFetchedTextureFromFile("transparent.j2c", MIPMAP_YES, IMMEDIATE_YES, LLViewerTexture::FETCHED_TEXTURE, + image = LLViewerTextureManager::getFetchedTextureFromFile("transparent.j2c", MIPMAP_YES, LLViewerFetchedTexture::BOOST_UI, LLViewerTexture::FETCHED_TEXTURE, 0,0,LLUUID("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903")); if (image) { @@ -315,7 +315,7 @@ void LLViewerTextureList::restoreGL() LLViewerFetchedTexture* LLViewerTextureList::getImageFromFile(const std::string& filename, BOOL usemipmaps, - BOOL level_immediate, + S32 boost_priority, S8 texture_type, LLGLint internal_format, LLGLenum primary_format, @@ -369,10 +369,14 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromFile(const std::string& addImage(imagep); - if (level_immediate) + if (boost_priority != 0) { - imagep->dontDiscard(); - imagep->setBoostLevel(LLViewerFetchedTexture::BOOST_UI); + if (boost_priority == LLViewerFetchedTexture::BOOST_UI || + boost_priority == LLViewerFetchedTexture::BOOST_ICON) + { + imagep->dontDiscard(); + } + imagep->setBoostLevel(boost_priority); } } @@ -384,7 +388,7 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromFile(const std::string& LLViewerFetchedTexture* LLViewerTextureList::getImage(const LLUUID &image_id, BOOL usemipmaps, - BOOL level_immediate, + S32 boost_priority, S8 texture_type, LLGLint internal_format, LLGLenum primary_format, @@ -403,7 +407,7 @@ LLViewerFetchedTexture* LLViewerTextureList::getImage(const LLUUID &image_id, if (imagep.isNull()) { - imagep = createImage(image_id, usemipmaps, level_immediate, texture_type, internal_format, primary_format, request_from_host) ; + imagep = createImage(image_id, usemipmaps, boost_priority, texture_type, internal_format, primary_format, request_from_host) ; } imagep->setGLTextureCreated(true); @@ -414,7 +418,7 @@ LLViewerFetchedTexture* LLViewerTextureList::getImage(const LLUUID &image_id, //when this function is called, there is no such texture in the gTextureList with image_id. LLViewerFetchedTexture* LLViewerTextureList::createImage(const LLUUID &image_id, BOOL usemipmaps, - BOOL level_immediate, + S32 boost_priority, S8 texture_type, LLGLint internal_format, LLGLenum primary_format, @@ -443,16 +447,20 @@ LLViewerFetchedTexture* LLViewerTextureList::createImage(const LLUUID &image_id, addImage(imagep); - if (level_immediate) + if (boost_priority != 0) { - imagep->dontDiscard(); - imagep->setBoostLevel(LLViewerFetchedTexture::BOOST_UI); + if (boost_priority == LLViewerFetchedTexture::BOOST_UI || + boost_priority == LLViewerFetchedTexture::BOOST_ICON) + { + imagep->dontDiscard(); + } + imagep->setBoostLevel(boost_priority); } else { //by default, the texure can not be removed from memory even if it is not used. //here turn this off - //if this texture should be set to NO_DELETE, either pass level_immediate == TRUE here, or call setNoDelete() afterwards. + //if this texture should be set to NO_DELETE, call setNoDelete() afterwards. imagep->forceActive() ; } @@ -1286,7 +1294,7 @@ void LLUIImageList::cleanUp() mUITextureList.clear() ; } -LLUIImagePtr LLUIImageList::getUIImageByID(const LLUUID& image_id) +LLUIImagePtr LLUIImageList::getUIImageByID(const LLUUID& image_id, S32 priority) { // use id as image name std::string image_name = image_id.asString(); @@ -1298,10 +1306,12 @@ LLUIImagePtr LLUIImageList::getUIImageByID(const LLUUID& image_id) return found_it->second; } - return loadUIImageByID(image_id); + const BOOL use_mips = FALSE; + const LLRect scale_rect = LLRect::null; + return loadUIImageByID(image_id, use_mips, scale_rect, priority); } -LLUIImagePtr LLUIImageList::getUIImage(const std::string& image_name) +LLUIImagePtr LLUIImageList::getUIImage(const std::string& image_name, S32 priority) { // look for existing image uuid_ui_image_map_t::iterator found_it = mUIImages.find(image_name); @@ -1310,18 +1320,24 @@ LLUIImagePtr LLUIImageList::getUIImage(const std::string& image_name) return found_it->second; } - return loadUIImageByName(image_name, image_name); + const BOOL use_mips = FALSE; + const LLRect scale_rect = LLRect::null; + return loadUIImageByName(image_name, image_name, use_mips, scale_rect, priority); } -LLUIImagePtr LLUIImageList::loadUIImageByName(const std::string& name, const std::string& filename, BOOL use_mips, const LLRect& scale_rect) +LLUIImagePtr LLUIImageList::loadUIImageByName(const std::string& name, const std::string& filename, + BOOL use_mips, const LLRect& scale_rect, S32 boost_priority ) { - LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTextureFromFile(filename, MIPMAP_NO, IMMEDIATE_YES); + if (boost_priority == 0) boost_priority = LLViewerFetchedTexture::BOOST_UI; + LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTextureFromFile(filename, MIPMAP_NO, boost_priority); return loadUIImage(imagep, name, use_mips, scale_rect); } -LLUIImagePtr LLUIImageList::loadUIImageByID(const LLUUID& id, BOOL use_mips, const LLRect& scale_rect) +LLUIImagePtr LLUIImageList::loadUIImageByID(const LLUUID& id, + BOOL use_mips, const LLRect& scale_rect, S32 boost_priority) { - LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTexture(id, MIPMAP_NO, IMMEDIATE_YES); + if (boost_priority == 0) boost_priority = LLViewerFetchedTexture::BOOST_UI; + LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTexture(id, MIPMAP_NO, boost_priority); return loadUIImage(imagep, id.asString(), use_mips, scale_rect); } @@ -1332,11 +1348,11 @@ LLUIImagePtr LLUIImageList::loadUIImage(LLViewerFetchedTexture* imagep, const st imagep->setAddressMode(LLTexUnit::TAM_CLAMP); //all UI images are non-deletable - imagep->setNoDelete() ; + imagep->setNoDelete(); LLUIImagePtr new_imagep = new LLUIImage(name, imagep); mUIImages.insert(std::make_pair(name, new_imagep)); - mUITextureList.push_back(imagep) ; + mUITextureList.push_back(imagep); LLUIImageLoadData* datap = new LLUIImageLoadData; datap->mImageName = name; diff --git a/indra/newview/llviewertexturelist.h b/indra/newview/llviewertexturelist.h index 11d1dd855f..fda57ce981 100644 --- a/indra/newview/llviewertexturelist.h +++ b/indra/newview/llviewertexturelist.h @@ -202,8 +202,8 @@ class LLUIImageList : public LLImageProviderInterface, public LLSingletonsetBoostLevel(LLViewerTexture::BOOST_MAP_LAYER); + current_image->setBoostLevel(LLViewerTexture::BOOST_MAP); current_image->setKnownDrawSize(llround(pix_width * LLUI::sGLScaleFactor.mV[VX]), llround(pix_height * LLUI::sGLScaleFactor.mV[VY])); if (!current_image->hasGLTexture()) -- cgit v1.2.3