diff options
author | Jesse Barker <jesse.barker@linaro.org> | 2012-08-23 15:47:12 -0700 |
---|---|---|
committer | Jesse Barker <jesse.barker@linaro.org> | 2012-08-23 15:47:12 -0700 |
commit | 0cd473c5d57f26fbbe49a2ad8a27d95bd735c723 (patch) | |
tree | 6a921daae4639d5f061dc2b736fe65c9f97abb62 | |
parent | 86420eb42a1f138cb7f5d448d1f9d030ebdee5e3 (diff) | |
download | glmark2-0cd473c5d57f26fbbe49a2ad8a27d95bd735c723.tar.gz |
CanvasX11GLX: Updates to handle the API change for GLX_EXT_swap_control
(The spec always had a void return value for glXSwapIntervalEXT, however, the
original example and protocol had a return value of int. To make matters worse,
the header files in mesa were updated a year after the spec.). Also, make the
GLX_MESA_swap_control initialization match the new logic for GLX_EXT_swap_control.
-rw-r--r-- | src/canvas-x11-glx.cpp | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/canvas-x11-glx.cpp b/src/canvas-x11-glx.cpp index 01d71cc..db3ac70 100644 --- a/src/canvas-x11-glx.cpp +++ b/src/canvas-x11-glx.cpp @@ -28,6 +28,7 @@ static PFNGLXSWAPINTERVALEXTPROC glXSwapIntervalEXT_; static PFNGLXSWAPINTERVALMESAPROC glXSwapIntervalMESA_; +static PFNGLXGETSWAPINTERVALMESAPROC glXGetSwapIntervalMESA_; /********************* * Protected methods * @@ -60,12 +61,24 @@ CanvasX11GLX::make_current() return false; } - if ((!glXSwapIntervalEXT_ || glXSwapIntervalEXT_(xdpy_, xwin_, 0)) && - (!glXSwapIntervalMESA_ || glXSwapIntervalMESA_(0))) - { - Log::info("** Failed to set swap interval. Results may be bounded above by refresh rate.\n"); + unsigned int desired_swap(0); + unsigned int actual_swap(-1); + if (glXSwapIntervalEXT_) { + glXSwapIntervalEXT_(xdpy_, xwin_, desired_swap); + glXQueryDrawable(xdpy_, xwin_, GLX_SWAP_INTERVAL_EXT, &actual_swap); + if (actual_swap == desired_swap) + return true; + } + + if (glXSwapIntervalMESA_) { + glXSwapIntervalMESA_(desired_swap); + actual_swap = glXGetSwapIntervalMESA_(); + if (actual_swap == desired_swap) + return true; } + Log::info("** Failed to set swap interval. Results may be bounded above by refresh rate.\n"); + return true; } @@ -131,6 +144,12 @@ CanvasX11GLX::init_extensions() reinterpret_cast<const GLubyte *>("glXSwapIntervalMESA") ) ); + glXGetSwapIntervalMESA_ = + reinterpret_cast<PFNGLXGETSWAPINTERVALMESAPROC>( + glXGetProcAddress( + reinterpret_cast<const GLubyte *>("glXGetSwapIntervalMESA") + ) + ); } |