From bf628d9cf36332aff50e09d46a2f0e33a94031b1 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 16 Dec 2013 09:29:53 -0800 Subject: [PATCH] Add support for lower-priority aliases of functions. For example, on desktop 2.1 GL on Apple, there's no glBindVertexArray, but there is glBindVertexArrayAPPLE, and as far as a caller is concerned, the APPLE variant should be able to stand in for the core/ARB version. Similarly for trying to do FBOs on an old Mesa implementation that didn't have ARB_fbo yet, but did have EXT_fbo. --- src/gen_dispatch.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/gen_dispatch.py b/src/gen_dispatch.py index 8acd9da..dabca02 100755 --- a/src/gen_dispatch.py +++ b/src/gen_dispatch.py @@ -535,6 +535,22 @@ class Generator(object): for provider in alias_func.providers.values(): providers.append(provider) + # Add some partial aliases of a few functions. These are ones + # that aren't quite aliases, because of some trivial behavior + # difference (like whether to produce an error for a + # non-Genned name), but where we'd like to fall back to the + # similar function if the proper one isn't present. + half_aliases = { + 'glBindVertexArray' : 'glBindVertexArrayAPPLE', + 'glBindVertexArrayAPPLE' : 'glBindVertexArray', + 'glBindFramebuffer' : 'glBindFramebufferEXT', + 'glBindFramebufferEXT' : 'glBindFramebuffer', + } + if func.name in half_aliases: + alias_func = self.functions[half_aliases[func.name]] + for provider in alias_func.providers.values(): + providers.append(provider) + if len(providers) != 1: self.outln(' static const enum {0}_provider providers[] = {{'.format(self.target)) for provider in providers: