summaryrefslogtreecommitdiff
path: root/indra/llrender
diff options
context:
space:
mode:
authorLogan Dethrow <log@lindenlab.com>2011-05-06 15:25:12 -0400
committerLogan Dethrow <log@lindenlab.com>2011-05-06 15:25:12 -0400
commit39ad3f1d880a26dcf8189cad2501002c189a7ac2 (patch)
treea843d0c5843ca5e6a5fcbdfc6929bc2b21b960d6 /indra/llrender
parent5c7a906b44aa950ec3c8b786fec6516b51f9d66c (diff)
parentdef9f9290e661e6a35b7b255eb71b6e2767fdea0 (diff)
merge
Diffstat (limited to 'indra/llrender')
-rw-r--r--indra/llrender/llgl.cpp29
-rw-r--r--indra/llrender/llgl.h7
-rw-r--r--indra/llrender/llvertexbuffer.cpp4
3 files changed, 12 insertions, 28 deletions
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index c86c89fa9b..b1a4051e96 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -105,7 +105,6 @@ LLMatrix4 gGLObliqueProjectionInverse;
#define LL_GL_NAME_POOLING 0
-LLGLNamePool::pool_list_t LLGLNamePool::sInstances;
std::list<LLGLUpdate*> LLGLUpdate::sGLQ;
#if (LL_WINDOWS || LL_LINUX || LL_SOLARIS) && !LL_MESA_HEADLESS
@@ -1920,22 +1919,8 @@ LLGLNamePool::LLGLNamePool()
{
}
-void LLGLNamePool::registerPool(LLGLNamePool* pool)
-{
- pool_list_t::iterator iter = std::find(sInstances.begin(), sInstances.end(), pool);
- if (iter == sInstances.end())
- {
- sInstances.push_back(pool);
- }
-}
-
LLGLNamePool::~LLGLNamePool()
{
- pool_list_t::iterator iter = std::find(sInstances.begin(), sInstances.end(), this);
- if (iter != sInstances.end())
- {
- sInstances.erase(iter);
- }
}
void LLGLNamePool::upkeep()
@@ -2004,20 +1989,22 @@ void LLGLNamePool::release(GLuint name)
void LLGLNamePool::upkeepPools()
{
LLMemType mt(LLMemType::MTYPE_UPKEEP_POOLS);
- for (pool_list_t::iterator iter = sInstances.begin(); iter != sInstances.end(); ++iter)
+ tracker_t::LLInstanceTrackerScopedGuard guard;
+ for (tracker_t::instance_iter iter = guard.beginInstances(); iter != guard.endInstances(); ++iter)
{
- LLGLNamePool* pool = *iter;
- pool->upkeep();
+ LLGLNamePool & pool = *iter;
+ pool.upkeep();
}
}
//static
void LLGLNamePool::cleanupPools()
{
- for (pool_list_t::iterator iter = sInstances.begin(); iter != sInstances.end(); ++iter)
+ tracker_t::LLInstanceTrackerScopedGuard guard;
+ for (tracker_t::instance_iter iter = guard.beginInstances(); iter != guard.endInstances(); ++iter)
{
- LLGLNamePool* pool = *iter;
- pool->cleanup();
+ LLGLNamePool & pool = *iter;
+ pool.cleanup();
}
}
diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h
index 684fd50883..51b0a1e45f 100644
--- a/indra/llrender/llgl.h
+++ b/indra/llrender/llgl.h
@@ -40,6 +40,7 @@
#include "v4math.h"
#include "llplane.h"
#include "llgltypes.h"
+#include "llinstancetracker.h"
#include "llglheaders.h"
#include "glh/glh_linear.h"
@@ -328,9 +329,11 @@ public:
Generic pooling scheme for things which use GL names (used for occlusion queries and vertex buffer objects).
Prevents thrashing of GL name caches by avoiding calls to glGenFoo and glDeleteFoo.
*/
-class LLGLNamePool
+class LLGLNamePool : public LLInstanceTracker<LLGLNamePool>
{
public:
+ typedef LLInstanceTracker<LLGLNamePool> tracker_t;
+
struct NameEntry
{
GLuint name;
@@ -357,13 +360,11 @@ public:
GLuint allocate();
void release(GLuint name);
- static void registerPool(LLGLNamePool* pool);
static void upkeepPools();
static void cleanupPools();
protected:
typedef std::vector<LLGLNamePool*> pool_list_t;
- static pool_list_t sInstances;
virtual GLuint allocateName() = 0;
virtual void releaseName(GLuint name) = 0;
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index 1beb74eca6..1a5a4f734d 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -323,10 +323,6 @@ void LLVertexBuffer::initClass(bool use_vbo, bool no_vbo_mapping)
}
sDisableVBOMapping = sEnableVBOs && no_vbo_mapping ;
- LLGLNamePool::registerPool(&sDynamicVBOPool);
- LLGLNamePool::registerPool(&sDynamicIBOPool);
- LLGLNamePool::registerPool(&sStreamVBOPool);
- LLGLNamePool::registerPool(&sStreamIBOPool);
}
//static