VirtualBox

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

Last change on this file since 69390 was 69390, checked in by vboxsync, 7 years ago

HostServices/SharedOpenGL: scm updates

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 5.3 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
6from __future__ import print_function
7import sys
8
9import apiutil
10
11
12apiutil.CopyrightC()
13
14print("""#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
23from get_sizes import *;
24
25
26funcs = [ 'GetIntegerv', 'GetFloatv', 'GetDoublev', 'GetBooleanv' ]
27types = [ 'GLint', 'GLfloat', 'GLdouble', 'GLboolean' ]
28
29for index in range(len(funcs)):
30 func_name = funcs[index]
31 params = apiutil.Parameters(func_name)
32 print('void SERVER_DISPATCH_APIENTRY crServerDispatch%s(%s)' % ( func_name, apiutil.MakeDeclarationString(params)))
33 print('{')
34 print('\t%s *get_values;' % types[index])
35 print('\tint tablesize;')
36 print("""
37 #ifdef CR_ARB_texture_compression
38 if (GL_COMPRESSED_TEXTURE_FORMATS_ARB == pname)
39 {
40 GLint numtexfmts = 0;
41 cr_server.head_spu->dispatch_table.GetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB, &numtexfmts);
42 tablesize = numtexfmts * sizeof(%s);
43 }
44 else
45 #endif
46 {
47 tablesize = __numValues( pname ) * sizeof(%s);
48 }
49 """ % (types[index], types[index]))
50 print('\t(void) params;')
51 print('\tget_values = (%s *) crAlloc( tablesize );' % types[index])
52 print('\tif (tablesize>0)')
53 print('\tcr_server.head_spu->dispatch_table.%s( pname, get_values );' % func_name)
54 print("""
55 if (GL_TEXTURE_BINDING_1D==pname
56 || GL_TEXTURE_BINDING_2D==pname
57 || GL_TEXTURE_BINDING_3D==pname
58 || GL_TEXTURE_BINDING_RECTANGLE_ARB==pname
59 || GL_TEXTURE_BINDING_CUBE_MAP_ARB==pname)
60 {
61 GLuint texid;
62 CRASSERT(tablesize/sizeof(%s)==1);
63 texid = (GLuint) *get_values;
64 *get_values = (%s) crStateTextureHWIDtoID(texid);
65 }
66 else if (GL_CURRENT_PROGRAM==pname)
67 {
68 GLuint programid;
69 CRASSERT(tablesize/sizeof(%s)==1);
70 programid = (GLuint) *get_values;
71 *get_values = (%s) crStateGLSLProgramHWIDtoID(programid);
72 }
73 else if (GL_FRAMEBUFFER_BINDING_EXT==pname
74 ||GL_READ_FRAMEBUFFER_BINDING==pname)
75 {
76 GLuint fboid;
77 CRASSERT(tablesize/sizeof(%s)==1);
78 fboid = (GLuint) *get_values;
79 if (crServerIsRedirectedToFBO()
80 && (fboid==cr_server.curClient->currentMural->aidFBOs[0]
81 || fboid==cr_server.curClient->currentMural->aidFBOs[1]))
82 {
83 fboid = 0;
84 }
85 else
86 {
87 fboid = crStateFBOHWIDtoID(fboid);
88 }
89 *get_values = (%s) fboid;
90 }
91 else if (GL_READ_BUFFER==pname)
92 {
93 if (crServerIsRedirectedToFBO()
94 && CR_SERVER_FBO_FOR_IDX(cr_server.curClient->currentMural, cr_server.curClient->currentMural->iCurReadBuffer)
95 && !crStateGetCurrent()->framebufferobject.readFB)
96 {
97 *get_values = (%s) crStateGetCurrent()->buffer.readBuffer;
98 Assert(crStateGetCurrent()->buffer.readBuffer == GL_BACK || crStateGetCurrent()->buffer.readBuffer == GL_FRONT);
99 }
100 }
101 else if (GL_DRAW_BUFFER==pname)
102 {
103 if (crServerIsRedirectedToFBO()
104 && CR_SERVER_FBO_FOR_IDX(cr_server.curClient->currentMural, cr_server.curClient->currentMural->iCurDrawBuffer)
105 && !crStateGetCurrent()->framebufferobject.drawFB)
106 {
107 *get_values = (%s) crStateGetCurrent()->buffer.drawBuffer;
108 Assert(crStateGetCurrent()->buffer.drawBuffer == GL_BACK || crStateGetCurrent()->buffer.drawBuffer == GL_FRONT);
109 }
110 }
111 else if (GL_RENDERBUFFER_BINDING_EXT==pname)
112 {
113 GLuint rbid;
114 CRASSERT(tablesize/sizeof(%s)==1);
115 rbid = (GLuint) *get_values;
116 *get_values = (%s) crStateRBOHWIDtoID(rbid);
117 }
118 else if (GL_ARRAY_BUFFER_BINDING_ARB==pname
119 || GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB==pname
120 || GL_VERTEX_ARRAY_BUFFER_BINDING_ARB==pname
121 || GL_NORMAL_ARRAY_BUFFER_BINDING_ARB==pname
122 || GL_COLOR_ARRAY_BUFFER_BINDING_ARB==pname
123 || GL_INDEX_ARRAY_BUFFER_BINDING_ARB==pname
124 || GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB==pname
125 || GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB==pname
126 || GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB==pname
127 || GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB==pname
128 || GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB==pname)
129 {
130 GLuint bufid;
131 CRASSERT(tablesize/sizeof(%s)==1);
132 bufid = (GLuint) *get_values;
133 *get_values = (%s) crStateBufferHWIDtoID(bufid);
134 }
135 else if (GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS==pname)
136 {
137 if (CR_MAX_TEXTURE_UNITS < (GLuint)*get_values)
138 {
139 *get_values = (%s)CR_MAX_TEXTURE_UNITS;
140 }
141 }
142 else if (GL_MAX_VERTEX_ATTRIBS_ARB==pname)
143 {
144 if (CR_MAX_VERTEX_ATTRIBS < (GLuint)*get_values)
145 {
146 *get_values = (%s)CR_MAX_VERTEX_ATTRIBS;
147 }
148 }
149 """ % (types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index], types[index]))
150 print('\tcrServerReturnValue( get_values, tablesize );')
151 print('\tcrFree(get_values);')
152 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