summaryrefslogtreecommitdiff
path: root/indra/newview/lltextureview.cpp
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2024-06-27 13:12:43 -0500
committerGitHub <noreply@github.com>2024-06-27 13:12:43 -0500
commitab87978cbc71cd4c83648627998055a010700f05 (patch)
tree1bf605af76de6f129b10c271517c33acae29fbaa /indra/newview/lltextureview.cpp
parente95df8a28436f6893dfe2f9e46e11fb18a0e1598 (diff)
1836 dont store texture in system memory unless absolutely necessary (#1843)
* #1836 Texture memory usage overhaul. Much decrufting - don't keep a copy of textures in system memory - use GPU to downrez textures instead of reloading from cache - use GPU to generate brightness/darkness bumpmaps
Diffstat (limited to 'indra/newview/lltextureview.cpp')
-rw-r--r--indra/newview/lltextureview.cpp65
1 files changed, 52 insertions, 13 deletions
diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp
index b51bcc5601..9d7319d5b8 100644
--- a/indra/newview/lltextureview.cpp
+++ b/indra/newview/lltextureview.cpp
@@ -461,7 +461,7 @@ public:
: texture_view("texture_view")
{
S32 line_height = LLFontGL::getFontMonospace()->getLineHeight();
- changeDefault(rect, LLRect(0,0,100,line_height * 4));
+ changeDefault(rect, LLRect(0,0,0,line_height * 7));
}
};
@@ -492,19 +492,51 @@ void LLGLTexMemBar::draw()
U32 total_objects = gObjectList.getNumObjects();
F32 x_right = 0.0;
+ U32 image_count = gTextureList.getNumImages();
+ U32 raw_image_count = 0;
+ U64 raw_image_bytes = 0;
+
+ U32 saved_raw_image_count = 0;
+ U64 saved_raw_image_bytes = 0;
+
+ U32 aux_raw_image_count = 0;
+ U64 aux_raw_image_bytes = 0;
+
+ for (auto& image : gTextureList)
+ {
+ const LLImageRaw* raw_image = image->getRawImage();
+
+ if (raw_image)
+ {
+ raw_image_count++;
+ raw_image_bytes += raw_image->getDataSize();
+ }
+
+ raw_image = image->getSavedRawImage();
+ if (raw_image)
+ {
+ saved_raw_image_count++;
+ saved_raw_image_bytes += raw_image->getDataSize();
+ }
+
+ raw_image = image->getAuxRawImage();
+ if (raw_image)
+ {
+ aux_raw_image_count++;
+ aux_raw_image_bytes += raw_image->getDataSize();
+ }
+ }
+
+ F64 raw_image_bytes_MB = raw_image_bytes / (1024.0 * 1024.0);
+ F64 saved_raw_image_bytes_MB = saved_raw_image_bytes / (1024.0 * 1024.0);
+ F64 aux_raw_image_bytes_MB = aux_raw_image_bytes / (1024.0 * 1024.0);
+
//----------------------------------------------------------------------------
LLGLSUIDefault gls_ui;
LLColor4 text_color(1.f, 1.f, 1.f, 0.75f);
LLColor4 color;
- // Gray background using completely magic numbers
- gGL.color4f(0.f, 0.f, 0.f, 0.25f);
- // const LLRect & rect(getRect());
- // gl_rect_2d(-4, v_offset, rect.mRight - rect.mLeft + 2, v_offset + line_height*4);
-
std::string text = "";
- LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, v_offset + line_height*6,
- text_color, LLFontGL::LEFT, LLFontGL::TOP);
LLTrace::Recording& recording = LLViewerStats::instance().getRecording();
@@ -525,6 +557,10 @@ void LLGLTexMemBar::draw()
U32 texFetchLatMed = U32(recording.getMean(LLTextureFetch::sTexFetchLatency).value() * 1000.0f);
U32 texFetchLatMax = U32(recording.getMax(LLTextureFetch::sTexFetchLatency).value() * 1000.0f);
+ // draw a background above first line.... no idea where the rest of the background comes from for the below text
+ gGL.color4f(0.f, 0.f, 0.f, 0.25f);
+ gl_rect_2d(-10, getRect().getHeight() + line_height + 1, getRect().getWidth()+2, getRect().getHeight()+2);
+
text = llformat("Est. Free: %d MB Sys Free: %d MB FBO: %d MB Bias: %.2f Cache: %.1f/%.1f MB",
(S32)LLViewerTexture::sFreeVRAMMegabytes,
LLMemory::getAvailableMemKB()/1024,
@@ -532,11 +568,15 @@ void LLGLTexMemBar::draw()
discard_bias,
cache_usage,
cache_max_usage);
- //, cache_entries, cache_max_entries
-
- LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, v_offset + line_height*6,
+ LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, v_offset + line_height*7,
text_color, LLFontGL::LEFT, LLFontGL::TOP);
+ text = llformat("Images: %d Raw: %d (%.2f MB) Saved: %d (%.2f MB) Aux: %d (%.2f MB)", image_count, raw_image_count, raw_image_bytes_MB,
+ saved_raw_image_count, saved_raw_image_bytes_MB,
+ aux_raw_image_count, aux_raw_image_bytes_MB);
+ LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, v_offset + line_height * 6,
+ text_color, LLFontGL::LEFT, LLFontGL::TOP);
+
U32 cache_read(0U), cache_write(0U), res_wait(0U);
LLAppViewer::getTextureFetch()->getStateStats(&cache_read, &cache_write, &res_wait);
@@ -549,7 +589,6 @@ void LLGLTexMemBar::draw()
cache_read,
cache_write,
res_wait);
-
LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, v_offset + line_height*5,
text_color, LLFontGL::LEFT, LLFontGL::TOP);
@@ -789,7 +828,7 @@ void LLTextureView::draw()
LL_INFOS() << "ID\tMEM\tBOOST\tPRI\tWIDTH\tHEIGHT\tDISCARD" << LL_ENDL;
}
- for (LLViewerTextureList::image_priority_list_t::iterator iter = gTextureList.mImageList.begin();
+ for (LLViewerTextureList::image_list_t::iterator iter = gTextureList.mImageList.begin();
iter != gTextureList.mImageList.end(); )
{
LLPointer<LLViewerFetchedTexture> imagep = *iter++;