glapi: Merge glapioffsets.h into glapidispath.h.

Move defines in glapioffsets.h to glapidispatch.h.  Rename
_gloffset_FIRST_DYNAMIC to _gloffset_COUNT, which is equal to the number
of entries in _glapi_table.

Consistently use SET_by_offset, GET_by_offset, CALL_by_offset, and
_gloffset_* to recursively define all SET/GET/CALL macros.
This commit is contained in:
Chia-I Wu 2010-10-26 00:16:49 +08:00
parent e4dbfa44ed
commit 07b85457d9
7 changed files with 3786 additions and 5109 deletions

View File

@ -3,7 +3,6 @@ GLAPI = ../gen
include $(TOP)/configs/current
OUTPUTS := \
glapi/glapioffsets.h \
glapi/glapitable.h \
glapi/glapitemp.h \
glapi/glprocs.h \
@ -47,9 +46,6 @@ endef
%/glapidispatch.h: $(GLAPI)/gl_table.py $(COMMON)
$(call gen-glapi,-c -m remap_table)
%/glapioffsets.h: $(GLAPI)/gl_offsets.py $(COMMON)
$(call gen-glapi,-c)
%/glapitable.h: $(GLAPI)/gl_table.py $(COMMON)
$(call gen-glapi,-c)

View File

@ -14,7 +14,6 @@ MESA_GLX_DIR = $(TOP)/src/glx
MESA_GLAPI_OUTPUTS = \
$(MESA_GLAPI_DIR)/glprocs.h \
$(MESA_GLAPI_DIR)/glapitemp.h \
$(MESA_GLAPI_DIR)/glapioffsets.h \
$(MESA_GLAPI_DIR)/glapitable.h
MESA_GLAPI_ASM_OUTPUTS = \
@ -132,9 +131,6 @@ $(MESA_GLAPI_DIR)/glprocs.h: gl_procs.py $(COMMON)
$(MESA_GLAPI_DIR)/glapitemp.h: gl_apitemp.py $(COMMON)
$(PYTHON2) $(PYTHON_FLAGS) $< > $@
$(MESA_GLAPI_DIR)/glapioffsets.h: gl_offsets.py $(COMMON)
$(PYTHON2) $(PYTHON_FLAGS) $< > $@
$(MESA_GLAPI_DIR)/glapitable.h: gl_table.py $(COMMON)
$(PYTHON2) $(PYTHON_FLAGS) $< > $@

View File

@ -124,52 +124,54 @@ class PrintRemapTable(gl_XML.gl_print_base):
functions.append( [f, count] )
count += 1
else:
abi_functions.append( f )
abi_functions.append( [f, -1] )
if self.es:
# remember functions with aliases
if len(f.entry_points) > 1:
alias_functions.append(f)
print '/* total number of offsets below */'
print '#define _gloffset_COUNT %d' % (len(abi_functions + functions))
print ''
for f in abi_functions:
print '#define CALL_%s(disp, parameters) (*((disp)->%s)) parameters' % (f.name, f.name)
print '#define GET_%s(disp) ((disp)->%s)' % (f.name, f.name)
print '#define SET_%s(disp, fn) ((disp)->%s = fn)' % (f.name, f.name)
for f, index in abi_functions:
print '#define _gloffset_%s %d' % (f.name, f.offset)
print ''
print '#if !defined(_GLAPI_USE_REMAP_TABLE)'
print ''
for [f, index] in functions:
print '#define CALL_%s(disp, parameters) (*((disp)->%s)) parameters' % (f.name, f.name)
print '#define GET_%s(disp) ((disp)->%s)' % (f.name, f.name)
print '#define SET_%s(disp, fn) ((disp)->%s = fn)' % (f.name, f.name)
for f, index in functions:
print '#define _gloffset_%s %d' % (f.name, f.offset)
print ''
print '#else'
print '#else /* !_GLAPI_USE_REMAP_TABLE */'
print ''
print '#define driDispatchRemapTable_size %u' % (count)
print 'extern int driDispatchRemapTable[ driDispatchRemapTable_size ];'
print ''
for [f, index] in functions:
for f, index in functions:
print '#define %s_remap_index %u' % (f.name, index)
print ''
for [f, index] in functions:
for f, index in functions:
print '#define _gloffset_%s driDispatchRemapTable[%s_remap_index]' % (f.name, f.name)
print ''
print '#endif /* _GLAPI_USE_REMAP_TABLE */'
print ''
for f, index in abi_functions + functions:
arg_string = gl_XML.create_parameter_string( f.parameters, 0 )
cast = '%s (GLAPIENTRYP)(%s)' % (f.return_type, arg_string)
print '#define CALL_%s(disp, parameters) CALL_by_offset(disp, (%s), driDispatchRemapTable[%s_remap_index], parameters)' % (f.name, cast, f.name)
print '#define GET_%s(disp) GET_by_offset(disp, driDispatchRemapTable[%s_remap_index])' % (f.name, f.name)
print '#define SET_%s(disp, fn) SET_by_offset(disp, driDispatchRemapTable[%s_remap_index], fn)' % (f.name, f.name)
print ''
print '#endif /* !defined(_GLAPI_USE_REMAP_TABLE) */'
print '#define CALL_%s(disp, parameters) CALL_by_offset(disp, (%s), _gloffset_%s, parameters)' % (f.name, cast, f.name)
print '#define GET_%s(disp) GET_by_offset(disp, _gloffset_%s)' % (f.name, f.name)
print '#define SET_%s(disp, fn) SET_by_offset(disp, _gloffset_%s, fn)' % (f.name, f.name)
if alias_functions:
print ''

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,6 @@
#endif
#include "glapi/glapitable.h"
#include "glapi/glapioffsets.h"
#include "main/glapidispatch.h"
#endif /* _DISPATCH_H */

View File

@ -220,7 +220,6 @@ extern void _mesa_error(void *ctx, GLenum error, const char *fmtString, ... );
#define GLAPIENTRY GL_APIENTRY
#endif
#include "%sapi/glapi/glapitable.h"
#include "%sapi/glapi/glapioffsets.h"
#include "%sapi/main/glapidispatch.h"
#if FEATURE_remap_table
@ -249,7 +248,7 @@ _mesa_map_static_functions_%s(void)
#endif
typedef void (*_glapi_proc)(void); /* generic function pointer */
""" % (shortname, shortname, shortname, shortname, shortname, shortname);
""" % (shortname, shortname, shortname, shortname, shortname);
# Finally we get to the all-important functions
print """/*************************************************************

File diff suppressed because it is too large Load Diff