aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mapi
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mapi')
-rw-r--r--mesalib/src/mapi/glapi/gen/gl_table.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/mesalib/src/mapi/glapi/gen/gl_table.py b/mesalib/src/mapi/glapi/gen/gl_table.py
index 6325341b5..a1a9186a4 100644
--- a/mesalib/src/mapi/glapi/gen/gl_table.py
+++ b/mesalib/src/mapi/glapi/gen/gl_table.py
@@ -98,6 +98,9 @@ class PrintRemapTable(gl_XML.gl_print_base):
return
def printBody(self, api):
+ print '#ifdef _MSC_VER'
+ print '#define INLINE __inline'
+ print '#endif'
print '#define CALL_by_offset(disp, cast, offset, parameters) \\'
print ' (*(cast (GET_by_offset(disp, offset)))) parameters'
print '#define GET_by_offset(disp, offset) \\'
@@ -167,11 +170,18 @@ class PrintRemapTable(gl_XML.gl_print_base):
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), _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)
+ print 'typedef %s (GLAPIENTRYP _glptr_%s)(%s);' % (f.return_type, f.name, arg_string)
+ print '#define CALL_%s(disp, parameters) \\' % (f.name)
+ print ' (* GET_%s(disp)) parameters' % (f.name)
+ print 'static INLINE _glptr_%s GET_%s(struct _glapi_table *disp) {' % (f.name, f.name)
+ print ' return (_glptr_%s) (GET_by_offset(disp, _gloffset_%s));' % (f.name, f.name)
+ print '}'
+ print
+ print 'static INLINE void SET_%s(struct _glapi_table *disp, %s (GLAPIENTRYP fn)(%s)) {' % (f.name, f.return_type, arg_string)
+ print ' SET_by_offset(disp, _gloffset_%s, fn);' % (f.name)
+ print '}'
+ print
if alias_functions:
print ''