Added adaptive vsync support (selectable in preferences->graphics->hardware, provided the driver supports it). Also hide 16x fsaa on amd hardware, as it is not supported on said hardware (unsure about intel).

This commit is contained in:
Shyotl
2014-03-28 02:34:03 -05:00
parent 894261862d
commit d6fdaa93a4
20 changed files with 204 additions and 54 deletions

View File

@@ -1640,12 +1640,18 @@ LLViewerWindow::LLViewerWindow(
LLViewerWindow::sMovieBaseName = "SLmovie";
resetSnapshotLoc();
S32 vsync_mode = gSavedSettings.getS32("SHRenderVsyncMode");
if(vsync_mode == -1 && !gGLManager.mHasAdaptiveVsync)
{
vsync_mode = 0; //Disable vsync if adaptive is desired yet isn't supported.
}
// create window
mWindow = LLWindowManager::createWindow(this,
title, name, x, y, width, height, 0,
fullscreen,
gNoRender,
gSavedSettings.getBOOL("DisableVerticalSync"),
vsync_mode,
!gNoRender,
ignore_pixel_depth,
gSavedSettings.getBOOL("RenderUseFBO") ? 0 : gSavedSettings.getU32("RenderFSAASamples")); //don't use window level anti-aliasing if FBOs are enabled
@@ -4436,14 +4442,20 @@ void LLViewerWindow::movieSize(S32 new_width, S32 new_height)
BORDERHEIGHT = size.mY- y;
LLCoordScreen new_size(new_width + BORDERWIDTH,
new_height + BORDERHEIGHT);
BOOL disable_sync = gSavedSettings.getBOOL("DisableVerticalSync");
S32 vsync_mode = gSavedSettings.getS32("SHRenderVsyncMode");
if(vsync_mode == -1 && !gGLManager.mHasAdaptiveVsync)
{
vsync_mode = 0; //Disable vsync if adaptive is desired yet isn't supported.
}
if (gViewerWindow->getWindow()->getFullscreen())
{
LLGLState::checkStates();
LLGLState::checkTextureChannels();
gViewerWindow->changeDisplaySettings(FALSE,
new_size,
disable_sync,
vsync_mode,
TRUE);
LLGLState::checkStates();
LLGLState::checkTextureChannels();
@@ -5429,9 +5441,16 @@ BOOL LLViewerWindow::checkSettings()
LLGLState::checkStates();
LLGLState::checkTextureChannels();
S32 vsync_mode = gSavedSettings.getS32("SHRenderVsyncMode");
if(vsync_mode == -1 && !gGLManager.mHasAdaptiveVsync)
{
vsync_mode = 0; //Disable vsync if adaptive is desired yet isn't supported.
}
changeDisplaySettings(TRUE,
desired_screen_size,
gSavedSettings.getBOOL("DisableVerticalSync"),
vsync_mode,
mShowFullscreenProgress);
LLGLState::checkStates();
LLGLState::checkTextureChannels();
@@ -5472,7 +5491,7 @@ void LLViewerWindow::restartDisplay(BOOL show_progress_bar)
}
}
BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size, BOOL disable_vsync, BOOL show_progress_bar)
BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size, const S32 vsync_mode, BOOL show_progress_bar)
{
BOOL was_maximized = gSavedSettings.getBOOL("WindowMaximized");
mWantFullscreen = fullscreen;
@@ -5491,6 +5510,7 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size,
U32 fsaa = gSavedSettings.getU32("RenderFSAASamples");
U32 old_fsaa = mWindow->getFSAASamples();
// going from windowed to windowed
if (!old_fullscreen && !fullscreen)
{
@@ -5500,7 +5520,7 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size,
mWindow->setSize(size);
}
if (fsaa == old_fsaa)
if (fsaa == old_fsaa && vsync_mode == mWindow->getFSAASamples())
{
return TRUE;
}
@@ -5539,13 +5559,14 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size,
}
mWindow->setFSAASamples(fsaa);
mWindow->setVsyncMode(vsync_mode);
result_first_try = mWindow->switchContext(fullscreen, size, disable_vsync, &new_pos);
result_first_try = mWindow->switchContext(fullscreen, size, vsync_mode, &new_pos);
if (!result_first_try)
{
// try to switch back
mWindow->setFSAASamples(old_fsaa);
result_second_try = mWindow->switchContext(old_fullscreen, old_size, disable_vsync, &new_pos);
result_second_try = mWindow->switchContext(old_fullscreen, old_size, vsync_mode, &new_pos);
if (!result_second_try)
{