VirtualBox

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

Last change on this file since 20175 was 20147, checked in by vboxsync, 16 years ago

crOpenGL: some opengl 2.0 parts

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