1 | /** @file
|
---|
2 | *
|
---|
3 | * VirtualBox Windows NT/2000/XP guest OpenGL ICD
|
---|
4 | *
|
---|
5 | * Simple buffered OpenGL functions
|
---|
6 | *
|
---|
7 | * Copyright (C) 2006-2007 innotek GmbH
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License as published by the Free Software Foundation,
|
---|
13 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
14 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
15 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #include "VBoxOGL.h"
|
---|
19 |
|
---|
20 |
|
---|
21 | /* OpenGL functions */
|
---|
22 | void APIENTRY glFinish (void)
|
---|
23 | {
|
---|
24 | /** @todo if no back buffer, then draw to screen */
|
---|
25 | VBOX_OGL_GEN_SYNC_OP(Finish);
|
---|
26 | }
|
---|
27 |
|
---|
28 | void APIENTRY glFlush (void)
|
---|
29 | {
|
---|
30 | /** @todo if no back buffer, then draw to screen */
|
---|
31 | VBOX_OGL_GEN_SYNC_OP(Flush);
|
---|
32 | }
|
---|
33 |
|
---|
34 | GLuint APIENTRY glGenLists (GLsizei range)
|
---|
35 | {
|
---|
36 | VBOX_OGL_GEN_SYNC_OP1_RET(GLuint, GenLists, range);
|
---|
37 | return retval;
|
---|
38 | }
|
---|
39 |
|
---|
40 | GLboolean APIENTRY glIsEnabled (GLenum cap)
|
---|
41 | {
|
---|
42 | /** @todo cache? */
|
---|
43 | VBOX_OGL_GEN_SYNC_OP1_RET(GLboolean, IsEnabled, cap);
|
---|
44 | return retval;
|
---|
45 | }
|
---|
46 |
|
---|
47 | GLboolean APIENTRY glIsList (GLuint list)
|
---|
48 | {
|
---|
49 | VBOX_OGL_GEN_SYNC_OP1_RET(GLboolean, IsList, list);
|
---|
50 | return retval;
|
---|
51 | }
|
---|
52 |
|
---|
53 | GLboolean APIENTRY glIsTexture (GLuint texture)
|
---|
54 | {
|
---|
55 | VBOX_OGL_GEN_SYNC_OP1_RET(GLboolean, IsTexture, texture);
|
---|
56 | return retval;
|
---|
57 | }
|
---|
58 |
|
---|
59 | static uint32_t vboxglGetNrElements(GLenum pname)
|
---|
60 | {
|
---|
61 | switch(pname)
|
---|
62 | {
|
---|
63 | case GL_ACCUM_ALPHA_BITS:
|
---|
64 | case GL_ACCUM_BLUE_BITS:
|
---|
65 | case GL_ACCUM_GREEN_BITS:
|
---|
66 | case GL_ACCUM_RED_BITS:
|
---|
67 | case GL_ALPHA_BIAS:
|
---|
68 | case GL_ALPHA_BITS:
|
---|
69 | case GL_ALPHA_SCALE:
|
---|
70 | case GL_ALPHA_TEST:
|
---|
71 | case GL_ALPHA_TEST_FUNC:
|
---|
72 | case GL_ALPHA_TEST_REF:
|
---|
73 | case GL_ATTRIB_STACK_DEPTH:
|
---|
74 | case GL_AUTO_NORMAL:
|
---|
75 | case GL_AUX_BUFFERS:
|
---|
76 | case GL_BLEND:
|
---|
77 | case GL_BLEND_DST:
|
---|
78 | // case GL_BLEND_EQUATION_EXT:
|
---|
79 | case GL_BLEND_SRC:
|
---|
80 | case GL_BLUE_BIAS:
|
---|
81 | case GL_BLUE_BITS:
|
---|
82 | case GL_BLUE_SCALE:
|
---|
83 | case GL_CLIENT_ATTRIB_STACK_DEPTH:
|
---|
84 | // case GL_CLIP_PLANEi:
|
---|
85 | case GL_COLOR_ARRAY:
|
---|
86 | case GL_COLOR_ARRAY_SIZE:
|
---|
87 | case GL_COLOR_ARRAY_STRIDE:
|
---|
88 | case GL_COLOR_ARRAY_TYPE:
|
---|
89 | case GL_COLOR_LOGIC_OP:
|
---|
90 | case GL_COLOR_MATERIAL:
|
---|
91 | case GL_COLOR_MATERIAL_FACE:
|
---|
92 | case GL_COLOR_MATERIAL_PARAMETER:
|
---|
93 | case GL_CULL_FACE:
|
---|
94 | case GL_CULL_FACE_MODE:
|
---|
95 | case GL_CURRENT_INDEX:
|
---|
96 | case GL_CURRENT_RASTER_DISTANCE:
|
---|
97 | case GL_CURRENT_RASTER_INDEX:
|
---|
98 | case GL_CURRENT_RASTER_POSITION_VALID:
|
---|
99 | case GL_DEPTH_BIAS:
|
---|
100 | case GL_DEPTH_BITS:
|
---|
101 | case GL_DEPTH_CLEAR_VALUE:
|
---|
102 | case GL_DEPTH_FUNC:
|
---|
103 | case GL_DEPTH_SCALE:
|
---|
104 | case GL_DEPTH_TEST:
|
---|
105 | case GL_DEPTH_WRITEMASK:
|
---|
106 | case GL_DITHER:
|
---|
107 | case GL_DOUBLEBUFFER:
|
---|
108 | case GL_DRAW_BUFFER:
|
---|
109 | case GL_EDGE_FLAG:
|
---|
110 | case GL_EDGE_FLAG_ARRAY:
|
---|
111 | case GL_EDGE_FLAG_ARRAY_STRIDE:
|
---|
112 | case GL_FOG:
|
---|
113 | case GL_FOG_DENSITY:
|
---|
114 | case GL_FOG_END:
|
---|
115 | case GL_FOG_HINT:
|
---|
116 | case GL_FOG_INDEX:
|
---|
117 | case GL_FOG_MODE:
|
---|
118 | case GL_FOG_START:
|
---|
119 | case GL_FRONT_FACE:
|
---|
120 | case GL_GREEN_BIAS:
|
---|
121 | case GL_GREEN_BITS:
|
---|
122 | case GL_GREEN_SCALE:
|
---|
123 | case GL_INDEX_ARRAY:
|
---|
124 | case GL_INDEX_ARRAY_STRIDE:
|
---|
125 | case GL_INDEX_ARRAY_TYPE:
|
---|
126 | case GL_INDEX_BITS:
|
---|
127 | case GL_INDEX_CLEAR_VALUE:
|
---|
128 | case GL_INDEX_LOGIC_OP:
|
---|
129 | case GL_INDEX_MODE:
|
---|
130 | case GL_INDEX_OFFSET:
|
---|
131 | case GL_INDEX_SHIFT:
|
---|
132 | case GL_INDEX_WRITEMASK:
|
---|
133 | // case GL_LIGHTi:
|
---|
134 | case GL_LIGHTING:
|
---|
135 | case GL_LIGHT_MODEL_LOCAL_VIEWER:
|
---|
136 | case GL_LIGHT_MODEL_TWO_SIDE:
|
---|
137 | case GL_LINE_SMOOTH:
|
---|
138 | case GL_LINE_SMOOTH_HINT:
|
---|
139 | case GL_LINE_STIPPLE:
|
---|
140 | case GL_LINE_STIPPLE_PATTERN:
|
---|
141 | case GL_LINE_STIPPLE_REPEAT:
|
---|
142 | case GL_LINE_WIDTH:
|
---|
143 | case GL_LINE_WIDTH_GRANULARITY :
|
---|
144 | case GL_LIST_BASE:
|
---|
145 | case GL_LIST_INDEX:
|
---|
146 | case GL_LIST_MODE:
|
---|
147 | case GL_LOGIC_OP_MODE:
|
---|
148 | case GL_MAP1_COLOR_4:
|
---|
149 | case GL_MAP1_GRID_SEGMENTS:
|
---|
150 | case GL_MAP1_INDEX:
|
---|
151 | case GL_MAP1_NORMAL:
|
---|
152 | case GL_MAP1_TEXTURE_COORD_1:
|
---|
153 | case GL_MAP1_TEXTURE_COORD_2:
|
---|
154 | case GL_MAP1_TEXTURE_COORD_3:
|
---|
155 | case GL_MAP1_TEXTURE_COORD_4:
|
---|
156 | case GL_MAP1_VERTEX_3:
|
---|
157 | case GL_MAP1_VERTEX_4:
|
---|
158 | case GL_MAP2_COLOR_4:
|
---|
159 | case GL_MAP2_INDEX:
|
---|
160 | case GL_MAP2_NORMAL:
|
---|
161 | case GL_MAP2_TEXTURE_COORD_1:
|
---|
162 | case GL_MAP2_TEXTURE_COORD_2:
|
---|
163 | case GL_MAP2_TEXTURE_COORD_3:
|
---|
164 | case GL_MAP2_TEXTURE_COORD_4:
|
---|
165 | case GL_MAP2_VERTEX_3:
|
---|
166 | case GL_MAP2_VERTEX_4:
|
---|
167 | case GL_MAP_COLOR:
|
---|
168 | case GL_MAP_STENCIL:
|
---|
169 | case GL_MATRIX_MODE:
|
---|
170 | case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
|
---|
171 | case GL_MAX_ATTRIB_STACK_DEPTH:
|
---|
172 | case GL_MAX_CLIP_PLANES:
|
---|
173 | case GL_MAX_EVAL_ORDER:
|
---|
174 | case GL_MAX_LIGHTS:
|
---|
175 | case GL_MAX_LIST_NESTING:
|
---|
176 | case GL_MAX_MODELVIEW_STACK_DEPTH:
|
---|
177 | case GL_MAX_NAME_STACK_DEPTH:
|
---|
178 | case GL_MAX_PIXEL_MAP_TABLE:
|
---|
179 | case GL_MAX_PROJECTION_STACK_DEPTH:
|
---|
180 | case GL_MAX_TEXTURE_SIZE:
|
---|
181 | case GL_MAX_TEXTURE_STACK_DEPTH :
|
---|
182 | case GL_MODELVIEW_STACK_DEPTH:
|
---|
183 | case GL_NAME_STACK_DEPTH:
|
---|
184 | case GL_NORMAL_ARRAY:
|
---|
185 | case GL_NORMAL_ARRAY_STRIDE:
|
---|
186 | case GL_NORMAL_ARRAY_TYPE:
|
---|
187 | case GL_NORMALIZE:
|
---|
188 | case GL_PACK_ALIGNMENT:
|
---|
189 | case GL_PACK_LSB_FIRST:
|
---|
190 | case GL_PACK_ROW_LENGTH:
|
---|
191 | case GL_PACK_SKIP_PIXELS:
|
---|
192 | case GL_PACK_SKIP_ROWS:
|
---|
193 | case GL_PACK_SWAP_BYTES:
|
---|
194 | case GL_PERSPECTIVE_CORRECTION_HINT:
|
---|
195 | case GL_PIXEL_MAP_A_TO_A_SIZE:
|
---|
196 | case GL_PIXEL_MAP_B_TO_B_SIZE:
|
---|
197 | case GL_PIXEL_MAP_G_TO_G_SIZE:
|
---|
198 | case GL_PIXEL_MAP_I_TO_A_SIZE:
|
---|
199 | case GL_PIXEL_MAP_I_TO_B_SIZE:
|
---|
200 | case GL_PIXEL_MAP_I_TO_G_SIZE:
|
---|
201 | case GL_PIXEL_MAP_I_TO_I_SIZE:
|
---|
202 | case GL_PIXEL_MAP_I_TO_R_SIZE:
|
---|
203 | case GL_PIXEL_MAP_R_TO_R_SIZE:
|
---|
204 | case GL_PIXEL_MAP_S_TO_S_SIZE:
|
---|
205 | case GL_POINT_SIZE:
|
---|
206 | case GL_POINT_SIZE_GRANULARITY :
|
---|
207 | case GL_POINT_SMOOTH:
|
---|
208 | case GL_POINT_SMOOTH_HINT :
|
---|
209 | case GL_POLYGON_OFFSET_FACTOR:
|
---|
210 | case GL_POLYGON_OFFSET_UNITS :
|
---|
211 | case GL_POLYGON_OFFSET_FILL:
|
---|
212 | case GL_POLYGON_OFFSET_LINE:
|
---|
213 | case GL_POLYGON_OFFSET_POINT:
|
---|
214 | case GL_POLYGON_SMOOTH:
|
---|
215 | case GL_POLYGON_SMOOTH_HINT:
|
---|
216 | case GL_POLYGON_STIPPLE:
|
---|
217 | case GL_PROJECTION_STACK_DEPTH:
|
---|
218 | case GL_READ_BUFFER:
|
---|
219 | case GL_RED_BIAS:
|
---|
220 | case GL_RED_BITS:
|
---|
221 | case GL_RED_SCALE:
|
---|
222 | case GL_RENDER_MODE:
|
---|
223 | case GL_RGBA_MODE:
|
---|
224 | case GL_SCISSOR_TEST:
|
---|
225 | case GL_SHADE_MODEL:
|
---|
226 | case GL_STENCIL_BITS:
|
---|
227 | case GL_STENCIL_CLEAR_VALUE:
|
---|
228 | case GL_STENCIL_FAIL:
|
---|
229 | case GL_STENCIL_FUNC:
|
---|
230 | case GL_STENCIL_PASS_DEPTH_FAIL:
|
---|
231 | case GL_STENCIL_PASS_DEPTH_PASS:
|
---|
232 | case GL_STENCIL_REF:
|
---|
233 | case GL_STENCIL_TEST:
|
---|
234 | case GL_STENCIL_VALUE_MASK:
|
---|
235 | case GL_STENCIL_WRITEMASK:
|
---|
236 | case GL_STEREO:
|
---|
237 | case GL_SUBPIXEL_BITS:
|
---|
238 | case GL_TEXTURE_1D:
|
---|
239 | // case GL_TEXTURE_1D_BINDING:
|
---|
240 | case GL_TEXTURE_2D :
|
---|
241 | // case GL_TEXTURE_2D_BINDING:
|
---|
242 | case GL_TEXTURE_COORD_ARRAY:
|
---|
243 | case GL_TEXTURE_COORD_ARRAY_SIZE:
|
---|
244 | case GL_TEXTURE_COORD_ARRAY_STRIDE:
|
---|
245 | case GL_TEXTURE_COORD_ARRAY_TYPE:
|
---|
246 | case GL_TEXTURE_GEN_Q:
|
---|
247 | case GL_TEXTURE_GEN_R:
|
---|
248 | case GL_TEXTURE_GEN_S:
|
---|
249 | case GL_TEXTURE_GEN_T:
|
---|
250 | case GL_TEXTURE_STACK_DEPTH:
|
---|
251 | case GL_UNPACK_ALIGNMENT:
|
---|
252 | case GL_UNPACK_LSB_FIRST:
|
---|
253 | case GL_UNPACK_ROW_LENGTH:
|
---|
254 | case GL_UNPACK_SKIP_PIXELS:
|
---|
255 | case GL_UNPACK_SKIP_ROWS:
|
---|
256 | case GL_UNPACK_SWAP_BYTES:
|
---|
257 | case GL_VERTEX_ARRAY:
|
---|
258 | case GL_VERTEX_ARRAY_SIZE:
|
---|
259 | case GL_VERTEX_ARRAY_STRIDE:
|
---|
260 | case GL_VERTEX_ARRAY_TYPE:
|
---|
261 | case GL_ZOOM_X:
|
---|
262 | case GL_ZOOM_Y:
|
---|
263 | return 1;
|
---|
264 |
|
---|
265 | case GL_ACCUM_CLEAR_VALUE:
|
---|
266 | // case GL_BLEND_COLOR_EXT:
|
---|
267 | case GL_COLOR_CLEAR_VALUE:
|
---|
268 | case GL_COLOR_WRITEMASK:
|
---|
269 | case GL_CURRENT_COLOR:
|
---|
270 | case GL_CURRENT_RASTER_COLOR:
|
---|
271 | case GL_CURRENT_RASTER_POSITION:
|
---|
272 | case GL_CURRENT_RASTER_TEXTURE_COORDS:
|
---|
273 | case GL_CURRENT_TEXTURE_COORDS:
|
---|
274 | case GL_FOG_COLOR:
|
---|
275 | case GL_LIGHT_MODEL_AMBIENT:
|
---|
276 | case GL_MAP2_GRID_DOMAIN:
|
---|
277 | case GL_VIEWPORT:
|
---|
278 | case GL_SCISSOR_BOX:
|
---|
279 | return 4;
|
---|
280 |
|
---|
281 | case GL_DEPTH_RANGE:
|
---|
282 | case GL_LINE_WIDTH_RANGE:
|
---|
283 | case GL_MAP1_GRID_DOMAIN:
|
---|
284 | case GL_MAP2_GRID_SEGMENTS:
|
---|
285 | case GL_MAX_VIEWPORT_DIMS:
|
---|
286 | case GL_POINT_SIZE_RANGE:
|
---|
287 | case GL_POLYGON_MODE:
|
---|
288 | return 2;
|
---|
289 |
|
---|
290 | case GL_CURRENT_NORMAL:
|
---|
291 | return 3;
|
---|
292 |
|
---|
293 | case GL_MODELVIEW_MATRIX:
|
---|
294 | case GL_PROJECTION_MATRIX:
|
---|
295 | case GL_TEXTURE_MATRIX:
|
---|
296 | return 16;
|
---|
297 |
|
---|
298 | default:
|
---|
299 | AssertMsgFailed(("%s Unknown element %x\n", __FUNCTION__, pname));
|
---|
300 | return 0;
|
---|
301 | }
|
---|
302 | }
|
---|
303 |
|
---|
304 | void APIENTRY glGetBooleanv (GLenum pname, GLboolean *params)
|
---|
305 | {
|
---|
306 | uint32_t n = vboxglGetNrElements(pname);
|
---|
307 |
|
---|
308 | if (!n)
|
---|
309 | {
|
---|
310 | AssertMsgFailed(("glGetBooleanv: Invalid enum %x\n", pname));
|
---|
311 | glSetError(GL_INVALID_ENUM);
|
---|
312 | return;
|
---|
313 | }
|
---|
314 |
|
---|
315 | VBOX_OGL_GEN_SYNC_OP2_PASS_PTR(GetBooleanv, pname, n*sizeof(GLboolean), params);
|
---|
316 | return;
|
---|
317 | }
|
---|
318 |
|
---|
319 | void APIENTRY glGetDoublev (GLenum pname, GLdouble *params)
|
---|
320 | {
|
---|
321 | uint32_t n = vboxglGetNrElements(pname);
|
---|
322 |
|
---|
323 | if (!n)
|
---|
324 | {
|
---|
325 | AssertMsgFailed(("glGetDoublev: Invalid enum %x\n", pname));
|
---|
326 | glSetError(GL_INVALID_ENUM);
|
---|
327 | return;
|
---|
328 | }
|
---|
329 |
|
---|
330 | VBOX_OGL_GEN_SYNC_OP2_PASS_PTR(GetDoublev, pname, n*sizeof(GLdouble), params);
|
---|
331 | return;
|
---|
332 | }
|
---|
333 |
|
---|
334 | void APIENTRY glGetFloatv (GLenum pname, GLfloat *params)
|
---|
335 | {
|
---|
336 | uint32_t n = vboxglGetNrElements(pname);
|
---|
337 |
|
---|
338 | if (!n)
|
---|
339 | {
|
---|
340 | AssertMsgFailed(("glGetFloatv: Invalid enum %x\n", pname));
|
---|
341 | glSetError(GL_INVALID_ENUM);
|
---|
342 | return;
|
---|
343 | }
|
---|
344 |
|
---|
345 | VBOX_OGL_GEN_SYNC_OP2_PASS_PTR(GetFloatv, pname, n*sizeof(GLfloat), params);
|
---|
346 | return;
|
---|
347 | }
|
---|
348 |
|
---|
349 | void APIENTRY glGetIntegerv (GLenum pname, GLint *params)
|
---|
350 | {
|
---|
351 | uint32_t n = vboxglGetNrElements(pname);
|
---|
352 |
|
---|
353 | if (!n)
|
---|
354 | {
|
---|
355 | AssertMsgFailed(("glGetIntegerv: Invalid enum %x\n", pname));
|
---|
356 | glSetError(GL_INVALID_ENUM);
|
---|
357 | return;
|
---|
358 | }
|
---|
359 |
|
---|
360 | VBOX_OGL_GEN_SYNC_OP2_PASS_PTR(GetIntegerv, pname, n*sizeof(GLint), params);
|
---|
361 | return;
|
---|
362 | }
|
---|
363 |
|
---|
364 |
|
---|
365 | void APIENTRY glGetMapdv (GLenum target, GLenum query, GLdouble *v)
|
---|
366 | {
|
---|
367 | AssertFailed(); /** @todo */
|
---|
368 | return;
|
---|
369 | }
|
---|
370 |
|
---|
371 | void APIENTRY glGetMapfv (GLenum target, GLenum query, GLfloat *v)
|
---|
372 | {
|
---|
373 | AssertFailed(); /** @todo */
|
---|
374 | return;
|
---|
375 | }
|
---|
376 |
|
---|
377 | void APIENTRY glGetMapiv (GLenum target, GLenum query, GLint *v)
|
---|
378 | {
|
---|
379 | AssertFailed(); /** @todo */
|
---|
380 | return;
|
---|
381 | }
|
---|
382 |
|
---|
383 | void APIENTRY glGetPointerv (GLenum pname, GLvoid* *params)
|
---|
384 | {
|
---|
385 | AssertFailed(); /** @todo */
|
---|
386 | return;
|
---|
387 | }
|
---|
388 |
|
---|
389 |
|
---|