Merge remote-tracking branch 'scrawl/master'

This commit is contained in:
Marc Zinnschlag 2013-10-13 18:55:49 +02:00
commit ce8694c84e
5 changed files with 30 additions and 4 deletions

View file

@ -23,6 +23,7 @@ namespace MWGui
, mLastWallpaperChangeTime(0.f) , mLastWallpaperChangeTime(0.f)
, mFirstLoad(true) , mFirstLoad(true)
, mProgress(0) , mProgress(0)
, mVSyncWasEnabled(false)
{ {
getWidget(mLoadingText, "LoadingText"); getWidget(mLoadingText, "LoadingText");
getWidget(mProgressBar, "ProgressBar"); getWidget(mProgressBar, "ProgressBar");
@ -67,6 +68,14 @@ namespace MWGui
void LoadingScreen::loadingOn() void LoadingScreen::loadingOn()
{ {
// Temporarily turn off VSync, we want to do actual loading rather than waiting for the screen to sync.
// Threaded loading would be even better, of course - especially because some drivers force VSync to on and we can't change it.
// In Ogre 1.8, the swapBuffers argument is useless and setVSyncEnabled is bugged with GLX, nothing we can do :/
mVSyncWasEnabled = mWindow->isVSyncEnabled();
#if OGRE_VERSION >= (1 << 16 | 9 << 8 | 0)
mWindow->setVSyncEnabled(false);
#endif
setVisible(true); setVisible(true);
if (mFirstLoad) if (mFirstLoad)
@ -83,6 +92,12 @@ namespace MWGui
void LoadingScreen::loadingOff() void LoadingScreen::loadingOff()
{ {
// Re-enable vsync now.
// In Ogre 1.8, the swapBuffers argument is useless and setVSyncEnabled is bugged with GLX, nothing we can do :/
#if OGRE_VERSION >= (1 << 16 | 9 << 8 | 0)
mWindow->setVSyncEnabled(mVSyncWasEnabled);
#endif
setVisible(false); setVisible(false);
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Loading); MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Loading);
@ -212,7 +227,8 @@ namespace MWGui
// caused a sync / flush and would be expensive). // caused a sync / flush and would be expensive).
// We're doing this so we can do some actual loading while the GPU is busy with the render. // We're doing this so we can do some actual loading while the GPU is busy with the render.
// This means the render is lagging a frame behind, but this is hardly noticable. // This means the render is lagging a frame behind, but this is hardly noticable.
mWindow->swapBuffers(false); // never Vsync, makes no sense here mWindow->swapBuffers();
mWindow->update(false); mWindow->update(false);
if (!hasCompositor) if (!hasCompositor)

View file

@ -57,6 +57,8 @@ namespace MWGui
Ogre::StringVector mResources; Ogre::StringVector mResources;
bool mVSyncWasEnabled;
void changeWallpaper(); void changeWallpaper();
void draw(); void draw();

View file

@ -363,8 +363,12 @@ namespace MWGui
else if (_sender == mVSyncButton) else if (_sender == mVSyncButton)
{ {
Settings::Manager::setBool("vsync", "Video", newState); Settings::Manager::setBool("vsync", "Video", newState);
// Ogre::Window::setVSyncEnabled is bugged in 1.8
#if OGRE_VERSION < (1 << 16 | 9 << 8 | 0)
MWBase::Environment::get().getWindowManager()-> MWBase::Environment::get().getWindowManager()->
messageBox("VSync will be applied after a restart", std::vector<std::string>()); messageBox("VSync will be applied after a restart", std::vector<std::string>());
#endif
apply();
} }
else else
{ {

View file

@ -769,6 +769,13 @@ void RenderingManager::processChangedSettings(const Settings::CategorySettingVec
|| it->second == "resolution y" || it->second == "resolution y"
|| it->second == "fullscreen")) || it->second == "fullscreen"))
changeRes = true; changeRes = true;
else if (it->first == "Video" && it->second == "vsync")
{
// setVSyncEnabled is bugged in 1.8
#if OGRE_VERSION >= (1 << 16 | 9 << 8 | 0)
mRendering.getWindow()->setVSyncEnabled(Settings::Manager::getBool("vsync", "Video"));
#endif
}
else if (it->second == "field of view" && it->first == "General") else if (it->second == "field of view" && it->first == "General")
mRendering.setFov(Settings::Manager::getFloat("field of view", "General")); mRendering.setFov(Settings::Manager::getFloat("field of view", "General"));
else if ((it->second == "texture filtering" && it->first == "General") else if ((it->second == "texture filtering" && it->first == "General")

View file

@ -30,9 +30,6 @@ namespace SFO
InputWrapper::~InputWrapper() InputWrapper::~InputWrapper()
{ {
if(mSDLWindow != NULL)
SDL_DestroyWindow(mSDLWindow);
mSDLWindow = NULL;
} }
void InputWrapper::capture(bool windowEventsOnly) void InputWrapper::capture(bool windowEventsOnly)