print """) { CRDLMContextState *state = CURRENT_STATE(); instance->execute = executeFunc;""" # Add in the common code for adding the instance to the display list AddInstanceToList(" ") print '}' print '' # Now generate the functions that won't use the crdlm_add_to_list utility. # These all directly add their own instances to the current display list # themselves, without using the crdlm_add_to_list() function. keys = apiutil.GetDispatchedFunctions(sys.argv[3] + "/APIspec.txt") for func_name in keys: if apiutil.CanCompile(func_name): print "\n/*** %s ***/" % func_name # Auto-generate an appropriate DL function. First, functions # that go into the display list but that rely on state will # have to have their argument strings expanded, to take pointers # to that appropriate state. if whichfile == "headers": wrap_struct(func_name) elif not apiutil.FindSpecial("dlm", func_name): wrap_execute(func_name) wrap_compile(func_name) # Generate mapping between OPCODE and routines to be executed. if whichfile == "headers": # Execute routine prototype needed to add static array of routines.
#include "cr_packfunctions.h" """ pack_specials = [] keys = apiutil.GetDispatchedFunctions("../glapi_parser/APIspec.txt") # make list of special functions ## VMGL: Because of state resume, a few more functions have specialized ## implementations by the new autogen script for func_name in keys: if ("get" in apiutil.Properties(func_name) or apiutil.FindSpecial("packspu", func_name) or apiutil.FindSpecial("packspu_flush", func_name) or apiutil.FindSpecial("packspu_vertex", func_name) or apiutil.CanCompile(func_name) or apiutil.SetsTrackedState(func_name)): pack_specials.append(func_name) for func_name in keys: if apiutil.FindSpecial("packspu_unimplemented", func_name): continue if func_name in pack_specials: return_type = apiutil.ReturnType(func_name) params = apiutil.Parameters(func_name) print 'extern %s PACKSPU_APIENTRY packspu_%s( %s );' % ( return_type, func_name, apiutil.MakeDeclarationString(params)) print """ #endif
basicCallString = apiutil.MakeCallString(params) # The two "special" state functions have real state implementations; # they don't need generated implementations, but should still # appear in headers. if func_name in ['CallList', 'CallLists']: if mode == 'table': print '\tt->%s = tilesortspu_State%s;' % (func_name, func_name) elif mode == 'header': print 'extern %s TILESORTSPU_APIENTRY tilesortspu_State%s( %s );' % (return_type, func_name, declarationString) continue # This dispatch table is used only for replaying display lists state. # It can safely have NULL entries in all the non-compilable or non-state functions. if not apiutil.CanCompile(func_name): if mode == 'table': print '\tt->%s = NULL;' % func_name elif mode == 'header': pass continue # The only entries left are those that manage tracked state. Everything # else gets a NULL. if not apiutil.SetsTrackedState(func_name): if mode == 'table': print '\tt->%s = NULL;' % func_name elif mode == 'header': pass else: if mode == 'table':
print """ /* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY expando.py SCRIPT */ #include <stdio.h> #include "cr_error.h" #include "cr_spu.h" #include "cr_dlm.h" #include "expandospu.h" """ allFunctions = [] generatedFunctions = [] for func_name in apiutil.GetDispatchedFunctions(sys.argv[1] + "/APIspec.txt"): if apiutil.FindSpecial("expando", func_name): allFunctions.append(func_name) elif apiutil.CanCompile(func_name) or apiutil.SetsClientState(func_name): generatedFunctions.append(func_name) allFunctions.append(func_name) for func_name in generatedFunctions: params = apiutil.Parameters(func_name) return_type = apiutil.ReturnType(func_name) basicCallString = apiutil.MakeCallString(params) declarationString = apiutil.MakeDeclarationString(params) dlmCallString = basicCallString chromiumProps = apiutil.ChromiumProps(func_name) needClientState = 0 if apiutil.UsesClientState(func_name): dlmCallString = basicCallString + ", clientState" needClientState = 1
print """ static void __fillin( int offset, char *name, SPUGenericFunction func ) { _cr_replicate_table[offset].name = crStrdup( name ); _cr_replicate_table[offset].fn = func; }""" pack_specials = [] # The selection mechanism here must match the selection # mechanisms used in replicatespu_proto.py and # replicatespu_generate.py. for func_name in keys: if (apiutil.FindSpecial("replicate", func_name) or apiutil.IsQuery(func_name) or apiutil.CanCompile(func_name) or apiutil.FindSpecial("replicatespu_flush", func_name) or apiutil.SetsTrackedState(func_name)): pack_specials.append(func_name) print '\nvoid replicatespuCreateFunctions( void )' print '{' print '\tint i = 0;' for index in range(num_funcs): func_name = keys[index] if func_name in pack_specials: print '\t__fillin( i++, "%s", (SPUGenericFunction) replicatespu_%s );' % ( func_name, func_name) else: print '\t__fillin( i++, "%s", (SPUGenericFunction) (replicate_spu.swap ? crPack%sSWAP : crPack%s) );' % ( func_name, func_name, func_name)