VirtualBox

source: vbox/trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_simpleget.py@ 28197

Last change on this file since 28197 was 27889, checked in by vboxsync, 15 years ago

crOpenGL: more code for multiscreen support

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.0 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 """#include "cr_spu.h"
14#include "chromium.h"
15#include "cr_error.h"
16#include "cr_mem.h"
17#include "cr_net.h"
18#include "server_dispatch.h"
19#include "server.h"
20"""
21
22from get_sizes import *;
23
24
25funcs = [ 'GetIntegerv', 'GetFloatv', 'GetDoublev', 'GetBooleanv' ]
26types = [ 'GLint', 'GLfloat', 'GLdouble', 'GLboolean' ]
27
28for index in range(len(funcs)):
29 func_name = funcs[index]
30 params = apiutil.Parameters(func_name)
31 print 'void SERVER_DISPATCH_APIENTRY crServerDispatch%s( %s )' % ( func_name, apiutil.MakeDeclarationString(params))
32 print '{'
33 print '\t%s *get_values;' % types[index]
34 print '\tint tablesize;'
35 print """
36 #ifdef CR_ARB_texture_compression
37 if (GL_COMPRESSED_TEXTURE_FORMATS_ARB == pname)
38 {
39 GLint numtexfmts = 0;
40 cr_server.head_spu->dispatch_table.GetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB, &numtexfmts);
41 tablesize = numtexfmts * sizeof(%s);
42 }
43 else
44 #endif
45 {
46 tablesize = __numValues( pname ) * sizeof(%s);
47 }
48 """ % (types[index], types[index])
49 print '\t(void) params;'
50 print '\tget_values = (%s *) crAlloc( tablesize );' % types[index]
51 print '\tif (tablesize>0)'
52 print '\tcr_server.head_spu->dispatch_table.%s( pname, get_values );' % func_name
53 print """
54 if (GL_TEXTURE_BINDING_1D==pname
55 || GL_TEXTURE_BINDING_2D==pname
56 || GL_TEXTURE_BINDING_3D==pname
57 || GL_TEXTURE_BINDING_RECTANGLE_ARB==pname
58 || GL_TEXTURE_BINDING_CUBE_MAP_ARB==pname)
59 {
60 GLuint texid;
61 CRASSERT(tablesize/sizeof(%s)==1);
62 texid = (GLuint) *get_values;
63 if (texid)
64 {
65 *get_values = (%s) (texid - cr_server.curClient->number * 100000);
66 }
67 }
68 else if (GL_CURRENT_PROGRAM==pname)
69 {
70 GLuint programid;
71 CRASSERT(tablesize/sizeof(%s)==1);
72 programid = (GLuint) *get_values;
73 *get_values = (%s) crStateGLSLProgramHWIDtoID(programid);
74 }
75 else if (GL_FRAMEBUFFER_BINDING_EXT==pname
76 ||GL_READ_FRAMEBUFFER_BINDING==pname)
77 {
78 GLuint fboid;
79 CRASSERT(tablesize/sizeof(%s)==1);
80 fboid = crStateFBOHWIDtoID((GLuint) *get_values);
81 if (crServerIsRedirectedToFBO()
82 && fboid==cr_server.curClient->currentMural->idFBO)
83 {
84 fboid = 0;
85 }
86 *get_values = (%s) fboid;
87 }
88 else if (GL_RENDERBUFFER_BINDING_EXT==pname)
89 {
90 GLuint rbid;
91 CRASSERT(tablesize/sizeof(%s)==1);
92 rbid = (GLuint) *get_values;
93 *get_values = (%s) crStateRBOHWIDtoID(rbid);
94 }
95 """ % (types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index])
96 print '\tcrServerReturnValue( get_values, tablesize );'
97 print '\tcrFree(get_values);'
98 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