summaryrefslogtreecommitdiff
path: root/src/mapi/glapi/gen
diff options
context:
space:
mode:
authorChia-I Wu <olv@lunarg.com>2010-10-29 12:45:04 +0800
committerChia-I Wu <olv@lunarg.com>2010-10-29 12:46:59 +0800
commit9de5c6a1cb1428154c371f4331b55b5161957b50 (patch)
treed4a40efee4d53646fb0350c7e4cf1472bd42a98c /src/mapi/glapi/gen
parent815faa448cccc38aebb1b60ecf0bd7e6bf8f277e (diff)
parentb762db62c2972506fa78a5ed72f796113fc9b0d1 (diff)
Merge branch 'glapi-reorg'
Conflicts: src/mapi/glapi/glapi_sparc.S src/mapi/glapi/glapi_x86.S src/mapi/glapi/glapidispatch.h src/mapi/glapi/glapioffsets.h src/mapi/glapi/glprocs.h
Diffstat (limited to 'src/mapi/glapi/gen')
-rw-r--r--src/mapi/glapi/gen/Makefile14
-rw-r--r--src/mapi/glapi/gen/glX_proto_send.py6
-rw-r--r--src/mapi/glapi/gen/gl_SPARC_asm.py4
-rw-r--r--src/mapi/glapi/gen/gl_procs.py8
-rw-r--r--src/mapi/glapi/gen/gl_table.py42
-rw-r--r--src/mapi/glapi/gen/gl_x86_asm.py5
6 files changed, 38 insertions, 41 deletions
diff --git a/src/mapi/glapi/gen/Makefile b/src/mapi/glapi/gen/Makefile
index d25eb983e8..ed1e664b8a 100644
--- a/src/mapi/glapi/gen/Makefile
+++ b/src/mapi/glapi/gen/Makefile
@@ -14,9 +14,7 @@ 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_DIR)/glapidispatch.h
+ $(MESA_GLAPI_DIR)/glapitable.h
MESA_GLAPI_ASM_OUTPUTS = \
$(MESA_GLAPI_DIR)/glapi_x86.S \
@@ -27,6 +25,7 @@ MESA_OUTPUTS = \
$(MESA_GLAPI_OUTPUTS) \
$(MESA_GLAPI_ASM_OUTPUTS) \
$(MESA_DIR)/main/enums.c \
+ $(MESA_DIR)/main/glapidispatch.h \
$(MESA_DIR)/main/remap_helper.h \
$(MESA_GLX_DIR)/indirect.c \
$(MESA_GLX_DIR)/indirect.h \
@@ -134,15 +133,9 @@ $(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) $< > $@
-$(MESA_GLAPI_DIR)/glapidispatch.h: gl_table.py $(COMMON)
- $(PYTHON2) $(PYTHON_FLAGS) $< -m remap_table > $@
-
######################################################################
$(MESA_GLAPI_DIR)/glapi_x86.S: gl_x86_asm.py $(COMMON)
@@ -161,6 +154,9 @@ $(MESA_DIR)/main/enums.c: gl_enums.py $(COMMON) $(ES_API)
-f $(MESA_GLAPI_DIR)/gen-es/es1_API.xml \
-f $(MESA_GLAPI_DIR)/gen-es/es2_API.xml > $@
+$(MESA_DIR)/main/glapidispatch.h: gl_table.py $(COMMON)
+ $(PYTHON2) $(PYTHON_FLAGS) $< -m remap_table > $@
+
$(MESA_DIR)/main/remap_helper.h: remap_helper.py $(COMMON)
$(PYTHON2) $(PYTHON_FLAGS) $< > $@
diff --git a/src/mapi/glapi/gen/glX_proto_send.py b/src/mapi/glapi/gen/glX_proto_send.py
index bd41c9e667..17ebad0176 100644
--- a/src/mapi/glapi/gen/glX_proto_send.py
+++ b/src/mapi/glapi/gen/glX_proto_send.py
@@ -166,7 +166,6 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
print '#include "indirect.h"'
print '#include "glxclient.h"'
print '#include "indirect_size.h"'
- print '#include "glapidispatch.h"'
print '#include "glapi.h"'
print '#include "glthread.h"'
print '#include <GL/glxproto.h>'
@@ -375,7 +374,7 @@ const GLuint __glXDefaultPixelStore[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
print ''
print '#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)'
print ' if (gc->isDirect) {'
- print ' %sCALL_%s(GET_DISPATCH(), (%s));' % (ret_string, func.name, func.get_called_parameter_string())
+ print ' %sGET_DISPATCH()->%s(%s);' % (ret_string, func.name, func.get_called_parameter_string())
print ' } else'
print '#endif'
print ' {'
@@ -994,6 +993,9 @@ extern HIDDEN NOINLINE FASTCALL GLubyte * __glXSetupVendorRequest(
asdf = func.static_glx_name(n)
if asdf not in func.static_entry_points:
print 'extern HIDDEN %s gl%s(%s);' % (func.return_type, asdf, params)
+ # give it a easy-to-remember name
+ if func.client_handcode:
+ print '#define gl_dispatch_stub_%s gl%s' % (n, asdf)
else:
print 'GLAPI %s GLAPIENTRY gl%s(%s);' % (func.return_type, asdf, params)
diff --git a/src/mapi/glapi/gen/gl_SPARC_asm.py b/src/mapi/glapi/gen/gl_SPARC_asm.py
index 33e752df38..400e684da0 100644
--- a/src/mapi/glapi/gen/gl_SPARC_asm.py
+++ b/src/mapi/glapi/gen/gl_SPARC_asm.py
@@ -39,8 +39,6 @@ class PrintGenericStubs(gl_XML.gl_print_base):
def printRealHeader(self):
- print '#include "glapi/glapioffsets.h"'
- print ''
print '#ifdef __arch64__'
print '#define GL_OFF(N)\t((N) * 8)'
print '#define GL_LL\t\tldx'
@@ -223,7 +221,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
for f in api.functionIterateByOffset():
name = f.dispatch_name()
- print '\tGL_STUB(gl%s, _gloffset_%s)' % (name, f.name)
+ print '\tGL_STUB(gl%s, %d)' % (name, f.offset)
if not f.is_static_entry_point(f.name):
print '\tHIDDEN(gl%s)' % (name)
diff --git a/src/mapi/glapi/gen/gl_procs.py b/src/mapi/glapi/gen/gl_procs.py
index 5de61fbdfe..a9ba48297a 100644
--- a/src/mapi/glapi/gen/gl_procs.py
+++ b/src/mapi/glapi/gen/gl_procs.py
@@ -96,7 +96,7 @@ typedef struct {
for func in api.functionIterateByOffset():
name = func.dispatch_name()
self.printFunctionString(func.name)
- table.append((base_offset, "gl" + name, "gl" + name, "NULL", func.name))
+ table.append((base_offset, "gl" + name, "gl" + name, "NULL", func.offset))
# The length of the function's name, plus 2 for "gl",
# plus 1 for the NUL.
@@ -112,9 +112,9 @@ typedef struct {
if func.has_different_protocol(n):
alt_name = "gl" + func.static_glx_name(n)
- table.append((base_offset, "gl" + name, alt_name, alt_name, func.name))
+ table.append((base_offset, "gl" + name, alt_name, alt_name, func.offset))
else:
- table.append((base_offset, "gl" + name, "gl" + name, "NULL", func.name))
+ table.append((base_offset, "gl" + name, "gl" + name, "NULL", func.offset))
base_offset += len(n) + 3
@@ -170,7 +170,7 @@ typedef struct {
print 'static const glprocs_table_t static_functions[] = {'
for info in table:
- print ' NAME_FUNC_OFFSET(%5u, %s, %s, %s, _gloffset_%s),' % info
+ print ' NAME_FUNC_OFFSET(%5u, %s, %s, %s, %d),' % info
print ' NAME_FUNC_OFFSET(-1, NULL, NULL, NULL, 0)'
print '};'
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 ''
diff --git a/src/mapi/glapi/gen/gl_x86_asm.py b/src/mapi/glapi/gen/gl_x86_asm.py
index 10dfa1ddb3..3b1d035f04 100644
--- a/src/mapi/glapi/gen/gl_x86_asm.py
+++ b/src/mapi/glapi/gen/gl_x86_asm.py
@@ -54,7 +54,6 @@ class PrintGenericStubs(gl_XML.gl_print_base):
def printRealHeader(self):
print '#include "x86/assyntax.h"'
- print '#include "glapi/glapioffsets.h"'
print ''
print '#if defined(STDCALL_API)'
print '# if defined(USE_MGL_NAMESPACE)'
@@ -215,7 +214,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
stack = self.get_stack_size(f)
alt = "%s@%u" % (name, stack)
- print '\tGL_STUB(%s, _gloffset_%s, %s)' % (name, f.name, alt)
+ print '\tGL_STUB(%s, %d, %s)' % (name, f.offset, alt)
if not f.is_static_entry_point(f.name):
print '\tHIDDEN(GL_PREFIX(%s, %s))' % (name, alt)
@@ -230,7 +229,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
if f.is_static_entry_point(n):
if n != f.name:
alt2 = "%s@%u" % (n, stack)
- text = '\tGL_STUB_ALIAS(%s, _gloffset_%s, %s, %s, %s)' % (n, f.name, alt2, name, alt)
+ text = '\tGL_STUB_ALIAS(%s, %d, %s, %s, %s)' % (n, f.offset, alt2, name, alt)
if f.has_different_protocol(n):
print '#ifndef GLX_INDIRECT_RENDERING'