Example: GetTestWrapper("glActiveTextureARB") = "CR_multitexture" Example: GetTestWrapper("glBegin") = "" """ cat = apiutil.Category(func_name) if (cat == "1.0" or cat == "1.1" or cat == "1.2" or cat == "Chromium" or cat == "GL_chromium"): return '' elif cat[0] == '1': # i.e. OpenGL 1.3 or 1.4 or 1.5 return "OPENGL_VERSION_" + string.replace(cat, ".", "_") else: assert cat != '' return string.replace(cat, "GL_", "") for func_name in apiutil.AllSpecials("../state_tracker/state"): params = apiutil.Parameters(func_name) if (apiutil.FindSpecial("server", func_name) or "get" in apiutil.Properties(func_name)): continue wrap = GetTestWrapper(func_name) if wrap: print '#if defined(CR_%s)' % wrap print 'void SERVER_DISPATCH_APIENTRY glStubDispatch%s( %s )' % ( func_name, apiutil.MakeDeclarationString(params)) print '{' print '\tcrState%s( %s );' % (func_name, apiutil.MakeCallString(params)) print '\tcr_server.head_spu->dispatch_table.%s( %s );' % ( func_name, apiutil.MakeCallString(params)) print '}'
keys = apiutil.GetDispatchedFunctions("../../glapi_parser/APIspec.txt") apiutil.CopyrightC() print """ /* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY pack.py SCRIPT */ #include <stdio.h> #include "cr_string.h" #include "cr_spu.h" #include "packspu.h" #include "cr_packfunctions.h" #include "packspu_proto.h" """ num_funcs = len(keys) - len(apiutil.AllSpecials('packspu_unimplemented')) print 'SPUNamedFunctionTable _cr_pack_table[%d];' % (num_funcs + 1) print """ static void __fillin( int offset, char *name, SPUGenericFunction func ) { _cr_pack_table[offset].name = crStrdup( name ); _cr_pack_table[offset].fn = func; }""" pack_specials = [] 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)
print(""" /* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY feedback_funcs.py SCRIPT */ #ifndef CR_STATE_FEEDBACK_FUNCS_H #define CR_STATE_FEEDBACK_FUNCS_H #include "cr_error.h" #if defined(WINDOWS) #define STATE_APIENTRY __stdcall #else #define STATE_APIENTRY #endif #define STATE_UNUSED(x) ((void)x)""") keys = apiutil.GetDispatchedFunctions(sys.argv[1] + "/APIspec.txt") for func_name in apiutil.AllSpecials("feedback"): return_type = apiutil.ReturnType(func_name) params = apiutil.Parameters(func_name) print('%s STATE_APIENTRY crStateFeedback%s(%s);' % (return_type, func_name, apiutil.MakeDeclarationString(params))) for func_name in apiutil.AllSpecials("select"): return_type = apiutil.ReturnType(func_name) params = apiutil.Parameters(func_name) print('%s STATE_APIENTRY crStateSelect%s(%s);' % (return_type, func_name, apiutil.MakeDeclarationString(params))) print('\n#endif /* CR_STATE_FEEDBACK_FUNCS_H */')
# # See the file LICENSE.txt for information on redistributing this software. # This function generates a prototype for each special function import sys sys.path.append( "../../glapi_parser" ) import apiutil apiutil.CopyrightC() print """ /* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY templatespu_proto.py SCRIPT */ #ifndef TEMPLATESPU_FUNCTIONS_H #define TEMPLATESPU_FUNCTIONS_H 1 """ # make apiutil load the GL function info d = apiutil.GetFunctionDict("../../glapi_parser/APIspec.txt") # Emit a C prototype for each special function functions = apiutil.AllSpecials("template") for func_name in functions: return_type = apiutil.ReturnType(func_name) params = apiutil.Parameters(func_name) print 'extern %s TEMPLATESPU_APIENTRY templatespu%s( %s );' % ( return_type, func_name, apiutil.MakeDeclarationString(params) ) print "#endif"
print("""/* DO NOT EDIT! THIS CODE IS AUTOGENERATED BY unpack_extend.py */ #ifndef UNPACK_EXTEND_H #define UNPACK_EXTEND_H 1 #include "cr_unpack.h" #ifdef __cplusplus extern "C" { #endif """) # # Print extern declarations for all special unpacker functions # for func_name in apiutil.AllSpecials("unpacker"): if "extpack" in apiutil.ChromiumProps(func_name): print('extern void crUnpackExtend%s(PCrUnpackerState pState);' % func_name) else: print('extern void crUnpack%s(PCrUnpackerState pState);' % func_name) print(""" #ifdef __cplusplus } #endif #endif """)
} break; case GL_QUADS: if ((thread->BeginEndState + 1) % 4) { thread->BeginEndState = (thread->BeginEndState + 1) % 4; return; } break; } DoVertex(); } """ keys = apiutil.GetDispatchedFunctions("../glapi_parser/APIspec.txt") for func_name in apiutil.AllSpecials( "packspu_vertex" ): params = apiutil.Parameters(func_name) print 'void PACKSPU_APIENTRY packspu_%s( %s )' % ( func_name, apiutil.MakeDeclarationString(params) ) print '{' print '\tGET_THREAD(thread);' print '\n\t/* DLMs for state resume */' print '\tif (IN_DL(thread))' print '\t\tcrDLMCompile%s(%s);' % (func_name, apiutil.MakeCallString(params)) print '\t' print '\tif (pack_spu.swap)' print '\t{' print '\t\tcrPack%sSWAP( %s );' % ( func_name, apiutil.MakeCallString( params ) ) print '\t}' print '\telse' print '\t{' print '\t\tcrPack%s( %s );' % ( func_name, apiutil.MakeCallString( params ) )
#include "cr_packfunctions.h" #include "hiddenlinespu.h" #include "hiddenlinespu_proto.h" """ keys = apiutil.GetDispatchedFunctions("../../glapi_parser/APIspec.txt") # Determine which functions to ignore ignore_functions = [] for func_name in keys: if func_name == "CreateContext": continue if ("get" in apiutil.Properties(func_name) or "setclient" in apiutil.Properties(func_name) or "useclient" in apiutil.Properties(func_name) or func_name in apiutil.AllSpecials("hiddenline_ignore") or apiutil.Category(func_name) == "GL_chromium"): ignore_functions.append(func_name) num_funcs = len(keys) - len(ignore_functions) specials = apiutil.AllSpecials( "hiddenline" ) + apiutil.AllSpecials( "hiddenline_pixel" ) print 'SPUNamedFunctionTable _cr_hiddenline_table[%d];' % (num_funcs + 1) print '' print 'static void __fillin( int offset, char *name, SPUGenericFunction func )' print '{' print '\tCRASSERT( offset < %d);' % (num_funcs + 1) print '\t_cr_hiddenline_table[offset].name = crStrdup( name );' print '\t_cr_hiddenline_table[offset].fn = func;'
apiutil.CopyrightC() print """ /* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY server_dispatch.py SCRIPT */ #include "cr_spu.h" #include "chromium.h" #include "cr_error.h" #include "server_dispatch.h" #include "server.h" #include "cr_unpack.h" CRCurrentStatePointers crServerCurrent; """ for func_name in apiutil.AllSpecials(sys.argv[1] + "/../state_tracker/state"): params = apiutil.Parameters(func_name) if (apiutil.FindSpecial("server", func_name) or "get" in apiutil.Properties(func_name)): continue wrap = apiutil.GetCategoryWrapper(func_name) if wrap: print '#if defined(CR_%s)' % wrap print 'void SERVER_DISPATCH_APIENTRY crServerDispatch%s( %s )' % ( func_name, apiutil.MakeDeclarationString(params)) print '{' print '\tcrState%s( %s );' % (func_name, apiutil.MakeCallString(params)) print '\tcr_server.head_spu->dispatch_table.%s( %s );' % ( func_name, apiutil.MakeCallString(params)) print '}'