Check that the OpenGL drawable supports negative frame swap intervals

This commit is contained in:
Alexander Guy 2021-08-13 21:11:41 +00:00 committed by Jon Evans
parent 37fd7c785e
commit 59ad333650
1 changed files with 22 additions and 0 deletions

View File

@ -47,6 +47,28 @@ public:
if( glXSwapIntervalEXT && glXQueryDrawable && dpy && drawable )
{
if( aVal < 0 )
{
if( !GLX_EXT_swap_control_tear )
{
aVal = 0;
}
else
{
// Even though the extensions might be available,
// we need to be sure that late/adaptive swaps are
// enabled on the drawable.
unsigned lateSwapsEnabled;
glXQueryDrawable( dpy, drawable, GLX_LATE_SWAPS_TEAR_EXT, &lateSwapsEnabled );
if( !lateSwapsEnabled )
{
aVal = 0;
}
}
}
unsigned clampedInterval;
glXSwapIntervalEXT( dpy, drawable, aVal );
glXQueryDrawable( dpy, drawable, GLX_SWAP_INTERVAL_EXT, &clampedInterval );