Fixed LLGLState::checkStates() failing upon context re-creation:

-After new context creation, immediately call LLRender::refreshState() after LLViewerWindow::initGLDefaults() in order to force states to apply.
--LLRender::initGLDefaults optimizes out gl calls by caching states, but the cached values are only applicable to the old context, not the new, so this optimization must be skipped (LLRender::mDirty).
-LLViewerWindow::mStatesDirty also triggered a redundant shader reload, since restoreGL also called setShaders().
Fixed somewhat annoying flicker of a single frame whilst recovering from screen resizing.
-Skip frame if LLViewerWindow::checkSettings() called LLViewerWindow::reshape. (reshape will set gWindowResized to true)
--True optimal fix will require some refactoring.
Reworked how window position is saved in LLViewerWindow::changeDisplaySettings. Hopefully reduces chances of odd behavior (had WindowX and WindowY get stuck at massive negative values before)
This commit is contained in:
Shyotl
2012-10-25 20:42:58 -05:00
parent 67ee544231
commit 1a741b97d2
5 changed files with 47 additions and 19 deletions

View File

@@ -1120,6 +1120,9 @@ void LLRender::refreshState(void)
setAlphaRejectSettings(mCurrAlphaFunc, mCurrAlphaFuncVal);
//Singu note: Also reset glBlendFunc
blendFunc(mCurrBlendColorSFactor,mCurrBlendColorDFactor,mCurrBlendAlphaSFactor,mCurrBlendAlphaDFactor);
mDirty = false;
}
@@ -1586,7 +1589,7 @@ void LLRender::setColorMask(bool writeColorR, bool writeColorG, bool writeColorB
if (mCurrColorMask[0] != writeColorR ||
mCurrColorMask[1] != writeColorG ||
mCurrColorMask[2] != writeColorB ||
mCurrColorMask[3] != writeAlpha)
mCurrColorMask[3] != writeAlpha || mDirty)
{
mCurrColorMask[0] = writeColorR;
mCurrColorMask[1] = writeColorG;
@@ -1641,7 +1644,7 @@ void LLRender::setAlphaRejectSettings(eCompareFunc func, F32 value)
}
if (mCurrAlphaFunc != func ||
mCurrAlphaFuncVal != value)
mCurrAlphaFuncVal != value || mDirty)
{
mCurrAlphaFunc = func;
mCurrAlphaFuncVal = value;
@@ -1685,7 +1688,7 @@ void LLRender::blendFunc(eBlendFactor sfactor, eBlendFactor dfactor)
llassert(sfactor < BF_UNDEF);
llassert(dfactor < BF_UNDEF);
if (mCurrBlendColorSFactor != sfactor || mCurrBlendColorDFactor != dfactor ||
mCurrBlendAlphaSFactor != sfactor || mCurrBlendAlphaDFactor != dfactor)
mCurrBlendAlphaSFactor != sfactor || mCurrBlendAlphaDFactor != dfactor || mDirty)
{
mCurrBlendColorSFactor = sfactor;
mCurrBlendAlphaSFactor = sfactor;
@@ -1710,7 +1713,7 @@ void LLRender::blendFunc(eBlendFactor color_sfactor, eBlendFactor color_dfactor,
return;
}
if (mCurrBlendColorSFactor != color_sfactor || mCurrBlendColorDFactor != color_dfactor ||
mCurrBlendAlphaSFactor != alpha_sfactor || mCurrBlendAlphaDFactor != alpha_dfactor)
mCurrBlendAlphaSFactor != alpha_sfactor || mCurrBlendAlphaDFactor != alpha_dfactor || mDirty)
{
mCurrBlendColorSFactor = color_sfactor;
mCurrBlendAlphaSFactor = alpha_sfactor;