vo_opengl: fall back to gcc thread local storage

gcc 4.8 does not support C11 thread local storage. This is a bit
annoying, so add a hack to use the gcc specific __thread extension if
C11 TLS is not available.

(This is used for the extremely silly mpv-internal way hwdec modules
access some platform specific handles. Disabling it simply made
hwdec_vaegl.c always fail initialization.)

Fixes #2631.
This commit is contained in:
wm4 2015-12-23 17:59:35 +01:00
parent af958221a1
commit 1a6f3c56ea
1 changed files with 7 additions and 1 deletions

View File

@ -111,7 +111,13 @@ int mpgl_validate_backend_opt(struct mp_log *log, const struct m_option *opt,
}
#if HAVE_C11_TLS
static _Thread_local MPGLContext *current_context;
#define MP_TLS _Thread_local
#elif defined(__GNU__)
#define MP_TLS __thread
#endif
#ifdef MP_TLS
static MP_TLS MPGLContext *current_context;
static void * GLAPIENTRY get_native_display(const char *name)
{