summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-12-18 15:29:47 +0100
committerwm4 <wm4@nowhere>2014-12-18 15:29:47 +0100
commit6f0da71c6b98b0866b24f66c9436cffdc6a75989 (patch)
tree56f3d5b2a76f520282b736b3a9bfadae5a4dfd80 /video
parent541f6731a02c9b1b82770630a159a76e75c060ef (diff)
downloadmpv-6f0da71c6b98b0866b24f66c9436cffdc6a75989.tar.bz2
mpv-6f0da71c6b98b0866b24f66c9436cffdc6a75989.tar.xz
vo_opengl: minor simplification in function loader
Don't force every entries without functions to define a dummy array.
Diffstat (limited to 'video')
-rw-r--r--video/out/gl_common.c16
1 files changed, 5 insertions, 11 deletions
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 = &section->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 = &section->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];