More thorough VBO teardown in resetVertexBuffers/stopGL. Also, found cases where gGL.init failed to be called when it should have been.
This commit is contained in:
@@ -1096,15 +1096,7 @@ void LLRender::init()
|
||||
glBindVertexArray(ret);
|
||||
#endif
|
||||
}
|
||||
|
||||
llassert_always(mBuffer.isNull()) ;
|
||||
stop_glerror();
|
||||
mBuffer = new LLVertexBuffer(immediate_mask, 0);
|
||||
mBuffer->allocateBuffer(4096, 0, TRUE);
|
||||
mBuffer->getVertexStrider(mVerticesp);
|
||||
mBuffer->getTexCoord0Strider(mTexcoordsp);
|
||||
mBuffer->getColorStrider(mColorsp);
|
||||
stop_glerror();
|
||||
restoreVertexBuffers();
|
||||
}
|
||||
|
||||
void LLRender::shutdown()
|
||||
@@ -1148,6 +1140,23 @@ void LLRender::refreshState(void)
|
||||
mDirty = false;
|
||||
}
|
||||
|
||||
void LLRender::resetVertexBuffers()
|
||||
{
|
||||
mBuffer = NULL;
|
||||
}
|
||||
|
||||
void LLRender::restoreVertexBuffers()
|
||||
{
|
||||
llassert_always(mBuffer.isNull());
|
||||
stop_glerror();
|
||||
mBuffer = new LLVertexBuffer(immediate_mask, 0);
|
||||
mBuffer->allocateBuffer(4096, 0, TRUE);
|
||||
mBuffer->getVertexStrider(mVerticesp);
|
||||
mBuffer->getTexCoord0Strider(mTexcoordsp);
|
||||
mBuffer->getColorStrider(mColorsp);
|
||||
stop_glerror();
|
||||
}
|
||||
|
||||
void LLRender::syncLightState()
|
||||
{
|
||||
LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
|
||||
|
||||
@@ -346,6 +346,9 @@ public:
|
||||
// Needed when the render context has changed and invalidated the current state
|
||||
void refreshState(void);
|
||||
|
||||
void resetVertexBuffers();
|
||||
void restoreVertexBuffers();
|
||||
|
||||
LLMatrix4a genRot(const GLfloat& a, const LLVector4a& axis) const;
|
||||
LLMatrix4a genRot(const GLfloat& a, const GLfloat& x, const GLfloat& y, const GLfloat& z) const { return genRot(a,LLVector4a(x,y,z)); }
|
||||
LLMatrix4a genOrtho(const GLfloat& left, const GLfloat& right, const GLfloat& bottom, const GLfloat& top, const GLfloat& znear, const GLfloat& zfar) const;
|
||||
|
||||
@@ -2175,6 +2175,10 @@ public:
|
||||
for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
|
||||
{
|
||||
LLDrawable* drawable = *i;
|
||||
if (drawable->getVObj().notNull())
|
||||
{
|
||||
drawable->getVObj()->resetVertexBuffers();
|
||||
}
|
||||
if (drawable->getVObj().notNull() && !group->mSpatialPartition->mRenderByGroup)
|
||||
{
|
||||
gPipeline.markRebuild(drawable, LLDrawable::REBUILD_ALL, TRUE);
|
||||
|
||||
@@ -133,6 +133,7 @@ public:
|
||||
|
||||
LLViewerObject(const LLUUID &id, const LLPCode type, LLViewerRegion *regionp, BOOL is_global = FALSE);
|
||||
|
||||
virtual void resetVertexBuffers() {}
|
||||
virtual void markDead(); // Mark this object as dead, and clean up its references
|
||||
BOOL isDead() const {return mDead;}
|
||||
BOOL isOrphaned() const { return mOrphaned; }
|
||||
|
||||
@@ -1737,7 +1737,6 @@ LLViewerWindow::LLViewerWindow(
|
||||
}
|
||||
LLVertexBuffer::initClass(gSavedSettings.getBOOL("RenderVBOEnable"), gSavedSettings.getBOOL("RenderVBOMappingDisable"));
|
||||
LL_INFOS("RenderInit") << "LLVertexBuffer initialization done." << LL_ENDL ;
|
||||
gGL.init() ;
|
||||
LLImageGL::initClass(LLViewerTexture::MAX_GL_IMAGE_CATEGORY) ;
|
||||
|
||||
if (LLFeatureManager::getInstance()->isSafe()
|
||||
@@ -5307,6 +5306,8 @@ void LLViewerWindow::stopGL(BOOL save_state)
|
||||
|
||||
gGLManager.mIsDisabled = TRUE;
|
||||
stop_glerror();
|
||||
|
||||
gGL.resetVertexBuffers();
|
||||
|
||||
llinfos << "Remaining allocated texture memory: " << LLImageGL::sGlobalTextureMemoryInBytes << " bytes" << llendl;
|
||||
}
|
||||
@@ -5323,6 +5324,7 @@ void LLViewerWindow::restoreGL(const std::string& progress_message)
|
||||
llinfos << "Restoring GL..." << llendl;
|
||||
gGLManager.mIsDisabled = FALSE;
|
||||
|
||||
gGL.init();
|
||||
initGLDefaults();
|
||||
gGL.refreshState(); //Singu Note: Call immediately. Cached states may have prevented initGLDefaults from actually applying changes.
|
||||
LLGLState::restoreGL();
|
||||
|
||||
@@ -550,6 +550,11 @@ const S32 LEAF_VERTICES = 16;
|
||||
|
||||
static LLFastTimer::DeclareTimer FTM_UPDATE_TREE("Update Tree");
|
||||
|
||||
void LLVOTree::resetVertexBuffers()
|
||||
{
|
||||
mReferenceBuffer = NULL;
|
||||
}
|
||||
|
||||
BOOL LLVOTree::updateGeometry(LLDrawable *drawable)
|
||||
{
|
||||
LLFastTimer ftm(FTM_UPDATE_TREE);
|
||||
|
||||
@@ -77,6 +77,7 @@ public:
|
||||
/*virtual*/ BOOL updateGeometry(LLDrawable *drawable);
|
||||
/*virtual*/ void updateSpatialExtents(LLVector4a &min, LLVector4a &max);
|
||||
|
||||
void resetVertexBuffers();
|
||||
virtual U32 getPartitionType() const;
|
||||
|
||||
void updateRadius();
|
||||
|
||||
@@ -491,6 +491,8 @@ void LLPipeline::init()
|
||||
gSavedSettings.getControl("RenderFSAASamples")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
|
||||
//gSavedSettings.getControl("RenderAvatarVP")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); //Already registered to handleSetShaderChanged
|
||||
//gSavedSettings.getControl("WindLightUseAtmosShaders")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); //Already registered to handleSetShaderChanged
|
||||
|
||||
gGL.init();
|
||||
}
|
||||
|
||||
LLPipeline::~LLPipeline()
|
||||
@@ -6743,6 +6745,8 @@ void LLPipeline::doResetVertexBuffers()
|
||||
//delete all name pool caches
|
||||
LLGLNamePool::cleanupPools();
|
||||
|
||||
gGL.resetVertexBuffers();
|
||||
|
||||
if (LLVertexBuffer::sGLCount > 0)
|
||||
{
|
||||
llwarns << "VBO wipe failed -- " << LLVertexBuffer::sGLCount << " buffers remaining." << llendl;
|
||||
@@ -6762,6 +6766,8 @@ void LLPipeline::doResetVertexBuffers()
|
||||
LLVertexBuffer::initClass(LLVertexBuffer::sEnableVBOs, LLVertexBuffer::sDisableVBOMapping);
|
||||
|
||||
LLVOPartGroup::restoreGL();
|
||||
|
||||
gGL.restoreVertexBuffers();
|
||||
}
|
||||
|
||||
void LLPipeline::renderObjects(U32 type, U32 mask, BOOL texture, BOOL batch_texture)
|
||||
|
||||
Reference in New Issue
Block a user