Fix deferred on mac. VBO cleanup. https://bitbucket.org/VirLinden/viewer-development-shining-fixes/changeset/853c76596bdb
This commit is contained in:
@@ -55,10 +55,10 @@ U32 nhpo2(U32 v)
|
||||
//============================================================================
|
||||
|
||||
//static
|
||||
LLVBOPool LLVertexBuffer::sStreamVBOPool;
|
||||
LLVBOPool LLVertexBuffer::sDynamicVBOPool;
|
||||
LLVBOPool LLVertexBuffer::sStreamIBOPool;
|
||||
LLVBOPool LLVertexBuffer::sDynamicIBOPool;
|
||||
LLVBOPool LLVertexBuffer::sStreamVBOPool(GL_STREAM_DRAW_ARB, GL_ARRAY_BUFFER_ARB);
|
||||
LLVBOPool LLVertexBuffer::sDynamicVBOPool(GL_DYNAMIC_DRAW_ARB, GL_ARRAY_BUFFER_ARB);
|
||||
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;
|
||||
|
||||
LLPrivateMemoryPool* LLVertexBuffer::sPrivatePoolp = NULL ;
|
||||
@@ -67,19 +67,19 @@ U32 LLVertexBuffer::sSetCount = 0;
|
||||
S32 LLVertexBuffer::sCount = 0;
|
||||
S32 LLVertexBuffer::sGLCount = 0;
|
||||
S32 LLVertexBuffer::sMappedCount = 0;
|
||||
BOOL LLVertexBuffer::sDisableVBOMapping = FALSE ;
|
||||
BOOL LLVertexBuffer::sEnableVBOs = TRUE;
|
||||
bool LLVertexBuffer::sDisableVBOMapping = false;
|
||||
bool LLVertexBuffer::sEnableVBOs = true;
|
||||
U32 LLVertexBuffer::sGLRenderBuffer = 0;
|
||||
U32 LLVertexBuffer::sGLRenderArray = 0;
|
||||
U32 LLVertexBuffer::sGLRenderIndices = 0;
|
||||
U32 LLVertexBuffer::sLastMask = 0;
|
||||
BOOL LLVertexBuffer::sVBOActive = FALSE;
|
||||
BOOL LLVertexBuffer::sIBOActive = FALSE;
|
||||
bool LLVertexBuffer::sVBOActive = false;
|
||||
bool LLVertexBuffer::sIBOActive = false;
|
||||
U32 LLVertexBuffer::sAllocatedBytes = 0;
|
||||
BOOL LLVertexBuffer::sMapped = FALSE;
|
||||
BOOL LLVertexBuffer::sUseStreamDraw = TRUE;
|
||||
BOOL LLVertexBuffer::sUseVAO = FALSE;
|
||||
BOOL LLVertexBuffer::sPreferStreamDraw = FALSE;
|
||||
bool LLVertexBuffer::sMapped = false;
|
||||
bool LLVertexBuffer::sUseStreamDraw = true;
|
||||
bool LLVertexBuffer::sUseVAO = false;
|
||||
bool LLVertexBuffer::sPreferStreamDraw = false;
|
||||
|
||||
const U32 FENCE_WAIT_TIME_NANOSECONDS = 10000; //1 ms
|
||||
|
||||
@@ -205,8 +205,8 @@ void LLVBOPool::release(U32 name, volatile U8* buffer, U32 size)
|
||||
Record rec;
|
||||
rec.mGLName = name;
|
||||
rec.mClientData = buffer;
|
||||
|
||||
if (!LLVertexBuffer::sDisableVBOMapping && mUsage == GL_DYNAMIC_DRAW_ARB)
|
||||
|
||||
if (buffer == NULL)
|
||||
{
|
||||
glDeleteBuffersARB(1, &rec.mGLName);
|
||||
}
|
||||
@@ -283,7 +283,7 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask)
|
||||
{
|
||||
if (sLastMask != data_mask)
|
||||
{
|
||||
BOOL error = FALSE;
|
||||
bool error = false;
|
||||
|
||||
if (LLGLSLShader::sNoFixedFunction)
|
||||
{
|
||||
@@ -344,7 +344,7 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask)
|
||||
{
|
||||
if (gDebugSession)
|
||||
{
|
||||
error = TRUE;
|
||||
error = true;
|
||||
gFailLog << "Bad client state! " << array[i] << " disabled." << std::endl;
|
||||
}
|
||||
else
|
||||
@@ -364,7 +364,7 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask)
|
||||
{ //needs to be disabled, make sure it was (DEBUG TEMPORARY)
|
||||
if (gDebugSession)
|
||||
{
|
||||
error = TRUE;
|
||||
error = true;
|
||||
gFailLog << "Bad client state! " << array[i] << " enabled." << std::endl;
|
||||
}
|
||||
else
|
||||
@@ -548,7 +548,7 @@ void LLVertexBuffer::validateRange(U32 start, U32 end, U32 count, U32 indices_of
|
||||
void LLVertexBuffer::drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indices_offset) const
|
||||
{
|
||||
validateRange(start, end, count, indices_offset);
|
||||
mMappable = FALSE;
|
||||
mMappable = false;
|
||||
gGL.syncMatrices();
|
||||
|
||||
llassert(mNumVerts >= 0);
|
||||
@@ -603,7 +603,7 @@ void LLVertexBuffer::drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indi
|
||||
void LLVertexBuffer::draw(U32 mode, U32 count, U32 indices_offset) const
|
||||
{
|
||||
llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL);
|
||||
mMappable = FALSE;
|
||||
mMappable = false;
|
||||
gGL.syncMatrices();
|
||||
|
||||
llassert(mNumIndices >= 0);
|
||||
@@ -649,7 +649,7 @@ void LLVertexBuffer::draw(U32 mode, U32 count, U32 indices_offset) const
|
||||
void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const
|
||||
{
|
||||
llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL);
|
||||
mMappable = FALSE;
|
||||
mMappable = false;
|
||||
gGL.syncMatrices();
|
||||
|
||||
llassert(mNumVerts >= 0);
|
||||
@@ -692,20 +692,10 @@ void LLVertexBuffer::initClass(bool use_vbo, bool no_vbo_mapping)
|
||||
sEnableVBOs = use_vbo && gGLManager.mHasVertexBufferObject ;
|
||||
sDisableVBOMapping = sEnableVBOs && no_vbo_mapping ;
|
||||
|
||||
if(!sPrivatePoolp)
|
||||
if (!sPrivatePoolp)
|
||||
{
|
||||
sPrivatePoolp = LLPrivateMemoryPoolManager::getInstance()->newPool(LLPrivateMemoryPool::STATIC) ;
|
||||
sPrivatePoolp = LLPrivateMemoryPoolManager::getInstance()->newPool(LLPrivateMemoryPool::STATIC);
|
||||
}
|
||||
|
||||
sStreamVBOPool.mType = GL_ARRAY_BUFFER_ARB;
|
||||
sStreamVBOPool.mUsage= GL_STREAM_DRAW_ARB;
|
||||
sStreamIBOPool.mType = GL_ELEMENT_ARRAY_BUFFER_ARB;
|
||||
sStreamIBOPool.mUsage= GL_STREAM_DRAW_ARB;
|
||||
|
||||
sDynamicVBOPool.mType = GL_ARRAY_BUFFER_ARB;
|
||||
sDynamicVBOPool.mUsage= GL_DYNAMIC_DRAW_ARB;
|
||||
sDynamicIBOPool.mType = GL_ELEMENT_ARRAY_BUFFER_ARB;
|
||||
sDynamicIBOPool.mUsage= GL_DYNAMIC_DRAW_ARB;
|
||||
}
|
||||
|
||||
//static
|
||||
@@ -718,18 +708,18 @@ void LLVertexBuffer::unbind()
|
||||
#endif
|
||||
sGLRenderArray = 0;
|
||||
sGLRenderIndices = 0;
|
||||
sIBOActive = FALSE;
|
||||
sIBOActive = false;
|
||||
}
|
||||
|
||||
if (sVBOActive)
|
||||
{
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||
sVBOActive = FALSE;
|
||||
sVBOActive = false;
|
||||
}
|
||||
if (sIBOActive)
|
||||
{
|
||||
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
|
||||
sIBOActive = FALSE;
|
||||
sIBOActive = false;
|
||||
}
|
||||
|
||||
sGLRenderBuffer = 0;
|
||||
@@ -758,64 +748,79 @@ void LLVertexBuffer::cleanupClass()
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
S32 LLVertexBuffer::determineUsage(S32 usage)
|
||||
{
|
||||
S32 ret_usage = usage;
|
||||
|
||||
if (!sEnableVBOs)
|
||||
{
|
||||
ret_usage = 0;
|
||||
}
|
||||
|
||||
if (usage == GL_STREAM_DRAW_ARB && !sUseStreamDraw)
|
||||
{
|
||||
ret_usage = 0;
|
||||
}
|
||||
|
||||
if (usage == GL_DYNAMIC_DRAW_ARB && sPreferStreamDraw)
|
||||
{
|
||||
ret_usage = GL_STREAM_DRAW_ARB;
|
||||
}
|
||||
|
||||
if (usage == 0 && LLRender::sGLCoreProfile)
|
||||
{ //MUST use VBOs for all rendering
|
||||
ret_usage = GL_STREAM_DRAW_ARB;
|
||||
}
|
||||
|
||||
if (usage && usage != GL_STREAM_DRAW_ARB)
|
||||
{ //only stream_draw and dynamic_draw are supported when using VBOs, dynamic draw is the default
|
||||
if (sDisableVBOMapping)
|
||||
{ //always use stream draw if VBO mapping is disabled
|
||||
ret_usage = GL_STREAM_DRAW_ARB;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret_usage = GL_DYNAMIC_DRAW_ARB;
|
||||
}
|
||||
}
|
||||
|
||||
return ret_usage;
|
||||
}
|
||||
|
||||
LLVertexBuffer::LLVertexBuffer(U32 typemask, S32 usage) :
|
||||
LLRefCount(),
|
||||
|
||||
mNumVerts(0),
|
||||
mNumIndices(0),
|
||||
mUsage(usage),
|
||||
mAlignedOffset(0),
|
||||
mAlignedIndexOffset(0),
|
||||
mSize(0),
|
||||
mIndicesSize(0),
|
||||
mTypeMask(typemask),
|
||||
mUsage(LLVertexBuffer::determineUsage(usage)),
|
||||
mGLBuffer(0),
|
||||
mGLIndices(0),
|
||||
mGLArray(0),
|
||||
mGLIndices(0),
|
||||
mMappedData(NULL),
|
||||
mMappedIndexData(NULL),
|
||||
mVertexLocked(FALSE),
|
||||
mIndexLocked(FALSE),
|
||||
mFinal(FALSE),
|
||||
mEmpty(TRUE),
|
||||
mMappedIndexData(NULL),
|
||||
mMappedDataUsingVBOs(false),
|
||||
mMappedIndexDataUsingVBOs(false),
|
||||
mVertexLocked(false),
|
||||
mIndexLocked(false),
|
||||
mFinal(false),
|
||||
mEmpty(true),
|
||||
mMappable(false),
|
||||
mFence(NULL)
|
||||
{
|
||||
LLMemType mt(LLMemType::MTYPE_VERTEX_DATA);
|
||||
mFence = NULL;
|
||||
if (!sEnableVBOs)
|
||||
{
|
||||
mUsage = 0 ;
|
||||
}
|
||||
|
||||
if (mUsage == GL_STREAM_DRAW_ARB && !sUseStreamDraw)
|
||||
{
|
||||
mUsage = 0;
|
||||
}
|
||||
|
||||
if (mUsage == GL_DYNAMIC_DRAW_ARB && sPreferStreamDraw)
|
||||
{
|
||||
mUsage = GL_STREAM_DRAW_ARB;
|
||||
}
|
||||
|
||||
if (mUsage == 0 && LLRender::sGLCoreProfile)
|
||||
{ //MUST use VBOs for all rendering
|
||||
mUsage = GL_STREAM_DRAW_ARB;
|
||||
}
|
||||
|
||||
if (mUsage && mUsage != GL_STREAM_DRAW_ARB)
|
||||
{ //only stream_draw and dynamic_draw are supported when using VBOs, dynamic draw is the default
|
||||
if (sDisableVBOMapping)
|
||||
{ //always use stream draw if VBO mapping is disabled
|
||||
mUsage = GL_STREAM_DRAW_ARB;
|
||||
}
|
||||
else
|
||||
{
|
||||
mUsage = GL_DYNAMIC_DRAW_ARB;
|
||||
}
|
||||
}
|
||||
|
||||
if (mUsage == GL_DYNAMIC_DRAW_ARB && !sDisableVBOMapping)
|
||||
{
|
||||
mMappable = TRUE;
|
||||
mMappable = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
mMappable = FALSE;
|
||||
mMappable = false;
|
||||
}
|
||||
|
||||
//zero out offsets
|
||||
@@ -824,12 +829,6 @@ LLVertexBuffer::LLVertexBuffer(U32 typemask, S32 usage) :
|
||||
mOffsets[i] = 0;
|
||||
}
|
||||
|
||||
mTypeMask = typemask;
|
||||
mSize = 0;
|
||||
mIndicesSize = 0;
|
||||
mAlignedOffset = 0;
|
||||
mAlignedIndexOffset = 0;
|
||||
|
||||
sCount++;
|
||||
}
|
||||
|
||||
@@ -1010,9 +1009,11 @@ void LLVertexBuffer::createGLBuffer(U32 size)
|
||||
return;
|
||||
}
|
||||
|
||||
mEmpty = TRUE;
|
||||
mEmpty = true;
|
||||
|
||||
if (useVBOs())
|
||||
mMappedDataUsingVBOs = useVBOs();
|
||||
|
||||
if (mMappedDataUsingVBOs)
|
||||
{
|
||||
genBuffer(size);
|
||||
}
|
||||
@@ -1039,12 +1040,14 @@ void LLVertexBuffer::createGLIndices(U32 size)
|
||||
return;
|
||||
}
|
||||
|
||||
mEmpty = TRUE;
|
||||
mEmpty = true;
|
||||
|
||||
//pad by 16 bytes for aligned copies
|
||||
size += 16;
|
||||
|
||||
if (useVBOs())
|
||||
mMappedIndexDataUsingVBOs = useVBOs();
|
||||
|
||||
if (mMappedIndexDataUsingVBOs)
|
||||
{
|
||||
//pad by another 16 bytes for VBO pointer adjustment
|
||||
size += 16;
|
||||
@@ -1064,15 +1067,15 @@ void LLVertexBuffer::destroyGLBuffer()
|
||||
LLMemType mt(LLMemType::MTYPE_VERTEX_DATA);
|
||||
if (mGLBuffer)
|
||||
{
|
||||
if (useVBOs())
|
||||
if (mMappedDataUsingVBOs)
|
||||
{
|
||||
releaseBuffer();
|
||||
}
|
||||
else
|
||||
{
|
||||
FREE_MEM(sPrivatePoolp, (void*) mMappedData) ;
|
||||
FREE_MEM(sPrivatePoolp, (void*) mMappedData);
|
||||
mMappedData = NULL;
|
||||
mEmpty = TRUE;
|
||||
mEmpty = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1085,15 +1088,15 @@ void LLVertexBuffer::destroyGLIndices()
|
||||
LLMemType mt(LLMemType::MTYPE_VERTEX_DATA);
|
||||
if (mGLIndices)
|
||||
{
|
||||
if (useVBOs())
|
||||
if (mMappedIndexDataUsingVBOs)
|
||||
{
|
||||
releaseIndices();
|
||||
}
|
||||
else
|
||||
{
|
||||
FREE_MEM(sPrivatePoolp, (void*) mMappedIndexData) ;
|
||||
FREE_MEM(sPrivatePoolp, (void*) mMappedIndexData);
|
||||
mMappedIndexData = NULL;
|
||||
mEmpty = TRUE;
|
||||
mEmpty = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1113,9 +1116,9 @@ void LLVertexBuffer::updateNumVerts(S32 nverts)
|
||||
nverts = 65535;
|
||||
}
|
||||
|
||||
S32 needed_size = calcOffsets(mTypeMask, mOffsets, nverts);
|
||||
U32 needed_size = calcOffsets(mTypeMask, mOffsets, nverts);
|
||||
|
||||
if (needed_size > mSize || needed_size <= mSize/2)
|
||||
if (needed_size > (U32)mSize || needed_size <= (U32)mSize/2)
|
||||
{
|
||||
createGLBuffer(needed_size);
|
||||
}
|
||||
@@ -1129,9 +1132,9 @@ void LLVertexBuffer::updateNumIndices(S32 nindices)
|
||||
|
||||
llassert(nindices >= 0);
|
||||
|
||||
S32 needed_size = sizeof(U16) * nindices;
|
||||
U32 needed_size = sizeof(U16) * nindices;
|
||||
|
||||
if (needed_size > mIndicesSize || needed_size <= mIndicesSize/2)
|
||||
if (needed_size > (U32)mIndicesSize || needed_size <= (U32)mIndicesSize/2)
|
||||
{
|
||||
createGLIndices(needed_size);
|
||||
}
|
||||
@@ -1278,16 +1281,10 @@ void LLVertexBuffer::resizeBuffer(S32 newnverts, S32 newnindices)
|
||||
}
|
||||
}
|
||||
|
||||
BOOL LLVertexBuffer::useVBOs() const
|
||||
bool LLVertexBuffer::useVBOs() const
|
||||
{
|
||||
//it's generally ineffective to use VBO for things that are streaming on apple
|
||||
|
||||
if (!mUsage)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return (mUsage != 0);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -1365,7 +1362,7 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo
|
||||
|
||||
if (!mVertexLocked)
|
||||
{
|
||||
mVertexLocked = TRUE;
|
||||
mVertexLocked = true;
|
||||
sMappedCount++;
|
||||
stop_glerror();
|
||||
|
||||
@@ -1444,8 +1441,8 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo
|
||||
{
|
||||
log_glerror();
|
||||
|
||||
//check the availability of memory
|
||||
LLMemory::logMemoryInfo(TRUE) ;
|
||||
//check the availability of memory
|
||||
LLMemory::logMemoryInfo(true) ;
|
||||
|
||||
if(mMappable)
|
||||
{
|
||||
@@ -1492,6 +1489,7 @@ 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");
|
||||
|
||||
volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range)
|
||||
{
|
||||
LLMemType mt(LLMemType::MTYPE_VERTEX_DATA);
|
||||
@@ -1543,7 +1541,7 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range
|
||||
{
|
||||
//LLMemType mt_v(LLMemType::MTYPE_VERTEX_MAP_BUFFER_INDICES);
|
||||
|
||||
mIndexLocked = TRUE;
|
||||
mIndexLocked = true;
|
||||
sMappedCount++;
|
||||
stop_glerror();
|
||||
|
||||
@@ -1622,7 +1620,7 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range
|
||||
if (!mMappedIndexData)
|
||||
{
|
||||
log_glerror();
|
||||
LLMemory::logMemoryInfo(TRUE) ;
|
||||
LLMemory::logMemoryInfo(true) ;
|
||||
|
||||
if(mMappable)
|
||||
{
|
||||
@@ -1738,12 +1736,13 @@ void LLVertexBuffer::unmapBuffer()
|
||||
mMappedData = NULL;
|
||||
}
|
||||
|
||||
mVertexLocked = FALSE ;
|
||||
mVertexLocked = false;
|
||||
sMappedCount--;
|
||||
}
|
||||
|
||||
if (mMappedIndexData && mIndexLocked)
|
||||
{
|
||||
LLFastTimer t(FTM_IBO_UNMAP);
|
||||
bindGLIndices();
|
||||
if(!mMappable)
|
||||
{
|
||||
@@ -1804,13 +1803,13 @@ void LLVertexBuffer::unmapBuffer()
|
||||
mMappedIndexData = NULL ;
|
||||
}
|
||||
|
||||
mIndexLocked = FALSE ;
|
||||
mIndexLocked = false ;
|
||||
sMappedCount--;
|
||||
}
|
||||
|
||||
if(updated_all)
|
||||
{
|
||||
mEmpty = FALSE;
|
||||
mEmpty = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1830,12 +1829,12 @@ template <class T,S32 type> struct VertexBufferStrider
|
||||
if (ptr == NULL)
|
||||
{
|
||||
llwarns << "mapIndexBuffer failed!" << llendl;
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
strider = (T*)ptr;
|
||||
strider.setStride(0);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
else if (vbo.hasDataType(type))
|
||||
{
|
||||
@@ -1846,21 +1845,18 @@ template <class T,S32 type> struct VertexBufferStrider
|
||||
if (ptr == NULL)
|
||||
{
|
||||
llwarns << "mapVertexBuffer failed!" << llendl;
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
strider = (T*)ptr;
|
||||
|
||||
strider.setStride(stride);
|
||||
//strider.setTypeSize(LLVertexBuffer::sTypeSize[type]);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
llerrs << "VertexBufferStrider could not find valid vertex data." << llendl;
|
||||
}
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1959,7 +1955,7 @@ bool LLVertexBuffer::bindGLBuffer(bool force_bind)
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, mGLBuffer);
|
||||
sGLRenderBuffer = mGLBuffer;
|
||||
sBindCount++;
|
||||
sVBOActive = TRUE;
|
||||
sVBOActive = true;
|
||||
|
||||
if (mGLArray)
|
||||
{
|
||||
@@ -1991,7 +1987,7 @@ bool LLVertexBuffer::bindGLIndices(bool force_bind)
|
||||
sGLRenderIndices = mGLIndices;
|
||||
stop_glerror();
|
||||
sBindCount++;
|
||||
sIBOActive = TRUE;
|
||||
sIBOActive = true;
|
||||
ret = true;
|
||||
}
|
||||
|
||||
@@ -2013,7 +2009,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
|
||||
|
||||
LLMemType mt(LLMemType::MTYPE_VERTEX_DATA);
|
||||
//set up pointers if the data mask is different ...
|
||||
BOOL setup = (sLastMask != data_mask);
|
||||
bool setup = (sLastMask != data_mask);
|
||||
|
||||
if (gDebugGL && data_mask != 0)
|
||||
{ //make sure data requirements are fulfilled
|
||||
@@ -2047,21 +2043,17 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
|
||||
if (mGLArray)
|
||||
{
|
||||
bindGLArray();
|
||||
setup = FALSE; //do NOT perform pointer setup if using VAO
|
||||
setup = false; //do NOT perform pointer setup if using VAO
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bindGLBuffer())
|
||||
{
|
||||
setup = TRUE;
|
||||
}
|
||||
if (bindGLIndices())
|
||||
{
|
||||
setup = TRUE;
|
||||
}
|
||||
const bool bindBuffer = bindGLBuffer();
|
||||
const bool bindIndices = bindGLIndices();
|
||||
|
||||
setup = setup || bindBuffer || bindIndices;
|
||||
}
|
||||
|
||||
BOOL error = FALSE;
|
||||
bool error = false;
|
||||
if (gDebugGL && !mGLArray)
|
||||
{
|
||||
GLint buff;
|
||||
@@ -2070,7 +2062,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
|
||||
{
|
||||
if (gDebugSession)
|
||||
{
|
||||
error = TRUE;
|
||||
error = true;
|
||||
gFailLog << "Invalid GL vertex buffer bound: " << buff << std::endl;
|
||||
}
|
||||
else
|
||||
@@ -2086,7 +2078,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
|
||||
{
|
||||
if (gDebugSession)
|
||||
{
|
||||
error = TRUE;
|
||||
error = true;
|
||||
gFailLog << "Invalid GL index buffer bound: " << buff << std::endl;
|
||||
}
|
||||
else
|
||||
@@ -2108,7 +2100,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
|
||||
#endif
|
||||
sGLRenderArray = 0;
|
||||
sGLRenderIndices = 0;
|
||||
sIBOActive = FALSE;
|
||||
sIBOActive = false;
|
||||
}
|
||||
|
||||
if (mGLBuffer)
|
||||
@@ -2117,13 +2109,13 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
|
||||
{
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||
sBindCount++;
|
||||
sVBOActive = FALSE;
|
||||
setup = TRUE; // ... or a VBO is deactivated
|
||||
sVBOActive = false;
|
||||
setup = true; // ... or a VBO is deactivated
|
||||
}
|
||||
if (sGLRenderBuffer != mGLBuffer)
|
||||
{
|
||||
sGLRenderBuffer = mGLBuffer;
|
||||
setup = TRUE; // ... or a client memory pointer changed
|
||||
setup = true; // ... or a client memory pointer changed
|
||||
}
|
||||
}
|
||||
if (mGLIndices)
|
||||
@@ -2132,7 +2124,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
|
||||
{
|
||||
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
|
||||
sBindCount++;
|
||||
sIBOActive = FALSE;
|
||||
sIBOActive = false;
|
||||
}
|
||||
|
||||
sGLRenderIndices = mGLIndices;
|
||||
@@ -2220,19 +2212,19 @@ void LLVertexBuffer::setupVertexBuffer(U32 data_mask)
|
||||
{
|
||||
S32 loc = TYPE_WEIGHT;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_WEIGHT]);
|
||||
glVertexAttribPointerARB(loc, 1, GL_FLOAT, FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT], ptr);
|
||||
glVertexAttribPointerARB(loc, 1, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT], ptr);
|
||||
}
|
||||
if (data_mask & MAP_WEIGHT4)
|
||||
{
|
||||
S32 loc = TYPE_WEIGHT4;
|
||||
void* ptr = (void*)(base+mOffsets[TYPE_WEIGHT4]);
|
||||
glVertexAttribPointerARB(loc, 4, GL_FLOAT, FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], ptr);
|
||||
glVertexAttribPointerARB(loc, 4, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], ptr);
|
||||
}
|
||||
if (data_mask & MAP_CLOTHWEIGHT)
|
||||
{
|
||||
S32 loc = TYPE_CLOTHWEIGHT;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_CLOTHWEIGHT]);
|
||||
glVertexAttribPointerARB(loc, 4, GL_FLOAT, TRUE, LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], ptr);
|
||||
glVertexAttribPointerARB(loc, 4, GL_FLOAT, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], ptr);
|
||||
}
|
||||
if (data_mask & MAP_TEXTURE_INDEX)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user