Skip to content

Commit

Permalink
Client|macOS: Re-enable runtime vsync changes on macOS
Browse files Browse the repository at this point in the history
Also cleaned up some older code.
  • Loading branch information
skyjake committed Oct 11, 2016
1 parent 4888bba commit ca1b1c4
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 23 deletions.
1 change: 1 addition & 0 deletions doomsday/apps/client/CMakeLists.txt
Expand Up @@ -113,6 +113,7 @@ relaxed_warnings (client)
target_link_libraries (client PUBLIC Deng::libappfw Deng::libdoomsday)
if (APPLE)
link_framework (client PUBLIC Cocoa)
link_framework (client PUBLIC OpenGL)
if (DENG_HAVE_QTKIT)
link_framework (client PUBLIC QTKit) # MusicPlayer
endif ()
Expand Down
2 changes: 1 addition & 1 deletion doomsday/apps/client/include/ui/clientwindow.h
Expand Up @@ -161,7 +161,7 @@ class ClientWindow : public de::BaseWindow
void fadeInTaskBarBlur(de::TimeDelta span);
void fadeOutTaskBarBlur(de::TimeDelta span);

void updateCanvasFormat();
//void updateCanvasFormat();
void updateRootSize();

// Notifications.
Expand Down
28 changes: 14 additions & 14 deletions doomsday/apps/client/src/gl/dgl_common.cpp
Expand Up @@ -321,36 +321,36 @@ void GL_ModulateTexture(int mode)
void GL_SetVSync(dd_bool on)
{
// Outside the main thread we'll need to defer the call.
if(!Sys_InMainThread())
if (!Sys_InMainThread())
{
GL_DeferSetVSync(on);
return;
}

if(!GL_state.features.vsync) return;
if (!GL_state.features.vsync) return;

/// @todo Manage vsync via QSurfaceFormat.
qDebug() << "GL_SetVSync:" << on << "(not implemented)";
/*
#ifdef WIN32
wglSwapIntervalEXT(on? 1 : 0);
DENG_ASSERT_GL_CONTEXT_ACTIVE();

#elif defined(MACOSX)
#ifdef WIN32
{
//wglSwapIntervalEXT(on? 1 : 0);
}
#elif defined (MACOSX)
{
// Tell CGL to wait for vertical refresh.
CGLContextObj context = CGLGetCurrentContext();
assert(context != 0);
if(context)
DENG_ASSERT(context != nullptr);
if (context)
{
GLint params[1] = { on? 1 : 0 };
CGLSetParameter(context, kCGLCPSwapInterval, params);
}
}
#elif defined(Q_WS_X11)
setXSwapInterval(on? 1 : 0);
#elif defined (Q_WS_X11)
{
//setXSwapInterval(on? 1 : 0);
}
#endif
*/
}

void GL_SetMultisample(dd_bool on)
Expand Down
4 changes: 2 additions & 2 deletions doomsday/apps/client/src/render/vr.cpp
Expand Up @@ -84,12 +84,12 @@ static void vrModeChanged()

vrCfg().setMode(VRConfig::StereoMode(vrMode));

if(ClientWindow::mainExists())
if (ClientWindow::mainExists())
{
// The logical UI size may need to be changed.
ClientWindow &win = ClientWindow::main();
win.updateRootSize();
win.updateCanvasFormat(); // possibly changes pixel format
//win.updateCanvasFormat(); // possibly changes pixel format
}

/*
Expand Down
12 changes: 6 additions & 6 deletions doomsday/apps/client/src/ui/clientwindow.cpp
Expand Up @@ -628,16 +628,16 @@ DENG2_PIMPL(ClientWindow)
{
if (variable.name() == "fsaa")
{
self.updateCanvasFormat();
//self.updateCanvasFormat();
}
else if (variable.name() == "vsync")
{
#ifdef WIN32
/*#ifdef WIN32
self.updateCanvasFormat();
DENG2_UNUSED(newValue);
#else
#else*/
GL_SetVSync(newValue.isTrue());
#endif
//#endif
}
}

Expand Down Expand Up @@ -1061,11 +1061,11 @@ void ClientWindow::hideTaskBarBlur()
}
}

void ClientWindow::updateCanvasFormat()
/*void ClientWindow::updateCanvasFormat()
{
//d->needSurfaceFormatUpdate = true;
/// @todo Update Canvas surface format.
}
}*/

void ClientWindow::updateRootSize()
{
Expand Down

0 comments on commit ca1b1c4

Please sign in to comment.