summaryrefslogtreecommitdiff
path: root/indra/llrender
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llrender')
-rw-r--r--indra/llrender/llgl.cpp44
-rw-r--r--indra/llrender/llimagegl.cpp34
-rw-r--r--indra/llrender/llimagegl.h10
-rw-r--r--indra/llrender/llrender.cpp6
4 files changed, 63 insertions, 31 deletions
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index 58183adfce..f24bf6ec78 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -88,24 +88,32 @@ void APIENTRY gl_debug_callback(GLenum source,
{
if (gGLDebugLoggingEnabled)
{
- if (severity == GL_DEBUG_SEVERITY_HIGH_ARB)
- {
- LL_WARNS() << "----- GL ERROR --------" << LL_ENDL;
- }
- else
- {
- LL_WARNS() << "----- GL WARNING -------" << LL_ENDL;
- }
- LL_WARNS() << "Type: " << std::hex << type << LL_ENDL;
- LL_WARNS() << "ID: " << std::hex << id << LL_ENDL;
- LL_WARNS() << "Severity: " << std::hex << severity << LL_ENDL;
- LL_WARNS() << "Message: " << message << LL_ENDL;
- LL_WARNS() << "-----------------------" << LL_ENDL;
- if (severity == GL_DEBUG_SEVERITY_HIGH_ARB)
- {
- LL_ERRS() << "Halting on GL Error" << LL_ENDL;
- }
-}
+
+ if (severity != GL_DEBUG_SEVERITY_HIGH_ARB &&
+ severity != GL_DEBUG_SEVERITY_MEDIUM_ARB &&
+ severity != GL_DEBUG_SEVERITY_LOW_ARB)
+ { //suppress out-of-spec messages sent by nvidia driver (mostly vertexbuffer hints)
+ return;
+ }
+
+ if (severity == GL_DEBUG_SEVERITY_HIGH_ARB)
+ {
+ LL_WARNS() << "----- GL ERROR --------" << LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS() << "----- GL WARNING -------" << LL_ENDL;
+ }
+ LL_WARNS() << "Type: " << std::hex << type << LL_ENDL;
+ LL_WARNS() << "ID: " << std::hex << id << LL_ENDL;
+ LL_WARNS() << "Severity: " << std::hex << severity << LL_ENDL;
+ LL_WARNS() << "Message: " << message << LL_ENDL;
+ LL_WARNS() << "-----------------------" << LL_ENDL;
+ if (severity == GL_DEBUG_SEVERITY_HIGH_ARB)
+ {
+ LL_ERRS() << "Halting on GL Error" << LL_ENDL;
+ }
+ }
}
#endif
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index 894eb8c773..d3af27272b 100644
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -41,6 +41,10 @@
#include "llrender.h"
#include "llwindow.h"
+#if !LL_IMAGEGL_THREAD_CHECK
+#define checkActiveThread()
+#endif
+
//----------------------------------------------------------------------------
const F32 MIN_TEXTURE_LIFETIME = 10.f;
@@ -437,6 +441,10 @@ LLImageGL::~LLImageGL()
void LLImageGL::init(BOOL usemipmaps)
{
+#if LL_IMAGEGL_THREAD_CHECK
+ mActiveThread = LLThread::currentID();
+#endif
+
// keep these members in the same order as declared in llimagehl.h
// so that it is obvious by visual inspection if we forgot to
// init a field.
@@ -1317,6 +1325,8 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt
BOOL LLImageGL::createGLTexture()
{
LL_PROFILE_ZONE_SCOPED;
+ checkActiveThread();
+
if (gGLManager.mIsDisabled)
{
LL_WARNS() << "Trying to create a texture while GL is disabled!" << LL_ENDL;
@@ -1349,6 +1359,8 @@ BOOL LLImageGL::createGLTexture()
BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename/*=0*/, BOOL to_create, S32 category)
{
LL_PROFILE_ZONE_SCOPED;
+ checkActiveThread();
+
if (gGLManager.mIsDisabled)
{
LL_WARNS() << "Trying to create a texture while GL is disabled!" << LL_ENDL;
@@ -1462,6 +1474,8 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S
BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_hasmips, S32 usename)
{
LL_PROFILE_ZONE_SCOPED;
+ checkActiveThread();
+
llassert(data_in);
stop_glerror();
@@ -1576,6 +1590,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_
// mark this as bound at this point, so we don't throw it out immediately
mLastBindTime = sLastFrameTime;
+ checkActiveThread();
return TRUE;
}
@@ -1690,18 +1705,10 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre
return TRUE ;
}
-void LLImageGL::deleteDeadTextures()
-{
- bool reset = false;
-
- if (reset)
- {
- gGL.getTexUnit(0)->activate();
- }
-}
-
void LLImageGL::destroyGLTexture()
{
+ checkActiveThread();
+
if (mTexName != 0)
{
if(mTextureMemory != S32Bytes(0))
@@ -1720,6 +1727,7 @@ void LLImageGL::destroyGLTexture()
//force to invalidate the gl texture, most likely a sculpty texture
void LLImageGL::forceToInvalidateGLTexture()
{
+ checkActiveThread();
if (mTexName != 0)
{
destroyGLTexture();
@@ -2196,6 +2204,12 @@ void LLImageGL::resetCurTexSizebar()
sCurTexPickSize = -1 ;
}
//----------------------------------------------------------------------------
+#if LL_IMAGEGL_THREAD_CHECK
+void LLImageGL::checkActiveThread()
+{
+ llassert(mActiveThread == LLThread::currentID());
+}
+#endif
//----------------------------------------------------------------------------
diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h
index ae773bb362..28996a554a 100644
--- a/indra/llrender/llimagegl.h
+++ b/indra/llrender/llimagegl.h
@@ -40,7 +40,8 @@
#include "threadpool.h"
#include "workqueue.h"
-class LLTextureAtlas ;
+#define LL_IMAGEGL_THREAD_CHECK 0 //set to 1 to enable thread debugging for ImageGL
+
class LLWindow;
#define BYTES_TO_MEGA_BYTES(x) ((x) >> 20)
@@ -54,7 +55,6 @@ public:
// These 2 functions replace glGenTextures() and glDeleteTextures()
static void generateTextures(S32 numTextures, U32 *textures);
static void deleteTextures(S32 numTextures, const U32 *textures);
- static void deleteDeadTextures();
// Size calculation
static S32 dataFormatBits(S32 dataformat);
@@ -189,6 +189,12 @@ public:
BOOL preAddToAtlas(S32 discard_level, const LLImageRaw* raw_image);
void postAddToAtlas() ;
+#if LL_IMAGEGL_THREAD_CHECK
+ // thread debugging
+ std::thread::id mActiveThread;
+ void checkActiveThread();
+#endif
+
public:
// Various GL/Rendering options
S32Bytes mTextureMemory;
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index 235f8a8eb0..8b4f250894 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -181,7 +181,11 @@ void LLTexUnit::bindFast(LLTexture* texture)
mCurrTexture = gl_tex->getTexName();
if (!mCurrTexture)
{
- mCurrTexture = LLImageGL::sDefaultGLTexture->getTexName();
+ LL_PROFILE_ZONE_NAMED("MISSING TEXTURE");
+ //if deleted, will re-generate it immediately
+ texture->forceImmediateUpdate();
+ gl_tex->forceUpdateBindStats();
+ texture->bindDefaultImage(mIndex);
}
glBindTexture(sGLTextureType[gl_tex->getTarget()], mCurrTexture);
mHasMipMaps = gl_tex->mHasMipMaps;