summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-01-16 07:52:14 +0100
committerGitHub <noreply@github.com>2020-01-16 07:52:14 +0100
commitb43101aae1718b5733a08fe7f626699465d8ae5c (patch)
tree0ab3f2a15841c805d9c8caf6aeafac232a1a9ff4
parent318445c5488734e64c7ea6877e5eab27acc1594d (diff)
parentc08d8feeadb39efd14364c55726c33405ea8b594 (diff)
Merge pull request #35169 from hoontee/master
Fix Vsync Via Compositor causing halved refresh rate when vsync is forced by the graphics driver
-rw-r--r--platform/windows/context_gl_windows.cpp3
-rw-r--r--platform/windows/context_gl_windows.h2
2 files changed, 4 insertions, 1 deletions
diff --git a/platform/windows/context_gl_windows.cpp b/platform/windows/context_gl_windows.cpp
index 21d954a736..434d685250 100644
--- a/platform/windows/context_gl_windows.cpp
+++ b/platform/windows/context_gl_windows.cpp
@@ -89,7 +89,7 @@ void ContextGL_Windows::swap_buffers() {
if (use_vsync) {
bool vsync_via_compositor_now = should_vsync_via_compositor();
- if (vsync_via_compositor_now) {
+ if (vsync_via_compositor_now && wglGetSwapIntervalEXT() == 0) {
DwmFlush();
}
@@ -205,6 +205,7 @@ Error ContextGL_Windows::initialize() {
}
wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress("wglSwapIntervalEXT");
+ wglGetSwapIntervalEXT = (PFNWGLGETSWAPINTERVALEXTPROC)wglGetProcAddress("wglGetSwapIntervalEXT");
//glWrapperInit(wrapper_get_proc_address);
return OK;
diff --git a/platform/windows/context_gl_windows.h b/platform/windows/context_gl_windows.h
index 0c6a6d1814..280c5a1e3c 100644
--- a/platform/windows/context_gl_windows.h
+++ b/platform/windows/context_gl_windows.h
@@ -41,6 +41,7 @@
#include <windows.h>
typedef bool(APIENTRY *PFNWGLSWAPINTERVALEXTPROC)(int interval);
+typedef int(APIENTRY *PFNWGLGETSWAPINTERVALEXTPROC)(void);
class ContextGL_Windows {
@@ -53,6 +54,7 @@ class ContextGL_Windows {
bool vsync_via_compositor;
PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT;
+ PFNWGLGETSWAPINTERVALEXTPROC wglGetSwapIntervalEXT;
static bool should_vsync_via_compositor();