diff options
author | cosmic-linden <111533034+cosmic-linden@users.noreply.github.com> | 2024-11-22 13:29:31 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-22 13:29:31 -0800 |
commit | 3d3332692a08b5faaa0a4123d700ba7338b2090a (patch) | |
tree | f19078130d804346488ce9028dcb74affbd6e8de | |
parent | 2d82fa2bc5321ac4372c256f46fe5a26e58c1a90 (diff) | |
parent | e7a7eedff3b850dd33dc02a299b5f23f73b98859 (diff) |
Merge pull request #3137 from secondlife/v-3104_extrafps
secondlife/viewer#3104: Fix outfit gallery pictures sometimes not loading. Remove texture resolution restriction.
-rw-r--r-- | indra/newview/lloutfitgallery.cpp | 48 | ||||
-rw-r--r-- | indra/newview/lloutfitgallery.h | 1 |
2 files changed, 24 insertions, 25 deletions
diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index 72fb9464d8..b1d5cd9e16 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -55,8 +55,15 @@ static LLPanelInjector<LLOutfitGallery> t_outfit_gallery("outfit_gallery"); -#define MAX_OUTFIT_PHOTO_WIDTH 256 -#define MAX_OUTFIT_PHOTO_HEIGHT 256 +// The maximum resolution at which to load the outfit photo. If the given +// texture has a higher resolution, tell the texture streaming system to +// only load the resolution needed. An in-world object may request to load +// the texture at a higher resolution, but that won't affect textures +// loaded with LLViewerTexture::FETCHED_TEXTURE. (see +// LLOutfitGalleryItem::setImageAssetId and also +// LLViewerTexture::LOD_TEXTURE) +#define MAX_OUTFIT_PHOTO_LOAD_WIDTH 256 +#define MAX_OUTFIT_PHOTO_LOAD_HEIGHT 256 const S32 GALLERY_ITEMS_PER_ROW_MIN = 2; @@ -979,28 +986,18 @@ void LLOutfitGalleryItem::draw() border.mRight = border.mRight + 1; gl_rect_2d(border, border_color, false); - // If the floater is focused, don't apply its alpha to the texture (STORM-677). - const F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency(); if (mTexturep) { - if (mImageUpdatePending && mTexturep->getDiscardLevel() >= 0) - { - mImageUpdatePending = false; - if (mTexturep->getOriginalWidth() > MAX_OUTFIT_PHOTO_WIDTH || mTexturep->getOriginalHeight() > MAX_OUTFIT_PHOTO_HEIGHT) - { - setDefaultImage(); - } - } - else - { - LLRect interior = border; - interior.stretch(-1); + LLRect interior = border; + interior.stretch(-1); - gl_draw_scaled_image(interior.mLeft - 1, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep, UI_VERTEX_COLOR % alpha); + // Pump the priority + const F32 stats = (F32)llmin(interior.getWidth() * interior.getHeight(), MAX_OUTFIT_PHOTO_LOAD_WIDTH * MAX_OUTFIT_PHOTO_LOAD_HEIGHT); + mTexturep->addTextureStats(stats); - // Pump the priority - mTexturep->addTextureStats((F32)(interior.getWidth() * interior.getHeight())); - } + // If the floater is focused, don't apply its alpha to the texture (STORM-677). + const F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency(); + gl_draw_scaled_image(interior.mLeft - 1, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep, UI_VERTEX_COLOR % alpha); } } @@ -1128,14 +1125,18 @@ bool LLOutfitGalleryItem::openOutfitsContent() bool LLOutfitGalleryItem::setImageAssetId(LLUUID image_asset_id) { - LLPointer<LLViewerFetchedTexture> texture = LLViewerTextureManager::getFetchedTexture(image_asset_id, FTT_DEFAULT, MIPMAP_YES, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); - if (texture && texture->getOriginalWidth() <= MAX_OUTFIT_PHOTO_WIDTH && texture->getOriginalHeight() <= MAX_OUTFIT_PHOTO_HEIGHT) + LLPointer<LLViewerFetchedTexture> texture = LLViewerTextureManager::getFetchedTexture(image_asset_id, FTT_DEFAULT, MIPMAP_YES, LLGLTexture::BOOST_NONE, LLViewerTexture::FETCHED_TEXTURE); + if (texture) { mImageAssetId = image_asset_id; mTexturep = texture; + // *TODO: There was previously logic which attempted to toggle + // visibility of the preview icon based on certain conditions, + // however these conditions either did not make sense or were not + // applicable due to texture streaming. Maybe we should only hide + // the preview icon if the texture has at least one mip loaded. mPreviewIcon->setVisible(false); mDefaultImage = false; - mImageUpdatePending = (texture->getDiscardLevel() == -1); return true; } return false; @@ -1152,7 +1153,6 @@ void LLOutfitGalleryItem::setDefaultImage() mImageAssetId.setNull(); mPreviewIcon->setVisible(true); mDefaultImage = true; - mImageUpdatePending = false; } LLContextMenu* LLOutfitGalleryContextMenu::createMenu() diff --git a/indra/newview/lloutfitgallery.h b/indra/newview/lloutfitgallery.h index fa441ff209..541ea2f9d4 100644 --- a/indra/newview/lloutfitgallery.h +++ b/indra/newview/lloutfitgallery.h @@ -266,7 +266,6 @@ private: bool mSelected; bool mWorn; bool mDefaultImage; - bool mImageUpdatePending; bool mHidden; std::string mOutfitName; }; |