# This script generates the packer/packer.def file. import sys import cPickle sys.path.append("../glapi_parser") import apiutil apiutil.CopyrightDef() print "DESCRIPTION \"\"" print "EXPORTS" keys = apiutil.GetDispatchedFunctions() for func_name in keys: if apiutil.CanPack(func_name): print "crPack%s" % func_name print "crPack%sSWAP" % func_name functions = [ 'crPackVertexAttrib1dARBBBOX', 'crPackVertexAttrib1dvARBBBOX', 'crPackVertexAttrib1fARBBBOX', 'crPackVertexAttrib1fvARBBBOX', 'crPackVertexAttrib1sARBBBOX', 'crPackVertexAttrib1svARBBBOX', 'crPackVertexAttrib2dARBBBOX', 'crPackVertexAttrib2dvARBBBOX', 'crPackVertexAttrib2fARBBBOX', 'crPackVertexAttrib2fvARBBBOX', 'crPackVertexAttrib2sARBBBOX', 'crPackVertexAttrib2svARBBBOX', 'crPackVertexAttrib3dARBBBOX', 'crPackVertexAttrib3dvARBBBOX', 'crPackVertexAttrib3fARBBBOX', 'crPackVertexAttrib3fvARBBBOX', 'crPackVertexAttrib3sARBBBOX', 'crPackVertexAttrib3svARBBBOX', 'crPackVertexAttrib4dARBBBOX', 'crPackVertexAttrib4dvARBBBOX', 'crPackVertexAttrib4fARBBBOX', 'crPackVertexAttrib4fvARBBBOX',
# Also skip this function if there's a trivial implementation # (i.e. one that degenerates to solely the use of crPack functions) # Otherwise, generate the function body. # The outgoing call string is based on the parameters. State-based # functions and pixelstore-based functions will require extended # call strings. basicCallString = apiutil.MakeCallString(params) needDL = 0 needThread = 0 needClientState = 0 needFlush = 0 needTrackState = 0 needWriteback = 0 needPack = apiutil.CanPack(func_name) 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'
# Skip this function if we have a specialized implementation if apiutil.FindSpecial("packspu", func_name) or apiutil.FindSpecial( "packspu_vertex", func_name): continue if "get" in apiutil.Properties(func_name): continue # Ok, need to find out more about this function. Apiutil to our rescue # Initialize functionCouldDL = 0 functionUsesClientState = 0 functionTracksState = 0 functionPacks = apiutil.CanPack(func_name) functionFlushes = 0 functionReadsBack = 0 functionParamsString = apiutil.MakeCallString(params) packerParamsString = functionParamsString dlmParamsString = functionParamsString # If you can be compiled in a display list we'll have to check with DLM if apiutil.CanCompile(func_name): functionCouldDL = 1 # packspu_flush_special (barriers, semaphores) need to go right away if apiutil.FindSpecial("packspu_flush", func_name): functionFlushes = 1 # serverdependent functions are packed, sent immediately,
continue # The packer dispatch table is used only for replaying display lists. # It can safely have NULL entries in all the non-compilable functions. if not apiutil.CanCompile(func_name): if mode == 'source': print '/* %s not generated: not a compilable function */' % func_name lastWasComment = 1 elif mode == 'table': print '\tt->%s = NULL;' % func_name elif mode == 'header': pass continue # All entries should be packable. If they're not, we're in trouble. if not apiutil.CanPack(func_name): print '#error %s is compilable, but not packable?!?' % func_name continue # The only functions that have to be generated are the ones # that need client-side state to unpack their data. All # others will work just fine with the standard crPack # routines. if not apiutil.UsesClientState(func_name): if mode == 'table': print '\tt->%s = tilesort_spu.swap ? crPack%sSWAP : crPack%s;' % ( func_name, func_name, func_name) continue # Here, we need to generate a function. if mode == 'source':