From 8ed9934a87d07a7d37af3399dc6b1af6ac8d662e Mon Sep 17 00:00:00 2001 From: Shyotl Date: Mon, 8 Apr 2019 18:13:28 -0500 Subject: [PATCH] Fix memory tracking bug with vertex buffers. (Cosmetic. Only affects debug stats) --- indra/llrender/llvertexbuffer.cpp | 14 +++++++------- indra/llrender/llvertexbuffer.h | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index e46fc679f..46705d1d6 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -74,10 +74,10 @@ U32 vbo_block_size(U32 size) U32 vbo_block_index(U32 size) { - return vbo_block_size(size)/LL_VBO_BLOCK_SIZE; + return ((vbo_block_size(size)-1)/LL_VBO_BLOCK_SIZE); } -const U32 LL_VBO_POOL_SEED_COUNT = vbo_block_index(LL_VBO_POOL_MAX_SEED_SIZE); +const U32 LL_VBO_POOL_SEED_COUNT = vbo_block_index(LL_VBO_POOL_MAX_SEED_SIZE)+1; //============================================================================ @@ -88,14 +88,14 @@ LLVBOPool LLVertexBuffer::sDynamicVBOPool(GL_DYNAMIC_DRAW_ARB, GL_ARRAY_BUFFER_A LLVBOPool LLVertexBuffer::sStreamIBOPool(GL_STREAM_DRAW_ARB, GL_ELEMENT_ARRAY_BUFFER_ARB); LLVBOPool LLVertexBuffer::sDynamicIBOPool(GL_DYNAMIC_DRAW_ARB, GL_ELEMENT_ARRAY_BUFFER_ARB); -U32 LLVBOPool::sBytesPooled = 0; -U32 LLVBOPool::sIndexBytesPooled = 0; +U64 LLVBOPool::sBytesPooled = 0; +U64 LLVBOPool::sIndexBytesPooled = 0; std::vector LLVBOPool::sPendingDeletions; std::list LLVertexBuffer::sAvailableVAOName; U32 LLVertexBuffer::sCurVAOName = 1; -U32 LLVertexBuffer::sAllocatedIndexBytes = 0; +U64 LLVertexBuffer::sAllocatedIndexBytes = 0; U32 LLVertexBuffer::sIndexCount = 0; U32 LLVertexBuffer::sBindCount = 0; @@ -111,7 +111,7 @@ U32 LLVertexBuffer::sGLRenderIndices = 0; U32 LLVertexBuffer::sLastMask = 0; bool LLVertexBuffer::sVBOActive = false; bool LLVertexBuffer::sIBOActive = false; -U32 LLVertexBuffer::sAllocatedBytes = 0; +U64 LLVertexBuffer::sAllocatedBytes = 0; U32 LLVertexBuffer::sVertexCount = 0; bool LLVertexBuffer::sMapped = false; bool LLVertexBuffer::sUseStreamDraw = true; @@ -341,7 +341,7 @@ void LLVBOPool::seedPool() { if (mMissCount[i] > mFreeList[i].size()) { - U32 size = i * LL_VBO_BLOCK_SIZE; + U32 size = i * LL_VBO_BLOCK_SIZE + LL_VBO_BLOCK_SIZE; S32 count = mMissCount[i] - mFreeList[i].size(); for (S32 j = 0; j < count; ++j) diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index a993bb98a..d61420abc 100644 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -54,8 +54,8 @@ class LLVBOPool { public: - static U32 sBytesPooled; - static U32 sIndexBytesPooled; + static U64 sBytesPooled; + static U64 sIndexBytesPooled; static std::vector sPendingDeletions; // Periodically call from render loop. Batches VBO deletions together in a single call. @@ -347,8 +347,8 @@ public: static bool sVBOActive; static bool sIBOActive; static U32 sLastMask; - static U32 sAllocatedBytes; - static U32 sAllocatedIndexBytes; + static U64 sAllocatedBytes; + static U64 sAllocatedIndexBytes; static U32 sVertexCount; static U32 sIndexCount; static U32 sBindCount;