summaryrefslogtreecommitdiff
path: root/indra/llrender
diff options
context:
space:
mode:
authorLoren Shih <seraph@lindenlab.com>2010-11-08 12:57:26 -0500
committerLoren Shih <seraph@lindenlab.com>2010-11-08 12:57:26 -0500
commita5e63b1dc0ce6c706de46dfea10784838e2d0257 (patch)
tree15c7d26720fe56bfc6adf796b20af4e3a5e94110 /indra/llrender
parentb3ab10923d74e64e543b15d773639a856f9989e7 (diff)
parent124a59263184391b0b4ec418c532b7a715e9b5a3 (diff)
Merge
Diffstat (limited to 'indra/llrender')
-rw-r--r--indra/llrender/llgl.cpp27
-rw-r--r--indra/llrender/llgl.h1
-rw-r--r--indra/llrender/llimagegl.cpp2
-rw-r--r--indra/llrender/llrender.cpp3
-rw-r--r--indra/llrender/llvertexbuffer.cpp12
5 files changed, 44 insertions, 1 deletions
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index 096e8e07ab..6ea63809f8 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -1055,6 +1055,33 @@ void flush_glerror()
glGetError();
}
+//this function outputs gl error to the log file, does not crash the code.
+void log_glerror()
+{
+ if (LL_UNLIKELY(!gGLManager.mInited))
+ {
+ return ;
+ }
+ // Create or update texture to be used with this data
+ GLenum error;
+ error = glGetError();
+ while (LL_UNLIKELY(error))
+ {
+ GLubyte const * gl_error_msg = gluErrorString(error);
+ if (NULL != gl_error_msg)
+ {
+ llwarns << "GL Error: " << error << " GL Error String: " << gl_error_msg << llendl ;
+ }
+ else
+ {
+ // gluErrorString returns NULL for some extensions' error codes.
+ // you'll probably have to grep for the number in glext.h.
+ llwarns << "GL Error: UNKNOWN 0x" << std::hex << error << std::dec << llendl;
+ }
+ error = glGetError();
+ }
+}
+
void do_assert_glerror()
{
if (LL_UNLIKELY(!gGLManager.mInited))
diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h
index b0decc1499..85fab7a0f8 100644
--- a/indra/llrender/llgl.h
+++ b/indra/llrender/llgl.h
@@ -158,6 +158,7 @@ void rotate_quat(LLQuaternion& rotation);
void flush_glerror(); // Flush GL errors when we know we're handling them correctly.
+void log_glerror();
void assert_glerror();
void clear_glerror();
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index 4ae01a59ff..ac43b53ecc 100644
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -1069,6 +1069,8 @@ BOOL LLImageGL::setSubImageFromFrameBuffer(S32 fb_x, S32 fb_y, S32 x_pos, S32 y_
checkTexSize(true) ;
llcallstacks << fb_x << " : " << fb_y << " : " << x_pos << " : " << y_pos << " : " << width << " : " << height <<
" : " << (S32)mComponents << llcallstacksendl ;
+
+ log_glerror() ;
}
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, fb_x, fb_y, x_pos, y_pos, width, height);
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index 46211f1419..fb2d0bc7a7 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -431,6 +431,9 @@ void LLTexUnit::setTextureFilteringOption(LLTexUnit::eTextureFilterOptions optio
if (gGL.mMaxAnisotropy < 1.f)
{
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gGL.mMaxAnisotropy);
+
+ llinfos << "gGL.mMaxAnisotropy: " << gGL.mMaxAnisotropy << llendl ;
+ gGL.mMaxAnisotropy = llmax(1.f, gGL.mMaxAnisotropy) ;
}
glTexParameterf(sGLTextureType[mCurrTexType], GL_TEXTURE_MAX_ANISOTROPY_EXT, gGL.mMaxAnisotropy);
}
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index 5ac5e2e8f4..07ec31dbd5 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -28,7 +28,7 @@
#include "llmemory.h"
#include <boost/static_assert.hpp>
-
+#include "llsys.h"
#include "llvertexbuffer.h"
// #include "llrender.h"
#include "llglheaders.h"
@@ -909,6 +909,14 @@ U8* LLVertexBuffer::mapBuffer(S32 access)
if (!mMappedData)
{
+ log_glerror();
+
+ //check the availability of memory
+ U32 avail_phy_mem, avail_vir_mem;
+ LLMemoryInfo::getAvailableMemoryKB(avail_phy_mem, avail_vir_mem) ;
+ llinfos << "Available physical mwmory(KB): " << avail_phy_mem << llendl ;
+ llinfos << "Available virtual memory(KB): " << avail_vir_mem << llendl;
+
//--------------------
//print out more debug info before crash
llinfos << "vertex buffer size: (num verts : num indices) = " << getNumVerts() << " : " << getNumIndices() << llendl ;
@@ -930,6 +938,8 @@ U8* LLVertexBuffer::mapBuffer(S32 access)
if (!mMappedIndexData)
{
+ log_glerror();
+
GLint buff;
glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff);
if ((GLuint)buff != mGLIndices)