diff options
author | Andrey Lihatskiy <andreylproductengine@lindenlab.com> | 2018-06-22 12:55:19 +0300 |
---|---|---|
committer | Andrey Lihatskiy <andreylproductengine@lindenlab.com> | 2018-06-22 12:55:19 +0300 |
commit | 5f432147e373c3223ac06797ecff147d447ed79f (patch) | |
tree | 942f163ad33ad3997aee3000cae321f5f693ad57 /indra/llrender/llvertexbuffer.cpp | |
parent | 99d9befb629c97f7c778c8a9ddfb9d0060d54de9 (diff) | |
parent | dc07de2f4a4c49d1877bf743b6f0d209392f6eb6 (diff) |
Merged lindenlab/viewer-release into default
Diffstat (limited to 'indra/llrender/llvertexbuffer.cpp')
-rw-r--r-- | indra/llrender/llvertexbuffer.cpp | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index f10301b42d..e3e605d040 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -98,7 +98,6 @@ U32 LLVertexBuffer::sCurVAOName = 1; U32 LLVertexBuffer::sAllocatedIndexBytes = 0; U32 LLVertexBuffer::sIndexCount = 0; -LLPrivateMemoryPool* LLVertexBuffer::sPrivatePoolp = NULL; U32 LLVertexBuffer::sBindCount = 0; U32 LLVertexBuffer::sSetCount = 0; S32 LLVertexBuffer::sCount = 0; @@ -191,6 +190,10 @@ volatile U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed) if (mUsage != GL_DYNAMIC_COPY_ARB) { //data will be provided by application ret = (U8*) ll_aligned_malloc<64>(size); + if (!ret) + { + LL_ERRS() << "Failed to allocate for LLVBOPool buffer" << LL_ENDL; + } } } else @@ -324,7 +327,7 @@ void LLVBOPool::cleanup() //NOTE: each component must be AT LEAST 4 bytes in size to avoid a performance penalty on AMD hardware -S32 LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_MAX] = +const S32 LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_MAX] = { sizeof(LLVector4), // TYPE_VERTEX, sizeof(LLVector4), // TYPE_NORMAL, @@ -341,7 +344,7 @@ S32 LLVertexBuffer::sTypeSize[LLVertexBuffer::TYPE_MAX] = sizeof(LLVector4), // TYPE_TEXTURE_INDEX (actually exists as position.w), no extra data, but stride is 16 bytes }; -static std::string vb_type_name[] = +static const std::string vb_type_name[] = { "TYPE_VERTEX", "TYPE_NORMAL", @@ -360,7 +363,7 @@ static std::string vb_type_name[] = "TYPE_INDEX", }; -U32 LLVertexBuffer::sGLMode[LLRender::NUM_MODES] = +const U32 LLVertexBuffer::sGLMode[LLRender::NUM_MODES] = { GL_TRIANGLES, GL_TRIANGLE_STRIP, @@ -509,7 +512,7 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask) } } - U32 map_tc[] = + static const U32 map_tc[] = { MAP_TEXCOORD1, MAP_TEXCOORD2, @@ -859,11 +862,6 @@ void LLVertexBuffer::initClass(bool use_vbo, bool no_vbo_mapping) { sEnableVBOs = use_vbo && gGLManager.mHasVertexBufferObject; sDisableVBOMapping = sEnableVBOs && no_vbo_mapping; - - if (!sPrivatePoolp) - { - sPrivatePoolp = LLPrivateMemoryPoolManager::getInstance()->newPool(LLPrivateMemoryPool::STATIC); - } } //static @@ -906,12 +904,6 @@ void LLVertexBuffer::cleanupClass() sStreamVBOPool.cleanup(); sDynamicVBOPool.cleanup(); sDynamicCopyVBOPool.cleanup(); - - if(sPrivatePoolp) - { - LLPrivateMemoryPoolManager::getInstance()->deletePool(sPrivatePoolp); - sPrivatePoolp = NULL; - } } //---------------------------------------------------------------------------- @@ -1202,7 +1194,7 @@ bool LLVertexBuffer::createGLBuffer(U32 size) { static int gl_buffer_idx = 0; mGLBuffer = ++gl_buffer_idx; - mMappedData = (U8*)ALLOCATE_MEM(sPrivatePoolp, size); + mMappedData = (U8*)ll_aligned_malloc_16(size); disclaimMem(mSize); mSize = size; claimMem(mSize); @@ -1244,7 +1236,7 @@ bool LLVertexBuffer::createGLIndices(U32 size) } else { - mMappedIndexData = (U8*)ALLOCATE_MEM(sPrivatePoolp, size); + mMappedIndexData = (U8*)ll_aligned_malloc_16(size); static int gl_buffer_idx = 0; mGLIndices = ++gl_buffer_idx; mIndicesSize = size; @@ -1267,7 +1259,7 @@ void LLVertexBuffer::destroyGLBuffer() } else { - FREE_MEM(sPrivatePoolp, (void*) mMappedData); + ll_aligned_free_16((void*)mMappedData); mMappedData = NULL; mEmpty = true; } @@ -1287,7 +1279,7 @@ void LLVertexBuffer::destroyGLIndices() } else { - FREE_MEM(sPrivatePoolp, (void*) mMappedIndexData); + ll_aligned_free_16((void*)mMappedIndexData); mMappedIndexData = NULL; mEmpty = true; } @@ -1390,7 +1382,7 @@ void LLVertexBuffer::setupVertexArray() #endif sGLRenderArray = mGLArray; - U32 attrib_size[] = + static const U32 attrib_size[] = { 3, //TYPE_VERTEX, 3, //TYPE_NORMAL, @@ -1407,7 +1399,7 @@ void LLVertexBuffer::setupVertexArray() 1, //TYPE_TEXTURE_INDEX }; - U32 attrib_type[] = + static const U32 attrib_type[] = { GL_FLOAT, //TYPE_VERTEX, GL_FLOAT, //TYPE_NORMAL, @@ -1424,7 +1416,7 @@ void LLVertexBuffer::setupVertexArray() GL_UNSIGNED_INT, //TYPE_TEXTURE_INDEX }; - bool attrib_integer[] = + static const bool attrib_integer[] = { false, //TYPE_VERTEX, false, //TYPE_NORMAL, @@ -1441,7 +1433,7 @@ void LLVertexBuffer::setupVertexArray() true, //TYPE_TEXTURE_INDEX }; - U32 attrib_normalized[] = + static const U32 attrib_normalized[] = { GL_FALSE, //TYPE_VERTEX, GL_FALSE, //TYPE_NORMAL, |