SH-2565 Move resetVertexBuffer operation to a consistent location (also avoid redundant resetting of vertex buffers on detail switches). Change assertion to a warning with count info. Fix bytes pooled debug display. Remove unused static vertex buffer.

master
Dave Parks 2012-01-25 15:37:36 -06:00
parent 9e621af3db
commit 0bbe8d73cb
5 changed files with 23 additions and 23 deletions

View File

@ -205,14 +205,13 @@ void LLVBOPool::release(U32 name, volatile U8* buffer, U32 size)
rec.mGLName = name;
rec.mClientData = buffer;
sBytesPooled += size;
if (!LLVertexBuffer::sDisableVBOMapping && mUsage == GL_DYNAMIC_DRAW_ARB)
{
glDeleteBuffersARB(1, &rec.mGLName);
}
else
{
sBytesPooled += size;
mFreeList[i].push_back(rec);
}
}

View File

@ -260,6 +260,9 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
gPipeline.disableLights();
//reset vertex buffers if needed
gPipeline.doResetVertexBuffers();
stop_glerror();
// Don't draw if the window is hidden or minimized.

View File

@ -63,7 +63,6 @@ extern PFNGLWEIGHTFVARBPROC glWeightfvARB;
extern PFNGLVERTEXBLENDARBPROC glVertexBlendARB;
#endif
static LLPointer<LLVertexBuffer> sRenderBuffer = NULL;
static const U32 sRenderMask = LLVertexBuffer::MAP_VERTEX |
LLVertexBuffer::MAP_NORMAL |
LLVertexBuffer::MAP_TEXCOORD0;

View File

@ -203,10 +203,6 @@ extern S32 gBoxFrame;
extern BOOL gDisplaySwapBuffers;
extern BOOL gDebugGL;
// hack counter for rendering a fixed number of frames after toggling
// fullscreen to work around DEV-5361
static S32 sDelayedVBOEnable = 0;
BOOL gAvatarBacklight = FALSE;
BOOL gDebugPipeline = FALSE;
@ -411,6 +407,7 @@ LLPipeline::LLPipeline() :
mOldRenderDebugMask(0),
mGroupQ1Locked(false),
mGroupQ2Locked(false),
mResetVertexBuffers(false),
mLastRebuildPool(NULL),
mAlphaPool(NULL),
mSkyPool(NULL),
@ -692,8 +689,6 @@ void LLPipeline::destroyGL()
if (LLVertexBuffer::sEnableVBOs)
{
// render 30 frames after switching to work around DEV-5361
sDelayedVBOEnable = 30;
LLVertexBuffer::sEnableVBOs = FALSE;
}
}
@ -2523,15 +2518,6 @@ void LLPipeline::updateGeom(F32 max_dtime)
assertInitialized();
if (sDelayedVBOEnable > 0)
{
if (--sDelayedVBOEnable <= 0)
{
resetVertexBuffers();
LLVertexBuffer::sEnableVBOs = TRUE;
}
}
// notify various object types to reset internal cost metrics, etc.
// for now, only LLVOVolume does this to throttle LOD changes
LLVOVolume::preUpdateGeom();
@ -6185,7 +6171,7 @@ LLSpatialPartition* LLPipeline::getSpatialPartition(LLViewerObject* vobj)
void LLPipeline::resetVertexBuffers(LLDrawable* drawable)
{
if (!drawable || drawable->isDead())
if (!drawable)
{
return;
}
@ -6198,7 +6184,19 @@ void LLPipeline::resetVertexBuffers(LLDrawable* drawable)
}
void LLPipeline::resetVertexBuffers()
{
{
mResetVertexBuffers = true;
}
void LLPipeline::doResetVertexBuffers()
{
if (!mResetVertexBuffers)
{
return;
}
mResetVertexBuffers = false;
for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
{
@ -6224,11 +6222,9 @@ void LLPipeline::resetVertexBuffers()
if (LLVertexBuffer::sGLCount > 0)
{
llwarns << "VBO wipe failed." << llendl;
llwarns << "VBO wipe failed -- " << LLVertexBuffer::sGLCount << " buffers remaining." << llendl;
}
llassert(LLVertexBuffer::sGLCount == 0);
LLVertexBuffer::unbind();
sRenderBump = gSavedSettings.getBOOL("RenderObjectBump");

View File

@ -111,6 +111,7 @@ public:
void destroyGL();
void restoreGL();
void resetVertexBuffers();
void doResetVertexBuffers();
void resizeScreenTexture();
void releaseGLBuffers();
void releaseScreenBuffers();
@ -653,6 +654,8 @@ protected:
bool mGroupQ2Locked;
bool mGroupQ1Locked;
bool mResetVertexBuffers; //if true, clear vertex buffers on next update
LLViewerObject::vobj_list_t mCreateQ;
LLDrawable::drawable_set_t mRetexturedList;