self.license = license.bsd_license_template % ( "(C) Copyright IBM Corporation 2004, 2005", "IBM")
self.generic_sizes = [3, 4, 6, 8, 12, 16, 24, 32]
self.pixel_stubs = {}
+ self.debug = 0
return
def printRealHeader(self):
return
def printFunction(self, f):
- if f.fn_offset < 0 or f.handcode or f.ignore: return
+ if f.fn_offset < 0 or f.client_handcode or f.ignore: return
if f.glx_rop != 0 or f.vectorequiv != None:
if f.image:
def printSingleFunction(self, f):
self.common_func_print_header(f)
+ if self.debug:
+ print ' printf( "Enter %%s...\\n", "gl%s" );' % (f.name)
+
if f.fn_parameters != []:
pc_decl = "GLubyte const * pc ="
else:
aa = "GL_FALSE"
print " %s read_reply(dpy, %s, %s, %s);" % (return_str, output_size, output_str, aa)
+ elif self.debug:
+ # Only emit the extra glFinish call for functions
+ # that don't already require a reply from the server.
+ print ' __indirect_glFinish();'
+
+ if self.debug:
+ print ' printf( "Exit %%s.\\n", "gl%s" );' % (f.name)
+
print ' UnlockDisplay(dpy); SyncHandle();'
print ' }'
indent = ""
trailer = None
+ if self.debug:
+ print '%s printf( "Enter %%s...\\n", "gl%s" );' % (indent, f.name)
+
if f.can_be_large:
print '%s if (cmdlen <= gc->maxSmallRenderCommandSize) {' % (indent)
print '%s if ( (gc->pc + cmdlen) > gc->bufEnd ) {' % (indent)
self.large_emit_begin(indent, f)
offset = self.common_emit_args(f, "pc", indent, 8, 1)
-
+
p = f.variable_length_parameter()
print '%s __glXSendLargeCommand(gc, pc, %u, %s, %s);' % (indent, offset + 8, p.name, p.size_string())
print '%s}' % (indent)
+ if self.debug:
+ print '%s __indirect_glFinish();' % (indent)
+ print '%s printf( "Exit %%s.\\n", "gl%s" );' % (indent, f.name)
+
if trailer: print trailer
print '}'
print ''
def show_usage():
- print "Usage: %s [-f input_file_name] [-m output_mode]" % sys.argv[0]
+ print "Usage: %s [-f input_file_name] [-m output_mode] [-d]" % sys.argv[0]
+ print " -m output_mode Output mode can be one of 'proto', 'init_c' or 'init_h'."
+ print " -d Enable extra debug information in the generated code."
sys.exit(1)
file_name = "gl_API.xml"
try:
- (args, trail) = getopt.getopt(sys.argv[1:], "f:m:")
+ (args, trail) = getopt.getopt(sys.argv[1:], "f:m:d")
except Exception,e:
show_usage()
+ debug = 0
mode = "proto"
for (arg,val) in args:
if arg == "-f":
file_name = val
elif arg == "-m":
mode = val
+ elif arg == "-d":
+ debug = 1
if mode == "proto":
dh = PrintGlxProtoStubs()
f = open(file_name)
+ dh.debug = debug
dh.printHeader()
parser.parse(f)
dh.printFooter()