X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fglapi%2FglX_proto_size.py;h=95cb5110cc3cc8d7dd08619883a90ddd33d15432;hb=56c4226fcc54158eb7fe54eeb13539a979ec155c;hp=62f32f3836a551c678e941c27c61b6910c8d275d;hpb=ca1ac986a1d6d3f292e3d20540de884ad08d9816;p=mesa.git diff --git a/src/mesa/glapi/glX_proto_size.py b/src/mesa/glapi/glX_proto_size.py index 62f32f3836a..95cb5110cc3 100644 --- a/src/mesa/glapi/glX_proto_size.py +++ b/src/mesa/glapi/glX_proto_size.py @@ -55,14 +55,21 @@ class glx_enum_function: # Fill self.count and self.enums using the dictionary of enums - # that was passed in. + # that was passed in. The generic Get functions (e.g., + # GetBooleanv and friends) are handled specially here. In + # the data the generic Get functions are refered to as "Get". + + if func_name in ["GetIntegerv", "GetBooleanv", "GetFloatv", "GetDoublev"]: + match_name = "Get" + else: + match_name = func_name mode_set = 0 for enum_name in enum_dict: e = enum_dict[ enum_name ] - - if e.functions.has_key( func_name ): - [count, mode] = e.functions[ func_name ] + + if e.functions.has_key( match_name ): + [count, mode] = e.functions[ match_name ] if mode_set and mode != self.mode: raise RuntimeError("Not all enums for %s have the same mode." % (func_name)) @@ -92,8 +99,8 @@ class glx_enum_function: self.count[i].sort() for e in self.count[i]: - self.sig += "%04x,%u," % (e, i) - + self.sig += "%04x,%d," % (e, i) + return self.sig @@ -270,7 +277,7 @@ class glx_server_enum_function(glx_enum_function): for o in keys: p = f.parameters_by_name[ foo[o] ] - printer.common_emit_one_arg(p, "pc", " ", 0) + printer.common_emit_one_arg(p, "pc", 0) fixup.append( p.name ) @@ -309,6 +316,8 @@ class PrintGlxSizeStubs_c(PrintGlxSizeStubs_common): print '#include ' if self.emit_get: print '#include "indirect_size_get.h"' + print '#include "glxserver.h"' + print '#include "indirect_util.h"' print '#include "indirect_size.h"' @@ -422,6 +431,13 @@ class PrintGlxReqSize_h(PrintGlxReqSize_common): class PrintGlxReqSize_c(PrintGlxReqSize_common): + """Create the server-side 'request size' functions. + + Create the server-side functions that are used to determine what the + size of a varible length command should be. The server then uses + this value to determine if the incoming command packed it malformed. + """ + def __init__(self): PrintGlxReqSize_common.__init__(self) self.counter_sigs = {} @@ -430,11 +446,10 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common): def printRealHeader(self): print '' print '#include ' - print '#include ' 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 '' @@ -515,17 +530,17 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common): if fixup: print ' if (swap) {' for name in fixup: - print ' %-14s = bswap_32( %s );' % (name, name) + print ' %s = bswap_32(%s);' % (name, name) print ' }' return - def common_emit_one_arg(self, p, pc, indent, adjust): + def common_emit_one_arg(self, p, pc, adjust): offset = p.offset dst = p.string() src = '(%s *)' % (p.type_string()) - print '%s%-18s = *%11s(%s + %u);' % (indent, dst, src, pc, offset + adjust); + print '%-18s = *%11s(%s + %u);' % (dst, src, pc, offset + adjust); return @@ -539,7 +554,7 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common): self.common_func_print_just_header(f) f.offset_of( f.parameters[0].name ) - [dim, w, h, d, junk] = f.dimensions() + [dim, w, h, d, junk] = f.get_images()[0].get_dimensions() print ' GLint row_length = * (GLint *)(pc + 4);' @@ -559,13 +574,18 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common): img = f.images[0] for p in f.parameterIterateGlxSend(): if p.name in [w, h, d, img.img_format, img.img_type, img.img_target]: - self.common_emit_one_arg( p, "pc", " ", 0 ) + self.common_emit_one_arg(p, "pc", 0) fixup.append( p.name ) print '' self.common_emit_fixups(fixup) + if img.img_null_flag: + print '' + print ' if (*(CARD32 *) (pc + %s))' % (img.offset - 4) + print ' return 0;' + print '' print ' return __glXImageSize(%s, %s, %s, %s, %s, %s,' % (img.img_format, img.img_type, img.img_target, w, h, d ) print ' image_height, row_length, skip_images,' @@ -617,7 +637,7 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common): self.common_func_print_just_header(f) for p in params: - self.common_emit_one_arg(p, "pc", " ", 0 ) + self.common_emit_one_arg(p, "pc", 0) print '' @@ -636,8 +656,6 @@ def show_usage(): print " -m output_mode Output mode can be one of 'size_c' or 'size_h'." print " --only-get Only emit 'get'-type functions." print " --only-set Only emit 'set'-type functions." - print " --get-alias-set When only 'get'-type functions are emitted, allow them" - print " to be aliases to 'set'-type funcitons." print "" print "By default, both 'get' and 'set'-type functions are emitted." sys.exit(1)