[All] Fixed checks for EXT_swap_control_tear

EGL and NSOpenGL do not offer an EXT_swap_control_tear equivalent so
use regular vsync for now. The relevant extension string is now
correctly checked on WGL and GLX.
This commit is contained in:
thefiddler 2014-04-29 08:10:18 +02:00
parent ab6b3c211c
commit 3da459b316
4 changed files with 21 additions and 2 deletions

View file

@ -125,6 +125,12 @@ namespace OpenTK.Platform.Egl
}
set
{
if (value < 0)
{
// EGL does not offer EXT_swap_control_tear yet
value = 1;
}
if (Egl.SwapInterval(WindowInfo.Display, value))
swap_interval = value;
else

View file

@ -257,6 +257,11 @@ namespace OpenTK
}
set
{
if (value < 0)
{
// NSOpenGL does not offer EXT_swap_control_tear yet
value = 1;
}
SetContextValue(value, NSOpenGLContextParameter.SwapInterval);
}
}

View file

@ -351,7 +351,7 @@ namespace OpenTK.Platform.Windows
Wgl.SupportsFunction("wglGetSwapIntervalEXT") &&
Wgl.SupportsFunction("wglSwapIntervalEXT");
vsync_tear_supported =
Wgl.SupportsExtension(DeviceContext, "WGL_EXT_swap_tear");
Wgl.SupportsExtension(DeviceContext, "WGL_EXT_swap_control_tear");
}
base.LoadAll();

View file

@ -30,6 +30,7 @@ namespace OpenTK.Platform.X11
IntPtr display;
X11WindowInfo currentWindow;
bool vsync_supported;
bool vsync_tear_supported;
int swap_interval = 1; // As defined in GLX_SGI_swap_control
readonly X11GraphicsMode ModeSelector = new X11GraphicsMode();
@ -362,6 +363,11 @@ namespace OpenTK.Platform.X11
{
if (vsync_supported)
{
if (value < 0 && !vsync_tear_supported)
{
value = 1;
}
ErrorCode error_code = 0;
using (new XLock(Display))
error_code = Glx.Sgi.SwapInterval(value);
@ -381,8 +387,10 @@ namespace OpenTK.Platform.X11
public override void LoadAll()
{
vsync_supported =
SupportsExtension(display, currentWindow, "SupportsExtension") &&
SupportsExtension(display, currentWindow, "GLX_SGI_swap_control") &&
Glx.SupportsFunction("glXSwapIntervalSGI");
vsync_tear_supported =
SupportsExtension(display, currentWindow, "GLX_EXT_swap_control_tear");
Debug.Print("Context supports vsync: {0}.", vsync_supported);
base.LoadAll();