VirtualBox

source: vbox/trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_get.py@ 64572

最後變更 在這個檔案從64572是 63942,由 vboxsync 提交於 8 年 前

OpenGL: fixed the most annoying coding style flaws, mainly removing spaces after '(' and before ')', no semantic change

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Id
檔案大小: 4.4 KB
 
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
8
9import apiutil
10
11
12apiutil.CopyrightC()
13
14print("""
15#include "cr_spu.h"
16#include "chromium.h"
17#include "cr_error.h"
18#include "cr_mem.h"
19#include "cr_net.h"
20#include "server_dispatch.h"
21#include "server.h"
22""")
23
24max_components = {
25 'GetClipPlane': 4,
26 'GetCombinerStageParameterfvNV': 4,
27 'GetCombinerStageParameterivNV': 4,
28 'GetCombinerOutputParameterfvNV': 4,
29 'GetCombinerOutputParameterivNV': 4,
30 'GetCombinerInputParameterfvNV': 4,
31 'GetCombinerInputParameterivNV': 4,
32 'GetFinalCombinerInputParameterfvNV': 4,
33 'GetFinalCombinerInputParameterivNV': 4,
34 'GetLightfv': 4,
35 'GetLightiv': 4,
36 'GetMaterialfv': 4,
37 'GetMaterialiv': 4,
38 'GetPolygonStipple': 32*32/8,
39 'GetTexEnvfv': 4,
40 'GetTexEnviv': 4,
41 'GetTexGendv': 4,
42 'GetTexGenfv': 4,
43 'GetTexGeniv': 4,
44 'GetTexLevelParameterfv': 1,
45 'GetTexLevelParameteriv': 1,
46 'GetTexParameterfv': 4,
47 'GetTexParameteriv': 4,
48 'GetProgramParameterdvNV': 4,
49 'GetProgramParameterfvNV': 4,
50 'GetProgramivNV': 1,
51 'GetTrackMatrixivNV': 1,
52 'GetVertexAttribPointervNV': 1,
53 'GetVertexAttribdvNV': 4,
54 'GetVertexAttribfvNV': 4,
55 'GetVertexAttribivNV': 4,
56 'GetFenceivNV': 1,
57 'GetVertexAttribdvARB': 4,
58 'GetVertexAttribfvARB': 4,
59 'GetVertexAttribivARB': 4,
60 'GetVertexAttribPointervARB': 1,
61 'GetProgramNamedParameterdvNV': 4,
62 'GetProgramNamedParameterfvNV': 4,
63 'GetProgramLocalParameterdvARB': 4,
64 'GetProgramLocalParameterfvARB': 4,
65 'GetProgramEnvParameterdvARB': 4,
66 'GetProgramEnvParameterfvARB': 4,
67 'GetProgramivARB': 1,
68 'AreProgramsResidentNV': 1,
69 'GetBufferParameterivARB': 1,
70 'GetBufferPointervARB': 1,
71 'GetQueryObjectivARB' : 1,
72 'GetQueryObjectuivARB' : 1,
73 'GetQueryivARB' : 1,
74 'GetProgramiv' : 1,
75 'GetShaderiv' : 1,
76 'GetObjectParameterfvARB': 1,
77 'GetObjectParameterivARB': 1,
78 'GetRenderbufferParameterivEXT': 1,
79 'GetFramebufferAttachmentParameterivEXT': 1
80}
81
82no_pnames = [
83 'GetClipPlane',
84 'GetPolygonStipple',
85 'GetProgramLocalParameterdvARB',
86 'GetProgramLocalParameterfvARB',
87 'GetProgramNamedParameterdvNV',
88 'GetProgramNamedParameterfvNV',
89 'GetProgramNamedParameterdvNV',
90 'GetProgramNamedParameterfvNV',
91 'GetProgramEnvParameterdvARB',
92 'GetProgramEnvParameterfvARB',
93 'GetProgramivARB',
94 'AreProgramsResidentNV',
95 'GetProgramiv',
96 'GetShaderiv',
97 'GetObjectParameterfvARB',
98 'GetObjectParameterivARB',
99 'GetRenderbufferParameterivEXT',
100 'GetFramebufferAttachmentParameterivEXT'
101];
102
103convert_bufferid = [
104 'GetVertexAttribdvARB',
105 'GetVertexAttribdvNV',
106 'GetVertexAttribfvARB',
107 'GetVertexAttribfvNV',
108 'GetVertexAttribivARB',
109 'GetVertexAttribivNV'
110];
111
112keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
113for func_name in keys:
114 #(return_type, arg_names, arg_types) = gl_mapping[func_name]
115 if ("get" in apiutil.Properties(func_name) and
116 apiutil.ReturnType(func_name) == "void" and
117 not apiutil.FindSpecial( "server", func_name )):
118
119 params = apiutil.Parameters(func_name)
120
121 print('void SERVER_DISPATCH_APIENTRY crServerDispatch%s(%s)' % (func_name, apiutil.MakeDeclarationString( params ) ))
122 print('{')
123
124 lastParam = params[-1]
125 assert apiutil.IsPointer(lastParam[1])
126 local_argtype = apiutil.PointerType(lastParam[1])
127 local_argname = 'local_%s' % lastParam[0]
128
129 print('\t%s %s[%d];' % ( local_argtype, local_argname, max_components[func_name] ))
130 print('\t(void) %s;' % lastParam[0])
131
132 params[-1] = (local_argname, local_argtype, 0)
133
134 print('\tcr_server.head_spu->dispatch_table.%s(%s);' % ( func_name, apiutil.MakeCallString(params) ))
135
136 if func_name in convert_bufferid:
137 print('\tif (pname==GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB){')
138 print('\t\tlocal_params[0]=(%s)crStateBufferHWIDtoID((GLint)local_params[0]);' % (local_argtype))
139 print('\t}')
140
141 if func_name in no_pnames:
142 print('\tcrServerReturnValue(&(%s[0]), %d*sizeof(%s));' % (local_argname, max_components[func_name], local_argtype ))
143 else:
144 print('\tcrServerReturnValue(&(%s[0]), crStateHlpComponentsCount(pname)*sizeof(%s));' % (local_argname, local_argtype ))
145 print ('}\n')
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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