summaryrefslogtreecommitdiff
path: root/src/mapi/glapi/gen
diff options
context:
space:
mode:
authorChia-I Wu <olv@lunarg.com>2010-10-26 00:16:49 +0800
committerChia-I Wu <olv@lunarg.com>2010-10-27 11:07:29 +0800
commit07b85457d95bcc70588584e9380c51cd63aa3a2b (patch)
tree29ff81a555ddd8fe6a9f5509810a9034eae8f143 /src/mapi/glapi/gen
parente4dbfa44ed018d124e1531077d506c8c914c1a51 (diff)
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.
Diffstat (limited to 'src/mapi/glapi/gen')
-rw-r--r--src/mapi/glapi/gen/Makefile4
-rw-r--r--src/mapi/glapi/gen/gl_table.py42
2 files changed, 22 insertions, 24 deletions
diff --git a/src/mapi/glapi/gen/Makefile b/src/mapi/glapi/gen/Makefile
index e8da34de42..d4efa529b5 100644
--- a/src/mapi/glapi/gen/Makefile
+++ b/src/mapi/glapi/gen/Makefile
@@ -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) $< > $@
diff --git a/src/mapi/glapi/gen/gl_table.py b/src/mapi/glapi/gen/gl_table.py
index 3bd7569e92..c7cb5a40a1 100644
--- a/src/mapi/glapi/gen/gl_table.py
+++ b/src/mapi/glapi/gen/gl_table.py
@@ -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:
- arg_string = gl_XML.create_parameter_string( f.parameters, 0 )
- cast = '%s (GLAPIENTRYP)(%s)' % (f.return_type, arg_string)
+ for f, index in functions:
+ print '#define _gloffset_%s driDispatchRemapTable[%s_remap_index]' % (f.name, f.name)
- 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 /* _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 ''
- 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 ''