diff options
author | Eric Anholt <eric@anholt.net> | 2019-04-19 12:25:29 -0700 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2019-06-25 18:29:34 -0400 |
commit | 8573dbcee30506f7ad1831247789deaf53a56a10 (patch) | |
tree | 7facd3c61b072448347499df38bae5c1a3420900 /src/gen_dispatch.py | |
parent | 4b4cd1d7680bf02007ba55732fa651bee9735c9d (diff) | |
download | libepoxy-8573dbcee30506f7ad1831247789deaf53a56a10.tar.gz |
Reuse the enum_strings in looking for extension providers.
Shaves another 14k off the binary:
1114236 56800 160 1171196 11defc providernames.so
1099948 56800 160 1156908 11a72c enumstrings.so
Fixes #202
Diffstat (limited to 'src/gen_dispatch.py')
-rwxr-xr-x | src/gen_dispatch.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/gen_dispatch.py b/src/gen_dispatch.py index 76248cb..f4d0f31 100755 --- a/src/gen_dispatch.py +++ b/src/gen_dispatch.py @@ -384,6 +384,7 @@ class Generator(object): for extension in reg.findall('extensions/extension'): extname = extension.get('name') + cond_extname = "enum_string[enum_string_offsets[i]]" self.supported_extensions.add(extname) @@ -391,19 +392,19 @@ class Generator(object): # or glx, which are separated by '|' apis = extension.get('supported').split('|') if 'glx' in apis: - condition = 'epoxy_conservative_has_glx_extension("{0}")'.format(extname) + condition = 'epoxy_conservative_has_glx_extension(provider_name)' loader = 'glXGetProcAddress((const GLubyte *){0})' self.process_require_statements(extension, condition, loader, extname) if 'egl' in apis: - condition = 'epoxy_conservative_has_egl_extension("{0}")'.format(extname) + condition = 'epoxy_conservative_has_egl_extension(provider_name)' loader = 'eglGetProcAddress({0})' self.process_require_statements(extension, condition, loader, extname) if 'wgl' in apis: - condition = 'epoxy_conservative_has_wgl_extension("{0}")'.format(extname) + condition = 'epoxy_conservative_has_wgl_extension(provider_name)' loader = 'wglGetProcAddress({0})' self.process_require_statements(extension, condition, loader, extname) if {'gl', 'gles1', 'gles2'}.intersection(apis): - condition = 'epoxy_conservative_has_gl_extension("{0}")'.format(extname) + condition = 'epoxy_conservative_has_gl_extension(provider_name)' loader = 'epoxy_get_proc_address({0})' self.process_require_statements(extension, condition, loader, extname) @@ -700,7 +701,9 @@ class Generator(object): self.outln(' int i;') self.outln(' for (i = 0; providers[i] != {0}_provider_terminator; i++) {{'.format(self.target)) + self.outln(' const char *provider_name = enum_string + enum_string_offsets[providers[i]];') self.outln(' switch (providers[i]) {') + self.outln('') for human_name in sorted(self.provider_enum.keys()): enum = self.provider_enum[human_name] |