From 6f9fb4536486b3d929ddb823a84d0825c5981895 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Madar=C3=A1sz?= Date: Sun, 11 Feb 2024 11:57:05 +0100 Subject: [PATCH] window: fix vsync flags --- bind/v4k.lua | 4 ++-- engine/joint/v4k.h | 6 +++--- engine/split/v4k_window.c | 2 +- engine/split/v4k_window.h | 4 ++-- engine/v4k.c | 2 +- engine/v4k.h | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/bind/v4k.lua b/bind/v4k.lua index 2801f8f..053d8ee 100644 --- a/bind/v4k.lua +++ b/bind/v4k.lua @@ -2008,9 +2008,9 @@ enum WINDOW_FLAGS { WINDOW_FIXED = 0x200, WINDOW_TRANSPARENT = 0x400, WINDOW_BORDERLESS = 0x800, - WINDOW_VSYNC = 0, + WINDOW_VSYNC_DISABLED = 0, WINDOW_VSYNC_ADAPTIVE = 0x1000, - WINDOW_VSYNC_DISABLED = 0x2000, + WINDOW_VSYNC = 0x2000, }; bool window_create(float scale, unsigned flags); bool window_create_from_handle(void *handle, float scale, unsigned flags); diff --git a/engine/joint/v4k.h b/engine/joint/v4k.h index 455a0a7..ec3c9e0 100644 --- a/engine/joint/v4k.h +++ b/engine/joint/v4k.h @@ -18655,9 +18655,9 @@ enum WINDOW_FLAGS { WINDOW_TRANSPARENT = 0x400, WINDOW_BORDERLESS = 0x800, - WINDOW_VSYNC = 0, + WINDOW_VSYNC_DISABLED = 0, WINDOW_VSYNC_ADAPTIVE = 0x1000, - WINDOW_VSYNC_DISABLED = 0x2000, + WINDOW_VSYNC = 0x2000, }; API bool window_create(float scale, unsigned flags); @@ -379457,7 +379457,7 @@ bool window_create_from_handle(void *handle, float scale, unsigned flags) { flags |= optioni("--vsync-adaptive", 0) || flag("--vsync-adaptive") ? WINDOW_VSYNC_ADAPTIVE : 0; int has_adaptive_vsync = glfwExtensionSupported("WGL_EXT_swap_control_tear") || glfwExtensionSupported("GLX_EXT_swap_control_tear") || glfwExtensionSupported("EXT_swap_control_tear"); int wants_adaptive_vsync = (flags & WINDOW_VSYNC_ADAPTIVE); - int interval = has_adaptive_vsync && wants_adaptive_vsync ? -1 : (flags & WINDOW_VSYNC_DISABLED ? 0 : 1); + int interval = has_adaptive_vsync && wants_adaptive_vsync ? -1 : (!(flags & WINDOW_VSYNC) ? 0 : 1); glfwSwapInterval(interval); const GLFWvidmode *mode = glfwGetVideoMode(monitor ? monitor : glfwGetPrimaryMonitor()); diff --git a/engine/split/v4k_window.c b/engine/split/v4k_window.c index 31fdf8c..f381b09 100644 --- a/engine/split/v4k_window.c +++ b/engine/split/v4k_window.c @@ -378,7 +378,7 @@ bool window_create_from_handle(void *handle, float scale, unsigned flags) { flags |= optioni("--vsync-adaptive", 0) || flag("--vsync-adaptive") ? WINDOW_VSYNC_ADAPTIVE : 0; int has_adaptive_vsync = glfwExtensionSupported("WGL_EXT_swap_control_tear") || glfwExtensionSupported("GLX_EXT_swap_control_tear") || glfwExtensionSupported("EXT_swap_control_tear"); int wants_adaptive_vsync = (flags & WINDOW_VSYNC_ADAPTIVE); - int interval = has_adaptive_vsync && wants_adaptive_vsync ? -1 : (flags & WINDOW_VSYNC_DISABLED ? 0 : 1); + int interval = has_adaptive_vsync && wants_adaptive_vsync ? -1 : (!(flags & WINDOW_VSYNC) ? 0 : 1); glfwSwapInterval(interval); const GLFWvidmode *mode = glfwGetVideoMode(monitor ? monitor : glfwGetPrimaryMonitor()); diff --git a/engine/split/v4k_window.h b/engine/split/v4k_window.h index d3034b1..7046695 100644 --- a/engine/split/v4k_window.h +++ b/engine/split/v4k_window.h @@ -19,9 +19,9 @@ enum WINDOW_FLAGS { WINDOW_TRANSPARENT = 0x400, WINDOW_BORDERLESS = 0x800, - WINDOW_VSYNC = 0, + WINDOW_VSYNC_DISABLED = 0, WINDOW_VSYNC_ADAPTIVE = 0x1000, - WINDOW_VSYNC_DISABLED = 0x2000, + WINDOW_VSYNC = 0x2000, }; API bool window_create(float scale, unsigned flags); diff --git a/engine/v4k.c b/engine/v4k.c index 2218f6e..351b38e 100644 --- a/engine/v4k.c +++ b/engine/v4k.c @@ -26601,7 +26601,7 @@ bool window_create_from_handle(void *handle, float scale, unsigned flags) { flags |= optioni("--vsync-adaptive", 0) || flag("--vsync-adaptive") ? WINDOW_VSYNC_ADAPTIVE : 0; int has_adaptive_vsync = glfwExtensionSupported("WGL_EXT_swap_control_tear") || glfwExtensionSupported("GLX_EXT_swap_control_tear") || glfwExtensionSupported("EXT_swap_control_tear"); int wants_adaptive_vsync = (flags & WINDOW_VSYNC_ADAPTIVE); - int interval = has_adaptive_vsync && wants_adaptive_vsync ? -1 : (flags & WINDOW_VSYNC_DISABLED ? 0 : 1); + int interval = has_adaptive_vsync && wants_adaptive_vsync ? -1 : (!(flags & WINDOW_VSYNC) ? 0 : 1); glfwSwapInterval(interval); const GLFWvidmode *mode = glfwGetVideoMode(monitor ? monitor : glfwGetPrimaryMonitor()); diff --git a/engine/v4k.h b/engine/v4k.h index 8996206..ee98424 100644 --- a/engine/v4k.h +++ b/engine/v4k.h @@ -4722,9 +4722,9 @@ enum WINDOW_FLAGS { WINDOW_TRANSPARENT = 0x400, WINDOW_BORDERLESS = 0x800, - WINDOW_VSYNC = 0, + WINDOW_VSYNC_DISABLED = 0, WINDOW_VSYNC_ADAPTIVE = 0x1000, - WINDOW_VSYNC_DISABLED = 0x2000, + WINDOW_VSYNC = 0x2000, }; API bool window_create(float scale, unsigned flags);