diff options
Diffstat (limited to 'mesalib/src/mapi/glapi/gen')
-rw-r--r-- | mesalib/src/mapi/glapi/gen/glX_proto_send.py | 40 | ||||
-rw-r--r-- | mesalib/src/mapi/glapi/gen/gl_table.py | 6 |
2 files changed, 31 insertions, 15 deletions
diff --git a/mesalib/src/mapi/glapi/gen/glX_proto_send.py b/mesalib/src/mapi/glapi/gen/glX_proto_send.py index bec022218..ca3a79056 100644 --- a/mesalib/src/mapi/glapi/gen/glX_proto_send.py +++ b/mesalib/src/mapi/glapi/gen/glX_proto_send.py @@ -423,7 +423,10 @@ __indirect_get_proc_address(const char *name) print '' print '#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)' print ' if (gc->isDirect) {' - print ' %sGET_DISPATCH()->%s(%s);' % (ret_string, func.name, func.get_called_parameter_string()) + print ' const _glapi_proc *const table = GET_DISPATCH();' + print ' PFNGL%sPROC p =' % (name.upper()) + print ' (PFNGL%sPROC) table[%d];' % (name.upper(), func.offset) + print ' %sp(%s);' % (ret_string, func.get_called_parameter_string()) print ' } else' print '#endif' print ' {' @@ -928,6 +931,7 @@ class PrintGlxProtoInit_c(gl_XML.gl_print_base): #include "indirect_init.h" #include "indirect.h" #include "glapi.h" +#include <assert.h> /** @@ -945,26 +949,24 @@ static int NoOp(void) */ struct _glapi_table * __glXNewIndirectAPI( void ) { - struct _glapi_table *glAPI; - GLuint entries; + _glapi_proc *table; + unsigned entries; + unsigned i; + int o; entries = _glapi_get_dispatch_table_size(); - glAPI = (struct _glapi_table *) Xmalloc(entries * sizeof(void *)); + table = (_glapi_proc *) Xmalloc(entries * sizeof(_glapi_proc)); /* first, set all entries to point to no-op functions */ - { - int i; - void **dispatch = (void **) glAPI; - for (i = 0; i < entries; i++) { - dispatch[i] = (void *) NoOp; - } + for (i = 0; i < entries; i++) { + table[i] = (_glapi_proc) NoOp; } /* now, initialize the entries we understand */""" def printRealFooter(self): print """ - return glAPI; + return (struct _glapi_table *) table; } """ return @@ -973,14 +975,22 @@ struct _glapi_table * __glXNewIndirectAPI( void ) def printBody(self, api): for [name, number] in api.categoryIterate(): if number != None: - preamble = '\n /* %3u. %s */\n\n' % (int(number), name) + preamble = '\n /* %3u. %s */\n' % (int(number), name) else: - preamble = '\n /* %s */\n\n' % (name) + preamble = '\n /* %s */\n' % (name) for func in api.functionIterateByCategory(name): if func.client_supported_for_indirect(): - print '%s glAPI->%s = __indirect_gl%s;' % (preamble, func.name, func.name) - preamble = '' + if preamble: + print preamble + preamble = None + + if func.is_abi(): + print ' table[{offset}] = (_glapi_proc) __indirect_gl{name};'.format(name = func.name, offset = func.offset) + else: + print ' o = _glapi_get_proc_offset("gl{0}");'.format(func.name) + print ' assert(o > 0);' + print ' table[o] = (_glapi_proc) __indirect_gl{0};'.format(func.name) return diff --git a/mesalib/src/mapi/glapi/gen/gl_table.py b/mesalib/src/mapi/glapi/gen/gl_table.py index 7f3b91513..a0ae4c39a 100644 --- a/mesalib/src/mapi/glapi/gen/gl_table.py +++ b/mesalib/src/mapi/glapi/gen/gl_table.py @@ -39,14 +39,20 @@ class PrintGlTable(gl_XML.gl_print_base): self.license = license.bsd_license_template % ( \ """Copyright (C) 1999-2003 Brian Paul All Rights Reserved. (C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM") + self.ifdef_emitted = False; return def printBody(self, api): for f in api.functionIterateByOffset(): + if not f.is_abi() and not self.ifdef_emitted: + print '#if !defined HAVE_SHARED_GLAPI' + self.ifdef_emitted = True arg_string = f.get_parameter_string() print ' %s (GLAPIENTRYP %s)(%s); /* %d */' % (f.return_type, f.name, arg_string, f.offset) + print '#endif /* !defined HAVE_SHARED_GLAPI */' + def printRealHeader(self): print '#ifndef GLAPIENTRYP' |