packCallString = basicCallString dlmCallString = basicCallString # Queries can either be handled by a pack/writeback, or by # a crState call, depending on whether the query is # server-dependent or not. if "serverdependent" in chromiumProps: needPack = 1 needWriteback = 1 needFlush = 1 needThread = 1 if return_type == 'void': packCallString = packCallString + ', &writeback' else: packCallString = packCallString + ', &return_val, &writeback' elif apiutil.IsQuery(func_name): needTrackState = 1 needPack = 0 # These functions have to check the display list state to see # whether they should be compiled or executed. if apiutil.CanCompile(func_name): needDL = 1 needThread = 1 if apiutil.UsesClientState(func_name): if needPack: needClientState = 1 needThread = 1 packCallString = basicCallString + ", &(clientState->unpack)" if needDL:
#include "cr_spu.h" #include "replicatespu.h" #include "cr_packfunctions.h" """ pack_specials = [] keys = apiutil.GetDispatchedFunctions("../../glapi_parser/APIspec.txt") # Create prototypes for every function that we either implement # or generate. The ones we implement are easy: they're all in # the file "replicate_special". The others are harder; this # code must be equivalent to the selection algorithm used in # replicatespu_generate.py and in replicate.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)): return_type = apiutil.ReturnType(func_name) props = apiutil.Properties(func_name) params = apiutil.Parameters(func_name) print 'extern %s REPLICATESPU_APIENTRY replicatespu_%s( %s );' % ( return_type, func_name, apiutil.MakeDeclarationString(params) ) print """ #endif """
packSuffix = "" basicCallString = apiutil.MakeCallString(params) packCallString = basicCallString dlmCallString = basicCallString needThreadDeclaration = 0 needClientStateDeclaration = 0 # Only the main source needs to handle display lists if apiutil.CanCompile(func_name): needDL = 1 needThreadDeclaration = 1 if apiutil.SetsTrackedState(func_name): needState = 1 needPack = 0 if apiutil.UsesClientState(func_name) and not apiutil.IsQuery(func_name): dlmCallString = basicCallString + ", clientState" needThreadDeclaration = 1 needClientStateDeclaration = 1 packCallString = packCallString + ", &(clientState->unpack)" if apiutil.FindSpecial("tilesort_bbox", func_name): packSuffix = "BBOX_COUNT" if "serverdependent" in chromiumProps: needThreadDeclaration = 1 needWriteback = 1 needState = 0 needPack = 0 if return_type != 'void': packCallString += ", &return_value" packCallString += ", &writeback" if apiutil.FindSpecial("tilesort_unimplemented", func_name):
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)