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.
This commit is contained in:
Adam
2021-11-09 15:31:56 -05:00
parent d0b62edd6b
commit 8803034721

View File

@@ -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));
});
}
}