summaryrefslogtreecommitdiff
path: root/indra/llrender
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llrender')
-rw-r--r--indra/llrender/llgl.cpp29
-rw-r--r--indra/llrender/llgl.h7
-rw-r--r--indra/llrender/llshadermgr.cpp2
-rw-r--r--indra/llrender/llvertexbuffer.cpp28
4 files changed, 25 insertions, 41 deletions
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index 99a1e5c826..f29ee0e57e 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
@@ -1945,22 +1944,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()
@@ -2029,20 +2014,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 c77d85ba2b..3d002fd8c4 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"
@@ -332,9 +333,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;
@@ -361,13 +364,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/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp
index 21b02fdb71..98a0a93084 100644
--- a/indra/llrender/llshadermgr.cpp
+++ b/indra/llrender/llshadermgr.cpp
@@ -315,7 +315,7 @@ void LLShaderMgr::dumpObjectLog(GLhandleARB ret, BOOL warns)
}
else
{
- LL_DEBUGS("ShaderLoading") << log << LL_ENDL;
+ LL_INFOS("ShaderLoading") << log << LL_ENDL;
}
}
}
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index 73efbfc999..8c9171ccf4 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -383,10 +383,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
@@ -633,7 +629,7 @@ void LLVertexBuffer::createGLBuffer()
{
static int gl_buffer_idx = 0;
mGLBuffer = ++gl_buffer_idx;
- mMappedData = (U8*) malloc(size);
+ mMappedData = (U8*) ll_aligned_malloc_16(size);
}
}
@@ -667,7 +663,7 @@ void LLVertexBuffer::createGLIndices()
}
else
{
- mMappedIndexData = (U8*) malloc(size);
+ mMappedIndexData = (U8*) ll_aligned_malloc_16(size);
static int gl_buffer_idx = 0;
mGLIndices = ++gl_buffer_idx;
}
@@ -690,7 +686,7 @@ void LLVertexBuffer::destroyGLBuffer()
}
else
{
- free(mMappedData);
+ ll_aligned_free_16(mMappedData);
mMappedData = NULL;
mEmpty = TRUE;
}
@@ -719,7 +715,7 @@ void LLVertexBuffer::destroyGLIndices()
}
else
{
- free(mMappedIndexData);
+ ll_aligned_free_16(mMappedIndexData);
mMappedIndexData = NULL;
mEmpty = TRUE;
}
@@ -852,8 +848,8 @@ void LLVertexBuffer::resizeBuffer(S32 newnverts, S32 newnindices)
{
if (!useVBOs())
{
- free(mMappedData);
- mMappedData = (U8*) malloc(newsize);
+ ll_aligned_free_16(mMappedData);
+ mMappedData = (U8*) ll_aligned_malloc_16(newsize);
}
mResized = TRUE;
}
@@ -873,8 +869,8 @@ void LLVertexBuffer::resizeBuffer(S32 newnverts, S32 newnindices)
{
if (!useVBOs())
{
- free(mMappedIndexData);
- mMappedIndexData = (U8*) malloc(new_index_size);
+ ll_aligned_free_16(mMappedIndexData);
+ mMappedIndexData = (U8*) ll_aligned_malloc_16(new_index_size);
}
mResized = TRUE;
}
@@ -915,8 +911,8 @@ void LLVertexBuffer::freeClientBuffer()
{
if(useVBOs() && sDisableVBOMapping && (mMappedData || mMappedIndexData))
{
- free(mMappedData) ;
- free(mMappedIndexData) ;
+ ll_aligned_free_16(mMappedData) ;
+ ll_aligned_free_16(mMappedIndexData) ;
mMappedData = NULL ;
mMappedIndexData = NULL ;
}
@@ -926,7 +922,7 @@ void LLVertexBuffer::allocateClientVertexBuffer()
{
if(!mMappedData)
{
- mMappedData = (U8*)malloc(getSize());
+ mMappedData = (U8*)ll_aligned_malloc_16(getSize());
}
}
@@ -934,7 +930,7 @@ void LLVertexBuffer::allocateClientIndexBuffer()
{
if(!mMappedIndexData)
{
- mMappedIndexData = (U8*)malloc(getIndicesSize());
+ mMappedIndexData = (U8*)ll_aligned_malloc_16(getIndicesSize());
}
}