summaryrefslogtreecommitdiffstats
path: root/src/mapi/glapi/gen
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2012-07-31 16:40:07 -0700
committerIan Romanick <[email protected]>2012-08-08 10:06:26 -0700
commitf5dffb7e36487ff8a012725aaf78a4b7d3169102 (patch)
treeb22888dbf6944e21cd974aaf3537e3521810adbe /src/mapi/glapi/gen
parent52d6df8aa7231c1d4d80a8599af0e2c5d02c7b6c (diff)
glx: Don't rely on struct _glapi_table
When --enable-shared-glapi is used, all non-ABI entries in the table are lies. There are two completely separate code generation paths used to assign dispatch offset. Neither has any clue about the other. Unsurprisingly, the can't agree on what offsets to assign. This adds a bunch of overhead to __glXNewIndirectAPI, but this function is called at most once. The test ExtensionNopDispatch was removed. There was just no way to make this test work with the information provided in shared-glapi. Since indirect_glx.c uses _glapi_get_proc_offset now, it was also impossible to make the tests work without shared-glapi. So much pain. This fixes indirect rendering with shared-glapi. Signed-off-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mapi/glapi/gen')
-rw-r--r--src/mapi/glapi/gen/glX_proto_send.py35
1 files changed, 21 insertions, 14 deletions
diff --git a/src/mapi/glapi/gen/glX_proto_send.py b/src/mapi/glapi/gen/glX_proto_send.py
index bec0222188f..b90b1674428 100644
--- a/src/mapi/glapi/gen/glX_proto_send.py
+++ b/src/mapi/glapi/gen/glX_proto_send.py
@@ -928,6 +928,7 @@ class PrintGlxProtoInit_c(gl_XML.gl_print_base):
#include "indirect_init.h"
#include "indirect.h"
#include "glapi.h"
+#include <assert.h>
/**
@@ -945,26 +946,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 +972,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