From 1a6f3c56ea6e7bf9928fc99469f8f5da4578f035 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 23 Dec 2015 17:59:35 +0100 Subject: 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. --- video/out/opengl/context.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'video') diff --git a/video/out/opengl/context.c b/video/out/opengl/context.c index c863334306..9dbabd16a3 100644 --- a/video/out/opengl/context.c +++ b/video/out/opengl/context.c @@ -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) { -- cgit v1.2.3