Changeset 63939 in vbox for trunk/src/VBox/GuestHost/OpenGL/spu_loader
- Timestamp:
- Sep 22, 2016 7:58:05 AM (8 years ago)
- Location:
- trunk/src/VBox/GuestHost/OpenGL/spu_loader
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/spu_loader/dispatch.py
r63199 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys 7 8 import apiutil … … 10 11 apiutil.CopyrightC() 11 12 12 print 13 print(""" 13 14 14 15 /* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY dispatch.py SCRIPT */ … … 43 44 44 45 void __buildDispatch( SPU *spu ) 45 {""" 46 {""") 46 47 47 48 keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") 48 49 for func_name in keys: 49 print '\tspu->dispatch_table.%s = (%sFunc_t) __findFunc( "%s", spu );' % (func_name,func_name,func_name)50 print '}'50 print('\tspu->dispatch_table.%s = (%sFunc_t) __findFunc( "%s", spu );' % (func_name,func_name,func_name)) 51 print('}') 51 52 52 53 53 print 54 print(""" 54 55 55 56 /* … … 80 81 */ 81 82 void crSPUInitDispatch( SPUDispatchTable *dispatch, const SPUNamedFunctionTable *table ) 82 {""" 83 {""") 83 84 84 85 for func_name in keys: 85 print '\tdispatch->%s = (%sFunc_t) crSPUFindFunction(table, "%s");' % (func_name, func_name, func_name)86 print '}'86 print('\tdispatch->%s = (%sFunc_t) crSPUFindFunction(table, "%s");' % (func_name, func_name, func_name)) 87 print('}') 87 88 88 89 89 90 90 print 91 print(""" 91 92 /* 92 93 * Generic no-op function … … 123 124 } 124 125 } 125 """ 126 """) -
trunk/src/VBox/GuestHost/OpenGL/spu_loader/dispatchheader.py
r56473 r63939 6 6 # This script generates the spu_dispatch_table.h file from gl_header.parsed 7 7 8 from __future__ import print_function 8 9 import sys, string 9 10 … … 13 14 apiutil.CopyrightC() 14 15 15 print 16 print(""" 16 17 /* DO NOT EDIT - THIS FILE GENERATED BY THE dispatchheader.py SCRIPT */ 17 18 … … 27 28 #include "chromium.h" 28 29 #include "state/cr_statetypes.h" 29 """ 30 """) 30 31 31 32 keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") 32 33 33 34 34 print '/* Offsets of each function within the dispatch table */'35 print('/* Offsets of each function within the dispatch table */') 35 36 offset = 0 36 37 for func_name in keys: 37 print '#define DISPATCH_OFFSET_%s %d' % (func_name, offset)38 print('#define DISPATCH_OFFSET_%s %d' % (func_name, offset)) 38 39 offset += 1 39 print ''40 print('') 40 41 41 print '/* Function typedefs */'42 print('/* Function typedefs */') 42 43 for func_name in keys: 43 44 return_type = apiutil.ReturnType(func_name) 44 45 params = apiutil.Parameters(func_name) 45 46 46 print 'typedef %s (SPU_APIENTRY *%sFunc_t)(%s);' % (return_type, func_name, apiutil.MakePrototypeString(params))47 print ''47 print('typedef %s (SPU_APIENTRY *%sFunc_t)(%s);' % (return_type, func_name, apiutil.MakePrototypeString(params))) 48 print('') 48 49 49 print 'struct _copy_list_node;'50 print ''51 print '/* Prototype for SPU internal state load/unload callbacks. */'52 print ''53 print 'typedef int (*SPUStateFunc_t)(void *);'54 print ''55 print '/* The SPU dispatch table */'56 print 'typedef struct _spu_dispatch_table {'50 print('struct _copy_list_node;') 51 print('') 52 print('/* Prototype for SPU internal state load/unload callbacks. */') 53 print('') 54 print('typedef int (*SPUStateFunc_t)(void *);') 55 print('') 56 print('/* The SPU dispatch table */') 57 print('typedef struct _spu_dispatch_table {') 57 58 58 59 for func_name in keys: 59 print "\t%sFunc_t %s; " % ( func_name, func_name)60 print("\t%sFunc_t %s; " % ( func_name, func_name )) 60 61 61 print 62 print(""" 62 63 struct _copy_list_node *copyList; 63 64 struct _spu_dispatch_table *copy_of; … … 75 76 76 77 #endif /* CR_SPU_DISPATCH_TABLE_H */ 77 """ 78 """) -
trunk/src/VBox/GuestHost/OpenGL/spu_loader/glloader.py
r63199 r63939 5 5 6 6 7 from __future__ import print_function 7 8 import sys 8 9 import apiutil … … 13 14 apiutil.CopyrightC() 14 15 15 print 16 print(""" 16 17 /* DO NOT EDIT - THIS FILE GENERATED BY THE glloader.py SCRIPT */ 17 18 #include "cr_error.h" … … 212 213 #endif 213 214 } 214 """ 215 """) 215 216 216 217 … … 229 230 return_type = apiutil.ReturnType(func_name); 230 231 params = apiutil.Parameters(func_name) 231 print 'static %s GLLOADER_APIENTRY Nop%s(%s)' % (return_type, func_name, apiutil.MakeDeclarationString(params))232 print '{'232 print('static %s GLLOADER_APIENTRY Nop%s(%s)' % (return_type, func_name, apiutil.MakeDeclarationString(params))) 233 print('{') 233 234 for (name, type, vecSize) in params: 234 235 if name != "": 235 print '\t(void) %s;' % name236 print('\t(void) %s;' % name) 236 237 if apiutil.ReturnType(func_name) != 'void': 237 print '\treturn 0;'238 print '}'239 print ''238 print('\treturn 0;') 239 print('}') 240 print('') 240 241 241 242 … … 252 253 # Generate the crLoadOpenGL() function 253 254 # 254 print 255 print(""" 255 256 void 256 257 crUnloadOpenGL( void ) … … 281 282 { 282 283 static const char *coreFunctions[] = { 283 """ 284 """) 284 285 285 286 for func_name in keys: 286 287 if not IsExtensionFunc(func_name): 287 print '\t\t"gl%s",' % func_name288 289 print 288 print('\t\t"gl%s",' % func_name) 289 290 print(""" 290 291 NULL 291 292 }; … … 338 339 # endif 339 340 #endif 340 """ 341 """) 341 342 342 343 useful_wgl_functions = [ … … 459 460 ] 460 461 461 print '#ifdef WINDOWS'462 print('#ifdef WINDOWS') 462 463 463 464 for fun in useful_wgl_functions: 464 print '\tinterface->%s = (%sFunc_t) crDLLGetNoError( glDll, "%s" );' % (fun,fun,fun)465 466 print '#elif defined(DARWIN)'467 print '# ifndef VBOX_WITH_COCOA_QT'465 print('\tinterface->%s = (%sFunc_t) crDLLGetNoError( glDll, "%s" );' % (fun,fun,fun)) 466 467 print('#elif defined(DARWIN)') 468 print('# ifndef VBOX_WITH_COCOA_QT') 468 469 for fun in useful_agl_functions: 469 print '\tinterface->%s = (%sFunc_t) crDLLGetNoError( aglDll, "%s" );' % (fun,fun,fun)470 print '# endif'470 print('\tinterface->%s = (%sFunc_t) crDLLGetNoError( aglDll, "%s" );' % (fun,fun,fun)) 471 print('# endif') 471 472 472 473 for fun in useful_cgl_functions: 473 print '\tinterface->%s = (%sFunc_t) crDLLGetNoError( cglDll, "%s" );' % (fun, fun,fun)474 print('\tinterface->%s = (%sFunc_t) crDLLGetNoError( cglDll, "%s" );' % (fun, fun,fun)) 474 475 475 476 for fun in in_gl_functions: 476 print '\tinterface->%s = (%sFunc_t) crDLLGetNoError( glDll, "%s" );' % (fun, fun,fun)477 478 print '#else'479 print '\t/* GLX */'477 print('\tinterface->%s = (%sFunc_t) crDLLGetNoError( glDll, "%s" );' % (fun, fun,fun)) 478 479 print('#else') 480 print('\t/* GLX */') 480 481 481 482 # XXX merge these loops? 482 483 for fun in useful_glx_functions: 483 print '\tinterface->%s = (%sFunc_t) crDLLGetNoError( glDll, "%s" );' % (fun, fun, fun)484 print('\tinterface->%s = (%sFunc_t) crDLLGetNoError( glDll, "%s" );' % (fun, fun, fun)) 484 485 for fun in possibly_useful_glx_functions: 485 print '\tinterface->%s = (%sFunc_t) crDLLGetNoError( glDll, "%s" );' % (fun, fun, fun)486 print '#endif'487 488 print 486 print('\tinterface->%s = (%sFunc_t) crDLLGetNoError( glDll, "%s" );' % (fun, fun, fun)) 487 print('#endif') 488 489 print(""" 489 490 if (!entry) 490 491 return 1; /* token value */ … … 513 514 { 514 515 struct extfunc { 515 const char *funcName; 516 const char *aliasName; 517 SPUGenericFunction nopFunction; 516 const char *funcName;""") 517 max_aliases = apiutil.ReverseAliasesMaxCount() 518 for i in range(1, 1 + max_aliases): 519 print("\t\tconst char *aliasName%d;" % i) 520 print(""" SPUGenericFunction nopFunction; 518 521 }; 519 522 static const struct extfunc functions[] = { 520 """ 523 """) 521 524 522 525 for func_name in keys: … … 526 529 else: 527 530 prefix = "gl" 528 s = '\t\t{ "' + prefix + func_name + '", ' 529 a = apiutil.ReverseAlias(func_name) 530 if a: 531 s += '"' + prefix + a + '", ' 532 else: 533 s += 'NULL, ' 534 s += '(SPUGenericFunction) Nop' + func_name + ' },' 535 print s 536 537 print """ 538 { NULL, NULL, NULL} 531 s = '\t\t{ "' + prefix + func_name + '"' 532 aliases = apiutil.ReverseAliases(func_name) 533 s += ''.join([', "' + prefix + a + '"' for a in aliases]) + ', NULL' * (max_aliases - len(aliases)) 534 s += ', (SPUGenericFunction) Nop' + func_name + ' },' 535 print(s) 536 537 print('\t\t{ NULL%s, NULL}' % (', NULL' * max_aliases)) 538 print(""" 539 539 }; 540 540 const struct extfunc *func; … … 550 550 551 551 for (func = functions; func->funcName; func++) { 552 SPUGenericFunction f = findExtFunction(interface, func->funcName); 553 if (!f && func->aliasName) { 554 f = findExtFunction(interface, func->aliasName); 555 } 556 if (!f) { 552 SPUGenericFunction f = findExtFunction(interface, func->funcName);""") 553 for i in range(1, 1 + max_aliases): 554 print(""" if (!f && func->aliasName%d) { 555 f = findExtFunction(interface, func->aliasName%d); 556 }"""% (i, i)) 557 print(""" if (!f) { 557 558 f = func->nopFunction; 558 559 } … … 566 567 return entry - table; /* number of entries filled */ 567 568 } 568 """ 569 570 571 print 569 """) 570 571 572 print(""" 572 573 573 574 #ifdef USE_OSMESA … … 605 606 #endif 606 607 607 """ 608 608 """) 609 -
trunk/src/VBox/GuestHost/OpenGL/spu_loader/spuchange.py
r63199 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys 7 8 import apiutil … … 10 11 apiutil.CopyrightC() 11 12 12 print 13 print(""" 13 14 14 15 /* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY spuchange.py SCRIPT */ … … 29 30 } 30 31 table->mark = 1; 31 """ 32 """) 32 33 33 34 keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") 34 35 for func_name in keys: 35 print '\tif ((uintptr_t)table->%s == (uintptr_t)orig_func)' % func_name36 print '\t{'37 print '\t\ttable->%s = (%sFunc_t)(uintptr_t)new_func;' % (func_name, func_name)38 print '\t\tfor (temp = table->copyList ; temp ; temp = temp->next)'39 print '\t\t{'40 print '\t\t\tcrSPUChangeInterface( temp->copy, orig_func, new_func );'41 print '\t\t}'42 print '\t}'36 print('\tif ((uintptr_t)table->%s == (uintptr_t)orig_func)' % func_name) 37 print('\t{') 38 print('\t\ttable->%s = (%sFunc_t)(uintptr_t)new_func;' % (func_name, func_name)) 39 print('\t\tfor (temp = table->copyList ; temp ; temp = temp->next)') 40 print('\t\t{') 41 print('\t\t\tcrSPUChangeInterface( temp->copy, orig_func, new_func );') 42 print('\t\t}') 43 print('\t}') 43 44 44 print 45 print(""" 45 46 if (table->copy_of != NULL) 46 47 { … … 52 53 } 53 54 table->mark = 0; 54 """ 55 print '}'55 """) 56 print('}') 56 57 57 print 58 print(""" 58 59 void crSPUChangeDispatch(SPUDispatchTable *dispatch, const SPUNamedFunctionTable *newtable) 59 60 { 60 61 SPUGenericFunction func; 61 """ 62 """) 62 63 keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") 63 64 for func_name in keys: 64 print '\tfunc = crSPUFindFunction(newtable, "%s");' % func_name65 print '\tif (func && ((SPUGenericFunction)dispatch->%s!=func))' % func_name66 print '\t{'67 print '\t\tcrDebug("%%s changed from %%p to %%p", "gl%s", (void *)(uintptr_t)dispatch->%s, (void *)(uintptr_t)func);' % (func_name, func_name)68 print '\t\tcrSPUChangeInterface(dispatch, (void *)(uintptr_t)dispatch->%s, (void *)(uintptr_t)func);' % func_name69 print '\t}\n'70 print 65 print('\tfunc = crSPUFindFunction(newtable, "%s");' % func_name) 66 print('\tif (func && ((SPUGenericFunction)dispatch->%s!=func))' % func_name) 67 print('\t{') 68 print('\t\tcrDebug("%%s changed from %%p to %%p", "gl%s", (void *)(uintptr_t)dispatch->%s, (void *)(uintptr_t)func);' % (func_name, func_name)) 69 print('\t\tcrSPUChangeInterface(dispatch, (void *)(uintptr_t)dispatch->%s, (void *)(uintptr_t)func);' % func_name) 70 print('\t}\n') 71 print(""" 71 72 } 72 """ 73 """) -
trunk/src/VBox/GuestHost/OpenGL/spu_loader/spucopy.py
r15532 r63939 4 4 # See the file LICENSE.txt for information on redistributing this software. 5 5 6 from __future__ import print_function 6 7 import sys 7 8 import apiutil … … 10 11 apiutil.CopyrightC() 11 12 12 print 13 print(""" 13 14 14 15 /* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY spucopy.py SCRIPT */ … … 19 20 void crSPUCopyDispatchTable( SPUDispatchTable *dst, SPUDispatchTable *src ) 20 21 { 21 """ 22 """) 22 23 23 24 keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt") 24 25 for func_name in keys: 25 print '\tdst->%s = src->%s;' % (func_name, func_name)26 print('\tdst->%s = src->%s;' % (func_name, func_name)) 26 27 27 28 # if the destination is already a copy of something, we'd better make sure 28 29 # that we take it off its source's copy list first. 29 30 30 print 31 print(""" 31 32 if (dst->copy_of != NULL) 32 33 { … … 77 78 } 78 79 } 79 """ 80 """)
Note:
See TracChangeset
for help on using the changeset viewer.