mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-02-24 15:06:58 +00:00
[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:
parent
ab6b3c211c
commit
3da459b316
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue