From 88030347212df6cd72300578b35c3159f25a6aa5 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 9 Nov 2021 15:31:56 -0500 Subject: [PATCH] gpu: enable adaptive vsync From the opengl wiki: Recent GL drivers implement a new WGL/GLX extension called EXT_swap_control_tear. This extension brings "adaptive vsync" as featured in modern gaming consoles to the PC. Adaptive vsync enables v-blank synchronisation when the frame rate is higher than the sync rate, but disables synchronisation when the frame rate drops below the sync rate. Disabling the synchronisation on low frame rates prevents the common problem where the frame rate syncs to a integer fraction of the screen's refresh rate in a complex scene. If the EXT_swap_control_tear extension is not supported, JOGL uses the absolute value as the swap interval, 1, the same as before. --- .../main/java/net/runelite/client/plugins/gpu/GpuPlugin.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java index 3f6656a445..b9900a988e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/gpu/GpuPlugin.java @@ -396,7 +396,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks final boolean unlockFps = this.config.unlockFps(); client.setUnlockedFps(unlockFps); - gl.setSwapInterval(unlockFps ? 1 : 0); + gl.setSwapInterval(unlockFps ? -1 : 0); if (log.isDebugEnabled()) { @@ -562,7 +562,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks clientThread.invokeLater(() -> { client.setUnlockedFps(unlockFps); - invokeOnMainThread(() -> gl.setSwapInterval(unlockFps ? 1 : 0)); + invokeOnMainThread(() -> gl.setSwapInterval(unlockFps ? -1 : 0)); }); } }