summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/llrender/llgltexture.cpp9
-rw-r--r--indra/newview/app_settings/settings.xml13
-rw-r--r--indra/newview/llviewertexturelist.cpp27
-rw-r--r--indra/newview/llviewertexturelist.h2
4 files changed, 41 insertions, 10 deletions
diff --git a/indra/llrender/llgltexture.cpp b/indra/llrender/llgltexture.cpp
index 9a2b2ef524..bb4205b319 100644
--- a/indra/llrender/llgltexture.cpp
+++ b/indra/llrender/llgltexture.cpp
@@ -170,6 +170,13 @@ bool LLGLTexture::createGLTexture(S32 discard_level, const LLImageRaw* imageraw,
void LLGLTexture::getGLObjectLabel(std::string& label, bool& error) const
{
+ // GL_VERSION_4_3
+ if (gGLManager.mGLVersion < 4.29f)
+ {
+ error = true;
+ label.clear();
+ return;
+ }
if (!mGLTexturep)
{
error = true;
@@ -194,6 +201,8 @@ void LLGLTexture::getGLObjectLabel(std::string& label, bool& error) const
std::string LLGLTexture::setGLObjectLabel(const std::string& prefix, bool append_texname) const
{
+ if (gGLManager.mGLVersion < 4.29f) { return ""; } // GL_VERSION_4_3
+
llassert(mGLTexturep);
if (mGLTexturep)
{
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;