Commit 77c14051 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

opengl: add missing callback to release the (current) context

parent a06b129a
......@@ -45,6 +45,7 @@ struct vlc_gl_t
void *sys;
int (*makeCurrent)(vlc_gl_t *);
void (*releaseCurrent)(vlc_gl_t *);
void (*swap)(vlc_gl_t *);
int (*lock)(vlc_gl_t *);
void (*unlock)(vlc_gl_t *);
......@@ -65,6 +66,11 @@ static inline int vlc_gl_MakeCurrent(vlc_gl_t *gl)
return gl->makeCurrent(gl);
}
static inline void vlc_gl_ReleaseCurrent(vlc_gl_t *gl)
{
gl->releaseCurrent(gl);
}
static inline int vlc_gl_Lock(vlc_gl_t *gl)
{
return (gl->lock != NULL) ? gl->lock(gl) : VLC_SUCCESS;
......
......@@ -69,6 +69,7 @@ typedef struct vlc_gl_sys_t
/* OpenGL callbacks */
static int MakeCurrent (vlc_gl_t *);
static void ReleaseCurrent (vlc_gl_t *);
static void SwapBuffers (vlc_gl_t *);
static void *GetSymbol(vlc_gl_t *, const char *);
......@@ -214,6 +215,7 @@ static int Open (vlc_object_t *obj, const struct gl_api *api)
/* Initialize OpenGL callbacks */
gl->sys = sys;
gl->makeCurrent = MakeCurrent;
gl->releaseCurrent = ReleaseCurrent;
gl->swap = SwapBuffers;
gl->getProcAddress = GetSymbol;
gl->lock = NULL;
......@@ -271,6 +273,14 @@ static int MakeCurrent (vlc_gl_t *gl)
return VLC_SUCCESS;
}
static void ReleaseCurrent (vlc_gl_t *gl)
{
vlc_gl_sys_t *sys = gl->sys;
eglMakeCurrent (sys->display, EGL_NO_SURFACE, EGL_NO_SURFACE,
EGL_NO_CONTEXT);
}
static void SwapBuffers (vlc_gl_t *gl)
{
vlc_gl_sys_t *sys = gl->sys;
......
......@@ -55,6 +55,7 @@ typedef struct vlc_gl_sys_t
} vlc_gl_sys_t;
static int MakeCurrent (vlc_gl_t *);
static void ReleaseCurrent (vlc_gl_t *);
static void SwapBuffers (vlc_gl_t *);
static void *GetSymbol(vlc_gl_t *, const char *);
......@@ -184,6 +185,15 @@ static int Open (vlc_object_t *obj)
goto error;
}
/* Initialize OpenGL callbacks */
gl->sys = sys;
gl->makeCurrent = MakeCurrent;
gl->releaseCurrent = ReleaseCurrent;
gl->swap = SwapBuffers;
gl->getProcAddress = GetSymbol;
gl->lock = NULL;
gl->unlock = NULL;
#ifdef GLX_ARB_get_proc_address
bool is_swap_interval_set = false;
# ifdef GLX_SGI_swap_control
......@@ -209,13 +219,6 @@ static int Open (vlc_object_t *obj)
# endif
#endif
/* Initialize OpenGL callbacks */
gl->sys = sys;
gl->makeCurrent = MakeCurrent;
gl->swap = SwapBuffers;
gl->getProcAddress = GetSymbol;
gl->lock = NULL;
gl->unlock = NULL;
return VLC_SUCCESS;
error:
......@@ -245,6 +248,13 @@ static int MakeCurrent (vlc_gl_t *gl)
return VLC_SUCCESS;
}
static void ReleaseCurrent (vlc_gl_t *gl)
{
vlc_gl_sys_t *sys = gl->sys;
glXMakeContextCurrent (sys->display, None, None, NULL);
}
static void SwapBuffers (vlc_gl_t *gl)
{
vlc_gl_sys_t *sys = gl->sys;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment