VirtualBox

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

Last change on this file since 18255 was 15532, checked in by vboxsync, 16 years ago

crOpenGL: export to OSE

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.6 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
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}
74
75no_pnames = [
76 'GetClipPlane',
77 'GetPolygonStipple',
78 'GetProgramLocalParameterdvARB',
79 'GetProgramLocalParameterfvARB',
80 'GetProgramNamedParameterdvNV',
81 'GetProgramNamedParameterfvNV',
82 'GetProgramNamedParameterdvNV',
83 'GetProgramNamedParameterfvNV',
84 'GetProgramEnvParameterdvARB',
85 'GetProgramEnvParameterfvARB',
86 'GetProgramivARB',
87 'AreProgramsResidentNV'
88];
89
90from get_components import *;
91
92keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
93for func_name in keys:
94 #(return_type, arg_names, arg_types) = gl_mapping[func_name]
95 if ("get" in apiutil.Properties(func_name) and
96 apiutil.ReturnType(func_name) == "void" and
97 not apiutil.FindSpecial( "server", func_name )):
98
99 params = apiutil.Parameters(func_name)
100
101 print 'void SERVER_DISPATCH_APIENTRY crServerDispatch%s( %s )' % (func_name, apiutil.MakeDeclarationString( params ) )
102 print '{'
103
104 lastParam = params[-1]
105 assert apiutil.IsPointer(lastParam[1])
106 local_argtype = apiutil.PointerType(lastParam[1])
107 local_argname = 'local_%s' % lastParam[0]
108
109 print '\t%s %s[%d];' % ( local_argtype, local_argname, max_components[func_name] )
110 print '\t(void) %s;' % lastParam[0]
111
112 params[-1] = (local_argname, local_argtype, 0)
113
114 print '\tcr_server.head_spu->dispatch_table.%s( %s );' % ( func_name, apiutil.MakeCallString(params) )
115 if func_name in no_pnames:
116 print '\tcrServerReturnValue( &(%s[0]), %d*sizeof(%s) );' % (local_argname, max_components[func_name], local_argtype );
117 else:
118 print '\tcrServerReturnValue( &(%s[0]), lookupComponents(pname)*sizeof(%s) );' % (local_argname, local_argtype );
119 print '}\n'
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