window: fix vsync flags

main
Dominik Madarász 2024-02-11 11:57:05 +01:00
parent 10746e8b0f
commit 6f9fb45364
6 changed files with 11 additions and 11 deletions

View File

@ -2008,9 +2008,9 @@ enum WINDOW_FLAGS {
WINDOW_FIXED = 0x200, WINDOW_FIXED = 0x200,
WINDOW_TRANSPARENT = 0x400, WINDOW_TRANSPARENT = 0x400,
WINDOW_BORDERLESS = 0x800, WINDOW_BORDERLESS = 0x800,
WINDOW_VSYNC = 0, WINDOW_VSYNC_DISABLED = 0,
WINDOW_VSYNC_ADAPTIVE = 0x1000, WINDOW_VSYNC_ADAPTIVE = 0x1000,
WINDOW_VSYNC_DISABLED = 0x2000, WINDOW_VSYNC = 0x2000,
}; };
bool window_create(float scale, unsigned flags); bool window_create(float scale, unsigned flags);
bool window_create_from_handle(void *handle, float scale, unsigned flags); bool window_create_from_handle(void *handle, float scale, unsigned flags);

View File

@ -18655,9 +18655,9 @@ enum WINDOW_FLAGS {
WINDOW_TRANSPARENT = 0x400, WINDOW_TRANSPARENT = 0x400,
WINDOW_BORDERLESS = 0x800, WINDOW_BORDERLESS = 0x800,
WINDOW_VSYNC = 0, WINDOW_VSYNC_DISABLED = 0,
WINDOW_VSYNC_ADAPTIVE = 0x1000, WINDOW_VSYNC_ADAPTIVE = 0x1000,
WINDOW_VSYNC_DISABLED = 0x2000, WINDOW_VSYNC = 0x2000,
}; };
API bool window_create(float scale, unsigned flags); 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; 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 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 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); glfwSwapInterval(interval);
const GLFWvidmode *mode = glfwGetVideoMode(monitor ? monitor : glfwGetPrimaryMonitor()); const GLFWvidmode *mode = glfwGetVideoMode(monitor ? monitor : glfwGetPrimaryMonitor());

View File

@ -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; 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 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 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); glfwSwapInterval(interval);
const GLFWvidmode *mode = glfwGetVideoMode(monitor ? monitor : glfwGetPrimaryMonitor()); const GLFWvidmode *mode = glfwGetVideoMode(monitor ? monitor : glfwGetPrimaryMonitor());

View File

@ -19,9 +19,9 @@ enum WINDOW_FLAGS {
WINDOW_TRANSPARENT = 0x400, WINDOW_TRANSPARENT = 0x400,
WINDOW_BORDERLESS = 0x800, WINDOW_BORDERLESS = 0x800,
WINDOW_VSYNC = 0, WINDOW_VSYNC_DISABLED = 0,
WINDOW_VSYNC_ADAPTIVE = 0x1000, WINDOW_VSYNC_ADAPTIVE = 0x1000,
WINDOW_VSYNC_DISABLED = 0x2000, WINDOW_VSYNC = 0x2000,
}; };
API bool window_create(float scale, unsigned flags); API bool window_create(float scale, unsigned flags);

View File

@ -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; 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 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 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); glfwSwapInterval(interval);
const GLFWvidmode *mode = glfwGetVideoMode(monitor ? monitor : glfwGetPrimaryMonitor()); const GLFWvidmode *mode = glfwGetVideoMode(monitor ? monitor : glfwGetPrimaryMonitor());

View File

@ -4722,9 +4722,9 @@ enum WINDOW_FLAGS {
WINDOW_TRANSPARENT = 0x400, WINDOW_TRANSPARENT = 0x400,
WINDOW_BORDERLESS = 0x800, WINDOW_BORDERLESS = 0x800,
WINDOW_VSYNC = 0, WINDOW_VSYNC_DISABLED = 0,
WINDOW_VSYNC_ADAPTIVE = 0x1000, WINDOW_VSYNC_ADAPTIVE = 0x1000,
WINDOW_VSYNC_DISABLED = 0x2000, WINDOW_VSYNC = 0x2000,
}; };
API bool window_create(float scale, unsigned flags); API bool window_create(float scale, unsigned flags);