From 6f0da71c6b98b0866b24f66c9436cffdc6a75989 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 18 Dec 2014 15:29:47 +0100 Subject: vo_opengl: minor simplification in function loader Don't force every entries without functions to define a dummy array. --- video/out/gl_common.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'video') diff --git a/video/out/gl_common.c b/video/out/gl_common.c index a8f06f7b6b..892f7cee8d 100644 --- a/video/out/gl_common.c +++ b/video/out/gl_common.c @@ -313,28 +313,24 @@ static const struct gl_functions gl_functions[] = { .ver_core = MPGL_VER(3, 0), .extension = "GL_EXT_texture_sRGB", .provides = MPGL_CAP_SRGB_TEX, - .functions = (const struct gl_function[]) {{0}}, }, // sRGB framebuffers, extension in GL 2.x, core in GL 3.x core. { .ver_core = MPGL_VER(3, 0), .extension = "GL_EXT_framebuffer_sRGB", .provides = MPGL_CAP_SRGB_FB, - .functions = (const struct gl_function[]) {{0}}, }, // Float textures, extension in GL 2.x, core in GL 3.x core. { .ver_core = MPGL_VER(3, 0), .extension = "GL_ARB_texture_float", .provides = MPGL_CAP_FLOAT_TEX, - .functions = (const struct gl_function[]) {{0}}, }, // GL_RED / GL_RG textures, extension in GL 2.x, core in GL 3.x core. { .ver_core = MPGL_VER(3, 0), .extension = "GL_ARB_texture_rg", .provides = MPGL_CAP_TEX_RG, - .functions = (const struct gl_function[]) {{0}}, }, // Swap control, always an OS specific extension { @@ -460,9 +456,6 @@ static const struct gl_functions gl_functions[] = { { .extension = "GL_APPLE_rgb_422", .provides = MPGL_CAP_APPLE_RGB_422, - .functions = (const struct gl_function[]) { - {0} - }, }, }; @@ -582,9 +575,10 @@ void mpgl_load_functions2(GL *gl, void *(*get_fn)(void *ctx, const char *n), void *loaded[MAX_FN_COUNT] = {0}; bool all_loaded = true; + const struct gl_function *fnlist = section->functions; - for (int i = 0; section->functions[i].funcnames[0]; i++) { - const struct gl_function *fn = §ion->functions[i]; + for (int i = 0; fnlist && fnlist[i].funcnames[0]; i++) { + const struct gl_function *fn = &fnlist[i]; void *ptr = NULL; for (int x = 0; fn->funcnames[x]; x++) { ptr = get_fn(fn_ctx, fn->funcnames[x]); @@ -608,8 +602,8 @@ void mpgl_load_functions2(GL *gl, void *(*get_fn)(void *ctx, const char *n), if (all_loaded || section->partial_ok) { gl->mpgl_caps |= section->provides; - for (int i = 0; section->functions[i].funcnames[0]; i++) { - const struct gl_function *fn = §ion->functions[i]; + for (int i = 0; fnlist && fnlist[i].funcnames[0]; i++) { + const struct gl_function *fn = &fnlist[i]; void **funcptr = (void**)(((char*)gl) + fn->offset); if (loaded[i]) *funcptr = loaded[i]; -- cgit v1.2.3