summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorCosmic Linden <cosmic@lindenlab.com>2024-10-03 16:43:04 -0700
committerCosmic Linden <cosmic@lindenlab.com>2024-10-03 16:43:04 -0700
commit322b4fb9c4c37787bd219dd97012f121309d591a (patch)
tree0091338c20e5138c7e8da9389a2701a49eab6efc /indra/newview
parentdc7b2adbebea2bd332de52d90dbbe651ee94031c (diff)
secondlife/viewer#2472: Feedback
Disable if not supported for OpenGL version Minimize performance footguns Simplify for clause
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/settings.xml13
-rw-r--r--indra/newview/llviewertexturelist.cpp27
-rw-r--r--indra/newview/llviewertexturelist.h2
3 files changed, 32 insertions, 10 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 5d3f3d58c6..4d0cffa2a9 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -7935,7 +7935,18 @@
<key>RenderDebugTextureLabel</key>
<map>
<key>Comment</key>
- <string>Enable texture labels via glObjectLabel. Requires restart for some features.</string>
+ <string>Enable texture labels via glObjectLabel.</string>
+ <key>Persist</key>
+ <integer>0</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>0</integer>
+ </map>
+ <key>RenderDebugTextureLabelLocalFiles</key>
+ <map>
+ <key>Comment</key>
+ <string>Enumerate textures with local file names. Doesn't do anything until RenderDebugTextureLabel is set to true. Requires restart.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index 99df814f32..4c13105d5d 100644
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -447,7 +447,7 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromFile(const std::string&
std::string url = "file://" + full_path;
LLViewerFetchedTexture* tex = getImageFromUrl(url, f_type, usemipmaps, boost_priority, texture_type, internal_format, primary_format, force_id);
- static LLCachedControl<bool> debug_texture_label(gSavedSettings, "RenderDebugTextureLabel", false);
+ static LLCachedControl<bool> debug_texture_label(gSavedSettings, "RenderDebugTextureLabelLocalFiles", false);
if (debug_texture_label())
{
gTextureList.mNameTextureList.push_back(LLViewerTextureList::NameElement(tex, filename));
@@ -1160,12 +1160,24 @@ void LLViewerTextureList::updateImagesNameTextures()
auto it = mNameTextureList.begin();
while (it != mNameTextureList.end()) // For ALL textures needing names
{
- if (it->mTex->hasGLTexture())
+ LLViewerFetchedTexture* tex = it->mTex;
+ // Check that the texture is in the list first (otherwise it may be a dead pointer)
+ // A raw pointer ensures textures are cleaned up when this code isn't running.
+ const bool alive = mImageList.find(tex) != mImageList.end();
+
+ if (alive)
{
- if(it->mTex->getTexName())
+ if (tex->hasGLTexture())
{
- it->mTex->setGLObjectLabel(it->mPrefix, true);
- it = mNameTextureList.erase(it); // Assume no rename needed
+ if(tex->getTexName())
+ {
+ tex->setGLObjectLabel(it->mPrefix, true);
+ it = mNameTextureList.erase(it); // Assume no rename needed
+ }
+ else
+ {
+ ++it; // Not ready
+ }
}
else
{
@@ -1174,7 +1186,7 @@ void LLViewerTextureList::updateImagesNameTextures()
}
else
{
- ++it; // Not ready
+ it = mNameTextureList.erase(it); // Remove dead pointer
}
}
}
@@ -1190,9 +1202,8 @@ void LLViewerTextureList::labelAll()
std::string label;
bool error;
- for (image_list_t::iterator it = mImageList.begin(); it != mImageList.end(); ++it)
+ for (LLViewerFetchedTexture* image : mImageList)
{
- LLViewerFetchedTexture* image = *it;
image->getGLObjectLabel(label, error);
if (!error && label.empty())
{
diff --git a/indra/newview/llviewertexturelist.h b/indra/newview/llviewertexturelist.h
index 6424e5c3f0..08dd2d0f7f 100644
--- a/indra/newview/llviewertexturelist.h
+++ b/indra/newview/llviewertexturelist.h
@@ -220,7 +220,7 @@ public:
struct NameElement
{
NameElement(LLViewerFetchedTexture* tex, const std::string& prefix) : mTex(tex), mPrefix(prefix) {}
- LLPointer<LLViewerFetchedTexture> mTex;
+ LLViewerFetchedTexture* mTex;
std::string mPrefix;
};
std::vector<NameElement> mNameTextureList;