VirtualBox

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

Last change on this file since 52560 was 36231, checked in by vboxsync, 14 years ago

crOpenGL: workaround for recent nvidia drivers, disabled yet as need more testing

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.8 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
6import sys
7import apiutil
8
9
10apiutil.CopyrightC()
11
12print """
13
14/* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY spuchange.py SCRIPT */
15
16#include "cr_spu.h"
17#include "cr_error.h"
18
19void crSPUChangeInterface( SPUDispatchTable *table, void *orig_func, void *new_func )
20{
21 struct _copy_list_node *temp;
22 if (table->mark == 1)
23 {
24 return;
25 }
26 if (orig_func == new_func)
27 {
28 return;
29 }
30 table->mark = 1;
31"""
32
33keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
34for func_name in keys:
35 print '\tif ((void *)table->%s == orig_func)' % func_name
36 print '\t{'
37 print '\t\ttable->%s = (%sFunc_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}'
43
44print """
45 if (table->copy_of != NULL)
46 {
47 crSPUChangeInterface( table->copy_of, orig_func, new_func );
48 }
49 for (temp = table->copyList ; temp ; temp = temp->next)
50 {
51 crSPUChangeInterface( temp->copy, orig_func, new_func );
52 }
53 table->mark = 0;
54"""
55print '}'
56
57print """
58void crSPUChangeDispatch(SPUDispatchTable *dispatch, const SPUNamedFunctionTable *newtable)
59{
60 SPUGenericFunction func;
61"""
62keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
63for func_name in keys:
64 print '\tfunc = crSPUFindFunction(newtable, "%s");' % func_name
65 print '\tif (func && ((SPUGenericFunction)dispatch->%s!=func))' % func_name
66 print '\t{'
67 print '\t\tcrDebug("%%s changed from %%p to %%p", "gl%s", dispatch->%s, func);' % (func_name, func_name)
68 print '\t\tcrSPUChangeInterface(dispatch, dispatch->%s, func);' % func_name
69 print '\t}\n'
70print """
71}
72"""
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