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:
Shyotl
2015-06-01 17:58:19 -05:00
parent 142322528c
commit 0688cda8d2
8 changed files with 41 additions and 10 deletions

View File

@@ -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;

View File

@@ -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;