From 4f3f503953537c806f9e39c20c038a1775ea796c Mon Sep 17 00:00:00 2001 From: Shyotl Date: Wed, 11 Jul 2012 17:12:40 -0500 Subject: [PATCH] Recreate mDeferredVB on vertexbuffer reset. Shuffled some code from LLVOPartGroup::restoreGL() to LLVOPartGroup::destroyGL(), as it makes more sense there. Bind the correct shader in wireframe.. glLineStipple call managed to sneak into no-fixed-function mode. LLViewerWindow::initFonts was called frequently and redundantly during destroygl->restoregl transition. --- indra/llui/llui.cpp | 6 +++- indra/newview/llface.cpp | 2 +- indra/newview/llselectmgr.cpp | 2 +- indra/newview/llviewermessage.cpp | 8 ++++-- indra/newview/llviewerwindow.cpp | 2 ++ indra/newview/llvopartgroup.cpp | 48 +++++++++++++++++-------------- indra/newview/pipeline.cpp | 16 ++++++++--- 7 files changed, 53 insertions(+), 31 deletions(-) diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 4dbffde3a..bf5fc316d 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -809,7 +809,11 @@ void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LL gGL.flush(); glLineWidth(2.5f); - glLineStipple(2, 0x3333 << shift); + if (!LLGLSLShader::sNoFixedFunction) + { + glLineStipple(2, 0x3333 << shift); + } + gGL.begin(LLRender::LINES); { diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 3df3a8467..9d8671d44 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1367,7 +1367,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, static LLCachedControl use_transform_feedback("RenderUseTransformFeedback", false); -#ifdef GL_TRANSFORM_FEEDBACK_BUFFER +#if 0//#ifdef GL_TRANSFORM_FEEDBACK_BUFFER if (use_transform_feedback && gTransformPositionProgram.mProgramObject && //transform shaders are loaded mVertexBuffer->useVBOs() && //target buffer is in VRAM diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 8cad1d048..223b6cf80 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -5651,7 +5651,7 @@ void LLSelectNode::renderOneWireframe(const LLColor4& color) if (shader) { - gHighlightProgram.bind(); + gDebugProgram.bind(); } gGL.matrixMode(LLRender::MM_MODELVIEW); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index c0e112c14..02bafff2c 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4754,8 +4754,6 @@ void process_kill_object(LLMessageSystem *mesgsys, void **user_data) LL_DEBUGS("Messaging") << "Kill message for local " << local_id << LL_ENDL; } - LLSelectMgr::getInstance()->removeObjectFromSelections(id); - // ...don't kill the avatar if (!(id == gAgentID)) { @@ -4785,6 +4783,12 @@ void process_kill_object(LLMessageSystem *mesgsys, void **user_data) gObjectList.mNumUnknownKills++; } } + + // We should remove the object from selection after it is marked dead by gObjectList to make LLToolGrab, + // which is using the object, release the mouse capture correctly when the object dies. + // See LLToolGrab::handleHoverActive() and LLToolGrab::handleHoverNonPhysical(). + LLSelectMgr::getInstance()->removeObjectFromSelections(id); + } } diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 273b69da1..833d6412d 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -4907,6 +4907,8 @@ void LLViewerWindow::restoreGL(const std::string& progress_message) void LLViewerWindow::initFonts(F32 zoom_factor) { + if(gGLManager.mIsDisabled) + return; LLFontGL::destroyAllGL(); // Initialize with possibly different zoom factor LLFontGL::initClass( gSavedSettings.getF32("FontScreenDPI"), diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index c5ceee40c..434c8ca64 100644 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -62,28 +62,6 @@ S32* LLVOPartGroup::sVBSlotCursor = NULL; //static void LLVOPartGroup::restoreGL() { - //Just iterate over all particle faces and mark their vbo index as 'uninitialized' since sVBSlotFree & sVBSlotCursor will be clobbered. - for (int i=0; imDrawable) - { - if (obj->mDrawable->getRenderType() == LLPipeline::RENDER_TYPE_PARTICLES || - obj->mDrawable->getRenderType() == LLPipeline::RENDER_TYPE_HUD_PARTICLES -#if ENABLE_CLASSIC_CLOUDS - || obj->mDrawable->getRenderType() == LLPipeline::RENDER_TYPE_CLASSIC_CLOUDS -#endif - ) - { - for (S32 j = 0; j < obj->mDrawable->getNumFaces(); ++j) - { - LLFace* facep = obj->mDrawable->getFace(j); - if(facep) - facep->setIndicesIndex(0xFFFFFFFF); - } - } - } - } for (S32 i = 0; i < LL_MAX_PARTICLE_COUNT; ++i) { sVBSlotFree[i] = i; @@ -142,6 +120,32 @@ void LLVOPartGroup::restoreGL() //static void LLVOPartGroup::destroyGL() { + //Just iterate over all particle faces and mark their vbo index as 'uninitialized' since sVBSlotFree & sVBSlotCursor will be clobbered. + for (int i=0; imDrawable) + { + if (obj->mDrawable->getRenderType() == LLPipeline::RENDER_TYPE_PARTICLES || + obj->mDrawable->getRenderType() == LLPipeline::RENDER_TYPE_HUD_PARTICLES +#if ENABLE_CLASSIC_CLOUDS + || obj->mDrawable->getRenderType() == LLPipeline::RENDER_TYPE_CLASSIC_CLOUDS +#endif + ) + { + for (S32 j = 0; j < obj->mDrawable->getNumFaces(); ++j) + { + LLFace* facep = obj->mDrawable->getFace(j); + if(facep) + facep->setIndicesIndex(0xFFFFFFFF); + } + } + } + } + for (S32 i = 0; i < LL_MAX_PARTICLE_COUNT; ++i) + { + sVBSlotFree[i] = i; + } sVB = NULL; } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 8b11475ed..d8bac39fd 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -457,9 +457,11 @@ void LLPipeline::init() { mCubeVB = ll_create_cube_vb(LLVertexBuffer::MAP_VERTEX, GL_STATIC_DRAW_ARB); } - - mDeferredVB = new LLVertexBuffer(DEFERRED_VB_MASK, 0); - mDeferredVB->allocateBuffer(8, 0, true); + if(mDeferredVB.isNull()) + { + mDeferredVB = new LLVertexBuffer(DEFERRED_VB_MASK, 0); + mDeferredVB->allocateBuffer(8, 0, true); + } setLightingDetail(-1); gSavedSettings.getControl("RenderAutoMaskAlphaDeferred")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); gSavedSettings.getControl("RenderAutoMaskAlphaNonDeferred")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); @@ -468,7 +470,7 @@ void LLPipeline::init() //gSavedSettings.getControl("RenderDelayVBUpdate")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); gSavedSettings.getControl("UseOcclusion")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); gSavedSettings.getControl("VertexShaderEnable")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); - + gSavedSettings.getControl("RenderFSAASamples")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); } LLPipeline::~LLPipeline() @@ -6102,6 +6104,7 @@ void LLPipeline::doResetVertexBuffers() mResetVertexBuffers = false; mCubeVB = NULL; + mDeferredVB = NULL; for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); iter != LLWorld::getInstance()->getRegionList().end(); ++iter) @@ -7241,6 +7244,11 @@ void LLPipeline::renderDeferredLighting() glh::matrix4f mat = glh_copy_matrix(gGLModelView); + if(mDeferredVB.isNull()) + { + mDeferredVB = new LLVertexBuffer(DEFERRED_VB_MASK, 0); + mDeferredVB->allocateBuffer(8, 0, true); + } LLStrider vert; mDeferredVB->getVertexStrider(vert); LLStrider tc0;