1 | /** @file
|
---|
2 | *
|
---|
3 | * VirtualBox Windows NT/2000/XP guest OpenGL ICD
|
---|
4 | *
|
---|
5 | * Complex 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 (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #include "VBoxOGL.h"
|
---|
19 |
|
---|
20 |
|
---|
21 | void APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
|
---|
22 | {
|
---|
23 | GLint cbDataType = glVBoxGetDataTypeSize(type);
|
---|
24 |
|
---|
25 | if (!cbDataType)
|
---|
26 | {
|
---|
27 | glLogError(GL_INVALID_ENUM);
|
---|
28 | return;
|
---|
29 | }
|
---|
30 |
|
---|
31 | GLint cbPixel = cbDataType * glInternalGetPixelFormatElements(format);
|
---|
32 |
|
---|
33 | VBOX_OGL_GEN_SYNC_OP7_PASS_PTR(ReadPixels, x, y, width, height, format, type, cbPixel*width*height, pixels);
|
---|
34 | return;
|
---|
35 | }
|
---|
36 |
|
---|
37 |
|
---|
38 | /** @todo */
|
---|
39 | void APIENTRY glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer)
|
---|
40 | {
|
---|
41 | AssertFailed();
|
---|
42 | }
|
---|
43 |
|
---|
44 | /** @todo */
|
---|
45 | void APIENTRY glSelectBuffer(GLsizei size, GLuint *buffer)
|
---|
46 | {
|
---|
47 | AssertFailed();
|
---|
48 | }
|
---|
49 |
|
---|
50 | /** @todo */
|
---|
51 | /* Note: when in GL_FEEDBACK or GL_SELECT mode -> fill those buffers
|
---|
52 | * when switching to GL_FEEDBACK or GL_SELECT mode -> pass pointers
|
---|
53 | */
|
---|
54 | GLint APIENTRY glRenderMode (GLenum mode)
|
---|
55 | {
|
---|
56 | AssertFailed();
|
---|
57 | VBOX_OGL_GEN_SYNC_OP1_RET(GLint, RenderMode, mode);
|
---|
58 | return retval;
|
---|
59 | }
|
---|
60 |
|
---|
61 |
|
---|
62 | void APIENTRY glGenTextures (GLsizei n, GLuint *textures)
|
---|
63 | {
|
---|
64 | VBOX_OGL_GEN_SYNC_OP2_PASS_PTR(GenTextures, n, n*sizeof(GLuint), textures);
|
---|
65 | return;
|
---|
66 | }
|
---|
67 |
|
---|
68 | GLboolean APIENTRY glAreTexturesResident (GLsizei n, const GLuint *textures, GLboolean *residences)
|
---|
69 | {
|
---|
70 | AssertFailed();
|
---|
71 | return 1;
|
---|
72 | }
|
---|
73 |
|
---|
74 | void APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
|
---|
75 | {
|
---|
76 | if (!count)
|
---|
77 | return; /* no error?? */
|
---|
78 |
|
---|
79 | AssertFailed();
|
---|
80 | return;
|
---|
81 | }
|
---|
82 |
|
---|
83 | void APIENTRY glBitmap (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap)
|
---|
84 | {
|
---|
85 | AssertFailed();
|
---|
86 | return;
|
---|
87 | }
|
---|
88 |
|
---|
89 | void APIENTRY glDrawPixels (GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
|
---|
90 | {
|
---|
91 | AssertFailed();
|
---|
92 | return;
|
---|
93 | }
|
---|
94 |
|
---|
95 | void APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params)
|
---|
96 | {
|
---|
97 | uint32_t n = glInternalTexParametervElem(pname);
|
---|
98 |
|
---|
99 | if (!n)
|
---|
100 | {
|
---|
101 | AssertFailed();
|
---|
102 | glLogError(GL_INVALID_ENUM);
|
---|
103 | return;
|
---|
104 | }
|
---|
105 | VBOX_OGL_GEN_SYNC_OP3_PASS_PTR(GetTexParameterfv, target, pname, n*sizeof(*params), params);
|
---|
106 | return;
|
---|
107 | }
|
---|
108 |
|
---|
109 | void APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params)
|
---|
110 | {
|
---|
111 | uint32_t n = glInternalTexParametervElem(pname);
|
---|
112 |
|
---|
113 | if (!n)
|
---|
114 | {
|
---|
115 | AssertFailed();
|
---|
116 | glLogError(GL_INVALID_ENUM);
|
---|
117 | return;
|
---|
118 | }
|
---|
119 | VBOX_OGL_GEN_SYNC_OP3_PASS_PTR(GetTexParameteriv, target, pname, n*sizeof(*params), params);
|
---|
120 | return;
|
---|
121 | }
|
---|
122 |
|
---|
123 | void APIENTRY glGetTexGenfv (GLenum coord, GLenum pname, GLfloat *params)
|
---|
124 | {
|
---|
125 | uint32_t n = glInternalTexGenvElem(pname);
|
---|
126 |
|
---|
127 | if (!n)
|
---|
128 | {
|
---|
129 | AssertFailed();
|
---|
130 | glLogError(GL_INVALID_ENUM);
|
---|
131 | return;
|
---|
132 | }
|
---|
133 | VBOX_OGL_GEN_SYNC_OP3_PASS_PTR(GetTexGenfv, coord, pname, n*sizeof(*params), params);
|
---|
134 | return;
|
---|
135 | }
|
---|
136 |
|
---|
137 | void APIENTRY glGetTexGeniv (GLenum coord, GLenum pname, GLint *params)
|
---|
138 | {
|
---|
139 | uint32_t n = glInternalTexGenvElem(pname);
|
---|
140 |
|
---|
141 | if (!n)
|
---|
142 | {
|
---|
143 | AssertFailed();
|
---|
144 | glLogError(GL_INVALID_ENUM);
|
---|
145 | return;
|
---|
146 | }
|
---|
147 | VBOX_OGL_GEN_SYNC_OP3_PASS_PTR(GetTexGeniv, coord, pname, n*sizeof(*params), params);
|
---|
148 | return;
|
---|
149 | }
|
---|
150 |
|
---|
151 | void APIENTRY glGetTexGendv (GLenum coord, GLenum pname, GLdouble *params)
|
---|
152 | {
|
---|
153 | uint32_t n = glInternalTexGenvElem(pname);
|
---|
154 |
|
---|
155 | if (!n)
|
---|
156 | {
|
---|
157 | AssertFailed();
|
---|
158 | glLogError(GL_INVALID_ENUM);
|
---|
159 | return;
|
---|
160 | }
|
---|
161 | VBOX_OGL_GEN_SYNC_OP3_PASS_PTR(GetTexGendv, coord, pname, n*sizeof(*params), params);
|
---|
162 | return;
|
---|
163 | }
|
---|
164 |
|
---|
165 | void APIENTRY glGetTexEnviv (GLenum target, GLenum pname, GLint *params)
|
---|
166 | {
|
---|
167 | uint32_t n = glInternalTexEnvvElem(pname);
|
---|
168 |
|
---|
169 | if (!n)
|
---|
170 | {
|
---|
171 | AssertFailed();
|
---|
172 | glLogError(GL_INVALID_ENUM);
|
---|
173 | return;
|
---|
174 | }
|
---|
175 | VBOX_OGL_GEN_SYNC_OP3_PASS_PTR(GetTexEnviv, target, pname, n*sizeof(*params), params);
|
---|
176 | }
|
---|
177 |
|
---|
178 | void APIENTRY glGetTexEnvfv (GLenum target, GLenum pname, GLfloat *params)
|
---|
179 | {
|
---|
180 | uint32_t n = glInternalTexEnvvElem(pname);
|
---|
181 |
|
---|
182 | if (!n)
|
---|
183 | {
|
---|
184 | AssertFailed();
|
---|
185 | glLogError(GL_INVALID_ENUM);
|
---|
186 | return;
|
---|
187 | }
|
---|
188 | VBOX_OGL_GEN_SYNC_OP3_PASS_PTR(GetTexEnvfv, target, pname, n*sizeof(*params), params);
|
---|
189 | }
|
---|
190 |
|
---|
191 | void APIENTRY glGetPixelMapfv (GLenum map, GLfloat *values)
|
---|
192 | {
|
---|
193 | uint32_t mapsize = glInternalGetIntegerv(map);
|
---|
194 | if (!mapsize)
|
---|
195 | {
|
---|
196 | AssertFailed();
|
---|
197 | glLogError(GL_INVALID_ENUM);
|
---|
198 | return;
|
---|
199 | }
|
---|
200 | VBOX_OGL_GEN_SYNC_OP2_PASS_PTR(GetPixelMapfv, map, mapsize*sizeof(*values), values);
|
---|
201 | }
|
---|
202 |
|
---|
203 | void APIENTRY glGetPixelMapuiv (GLenum map, GLuint *values)
|
---|
204 | {
|
---|
205 | uint32_t mapsize = glInternalGetIntegerv(map);
|
---|
206 | if (!mapsize)
|
---|
207 | {
|
---|
208 | AssertFailed();
|
---|
209 | glLogError(GL_INVALID_ENUM);
|
---|
210 | return;
|
---|
211 | }
|
---|
212 | VBOX_OGL_GEN_SYNC_OP2_PASS_PTR(GetPixelMapuiv, map, mapsize*sizeof(*values), values);
|
---|
213 | }
|
---|
214 |
|
---|
215 | void APIENTRY glGetPixelMapusv (GLenum map, GLushort *values)
|
---|
216 | {
|
---|
217 | uint32_t mapsize = glInternalGetIntegerv(map);
|
---|
218 | if (!mapsize)
|
---|
219 | {
|
---|
220 | AssertFailed();
|
---|
221 | glLogError(GL_INVALID_ENUM);
|
---|
222 | return;
|
---|
223 | }
|
---|
224 | VBOX_OGL_GEN_SYNC_OP2_PASS_PTR(GetPixelMapusv, map, mapsize*sizeof(*values), values);
|
---|
225 | }
|
---|
226 |
|
---|
227 | void APIENTRY glGetMaterialiv (GLenum face, GLenum pname, GLint *params)
|
---|
228 | {
|
---|
229 | uint32_t n = glInternalMaterialvElem(pname);
|
---|
230 |
|
---|
231 | if (!n)
|
---|
232 | {
|
---|
233 | AssertFailed();
|
---|
234 | glLogError(GL_INVALID_ENUM);
|
---|
235 | return;
|
---|
236 | }
|
---|
237 | VBOX_OGL_GEN_SYNC_OP3_PASS_PTR(GetMaterialiv, face, pname, n*sizeof(*params), params);
|
---|
238 | }
|
---|
239 |
|
---|
240 | void APIENTRY glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params)
|
---|
241 | {
|
---|
242 | uint32_t n = glInternalMaterialvElem(pname);
|
---|
243 |
|
---|
244 | if (!n)
|
---|
245 | {
|
---|
246 | AssertFailed();
|
---|
247 | glLogError(GL_INVALID_ENUM);
|
---|
248 | return;
|
---|
249 | }
|
---|
250 | VBOX_OGL_GEN_SYNC_OP3_PASS_PTR(GetMaterialfv, face, pname, n*sizeof(*params), params);
|
---|
251 | }
|
---|
252 |
|
---|
253 | void APIENTRY glGetLightiv (GLenum light, GLenum pname, GLint *params)
|
---|
254 | {
|
---|
255 | uint32_t n = glInternalLightvElem(pname);
|
---|
256 |
|
---|
257 | if (!n)
|
---|
258 | {
|
---|
259 | AssertFailed();
|
---|
260 | glLogError(GL_INVALID_ENUM);
|
---|
261 | return;
|
---|
262 | }
|
---|
263 | VBOX_OGL_GEN_SYNC_OP3_PASS_PTR(GetLightiv, light, pname, n*sizeof(*params), params);
|
---|
264 | }
|
---|
265 |
|
---|
266 | void APIENTRY glGetLightfv (GLenum light, GLenum pname, GLfloat *params)
|
---|
267 | {
|
---|
268 | uint32_t n = glInternalLightvElem(pname);
|
---|
269 |
|
---|
270 | if (!n)
|
---|
271 | {
|
---|
272 | AssertFailed();
|
---|
273 | glLogError(GL_INVALID_ENUM);
|
---|
274 | return;
|
---|
275 | }
|
---|
276 | VBOX_OGL_GEN_SYNC_OP3_PASS_PTR(GetLightfv, light, pname, n*sizeof(*params), params);
|
---|
277 | }
|
---|
278 |
|
---|
279 | void APIENTRY glGetClipPlane (GLenum plane, GLdouble *equation)
|
---|
280 | {
|
---|
281 | VBOX_OGL_GEN_SYNC_OP2_PASS_PTR(GetClipPlane, plane, 4*sizeof(GLdouble), equation);
|
---|
282 | return;
|
---|
283 | }
|
---|
284 |
|
---|
285 | void APIENTRY glGetPolygonStipple (GLubyte *mask)
|
---|
286 | {
|
---|
287 | VBOX_OGL_GEN_SYNC_OP1_PASS_PTR(GetPolygonStipple, 32*32/8, mask);
|
---|
288 | }
|
---|
289 |
|
---|
290 | void APIENTRY glGetTexImage (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)
|
---|
291 | {
|
---|
292 | GLint cbDataType = glVBoxGetDataTypeSize(type);
|
---|
293 |
|
---|
294 | if (!cbDataType)
|
---|
295 | {
|
---|
296 | glLogError(GL_INVALID_ENUM);
|
---|
297 | return;
|
---|
298 | }
|
---|
299 |
|
---|
300 | /** @todo check dimensions of texture */
|
---|
301 | AssertFailed();
|
---|
302 | GLint cbPixel = cbDataType * glInternalGetPixelFormatElements(format);
|
---|
303 | VBOX_OGL_GEN_SYNC_OP5_PASS_PTR(GetTexImage, target, level, format, type, cbPixel, pixels);
|
---|
304 | }
|
---|
305 |
|
---|
306 | void APIENTRY glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params)
|
---|
307 | {
|
---|
308 | VBOX_OGL_GEN_SYNC_OP4_PASS_PTR(GetTexLevelParameterfv, target, level, pname, sizeof(*params), params);
|
---|
309 | }
|
---|
310 |
|
---|
311 | void APIENTRY glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params)
|
---|
312 | {
|
---|
313 | VBOX_OGL_GEN_SYNC_OP4_PASS_PTR(GetTexLevelParameteriv, target, level, pname, sizeof(*params), params);
|
---|
314 | }
|
---|