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. https://bitbucket.org/VirLinden/viewer-development-shining-fixes/changeset/56ac56c3cc9a

This commit is contained in:
Shyotl
2012-01-26 12:55:24 -06:00
parent a6f95d21af
commit f9d802f832
5 changed files with 26 additions and 12 deletions

View File

@@ -206,14 +206,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

@@ -283,7 +283,10 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot, boo
stop_glerror();
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

@@ -158,7 +158,7 @@ extern BOOL gDebugGL;
// hack counter for rendering a fixed number of frames after toggling
// fullscreen to work around DEV-5361
static S32 sDelayedVBOEnable = 0;
//static S32 sDelayedVBOEnable = 0;
BOOL gAvatarBacklight = FALSE;
@@ -555,7 +555,7 @@ void LLPipeline::destroyGL()
if (LLVertexBuffer::sEnableVBOs)
{
// render 30 frames after switching to work around DEV-5361
sDelayedVBOEnable = 30;
//sDelayedVBOEnable = 30;
LLVertexBuffer::sEnableVBOs = FALSE;
}
}
@@ -2308,14 +2308,14 @@ void LLPipeline::updateGeom(F32 max_dtime)
assertInitialized();
if (sDelayedVBOEnable > 0)
/*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
@@ -5852,7 +5852,7 @@ LLSpatialPartition* LLPipeline::getSpatialPartition(LLViewerObject* vobj)
void LLPipeline::resetVertexBuffers(LLDrawable* drawable)
{
if (!drawable || drawable->isDead())
if (!drawable)
{
return;
}
@@ -5866,6 +5866,18 @@ 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)
{
@@ -5891,11 +5903,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

@@ -110,6 +110,7 @@ public:
void destroyGL();
void restoreGL();
void resetVertexBuffers();
void doResetVertexBuffers();
void resizeScreenTexture();
void releaseGLBuffers();
void releaseScreenBuffers();
@@ -632,6 +633,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;