aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mapi/glapi/gen/glX_proto_size.py
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mapi/glapi/gen/glX_proto_size.py')
-rwxr-xr-x[-rw-r--r--]mesalib/src/mapi/glapi/gen/glX_proto_size.py43
1 files changed, 31 insertions, 12 deletions
diff --git a/mesalib/src/mapi/glapi/gen/glX_proto_size.py b/mesalib/src/mapi/glapi/gen/glX_proto_size.py
index fdb355d4d..26a2fdf36 100644..100755
--- a/mesalib/src/mapi/glapi/gen/glX_proto_size.py
+++ b/mesalib/src/mapi/glapi/gen/glX_proto_size.py
@@ -289,7 +289,7 @@ class glx_server_enum_function(glx_enum_function):
print ''
print ' compsize = __gl%s_size(%s);' % (f.name, string.join(f.count_parameter_list, ","))
p = f.variable_length_parameter()
- print ' return __GLX_PAD(%s);' % (p.size_string())
+ print ' return safe_pad(%s);' % (p.size_arg_string())
print '}'
print ''
@@ -313,7 +313,14 @@ class PrintGlxSizeStubs_common(gl_XML.gl_print_base):
class PrintGlxSizeStubs_c(PrintGlxSizeStubs_common):
def printRealHeader(self):
print ''
- print '#include <X11/Xfuncproto.h>'
+ print '#ifdef HAVE_DIX_CONFIG_H'
+ print '#include <dix-config.h>'
+ print '#else'
+ print ''
+ print '#include "glheader.h"'
+ print ''
+ print '#endif'
+ print ''
print '#include <GL/gl.h>'
if self.emit_get:
print '#include "indirect_size_get.h"'
@@ -426,7 +433,7 @@ class PrintGlxReqSize_h(PrintGlxReqSize_common):
def printBody(self, api):
for func in api.functionIterateGlx():
if not func.ignore and func.has_variable_size_request():
- print 'extern PURE _X_HIDDEN int __glX%sReqSize(const GLbyte *pc, Bool swap);' % (func.name)
+ print 'extern PURE _X_HIDDEN int __glX%sReqSize(const GLbyte *pc, Bool swap, int reqlen);' % (func.name)
class PrintGlxReqSize_c(PrintGlxReqSize_common):
@@ -444,26 +451,32 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common):
def printRealHeader(self):
print ''
+ print '#ifdef HAVE_DIX_CONFIG_H'
+ print '#include <dix-config.h>'
+ print '#else'
+ print ''
+ print '#include "glheader.h"'
+ print ''
+ print '#endif'
+ print ''
print '#include <GL/gl.h>'
print '#include "glxserver.h"'
print '#include "glxbyteorder.h"'
print '#include "indirect_size.h"'
print '#include "indirect_reqsize.h"'
print ''
- print '#define __GLX_PAD(x) (((x) + 3) & ~3)'
- print ''
print '#if defined(__CYGWIN__) || defined(__MINGW32__)'
print '# undef HAVE_ALIAS'
print '#endif'
print '#ifdef HAVE_ALIAS'
print '# define ALIAS2(from,to) \\'
- print ' GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap ) \\'
+ print ' GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap, int reqlen ) \\'
print ' __attribute__ ((alias( # to )));'
print '# define ALIAS(from,to) ALIAS2( from, __glX ## to ## ReqSize )'
print '#else'
print '# define ALIAS(from,to) \\'
- print ' GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap ) \\'
- print ' { return __glX ## to ## ReqSize( pc, swap ); }'
+ print ' GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap, int reqlen ) \\'
+ print ' { return __glX ## to ## ReqSize( pc, swap, reqlen ); }'
print '#endif'
print ''
print ''
@@ -545,7 +558,7 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common):
def common_func_print_just_header(self, f):
print 'int'
- print '__glX%sReqSize( const GLbyte * pc, Bool swap )' % (f.name)
+ print '__glX%sReqSize( const GLbyte * pc, Bool swap, int reqlen )' % (f.name)
print '{'
@@ -603,6 +616,7 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common):
plus = ''
size = ''
param_offsets = {}
+ plusAdded=0
# Calculate the offset of each counter parameter and the
# size string for the variable length parameter(s). While
@@ -618,8 +632,10 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common):
if s == 0: s = 1
sig += "(%u,%u)" % (f.offset_of(p.counter), s)
- size += '%s%s' % (plus, p.size_string())
- plus = ' + '
+ if len(plus)!=0:
+ plusAdded=1
+ size += '%s%s' % (plus, p.size_arg_string())
+ plus = ', '
# If the calculated signature matches a function that has
@@ -643,7 +659,10 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common):
self.common_emit_fixups(fixup)
print ''
- print ' return __GLX_PAD(%s);' % (size)
+ if plusAdded:
+ print ' return safe_pad(safe_add(%s));' % (size)
+ else:
+ print ' return safe_pad(%s);' % (size)
print '}'
print ''