summaryrefslogtreecommitdiff
path: root/indra/llrender
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llrender')
-rw-r--r--indra/llrender/llgl.cpp22
-rw-r--r--indra/llrender/llrender.cpp6
-rw-r--r--indra/llrender/llrender.h3
-rw-r--r--indra/llrender/llvertexbuffer.cpp2
4 files changed, 30 insertions, 3 deletions
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index 42beddc5c7..570a0cbed1 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -60,6 +60,8 @@ BOOL gClothRipple = FALSE;
BOOL gNoRender = FALSE;
LLMatrix4 gGLObliqueProjectionInverse;
+#define LL_GL_NAME_POOLING 0
+
LLGLNamePool::pool_list_t LLGLNamePool::sInstances;
#if (LL_WINDOWS || LL_LINUX) && !LL_MESA_HEADLESS
@@ -1627,6 +1629,7 @@ void LLGLNamePool::cleanup()
GLuint LLGLNamePool::allocate()
{
+#if LL_GL_NAME_POOLING
for (name_list_t::iterator iter = mNameList.begin(); iter != mNameList.end(); ++iter)
{
if (!iter->used)
@@ -1642,18 +1645,33 @@ GLuint LLGLNamePool::allocate()
mNameList.push_back(entry);
return entry.name;
+#else
+ return allocateName();
+#endif
}
void LLGLNamePool::release(GLuint name)
{
+#if LL_GL_NAME_POOLING
for (name_list_t::iterator iter = mNameList.begin(); iter != mNameList.end(); ++iter)
{
if (iter->name == name)
{
- iter->used = FALSE;
- return;
+ if (iter->used)
+ {
+ iter->used = FALSE;
+ return;
+ }
+ else
+ {
+ llerrs << "Attempted to release a pooled name that is not in use!" << llendl;
+ }
}
}
+ llerrs << "Attempted to release a non pooled name!" << llendl;
+#else
+ releaseName(name);
+#endif
}
//static
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index 4a87424bb8..9b116d6410 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -439,10 +439,16 @@ LLRender::LLRender()
LLRender::~LLRender()
{
+ shutdown();
+}
+
+void LLRender::shutdown()
+{
for (U32 i = 0; i < mTexUnits.size(); i++)
{
delete mTexUnits[i];
}
+ mTexUnits.clear();
}
void LLRender::translatef(const GLfloat& x, const GLfloat& y, const GLfloat& z)
diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h
index 7896f6c922..5133f2804e 100644
--- a/indra/llrender/llrender.h
+++ b/indra/llrender/llrender.h
@@ -176,7 +176,8 @@ public:
LLRender();
~LLRender();
-
+ void shutdown();
+
void translatef(const GLfloat& x, const GLfloat& y, const GLfloat& z);
void scalef(const GLfloat& x, const GLfloat& y, const GLfloat& z);
void pushMatrix();
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index 3f2eb61641..2414d2adff 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -195,6 +195,7 @@ void LLVertexBuffer::drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indi
glDrawRangeElements(sGLMode[mode], start, end, count, GL_UNSIGNED_SHORT,
((U16*) getIndicesPointer()) + indices_offset);
+ stop_glerror();
}
void LLVertexBuffer::draw(U32 mode, U32 count, U32 indices_offset) const
@@ -246,6 +247,7 @@ void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const
}
glDrawArrays(sGLMode[mode], first, count);
+ stop_glerror();
}
//static