Make sure the vsync methods are really available

libglvnd seems to return a pointer to a function that does NOTHING
for things the backing driver doesn't support.

So we check if the extension is actually advertised before using it.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2018-12-08 18:15:19 +00:00
parent 8114ec4c79
commit da3df75a8c
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
1 changed files with 20 additions and 0 deletions

View File

@ -4485,6 +4485,11 @@ vsync_opengl_init(session_t *ps) {
if (!ensure_glx_context(ps))
return false;
if (!glx_hasglxext(ps, "GLX_SGI_video_sync")) {
printf_errf("(): Your driver doesn't support SGI_video_sync, giving up.");
return false;
}
// Get video sync functions
if (!ps->psglx->glXGetVideoSyncSGI)
ps->psglx->glXGetVideoSyncSGI = (f_GetVideoSync)
@ -4510,6 +4515,11 @@ vsync_opengl_oml_init(session_t *ps) {
if (!ensure_glx_context(ps))
return false;
if (!glx_hasglxext(ps, "GLX_OML_sync_control")) {
printf_errf("(): Your driver doesn't support OML_sync_control, giving up.");
return false;
}
// Get video sync functions
if (!ps->psglx->glXGetSyncValuesOML)
ps->psglx->glXGetSyncValuesOML = (f_GetSyncValuesOML)
@ -4535,6 +4545,11 @@ vsync_opengl_swc_init(session_t *ps) {
if (!ensure_glx_context(ps))
return false;
if (!glx_hasglxext(ps, "GLX_SGI_swap_control")) {
printf_errf("(): Your driver doesn't support SGI_swap_control, giving up.");
return false;
}
if (!bkend_use_glx(ps)) {
printf_errf("(): I'm afraid glXSwapIntervalSGI wouldn't help if you are "
"not using GLX backend. You could try, nonetheless.");
@ -4563,6 +4578,11 @@ vsync_opengl_mswc_init(session_t *ps) {
if (!ensure_glx_context(ps))
return false;
if (!glx_hasglxext(ps, "GLX_MESA_swap_control")) {
printf_errf("(): Your driver doesn't support MESA_swap_control, giving up.");
return false;
}
if (!bkend_use_glx(ps)) {
printf_errf("(): I'm afraid glXSwapIntervalMESA wouldn't help if you are "
"not using GLX backend. You could try, nonetheless.");