diff options
author | Debi King (Dessie) <dessie@lindenlab.com> | 2011-10-06 14:00:26 -0400 |
---|---|---|
committer | Debi King (Dessie) <dessie@lindenlab.com> | 2011-10-06 14:00:26 -0400 |
commit | 0a4b187301e1d5521dda7d2f157a94f02d597365 (patch) | |
tree | 92cee20619bc5406670689bfa06bf9dc45c23bc4 /indra/llrender | |
parent | a7076142429eb604e4f756223b70ff85a5ea3490 (diff) | |
parent | 6095127468f91770abe276b7d55754bbec228df3 (diff) |
merged .hgtags
Diffstat (limited to 'indra/llrender')
-rw-r--r-- | indra/llrender/llrender.cpp | 20 | ||||
-rw-r--r-- | indra/llrender/llrender.h | 1 | ||||
-rw-r--r-- | indra/llrender/llvertexbuffer.cpp | 48 | ||||
-rw-r--r-- | indra/llrender/llvertexbuffer.h | 5 |
4 files changed, 46 insertions, 28 deletions
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index d72918b15d..edcc47aa14 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -927,13 +927,7 @@ LLRender::LLRender() mMode(LLRender::TRIANGLES), mCurrTextureUnitIndex(0), mMaxAnisotropy(0.f) -{ - mBuffer = new LLVertexBuffer(immediate_mask, 0); - mBuffer->allocateBuffer(4096, 0, TRUE); - mBuffer->getVertexStrider(mVerticesp); - mBuffer->getTexCoord0Strider(mTexcoordsp); - mBuffer->getColorStrider(mColorsp); - +{ mTexUnits.reserve(LL_NUM_TEXTURE_LAYERS); for (U32 i = 0; i < LL_NUM_TEXTURE_LAYERS; i++) { @@ -964,6 +958,17 @@ LLRender::~LLRender() shutdown(); } +void LLRender::init() +{ + llassert_always(mBuffer.isNull()) ; + + mBuffer = new LLVertexBuffer(immediate_mask, 0); + mBuffer->allocateBuffer(4096, 0, TRUE); + mBuffer->getVertexStrider(mVerticesp); + mBuffer->getTexCoord0Strider(mTexcoordsp); + mBuffer->getColorStrider(mColorsp); +} + void LLRender::shutdown() { for (U32 i = 0; i < mTexUnits.size(); i++) @@ -979,6 +984,7 @@ void LLRender::shutdown() delete mLightState[i]; } mLightState.clear(); + mBuffer = NULL ; } void LLRender::refreshState(void) diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index 9eedebe2ce..8f7ee30d87 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -310,6 +310,7 @@ public: LLRender(); ~LLRender(); + void init() ; void shutdown(); // Refreshes renderer state to the cached values diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index b6a252e8fa..8fd1193780 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -25,7 +25,6 @@ */ #include "linden_common.h" -#include "llmemory.h" #include <boost/static_assert.hpp> #include "llsys.h" @@ -36,6 +35,7 @@ #include "llrender.h" #include "llvector4a.h" #include "llglslshader.h" +#include "llmemory.h" //============================================================================ @@ -46,6 +46,7 @@ LLVBOPool LLVertexBuffer::sDynamicVBOPool; LLVBOPool LLVertexBuffer::sStreamIBOPool; LLVBOPool LLVertexBuffer::sDynamicIBOPool; +LLPrivateMemoryPool* LLVertexBuffer::sPrivatePoolp = NULL ; U32 LLVertexBuffer::sBindCount = 0; U32 LLVertexBuffer::sSetCount = 0; S32 LLVertexBuffer::sCount = 0; @@ -443,6 +444,11 @@ void LLVertexBuffer::initClass(bool use_vbo, bool no_vbo_mapping) } sDisableVBOMapping = sEnableVBOs && no_vbo_mapping ; + + if(!sPrivatePoolp) + { + sPrivatePoolp = LLPrivateMemoryPoolManager::getInstance()->newPool(LLPrivateMemoryPool::STATIC) ; + } } //static @@ -472,7 +478,11 @@ void LLVertexBuffer::cleanupClass() unbind(); clientCopy(); // deletes GL buffers - //llassert_always(!sCount) ; + if(sPrivatePoolp) + { + LLPrivateMemoryPoolManager::getInstance()->deletePool(sPrivatePoolp) ; + sPrivatePoolp = NULL ; + } } void LLVertexBuffer::clientCopy(F64 max_time) @@ -722,7 +732,7 @@ void LLVertexBuffer::createGLBuffer() { static int gl_buffer_idx = 0; mGLBuffer = ++gl_buffer_idx; - mMappedData = (U8*) ll_aligned_malloc_16(size); + mMappedData = (U8*)ALLOCATE_MEM(sPrivatePoolp, size); } } @@ -756,7 +766,7 @@ void LLVertexBuffer::createGLIndices() } else { - mMappedIndexData = (U8*) ll_aligned_malloc_16(size); + mMappedIndexData = (U8*)ALLOCATE_MEM(sPrivatePoolp, size); static int gl_buffer_idx = 0; mGLIndices = ++gl_buffer_idx; } @@ -779,7 +789,7 @@ void LLVertexBuffer::destroyGLBuffer() } else { - ll_aligned_free_16(mMappedData); + FREE_MEM(sPrivatePoolp, mMappedData) ; mMappedData = NULL; mEmpty = TRUE; } @@ -808,7 +818,7 @@ void LLVertexBuffer::destroyGLIndices() } else { - ll_aligned_free_16(mMappedIndexData); + FREE_MEM(sPrivatePoolp, mMappedIndexData) ; mMappedIndexData = NULL; mEmpty = TRUE; } @@ -941,8 +951,8 @@ void LLVertexBuffer::resizeBuffer(S32 newnverts, S32 newnindices) { if (!useVBOs()) { - ll_aligned_free_16(mMappedData); - mMappedData = (U8*) ll_aligned_malloc_16(newsize); + FREE_MEM(sPrivatePoolp, mMappedData); + mMappedData = (U8*)ALLOCATE_MEM(sPrivatePoolp, newsize); } mResized = TRUE; } @@ -962,8 +972,8 @@ void LLVertexBuffer::resizeBuffer(S32 newnverts, S32 newnindices) { if (!useVBOs()) { - ll_aligned_free_16(mMappedIndexData); - mMappedIndexData = (U8*) ll_aligned_malloc_16(new_index_size); + FREE_MEM(sPrivatePoolp, mMappedIndexData) ; + mMappedIndexData = (U8*)ALLOCATE_MEM(sPrivatePoolp, new_index_size); } mResized = TRUE; } @@ -998,8 +1008,8 @@ void LLVertexBuffer::freeClientBuffer() { if(useVBOs() && sDisableVBOMapping && (mMappedData || mMappedIndexData)) { - ll_aligned_free_16(mMappedData) ; - ll_aligned_free_16(mMappedIndexData) ; + FREE_MEM(sPrivatePoolp, mMappedData) ; + FREE_MEM(sPrivatePoolp, mMappedIndexData) ; mMappedData = NULL ; mMappedIndexData = NULL ; } @@ -1009,7 +1019,7 @@ void LLVertexBuffer::allocateClientVertexBuffer() { if(!mMappedData) { - mMappedData = (U8*)ll_aligned_malloc_16(getSize()); + mMappedData = (U8*)ALLOCATE_MEM(sPrivatePoolp, getSize()); } } @@ -1017,7 +1027,7 @@ void LLVertexBuffer::allocateClientIndexBuffer() { if(!mMappedIndexData) { - mMappedIndexData = (U8*)ll_aligned_malloc_16(getIndicesSize()); + mMappedIndexData = (U8*)ALLOCATE_MEM(sPrivatePoolp, getIndicesSize()); } } @@ -1159,12 +1169,9 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran { 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; - + //check the availability of memory + LLMemory::logMemoryInfo(TRUE) ; + if(!sDisableVBOMapping) { //-------------------- @@ -1324,6 +1331,7 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range) if (!mMappedIndexData) { log_glerror(); + LLMemory::logMemoryInfo(TRUE) ; if(!sDisableVBOMapping) { diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index cc5d11e1c2..578cec3885 100644 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -79,7 +79,7 @@ public: //============================================================================ // base class - +class LLPrivateMemoryPool ; class LLVertexBuffer : public LLRefCount { public: @@ -282,6 +282,9 @@ protected: void waitFence() const; +private: + static LLPrivateMemoryPool* sPrivatePoolp ; + public: static S32 sCount; static S32 sGLCount; |