diff --git a/src/dispatch_common.c b/src/dispatch_common.c index 32fb43e..cf2a398 100644 --- a/src/dispatch_common.c +++ b/src/dispatch_common.c @@ -338,6 +338,16 @@ epoxy_gles2_dlsym(const char *name) return do_dlsym(&api.gles1_handle, "libGLESv2.so.2", name, true); } +void * +epoxy_get_core_proc_address(const char *name, int core_version) +{ + if (core_version <= 12) { + return epoxy_gl_dlsym(name); + } else { + return epoxy_get_proc_address(name); + } +} + void * epoxy_get_proc_address(const char *name) { diff --git a/src/dispatch_common.h b/src/dispatch_common.h index a454ad3..78fc042 100644 --- a/src/dispatch_common.h +++ b/src/dispatch_common.h @@ -55,6 +55,7 @@ void *epoxy_gl_dlsym(const char *name); void *epoxy_gles1_dlsym(const char *name); void *epoxy_gles2_dlsym(const char *name); void *epoxy_get_proc_address(const char *name); +void *epoxy_get_core_proc_address(const char *name, int core_version); int epoxy_conservative_gl_version(void); bool epoxy_conservative_has_gl_extension(const char *name); diff --git a/src/gen_dispatch.py b/src/gen_dispatch.py index 537ae80..0de4274 100755 --- a/src/gen_dispatch.py +++ b/src/gen_dispatch.py @@ -282,14 +282,8 @@ class Generator(object): human_name = 'Desktop OpenGL {0}'.format(feature.get('number')) condition = 'epoxy_is_desktop_gl()' - # Everything in GL 1.2 is guaranteed to be present as - # public symbols in the Linux libGL ABI. Everything - # else is supposed to not be present, so you have to - # glXGetProcAddress() it. - if version <= 12: - loader = 'epoxy_gl_dlsym({0})' - else: - loader = 'epoxy_get_proc_address({0})' + loader = 'epoxy_get_core_proc_address({0}, {1})'.format('{0}', version) + if version >= 11: condition += ' && epoxy_conservative_gl_version() >= {0}'.format(version) elif api == 'gles2': human_name = 'OpenGL ES {0}'.format(feature.get('number'))