VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/spu_loader/spuchange.py@ 70939

Last change on this file since 70939 was 69392, checked in by vboxsync, 7 years ago

GuestHost/OpenGL: scm updates

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 1.9 KB
Line 
1# Copyright (c) 2001, Stanford University
2# All rights reserved.
3#
4# See the file LICENSE.txt for information on redistributing this software.
5
6from __future__ import print_function
7import sys
8import apiutil
9
10
11apiutil.CopyrightC()
12
13print("""
14
15/* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY spuchange.py SCRIPT */
16
17#include "cr_spu.h"
18#include "cr_error.h"
19
20void crSPUChangeInterface(SPUDispatchTable *table, void *orig_func, void *new_func)
21{
22 struct _copy_list_node *temp;
23 if (table->mark == 1)
24 {
25 return;
26 }
27 if (orig_func == new_func)
28 {
29 return;
30 }
31 table->mark = 1;
32""")
33
34keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
35for func_name in keys:
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}')
44
45print("""
46 if (table->copy_of != NULL)
47 {
48 crSPUChangeInterface(table->copy_of, orig_func, new_func);
49 }
50 for (temp = table->copyList; temp; temp = temp->next)
51 {
52 crSPUChangeInterface(temp->copy, orig_func, new_func);
53 }
54 table->mark = 0;
55""")
56print('}')
57
58print("""
59void crSPUChangeDispatch(SPUDispatchTable *dispatch, const SPUNamedFunctionTable *newtable)
60{
61 SPUGenericFunction func;
62""")
63keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
64for func_name in keys:
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')
71print("""
72}
73""")
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette