From 0b1b7c6618da3813334f4bacacf44d783fca0b58 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Sat, 23 Apr 2011 00:58:27 -0500 Subject: [PATCH] Fixed issues with changing AA and AF... -AF change no longer reloads the window to apply. Doing such isn't needed anymore. -AA change no longer reloads the window to apply, IFF RenderUseFBO is true. -AA change, IFF RenderUseFBO is false, reloads window. Texture issues under this scenario should be resolved. -LLComboBox now updates control_name it's linked to, automatically. -New LLComboBox Behavor when paired with new AA/AF application changes renders LLFloaterHardwareSettings::apply() pointless, EXCEPT for when changing AA while FBOs are off. --- indra/llrender/llimagegl.cpp | 12 ++++++++- indra/llui/llcombobox.cpp | 2 ++ indra/newview/llfloaterhardwaresettings.cpp | 28 ++++++--------------- indra/newview/llviewercontrol.cpp | 17 +++++++++++++ 4 files changed, 38 insertions(+), 21 deletions(-) diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 60c3582d8..b0660f9df 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -301,11 +301,13 @@ S32 LLImageGL::updateBoundTexMem()const //static void LLImageGL::destroyGL(BOOL save_state) { + deleteDeadTextures(); //Dump unimportant textures. for (S32 stage = 0; stage < gGLManager.mNumTextureUnits; stage++) { gGL.getTexUnit(stage)->unbind(LLTexUnit::TT_TEXTURE); } + int stored_count = 0; sAllowReadBackRaw = true ; for (std::set::iterator iter = sImageList.begin(); iter != sImageList.end(); iter++) @@ -320,18 +322,24 @@ void LLImageGL::destroyGL(BOOL save_state) { glimage->mSaveData = NULL ; } + else + stored_count++; } glimage->destroyGLTexture(); stop_glerror(); } } + llinfos << "Storing " << stored_count << " images..." << llendl; sAllowReadBackRaw = false ; + deleteDeadTextures();//Now, actually call glDeleteTextures for everything. } //static void LLImageGL::restoreGL() { + + int recovered_count = 0; for (std::set::iterator iter = sImageList.begin(); iter != sImageList.end(); iter++) { @@ -346,10 +354,12 @@ void LLImageGL::restoreGL() { glimage->createGLTexture(glimage->mCurrentDiscardLevel, glimage->mSaveData, 0, TRUE, glimage->getCategory()); stop_glerror(); + recovered_count++; } glimage->mSaveData = NULL; // deletes data } } + llinfos << "Restored " << recovered_count << " images" << llendl; } //static @@ -1281,7 +1291,7 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre llverify(gGL.getTexUnit(0)->bindManual(mBindTarget, mTexName)); //debug code, leave it there commented. - //checkTexSize() ; + checkTexSize() ; LLGLint glwidth = 0; glGetTexLevelParameteriv(mTarget, gl_discard, GL_TEXTURE_WIDTH, (GLint*)&glwidth); diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 8f33e40fc..2e1167223 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -248,6 +248,8 @@ void LLComboBox::onCommit() mTextEntry->setValue(getSimple()); mTextEntry->setTentative(FALSE); } + + setControlValue(getValue()); LLUICtrl::onCommit(); } diff --git a/indra/newview/llfloaterhardwaresettings.cpp b/indra/newview/llfloaterhardwaresettings.cpp index 3b721c6ba..9a420a37b 100644 --- a/indra/newview/llfloaterhardwaresettings.cpp +++ b/indra/newview/llfloaterhardwaresettings.cpp @@ -169,32 +169,20 @@ BOOL LLFloaterHardwareSettings::postBuild() } -void LLFloaterHardwareSettings::apply() +void LLFloaterHardwareSettings::apply() { - // Anisotropic rendering - BOOL old_anisotropic = LLImageGL::sGlobalUseAnisotropic; - LLImageGL::sGlobalUseAnisotropic = childGetValue("ani"); - - U32 fsaa = (U32) childGetValue("fsaa").asInteger(); - U32 old_fsaa = gSavedSettings.getU32("RenderFSAASamples"); - - BOOL logged_in = (LLStartUp::getStartupState() >= STATE_STARTED); - - if (old_fsaa != fsaa) + //Still do a bit of voodoo here. V2 forces restart to change FSAA with FBOs off. + //Let's not do that, and instead do pre-V2 FSAA change handling for that particular case + if(!LLRenderTarget::sUseFBO && (mFSAASamples != (U32)childGetValue("fsaa").asInteger())) { - gSavedSettings.setU32("RenderFSAASamples", fsaa); + BOOL logged_in = (LLStartUp::getStartupState() >= STATE_STARTED); LLWindow* window = gViewerWindow->getWindow(); LLCoordScreen size; window->getSize(&size); gViewerWindow->changeDisplaySettings(window->getFullscreen(), - size, - gSavedSettings.getBOOL("DisableVerticalSync"), - logged_in); - } - else if (old_anisotropic != LLImageGL::sGlobalUseAnisotropic) - { - LLImageGL::dirtyTexOptions(); - gViewerWindow->restartDisplay(logged_in); + size, + gSavedSettings.getBOOL("DisableVerticalSync"), + logged_in); } refresh(); diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 8adbde0d5..9859a8883 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -121,6 +121,14 @@ static bool handleTerrainDetailChanged(const LLSD& newvalue) static bool handleSetShaderChanged(const LLSD& newvalue) { + + // Changing shader also changes the terrain detail to high, reflect that change here + if (newvalue.asBoolean()) + { + // shaders enabled, set terrain detail to high + gSavedSettings.setS32("RenderTerrainDetail", 1); + } + // else, leave terrain detail as is LLViewerShaderMgr::instance()->setShaders(); return true; } @@ -184,6 +192,13 @@ static bool handleReleaseGLBufferChanged(const LLSD& newvalue) return true; } +static bool handleAnisotropicChanged(const LLSD& newvalue) +{ + LLImageGL::sGlobalUseAnisotropic = newvalue.asBoolean(); + LLImageGL::dirtyTexOptions(); + return true; +} + static bool handleVolumeLODChanged(const LLSD& newvalue) { LLVOVolume::sLODFactor = (F32) newvalue.asReal(); @@ -549,6 +564,8 @@ void settings_setup_listeners() gSavedSettings.getControl("RenderAnimateTrees")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _1)); gSavedSettings.getControl("RenderAvatarVP")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1)); gSavedSettings.getControl("VertexShaderEnable")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1)); + gSavedSettings.getControl("RenderFSAASamples")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _1)); + gSavedSettings.getControl("RenderAnisotropic")->getSignal()->connect(boost::bind(&handleAnisotropicChanged, _1)); gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _1)); gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1)); gSavedSettings.getControl("EnableRippleWater")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1));