VirtualBox

source: vbox/trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_dispatch.py@ 51524

Last change on this file since 51524 was 50443, checked in by vboxsync, 11 years ago

crOpenGL: also check textures

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.5 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, string, re
7
8import apiutil
9
10
11
12apiutil.CopyrightC()
13
14print """
15/* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY server_dispatch.py SCRIPT */
16#include "cr_spu.h"
17#include "chromium.h"
18#include "cr_error.h"
19#include "server_dispatch.h"
20#include "server.h"
21#include "cr_unpack.h"
22
23CRCurrentStatePointers crServerCurrent;
24"""
25
26
27for func_name in apiutil.AllSpecials( sys.argv[1]+"/../state_tracker/state" ):
28 params = apiutil.Parameters(func_name)
29 if (apiutil.FindSpecial( "server", func_name ) or
30 "get" in apiutil.Properties(func_name)):
31 continue
32
33 wrap = apiutil.GetCategoryWrapper(func_name)
34 if wrap:
35 print '#if defined(CR_%s)' % wrap
36 print 'void SERVER_DISPATCH_APIENTRY crServerDispatch%s( %s )' % ( func_name, apiutil.MakeDeclarationString( params ) )
37 print '{'
38 print '\tcrState%s( %s );' % (func_name, apiutil.MakeCallString( params ) )
39 print '\tcr_server.head_spu->dispatch_table.%s( %s );' % (func_name, apiutil.MakeCallString( params ) )
40 print '}'
41 if wrap:
42 print '#endif'
43
44
45keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
46for func_name in keys:
47 current = 0
48 array = ""
49 condition = ""
50 m = re.search( r"^(Color|Normal)([1234])(ub|b|us|s|ui|i|f|d)$", func_name )
51 if m :
52 current = 1
53 name = string.lower( m.group(1)[:1] ) + m.group(1)[1:]
54 type = m.group(3) + m.group(2)
55 m = re.search( r"^(SecondaryColor)(3)(ub|b|us|s|ui|i|f|d)(EXT)$", func_name )
56 if m :
57 current = 1
58 name = string.lower(m.group(1)[:1] ) + m.group(1)[1:]
59 type = m.group(3) + m.group(2)
60 m = re.search( r"^(TexCoord)([1234])(ub|b|us|s|ui|i|f|d)$", func_name )
61 if m :
62 current = 1
63 name = string.lower( m.group(1)[:1] ) + m.group(1)[1:]
64 type = m.group(3) + m.group(2)
65 array = "[0]"
66 m = re.search( r"^(MultiTexCoord)([1234])(ub|b|us|s|ui|i|f|d)ARB$", func_name )
67 if m :
68 current = 1
69 name = "texCoord"
70 type = m.group(3) + m.group(2)
71 array = "[texture-GL_TEXTURE0_ARB]"
72 condition = "if (texture >= GL_TEXTURE0_ARB && texture < GL_TEXTURE0_ARB + CR_MAX_TEXTURE_UNITS)"
73 m = re.match( r"^(Index)(ub|b|us|s|ui|i|f|d)$", func_name )
74 if m :
75 current = 1
76 name = string.lower( m.group(1)[:1] ) + m.group(1)[1:]
77 type = m.group(2) + "1"
78 m = re.match( r"^(EdgeFlag)$", func_name )
79 if m :
80 current = 1
81 name = string.lower( m.group(1)[:1] ) + m.group(1)[1:]
82 type = "l1"
83 m = re.match( r"^(FogCoord)(f|d)(EXT)$", func_name)
84 if m :
85 current = 1
86 name = string.lower( m.group(1)[:1] ) + m.group(1)[1:]
87 type = m.group(2) + "1"
88
89 # Vertex attribute commands w/ some special cases
90 m = re.search( r"^(VertexAttrib)([1234])(s|i|f|d)ARB$", func_name )
91 if m :
92 current = 1
93 name = string.lower( m.group(1)[:1] ) + m.group(1)[1:]
94 type = m.group(3) + m.group(2)
95 array = "[index]"
96 condition = "if (index < CR_MAX_VERTEX_ATTRIBS)"
97 if func_name == "VertexAttrib4NubARB":
98 current = 1
99 name = "vertexAttrib"
100 type = "ub4"
101 array = "[index]"
102 condition = "if (index < CR_MAX_VERTEX_ATTRIBS)"
103
104 if current:
105 params = apiutil.Parameters(func_name)
106 print 'void SERVER_DISPATCH_APIENTRY crServerDispatch%s( %s )' % ( func_name, apiutil.MakeDeclarationString(params) )
107 print '{'
108 print '\t%s' % (condition)
109 print '\t{'
110 print '\t\tcr_server.head_spu->dispatch_table.%s( %s );' % (func_name, apiutil.MakeCallString(params) )
111 print "\t\tcr_server.current.c.%s.%s%s = cr_unpackData;" % (name,type,array)
112 print '\t}'
113 print '}\n'
114
115print """
116void crServerInitDispatch(void)
117{
118 crSPUInitDispatchTable( &(cr_server.dispatch) );
119 crSPUCopyDispatchTable( &(cr_server.dispatch), &(cr_server.head_spu->dispatch_table ) );
120"""
121
122for func_name in keys:
123 if ("get" in apiutil.Properties(func_name) or
124 apiutil.FindSpecial( "server", func_name ) or
125 apiutil.FindSpecial( sys.argv[1]+"/../state_tracker/state", func_name )):
126
127 wrap = apiutil.GetCategoryWrapper(func_name)
128 if wrap:
129 print '#if defined(CR_%s)' % wrap
130
131 print '\tcr_server.dispatch.%s = crServerDispatch%s;' % (func_name, func_name)
132 if wrap:
133 print '#endif'
134
135print '}'
136
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