Skip to content
Snippets Groups Projects
Commit efe45c93 authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Clean up warning from failure to delete vbo

parent ee97f3a0
Branches
Tags
No related merge requests found
...@@ -1140,6 +1140,14 @@ LLRender::~LLRender() ...@@ -1140,6 +1140,14 @@ LLRender::~LLRender()
void LLRender::init() void LLRender::init()
{ {
if (mDummyVAO != 0)
{ //bind a dummy vertex array object so we're core profile compliant
#ifdef GL_ARB_vertex_array_object
glDeleteVertexArrays(1, &mDummyVAO);
#endif
mDummyVAO = 0;
}
if (sGLCoreProfile && !LLVertexBuffer::sUseVAO) if (sGLCoreProfile && !LLVertexBuffer::sUseVAO)
{ //bind a dummy vertex array object so we're core profile compliant { //bind a dummy vertex array object so we're core profile compliant
#ifdef GL_ARB_vertex_array_object #ifdef GL_ARB_vertex_array_object
...@@ -1147,28 +1155,12 @@ void LLRender::init() ...@@ -1147,28 +1155,12 @@ void LLRender::init()
glBindVertexArray(mDummyVAO); glBindVertexArray(mDummyVAO);
#endif #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(); stop_glerror();
restoreVertexBuffers();
} }
void LLRender::shutdown() void LLRender::shutdown()
{ {
if (mDummyVAO != 0)
{ //bind a dummy vertex array object so we're core profile compliant
#ifdef GL_ARB_vertex_array_object
glDeleteVertexArrays(1, &mDummyVAO);
#endif
mDummyVAO = 0;
}
for (U32 i = 0; i < mTexUnits.size(); i++) for (U32 i = 0; i < mTexUnits.size(); i++)
{ {
delete mTexUnits[i]; delete mTexUnits[i];
...@@ -1182,7 +1174,16 @@ void LLRender::shutdown() ...@@ -1182,7 +1174,16 @@ void LLRender::shutdown()
delete mLightState[i]; delete mLightState[i];
} }
mLightState.clear(); mLightState.clear();
mBuffer = NULL ;
mBuffer = nullptr;
if (mDummyVAO != 0)
{ //bind a dummy vertex array object so we're core profile compliant
#ifdef GL_ARB_vertex_array_object
glDeleteVertexArrays(1, &mDummyVAO);
#endif
mDummyVAO = 0;
}
} }
void LLRender::refreshState(void) void LLRender::refreshState(void)
...@@ -1197,14 +1198,38 @@ void LLRender::refreshState(void) ...@@ -1197,14 +1198,38 @@ void LLRender::refreshState(void)
} }
mTexUnits[active_unit]->activate(); mTexUnits[active_unit]->activate();
stop_glerror();
setColorMask(mCurrColorMask[0], mCurrColorMask[1], mCurrColorMask[2], mCurrColorMask[3]); setColorMask(mCurrColorMask[0], mCurrColorMask[1], mCurrColorMask[2], mCurrColorMask[3]);
stop_glerror();
setAlphaRejectSettings(mCurrAlphaFunc, mCurrAlphaFuncVal); setAlphaRejectSettings(mCurrAlphaFunc, mCurrAlphaFuncVal);
stop_glerror();
mDirty = false; mDirty = false;
} }
void LLRender::resetVertexBuffers()
{
mBuffer = nullptr;
}
void LLRender::restoreVertexBuffers()
{
llassert_always(mBuffer.isNull());
stop_glerror();
mBuffer = new LLVertexBuffer(immediate_mask, 0);
stop_glerror();
mBuffer->allocateBuffer(4096, 0, TRUE);
stop_glerror();
mBuffer->getVertexStrider(mVerticesp);
stop_glerror();
mBuffer->getTexCoord0Strider(mTexcoordsp);
stop_glerror();
mBuffer->getColorStrider(mColorsp);
stop_glerror();
}
void LLRender::syncLightState() void LLRender::syncLightState()
{ {
LLGLSLShader *shader = LLGLSLShader::sCurBoundShaderPtr; LLGLSLShader *shader = LLGLSLShader::sCurBoundShaderPtr;
......
...@@ -376,6 +376,9 @@ class LLRender ...@@ -376,6 +376,9 @@ class LLRender
// Needed when the render context has changed and invalidated the current state // Needed when the render context has changed and invalidated the current state
void refreshState(void); void refreshState(void);
void resetVertexBuffers();
void restoreVertexBuffers();
void translatef(const GLfloat& x, const GLfloat& y, const GLfloat& z); void translatef(const GLfloat& x, const GLfloat& y, const GLfloat& z);
void scalef(const GLfloat& x, const GLfloat& y, const GLfloat& z); void scalef(const GLfloat& x, const GLfloat& y, const GLfloat& z);
void rotatef(const GLfloat& a, const GLfloat& x, const GLfloat& y, const GLfloat& z); void rotatef(const GLfloat& a, const GLfloat& x, const GLfloat& y, const GLfloat& z);
......
...@@ -5498,6 +5498,7 @@ void LLViewerWindow::stopGL(BOOL save_state) ...@@ -5498,6 +5498,7 @@ void LLViewerWindow::stopGL(BOOL save_state)
stop_glerror(); stop_glerror();
LLVOPartGroup::destroyGL(); LLVOPartGroup::destroyGL();
stop_glerror();
LLViewerDynamicTexture::destroyGL(); LLViewerDynamicTexture::destroyGL();
stop_glerror(); stop_glerror();
...@@ -5506,8 +5507,10 @@ void LLViewerWindow::stopGL(BOOL save_state) ...@@ -5506,8 +5507,10 @@ void LLViewerWindow::stopGL(BOOL save_state)
{ {
gPipeline.destroyGL(); gPipeline.destroyGL();
} }
stop_glerror();
gBox.cleanupGL(); gBox.cleanupGL();
stop_glerror();
if(gPostProcess) if(gPostProcess)
{ {
...@@ -5521,12 +5524,18 @@ void LLViewerWindow::stopGL(BOOL save_state) ...@@ -5521,12 +5524,18 @@ void LLViewerWindow::stopGL(BOOL save_state)
stop_glerror(); stop_glerror();
//unload shader's //unload shader's
while (LLGLSLShader::sInstances.size()) while (!LLGLSLShader::sInstances.empty())
{ {
LLGLSLShader* shader = *(LLGLSLShader::sInstances.begin()); LLGLSLShader* shader = *(LLGLSLShader::sInstances.begin());
shader->unload(); shader->unload();
} }
gGL.resetVertexBuffers();
LLVertexBuffer::cleanupClass();
stop_glerror();
LL_INFOS() << "Remaining allocated texture memory: " << LLImageGL::sGlobalTextureMemory.value() << " bytes" << LL_ENDL; LL_INFOS() << "Remaining allocated texture memory: " << LLImageGL::sGlobalTextureMemory.value() << " bytes" << LL_ENDL;
} }
} }
...@@ -5542,7 +5551,9 @@ void LLViewerWindow::restoreGL(const std::string& progress_message) ...@@ -5542,7 +5551,9 @@ void LLViewerWindow::restoreGL(const std::string& progress_message)
LL_INFOS() << "Restoring GL..." << LL_ENDL; LL_INFOS() << "Restoring GL..." << LL_ENDL;
gGLManager.mIsDisabled = FALSE; gGLManager.mIsDisabled = FALSE;
gGL.init();
initGLDefaults(); initGLDefaults();
gGL.refreshState();
LLGLState::restoreGL(); LLGLState::restoreGL();
gTextureList.restoreGL(); gTextureList.restoreGL();
......
...@@ -7395,6 +7395,7 @@ void LLPipeline::doResetVertexBuffers(bool forced) ...@@ -7395,6 +7395,7 @@ void LLPipeline::doResetVertexBuffers(bool forced)
} }
LLVOPartGroup::destroyGL(); LLVOPartGroup::destroyGL();
gGL.resetVertexBuffers();
SUBSYSTEM_CLEANUP(LLVertexBuffer); SUBSYSTEM_CLEANUP(LLVertexBuffer);
if (LLVertexBuffer::sGLCount > 0) if (LLVertexBuffer::sGLCount > 0)
...@@ -7420,6 +7421,7 @@ void LLPipeline::doResetVertexBuffers(bool forced) ...@@ -7420,6 +7421,7 @@ void LLPipeline::doResetVertexBuffers(bool forced)
LLVertexBuffer::initClass(LLVertexBuffer::sEnableVBOs, LLVertexBuffer::sDisableVBOMapping); LLVertexBuffer::initClass(LLVertexBuffer::sEnableVBOs, LLVertexBuffer::sDisableVBOMapping);
LLVOPartGroup::restoreGL(); LLVOPartGroup::restoreGL();
gGL.restoreVertexBuffers();
} }
void LLPipeline::renderObjects(U32 type, U32 mask, bool texture, bool batch_texture) void LLPipeline::renderObjects(U32 type, U32 mask, bool texture, bool batch_texture)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment