From 16e951c2cdfa6710f0d5cc77b513e0f2a5f1377d Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 1 Mar 2013 15:55:08 +0100 Subject: gl_common: split into platform specific files Do this instead of stuffing all x11/cocoa/win32/wayland specific code into gl_common.c. The cocoa specific parts could probably go directly into cocoa_common.m, possibly same with wayland. Also redo how the list of backends is managed. Get rid of the GLTYPE_ constants. Instead of having a big switch() on GLTYPE_, each backend entry has a function pointer to setup the MPGLContext callback (e.g. mpgl_set_backend_x11()). --- video/out/gl_common.h | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'video/out/gl_common.h') diff --git a/video/out/gl_common.h b/video/out/gl_common.h index 0150e9319c..1f28d87855 100644 --- a/video/out/gl_common.h +++ b/video/out/gl_common.h @@ -73,14 +73,6 @@ void glEnable3DLeft(GL *gl, int type); void glEnable3DRight(GL *gl, int type); void glDisable3D(GL *gl, int type); -enum MPGLType { - GLTYPE_AUTO, - GLTYPE_COCOA, - GLTYPE_W32, - GLTYPE_X11, - GLTYPE_WAYLAND, -}; - enum { MPGL_CAP_GL = (1 << 0), // GL was successfully loaded MPGL_CAP_GL_LEGACY = (1 << 1), // GL 1.1 (but not 3.x) @@ -104,7 +96,6 @@ enum { typedef struct MPGLContext { GL *gl; - enum MPGLType type; struct vo *vo; // Bit size of each component in the created framebuffer. 0 if unknown. @@ -142,9 +133,7 @@ typedef struct MPGLContext { void *priv; } MPGLContext; -int mpgl_find_backend(const char *name); - -MPGLContext *mpgl_init(enum MPGLType type, struct vo *vo); +MPGLContext *mpgl_init(struct vo *vo, const char *backend_name); void mpgl_uninit(MPGLContext *ctx); // Create a VO window and create a GL context on it. @@ -155,6 +144,18 @@ void mpgl_uninit(MPGLContext *ctx); bool mpgl_config_window(struct MPGLContext *ctx, int gl_caps, uint32_t d_width, uint32_t d_height, uint32_t flags); +int mpgl_find_backend(const char *name); + +void mpgl_set_backend_cocoa(MPGLContext *ctx); +void mpgl_set_backend_w32(MPGLContext *ctx); +void mpgl_set_backend_x11(MPGLContext *ctx); +void mpgl_set_backend_wayland(MPGLContext *ctx); + +void *mp_getdladdr(const char *s); + +void mpgl_load_functions(GL *gl, void *(*getProcAddress)(const GLubyte *), + const char *ext2); + // print a multi line string with line numbers (e.g. for shader sources) // mod, lev: module and log level, as in mp_msg() void mp_log_source(int mod, int lev, const char *src); -- cgit v1.2.3