VirtualBox

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

最後變更 在這個檔案從43031是 31808,由 vboxsync 提交於 14 年 前

crOpenGL: resource sharing between contexts

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

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