summaryrefslogtreecommitdiff
path: root/indra/llrender/llvertexbuffer.cpp
diff options
context:
space:
mode:
authorRichard Linden <none@none>2014-02-24 18:45:59 -0800
committerRichard Linden <none@none>2014-02-24 18:45:59 -0800
commit80b4a4a1f54dccb814b5486423bf6492b3ae58a7 (patch)
treef17c7a9b433e443b2f30251dd15b1bf50d4f803c /indra/llrender/llvertexbuffer.cpp
parentde8fea13627cc5978b8a6135802a52864a11c39a (diff)
parentef591d280eb3c5bae7da20540ad4cbb30858d0aa (diff)
merge with release
Diffstat (limited to 'indra/llrender/llvertexbuffer.cpp')
-rwxr-xr-xindra/llrender/llvertexbuffer.cpp209
1 files changed, 107 insertions, 102 deletions
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index e6f20cd40e..d06564df36 100755
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -26,7 +26,7 @@
#include "linden_common.h"
-#include <boost/static_assert.hpp>
+#include "llfasttimer.h"
#include "llsys.h"
#include "llvertexbuffer.h"
// #include "llrender.h"
@@ -190,7 +190,7 @@ volatile U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed)
glBufferDataARB(mType, size, 0, mUsage);
if (mUsage != GL_DYNAMIC_COPY_ARB)
{ //data will be provided by application
- ret = (U8*) ll_aligned_malloc(size, 64);
+ ret = (U8*) ll_aligned_malloc<64>(size);
}
}
else
@@ -244,7 +244,7 @@ void LLVBOPool::release(U32 name, volatile U8* buffer, U32 size)
llassert(vbo_block_size(size) == size);
deleteBuffer(name);
- ll_aligned_free((U8*) buffer);
+ ll_aligned_free_fallback((U8*) buffer);
if (mType == GL_ARRAY_BUFFER_ARB)
{
@@ -298,7 +298,7 @@ void LLVBOPool::cleanup()
if (r.mClientData)
{
- ll_aligned_free((void*) r.mClientData);
+ ll_aligned_free<64>((void*) r.mClientData);
}
l.pop_front();
@@ -484,7 +484,7 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask)
}
else
{
- llerrs << "Bad client state! " << array[i] << " disabled." << llendl;
+ LL_ERRS() << "Bad client state! " << array[i] << " disabled." << LL_ENDL;
}
}
}
@@ -503,7 +503,7 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask)
}
else
{
- llerrs << "Bad client state! " << array[i] << " enabled." << llendl;
+ LL_ERRS() << "Bad client state! " << array[i] << " enabled." << LL_ENDL;
}
}
}
@@ -557,10 +557,10 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask)
}
//static
-static LLFastTimer::DeclareTimer FTM_VB_DRAW_ARRAYS("drawArrays");
+static LLTrace::BlockTimerStatHandle FTM_VB_DRAW_ARRAYS("drawArrays");
void LLVertexBuffer::drawArrays(U32 mode, const std::vector<LLVector3>& pos, const std::vector<LLVector3>& norm)
{
- LLFastTimer t(FTM_VB_DRAW_ARRAYS);
+ LL_RECORD_BLOCK_TIME(FTM_VB_DRAW_ARRAYS);
llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL);
gGL.syncMatrices();
@@ -571,13 +571,13 @@ void LLVertexBuffer::drawArrays(U32 mode, const std::vector<LLVector3>& pos, con
if( count == 0 )
{
- llwarns << "Called drawArrays with 0 vertices" << llendl;
+ LL_WARNS() << "Called drawArrays with 0 vertices" << LL_ENDL;
return;
}
if( norm.size() < pos.size() )
{
- llwarns << "Called drawArrays with #" << norm.size() << " normals and #" << pos.size() << " vertices" << llendl;
+ LL_WARNS() << "Called drawArrays with #" << norm.size() << " normals and #" << pos.size() << " vertices" << LL_ENDL;
return;
}
@@ -654,7 +654,7 @@ void LLVertexBuffer::validateRange(U32 start, U32 end, U32 count, U32 indices_of
if (start >= (U32) mNumVerts ||
end >= (U32) mNumVerts)
{
- llerrs << "Bad vertex buffer draw range: [" << start << ", " << end << "] vs " << mNumVerts << llendl;
+ LL_ERRS() << "Bad vertex buffer draw range: [" << start << ", " << end << "] vs " << mNumVerts << LL_ENDL;
}
llassert(mNumIndices >= 0);
@@ -662,7 +662,7 @@ void LLVertexBuffer::validateRange(U32 start, U32 end, U32 count, U32 indices_of
if (indices_offset >= (U32) mNumIndices ||
indices_offset + count > (U32) mNumIndices)
{
- llerrs << "Bad index buffer draw range: [" << indices_offset << ", " << indices_offset+count << "]" << llendl;
+ LL_ERRS() << "Bad index buffer draw range: [" << indices_offset << ", " << indices_offset+count << "]" << LL_ENDL;
}
if (gDebugGL && !useVBOs())
@@ -672,7 +672,7 @@ void LLVertexBuffer::validateRange(U32 start, U32 end, U32 count, U32 indices_of
{
if (idx[i] < start || idx[i] > end)
{
- llerrs << "Index out of range: " << idx[i] << " not in [" << start << ", " << end << "]" << llendl;
+ LL_ERRS() << "Index out of range: " << idx[i] << " not in [" << start << ", " << end << "]" << LL_ENDL;
}
}
@@ -690,7 +690,7 @@ void LLVertexBuffer::validateRange(U32 start, U32 end, U32 count, U32 indices_of
S32 idx = (S32) (v[i][3]+0.25f);
if (idx < 0 || idx >= shader->mFeatures.mIndexedTextureChannels)
{
- llerrs << "Bad texture index found in vertex data stream." << llendl;
+ LL_ERRS() << "Bad texture index found in vertex data stream." << LL_ENDL;
}
}
}
@@ -710,19 +710,19 @@ void LLVertexBuffer::drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indi
{
if (mGLArray != sGLRenderArray)
{
- llerrs << "Wrong vertex array bound." << llendl;
+ LL_ERRS() << "Wrong vertex array bound." << LL_ENDL;
}
}
else
{
if (mGLIndices != sGLRenderIndices)
{
- llerrs << "Wrong index buffer bound." << llendl;
+ LL_ERRS() << "Wrong index buffer bound." << LL_ENDL;
}
if (mGLBuffer != sGLRenderBuffer)
{
- llerrs << "Wrong vertex buffer bound." << llendl;
+ LL_ERRS() << "Wrong vertex buffer bound." << LL_ENDL;
}
}
@@ -733,13 +733,13 @@ void LLVertexBuffer::drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indi
if (elem != mGLIndices)
{
- llerrs << "Wrong index buffer bound!" << llendl;
+ LL_ERRS() << "Wrong index buffer bound!" << LL_ENDL;
}
}
if (mode >= LLRender::NUM_MODES)
{
- llerrs << "Invalid draw mode: " << mode << llendl;
+ LL_ERRS() << "Invalid draw mode: " << mode << LL_ENDL;
return;
}
@@ -767,32 +767,32 @@ void LLVertexBuffer::draw(U32 mode, U32 count, U32 indices_offset) const
if (indices_offset >= (U32) mNumIndices ||
indices_offset + count > (U32) mNumIndices)
{
- llerrs << "Bad index buffer draw range: [" << indices_offset << ", " << indices_offset+count << "]" << llendl;
+ LL_ERRS() << "Bad index buffer draw range: [" << indices_offset << ", " << indices_offset+count << "]" << LL_ENDL;
}
if (mGLArray)
{
if (mGLArray != sGLRenderArray)
{
- llerrs << "Wrong vertex array bound." << llendl;
+ LL_ERRS() << "Wrong vertex array bound." << LL_ENDL;
}
}
else
{
if (mGLIndices != sGLRenderIndices)
{
- llerrs << "Wrong index buffer bound." << llendl;
+ LL_ERRS() << "Wrong index buffer bound." << LL_ENDL;
}
if (mGLBuffer != sGLRenderBuffer)
{
- llerrs << "Wrong vertex buffer bound." << llendl;
+ LL_ERRS() << "Wrong vertex buffer bound." << LL_ENDL;
}
}
if (mode >= LLRender::NUM_MODES)
{
- llerrs << "Invalid draw mode: " << mode << llendl;
+ LL_ERRS() << "Invalid draw mode: " << mode << LL_ENDL;
return;
}
@@ -805,7 +805,7 @@ void LLVertexBuffer::draw(U32 mode, U32 count, U32 indices_offset) const
placeFence();
}
-static LLFastTimer::DeclareTimer FTM_GL_DRAW_ARRAYS("GL draw arrays");
+static LLTrace::BlockTimerStatHandle FTM_GL_DRAW_ARRAYS("GL draw arrays");
void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const
{
llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL);
@@ -816,37 +816,37 @@ void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const
if (first >= (U32) mNumVerts ||
first + count > (U32) mNumVerts)
{
- llerrs << "Bad vertex buffer draw range: [" << first << ", " << first+count << "]" << llendl;
+ LL_ERRS() << "Bad vertex buffer draw range: [" << first << ", " << first+count << "]" << LL_ENDL;
}
if (mGLArray)
{
if (mGLArray != sGLRenderArray)
{
- llerrs << "Wrong vertex array bound." << llendl;
+ LL_ERRS() << "Wrong vertex array bound." << LL_ENDL;
}
}
else
{
if (mGLBuffer != sGLRenderBuffer || useVBOs() != sVBOActive)
{
- llerrs << "Wrong vertex buffer bound." << llendl;
+ LL_ERRS() << "Wrong vertex buffer bound." << LL_ENDL;
}
}
if (mode >= LLRender::NUM_MODES)
{
- llerrs << "Invalid draw mode: " << mode << llendl;
+ LL_ERRS() << "Invalid draw mode: " << mode << LL_ENDL;
return;
}
{
- LLFastTimer t2(FTM_GL_DRAW_ARRAYS);
- stop_glerror();
+ LL_RECORD_BLOCK_TIME(FTM_GL_DRAW_ARRAYS);
+ stop_glerror();
LLGLSLShader::startProfile();
- glDrawArrays(sGLMode[mode], first, count);
+ glDrawArrays(sGLMode[mode], first, count);
LLGLSLShader::stopProfile(count, mode);
- }
+ }
stop_glerror();
placeFence();
@@ -956,7 +956,8 @@ S32 LLVertexBuffer::determineUsage(S32 usage)
return ret_usage;
}
-LLVertexBuffer::LLVertexBuffer(U32 typemask, S32 usage) :
+LLVertexBuffer::LLVertexBuffer(U32 typemask, S32 usage)
+: LLTrace::MemTrackable<LLVertexBuffer>("LLVertexBuffer"),
LLRefCount(),
mNumVerts(0),
@@ -1093,7 +1094,9 @@ void LLVertexBuffer::waitFence() const
void LLVertexBuffer::genBuffer(U32 size)
{
+ disclaimMem(mSize);
mSize = vbo_block_size(size);
+ claimMem(mSize);
if (mUsage == GL_STREAM_DRAW_ARB)
{
@@ -1187,7 +1190,9 @@ void LLVertexBuffer::createGLBuffer(U32 size)
static int gl_buffer_idx = 0;
mGLBuffer = ++gl_buffer_idx;
mMappedData = (U8*)ALLOCATE_MEM(sPrivatePoolp, size);
+ disclaimMem(mSize);
mSize = size;
+ claimMem(mSize);
}
}
@@ -1271,7 +1276,7 @@ void LLVertexBuffer::updateNumVerts(S32 nverts)
if (nverts > 65536)
{
- llwarns << "Vertex buffer overflow!" << llendl;
+ LL_WARNS() << "Vertex buffer overflow!" << LL_ENDL;
nverts = 65536;
}
@@ -1310,7 +1315,7 @@ void LLVertexBuffer::allocateBuffer(S32 nverts, S32 nindices, bool create)
if (nverts < 0 || nindices < 0 ||
nverts > 65536)
{
- llerrs << "Bad vertex buffer allocation: " << nverts << " : " << nindices << llendl;
+ LL_ERRS() << "Bad vertex buffer allocation: " << nverts << " : " << nindices << LL_ENDL;
}
updateNumVerts(nverts);
@@ -1331,7 +1336,7 @@ void LLVertexBuffer::allocateBuffer(S32 nverts, S32 nindices, bool create)
}
}
-static LLFastTimer::DeclareTimer FTM_SETUP_VERTEX_ARRAY("Setup VAO");
+static LLTrace::BlockTimerStatHandle FTM_SETUP_VERTEX_ARRAY("Setup VAO");
void LLVertexBuffer::setupVertexArray()
{
@@ -1340,7 +1345,7 @@ void LLVertexBuffer::setupVertexArray()
return;
}
- LLFastTimer t(FTM_SETUP_VERTEX_ARRAY);
+ LL_RECORD_BLOCK_TIME(FTM_SETUP_VERTEX_ARRAY);
#if GL_ARB_vertex_array_object
glBindVertexArray(mGLArray);
#endif
@@ -1495,8 +1500,8 @@ bool expand_region(LLVertexBuffer::MappedRegion& region, S32 index, S32 count)
return true;
}
-static LLFastTimer::DeclareTimer FTM_VBO_MAP_BUFFER_RANGE("VBO Map Range");
-static LLFastTimer::DeclareTimer FTM_VBO_MAP_BUFFER("VBO Map");
+static LLTrace::BlockTimerStatHandle FTM_VBO_MAP_BUFFER_RANGE("VBO Map Range");
+static LLTrace::BlockTimerStatHandle FTM_VBO_MAP_BUFFER("VBO Map");
// Map for data access
volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_range)
@@ -1504,11 +1509,11 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo
bindGLBuffer(true);
if (mFinal)
{
- llerrs << "LLVertexBuffer::mapVeretxBuffer() called on a finalized buffer." << llendl;
+ LL_ERRS() << "LLVertexBuffer::mapVeretxBuffer() called on a finalized buffer." << LL_ENDL;
}
if (!useVBOs() && !mMappedData && !mMappedIndexData)
{
- llerrs << "LLVertexBuffer::mapVertexBuffer() called on unallocated buffer." << llendl;
+ LL_ERRS() << "LLVertexBuffer::mapVertexBuffer() called on unallocated buffer." << LL_ENDL;
}
if (useVBOs())
@@ -1545,7 +1550,7 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo
if (mVertexLocked && map_range)
{
- llerrs << "Attempted to map a specific range of a buffer that was already mapped." << llendl;
+ LL_ERRS() << "Attempted to map a specific range of a buffer that was already mapped." << LL_ENDL;
}
if (!mVertexLocked)
@@ -1567,7 +1572,7 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo
if (map_range)
{
#ifdef GL_ARB_map_buffer_range
- LLFastTimer t(FTM_VBO_MAP_BUFFER_RANGE);
+ LL_RECORD_BLOCK_TIME(FTM_VBO_MAP_BUFFER_RANGE);
S32 offset = mOffsets[type] + sTypeSize[type]*index;
S32 length = (sTypeSize[type]*count+0xF) & ~0xF;
src = (U8*) glMapBufferRange(GL_ARRAY_BUFFER_ARB, offset, length,
@@ -1587,11 +1592,11 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo
if (size < mSize)
{
- llerrs << "Invalid buffer size." << llendl;
+ LL_ERRS() << "Invalid buffer size." << LL_ENDL;
}
}
- LLFastTimer t(FTM_VBO_MAP_BUFFER);
+ LL_RECORD_BLOCK_TIME(FTM_VBO_MAP_BUFFER);
src = (U8*) glMapBufferRange(GL_ARRAY_BUFFER_ARB, 0, mSize,
GL_MAP_WRITE_BIT |
GL_MAP_FLUSH_EXPLICIT_BIT);
@@ -1638,25 +1643,25 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo
{
//--------------------
//print out more debug info before crash
- llinfos << "vertex buffer size: (num verts : num indices) = " << getNumVerts() << " : " << getNumIndices() << llendl;
+ LL_INFOS() << "vertex buffer size: (num verts : num indices) = " << getNumVerts() << " : " << getNumIndices() << LL_ENDL;
GLint size;
glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size);
- llinfos << "GL_ARRAY_BUFFER_ARB size is " << size << llendl;
+ LL_INFOS() << "GL_ARRAY_BUFFER_ARB size is " << size << LL_ENDL;
//--------------------
GLint buff;
glGetIntegerv(GL_ARRAY_BUFFER_BINDING_ARB, &buff);
if ((GLuint)buff != mGLBuffer)
{
- llerrs << "Invalid GL vertex buffer bound: " << buff << llendl;
+ LL_ERRS() << "Invalid GL vertex buffer bound: " << buff << LL_ENDL;
}
- llerrs << "glMapBuffer returned NULL (no vertex data)" << llendl;
+ LL_ERRS() << "glMapBuffer returned NULL (no vertex data)" << LL_ENDL;
}
else
{
- llerrs << "memory allocation for vertex data failed." << llendl;
+ LL_ERRS() << "memory allocation for vertex data failed." << LL_ENDL;
}
}
}
@@ -1677,19 +1682,19 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo
}
-static LLFastTimer::DeclareTimer FTM_VBO_MAP_INDEX_RANGE("IBO Map Range");
-static LLFastTimer::DeclareTimer FTM_VBO_MAP_INDEX("IBO Map");
+static LLTrace::BlockTimerStatHandle FTM_VBO_MAP_INDEX_RANGE("IBO Map Range");
+static LLTrace::BlockTimerStatHandle FTM_VBO_MAP_INDEX("IBO Map");
volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range)
{
bindGLIndices(true);
if (mFinal)
{
- llerrs << "LLVertexBuffer::mapIndexBuffer() called on a finalized buffer." << llendl;
+ LL_ERRS() << "LLVertexBuffer::mapIndexBuffer() called on a finalized buffer." << LL_ENDL;
}
if (!useVBOs() && !mMappedData && !mMappedIndexData)
{
- llerrs << "LLVertexBuffer::mapIndexBuffer() called on unallocated buffer." << llendl;
+ LL_ERRS() << "LLVertexBuffer::mapIndexBuffer() called on unallocated buffer." << LL_ENDL;
}
if (useVBOs())
@@ -1723,7 +1728,7 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range
if (mIndexLocked && map_range)
{
- llerrs << "Attempted to map a specific range of a buffer that was already mapped." << llendl;
+ LL_ERRS() << "Attempted to map a specific range of a buffer that was already mapped." << LL_ENDL;
}
if (!mIndexLocked)
@@ -1739,7 +1744,7 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range
if (elem != mGLIndices)
{
- llerrs << "Wrong index buffer bound!" << llendl;
+ LL_ERRS() << "Wrong index buffer bound!" << LL_ENDL;
}
}
@@ -1756,7 +1761,7 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range
if (map_range)
{
#ifdef GL_ARB_map_buffer_range
- LLFastTimer t(FTM_VBO_MAP_INDEX_RANGE);
+ LL_RECORD_BLOCK_TIME(FTM_VBO_MAP_INDEX_RANGE);
S32 offset = sizeof(U16)*index;
S32 length = sizeof(U16)*count;
src = (U8*) glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length,
@@ -1768,7 +1773,7 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range
else
{
#ifdef GL_ARB_map_buffer_range
- LLFastTimer t(FTM_VBO_MAP_INDEX);
+ LL_RECORD_BLOCK_TIME(FTM_VBO_MAP_INDEX);
src = (U8*) glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER_ARB, 0, sizeof(U16)*mNumIndices,
GL_MAP_WRITE_BIT |
GL_MAP_FLUSH_EXPLICIT_BIT);
@@ -1792,7 +1797,7 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range
}
else
{
- LLFastTimer t(FTM_VBO_MAP_INDEX);
+ LL_RECORD_BLOCK_TIME(FTM_VBO_MAP_INDEX);
map_range = false;
src = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
}
@@ -1817,14 +1822,14 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range
glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff);
if ((GLuint)buff != mGLIndices)
{
- llerrs << "Invalid GL index buffer bound: " << buff << llendl;
+ LL_ERRS() << "Invalid GL index buffer bound: " << buff << LL_ENDL;
}
- llerrs << "glMapBuffer returned NULL (no index data)" << llendl;
+ LL_ERRS() << "glMapBuffer returned NULL (no index data)" << LL_ENDL;
}
else
{
- llerrs << "memory allocation for Index data failed. " << llendl;
+ LL_ERRS() << "memory allocation for Index data failed. " << LL_ENDL;
}
}
}
@@ -1843,12 +1848,12 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range
}
}
-static LLFastTimer::DeclareTimer FTM_VBO_UNMAP("VBO Unmap");
-static LLFastTimer::DeclareTimer FTM_VBO_FLUSH_RANGE("Flush VBO Range");
+static LLTrace::BlockTimerStatHandle FTM_VBO_UNMAP("VBO Unmap");
+static LLTrace::BlockTimerStatHandle FTM_VBO_FLUSH_RANGE("Flush VBO Range");
-static LLFastTimer::DeclareTimer FTM_IBO_UNMAP("IBO Unmap");
-static LLFastTimer::DeclareTimer FTM_IBO_FLUSH_RANGE("Flush IBO Range");
+static LLTrace::BlockTimerStatHandle FTM_IBO_UNMAP("IBO Unmap");
+static LLTrace::BlockTimerStatHandle FTM_IBO_FLUSH_RANGE("Flush IBO Range");
void LLVertexBuffer::unmapBuffer()
{
@@ -1861,7 +1866,7 @@ void LLVertexBuffer::unmapBuffer()
if (mMappedData && mVertexLocked)
{
- LLFastTimer t(FTM_VBO_UNMAP);
+ LL_RECORD_BLOCK_TIME(FTM_VBO_UNMAP);
bindGLBuffer(true);
updated_all = mIndexLocked; //both vertex and index buffers done updating
@@ -1902,7 +1907,7 @@ void LLVertexBuffer::unmapBuffer()
S32 length = sTypeSize[region.mType]*region.mCount;
if (gGLManager.mHasMapBufferRange)
{
- LLFastTimer t(FTM_VBO_FLUSH_RANGE);
+ LL_RECORD_BLOCK_TIME(FTM_VBO_FLUSH_RANGE);
#ifdef GL_ARB_map_buffer_range
glFlushMappedBufferRange(GL_ARRAY_BUFFER_ARB, offset, length);
#endif
@@ -1932,7 +1937,7 @@ void LLVertexBuffer::unmapBuffer()
if (mMappedIndexData && mIndexLocked)
{
- LLFastTimer t(FTM_IBO_UNMAP);
+ LL_RECORD_BLOCK_TIME(FTM_IBO_UNMAP);
bindGLIndices();
if(!mMappable)
{
@@ -1969,7 +1974,7 @@ void LLVertexBuffer::unmapBuffer()
S32 length = sizeof(U16)*region.mCount;
if (gGLManager.mHasMapBufferRange)
{
- LLFastTimer t(FTM_IBO_FLUSH_RANGE);
+ LL_RECORD_BLOCK_TIME(FTM_IBO_FLUSH_RANGE);
#ifdef GL_ARB_map_buffer_range
glFlushMappedBufferRange(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length);
#endif
@@ -2020,7 +2025,7 @@ template <class T,S32 type> struct VertexBufferStrider
if (ptr == NULL)
{
- llwarns << "mapIndexBuffer failed!" << llendl;
+ LL_WARNS() << "mapIndexBuffer failed!" << LL_ENDL;
return false;
}
@@ -2036,7 +2041,7 @@ template <class T,S32 type> struct VertexBufferStrider
if (ptr == NULL)
{
- llwarns << "mapVertexBuffer failed!" << llendl;
+ LL_WARNS() << "mapVertexBuffer failed!" << LL_ENDL;
return false;
}
@@ -2046,7 +2051,7 @@ template <class T,S32 type> struct VertexBufferStrider
}
else
{
- llerrs << "VertexBufferStrider could not find valid vertex data." << llendl;
+ LL_ERRS() << "VertexBufferStrider could not find valid vertex data." << LL_ENDL;
}
return false;
}
@@ -2113,13 +2118,13 @@ bool LLVertexBuffer::getClothWeightStrider(LLStrider<LLVector4>& strider, S32 in
//----------------------------------------------------------------------------
-static LLFastTimer::DeclareTimer FTM_BIND_GL_ARRAY("Bind Array");
+static LLTrace::BlockTimerStatHandle FTM_BIND_GL_ARRAY("Bind Array");
bool LLVertexBuffer::bindGLArray()
{
if (mGLArray && sGLRenderArray != mGLArray)
{
{
- LLFastTimer t(FTM_BIND_GL_ARRAY);
+ LL_RECORD_BLOCK_TIME(FTM_BIND_GL_ARRAY);
#if GL_ARB_vertex_array_object
glBindVertexArray(mGLArray);
#endif
@@ -2136,7 +2141,7 @@ bool LLVertexBuffer::bindGLArray()
return false;
}
-static LLFastTimer::DeclareTimer FTM_BIND_GL_BUFFER("Bind Buffer");
+static LLTrace::BlockTimerStatHandle FTM_BIND_GL_BUFFER("Bind Buffer");
bool LLVertexBuffer::bindGLBuffer(bool force_bind)
{
@@ -2146,7 +2151,7 @@ bool LLVertexBuffer::bindGLBuffer(bool force_bind)
if (useVBOs() && (force_bind || (mGLBuffer && (mGLBuffer != sGLRenderBuffer || !sVBOActive))))
{
- //LLFastTimer t(FTM_BIND_GL_BUFFER); <-- this timer is showing up as a hotspot (irony)
+ //LL_RECORD_BLOCK_TIME(FTM_BIND_GL_BUFFER);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, mGLBuffer);
sGLRenderBuffer = mGLBuffer;
@@ -2161,7 +2166,7 @@ bool LLVertexBuffer::bindGLBuffer(bool force_bind)
return ret;
}
-static LLFastTimer::DeclareTimer FTM_BIND_GL_INDICES("Bind Indices");
+static LLTrace::BlockTimerStatHandle FTM_BIND_GL_INDICES("Bind Indices");
bool LLVertexBuffer::bindGLIndices(bool force_bind)
{
@@ -2170,10 +2175,10 @@ bool LLVertexBuffer::bindGLIndices(bool force_bind)
bool ret = false;
if (useVBOs() && (force_bind || (mGLIndices && (mGLIndices != sGLRenderIndices || !sIBOActive))))
{
- LLFastTimer t(FTM_BIND_GL_INDICES);
+ LL_RECORD_BLOCK_TIME(FTM_BIND_GL_INDICES);
/*if (sMapped)
{
- llerrs << "VBO bound while another VBO mapped!" << llendl;
+ LL_ERRS() << "VBO bound while another VBO mapped!" << LL_ENDL;
}*/
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, mGLIndices);
sGLRenderIndices = mGLIndices;
@@ -2225,7 +2230,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
U32 required = 1 << i;
if ((data_mask & required) == 0)
{
- llwarns << "Missing attribute: " << LLShaderMgr::instance()->mReservedAttribs[i] << llendl;
+ LL_WARNS() << "Missing attribute: " << LLShaderMgr::instance()->mReservedAttribs[i] << LL_ENDL;
}
required_mask |= required;
@@ -2243,29 +2248,29 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
U32 unsatisfied_flag = unsatisfied_mask & (1 << i);
switch (unsatisfied_flag)
{
- case MAP_VERTEX: llinfos << "Missing vert pos" << llendl; break;
- case MAP_NORMAL: llinfos << "Missing normals" << llendl; break;
- case MAP_TEXCOORD0: llinfos << "Missing TC 0" << llendl; break;
- case MAP_TEXCOORD1: llinfos << "Missing TC 1" << llendl; break;
- case MAP_TEXCOORD2: llinfos << "Missing TC 2" << llendl; break;
- case MAP_TEXCOORD3: llinfos << "Missing TC 3" << llendl; break;
- case MAP_COLOR: llinfos << "Missing vert color" << llendl; break;
- case MAP_EMISSIVE: llinfos << "Missing emissive" << llendl; break;
- case MAP_TANGENT: llinfos << "Missing tangent" << llendl; break;
- case MAP_WEIGHT: llinfos << "Missing weight" << llendl; break;
- case MAP_WEIGHT4: llinfos << "Missing weightx4" << llendl; break;
- case MAP_CLOTHWEIGHT: llinfos << "Missing clothweight" << llendl; break;
- case MAP_TEXTURE_INDEX: llinfos << "Missing tex index" << llendl; break;
- default: llinfos << "Missing who effin knows: " << unsatisfied_flag << llendl;
+ case MAP_VERTEX: LL_INFOS() << "Missing vert pos" << LL_ENDL; break;
+ case MAP_NORMAL: LL_INFOS() << "Missing normals" << LL_ENDL; break;
+ case MAP_TEXCOORD0: LL_INFOS() << "Missing TC 0" << LL_ENDL; break;
+ case MAP_TEXCOORD1: LL_INFOS() << "Missing TC 1" << LL_ENDL; break;
+ case MAP_TEXCOORD2: LL_INFOS() << "Missing TC 2" << LL_ENDL; break;
+ case MAP_TEXCOORD3: LL_INFOS() << "Missing TC 3" << LL_ENDL; break;
+ case MAP_COLOR: LL_INFOS() << "Missing vert color" << LL_ENDL; break;
+ case MAP_EMISSIVE: LL_INFOS() << "Missing emissive" << LL_ENDL; break;
+ case MAP_TANGENT: LL_INFOS() << "Missing tangent" << LL_ENDL; break;
+ case MAP_WEIGHT: LL_INFOS() << "Missing weight" << LL_ENDL; break;
+ case MAP_WEIGHT4: LL_INFOS() << "Missing weightx4" << LL_ENDL; break;
+ case MAP_CLOTHWEIGHT: LL_INFOS() << "Missing clothweight" << LL_ENDL; break;
+ case MAP_TEXTURE_INDEX: LL_INFOS() << "Missing tex index" << LL_ENDL; break;
+ default: LL_INFOS() << "Missing who effin knows: " << unsatisfied_flag << LL_ENDL;
}
}
if (unsatisfied_mask & (1 << TYPE_INDEX))
{
- llinfos << "Missing indices" << llendl;
+ LL_INFOS() << "Missing indices" << LL_ENDL;
}
- llerrs << "Shader consumption mismatches data provision." << llendl;
+ LL_ERRS() << "Shader consumption mismatches data provision." << LL_ENDL;
}
}
}
@@ -2297,7 +2302,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
}
else
{
- llerrs << "Invalid GL vertex buffer bound: " << buff << llendl;
+ LL_ERRS() << "Invalid GL vertex buffer bound: " << buff << LL_ENDL;
}
}
@@ -2312,7 +2317,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
}
else
{
- llerrs << "Invalid GL index buffer bound: " << buff << llendl;
+ LL_ERRS() << "Invalid GL index buffer bound: " << buff << LL_ENDL;
}
}
}
@@ -2388,10 +2393,10 @@ void LLVertexBuffer::setupVertexBuffer(U32 data_mask)
U32 mask = 1 << i;
if (mask & data_mask && !(mask & mTypeMask))
{ //bit set in data_mask, but not set in mTypeMask
- llwarns << "Missing required component " << vb_type_name[i] << llendl;
+ LL_WARNS() << "Missing required component " << vb_type_name[i] << LL_ENDL;
}
}
- llerrs << "LLVertexBuffer::setupVertexBuffer missing required components for supplied data mask." << llendl;
+ LL_ERRS() << "LLVertexBuffer::setupVertexBuffer missing required components for supplied data mask." << LL_ENDL;
}
if (LLGLSLShader::sNoFixedFunction)