Force Mesa to use its own call

Mesa does not support adaptive swapping but will sometimes report that
it does.  This prevents Mesa drivers from testing (and segfaulting) the
limits of their call

Fixes https://gitlab.com/kicad/code/kicad/issues/10069

(cherry picked from commit 100cf757fe)
This commit is contained in:
Seth Hillbrand 2022-01-08 17:11:13 -08:00
parent 974a66ddec
commit f4d12fb19c
1 changed files with 7 additions and 3 deletions

View File

@ -47,12 +47,16 @@ public:
Display *dpy = glXGetCurrentDisplay(); Display *dpy = glXGetCurrentDisplay();
GLXDrawable drawable = glXGetCurrentDrawable(); GLXDrawable drawable = glXGetCurrentDrawable();
std::string vendor( reinterpret_cast<const char*>( glGetString( GL_VENDOR ) ) );
bool is_mesa = ( vendor.find( "Mesa" ) != std::string::npos );
if( glXSwapIntervalEXT && glXQueryDrawable && dpy && drawable ) if( !is_mesa && glXSwapIntervalEXT && glXQueryDrawable && dpy && drawable )
{ {
std::string exts( glXQueryExtensionsString( dpy, DefaultScreen( dpy ) ) );
if( aVal < 0 ) if( aVal < 0 )
{ {
if( !wxGLCanvas::IsExtensionSupported( "GLX_EXT_swap_control_tear" ) ) if( exts.find( "GLX_EXT_swap_control_tear" ) == std::string::npos )
{ {
aVal = 0; aVal = 0;
} }
@ -62,7 +66,7 @@ public:
// we need to be sure that late/adaptive swaps are // we need to be sure that late/adaptive swaps are
// enabled on the drawable. // enabled on the drawable.
unsigned lateSwapsEnabled; unsigned lateSwapsEnabled = 0;
glXQueryDrawable( dpy, drawable, GLX_LATE_SWAPS_TEAR_EXT, &lateSwapsEnabled ); glXQueryDrawable( dpy, drawable, GLX_LATE_SWAPS_TEAR_EXT, &lateSwapsEnabled );
if( !lateSwapsEnabled ) if( !lateSwapsEnabled )