diff options
author | Eric Anholt <eric@anholt.net> | 2013-12-09 22:14:09 -0800 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2013-12-09 23:01:33 -0800 |
commit | b128dd9b253b1586458ecb78276eb1b1a74ad4e3 (patch) | |
tree | c270d6353e87bd8e136239143b00d4617ae559b7 /src | |
parent | d73f06fb4520705ad89036cdf2142307ccd1646c (diff) |
Move the check for whether to dlsym or GPA on linux to the common C code.
This is going to change for macos and win32, and this will be easier
than trying to spread that logic through the python code and into the
generated code.
Diffstat (limited to 'src')
-rw-r--r-- | src/dispatch_common.c | 10 | ||||
-rw-r--r-- | src/dispatch_common.h | 1 | ||||
-rwxr-xr-x | src/gen_dispatch.py | 10 |
3 files changed, 13 insertions, 8 deletions
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 @@ -339,6 +339,16 @@ epoxy_gles2_dlsym(const char *name) } 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) { #ifdef _WIN32 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')) |