VirtualBox

source: vbox/trunk/include/VBox/HostServices/VBoxOGLOp.h@ 3473

Last change on this file since 3473 was 3473, checked in by vboxsync, 18 years ago

Bugfix

File size: 90.6 KB
Line 
1/** @file
2 *
3 * VirtualBox OpenGL command pack/unpack header
4 *
5 * Copyright (C) 2006-2007 innotek GmbH
6 *
7 * This file is part of VirtualBox Open Source Edition (OSE), as
8 * available from http://www.virtualbox.org. This file is free software;
9 * you can redistribute it and/or modify it under the terms of the GNU
10 * General Public License as published by the Free Software Foundation,
11 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
12 * distribution. VirtualBox OSE is distributed in the hope that it will
13 * be useful, but WITHOUT ANY WARRANTY of any kind.
14 *
15 * If you received this file as part of a commercial VirtualBox
16 * distribution, then only the terms of your commercial VirtualBox
17 * license agreement apply instead of the previous paragraph.
18 *
19 */
20#ifndef __VBOXOGLOP_H__
21#define __VBOXOGLOP_H__
22
23#ifdef VBOX_OGL_GUEST_SIDE
24/************************************************************************************************************
25 * Guest side macro's for packing OpenGL function calls into the command buffer. *
26 * *
27 ************************************************************************************************************/
28
29#define VBOX_OGL_NAME_PREFIX(Function) gl##Function
30
31#define OGL_CMD(op, numpar, size) \
32 VBoxCmdStart(VBOX_OGL_OP_##op, numpar, size);
33
34#define OGL_PARAM(val, size) \
35 VBoxCmdSaveParameter((uint8_t *)&val, size);
36
37#define OGL_MEMPARAM(ptr, size) \
38 VBoxCmdSaveMemParameter((uint8_t *)ptr, size);
39
40#define OGL_CMD_END(op) \
41 VBoxCmdStop(VBOX_OGL_OP_##op);
42
43
44#define VBOX_OGL_GEN_OP(op) \
45 OGL_CMD(op, 0, 0); \
46 OGL_CMD_END(op);
47
48#define VBOX_OGL_GEN_OP1(op, p1) \
49 OGL_CMD(op, 1, sizeof(p1)); \
50 OGL_PARAM(p1, sizeof(p1)); \
51 OGL_CMD_END(op);
52
53#define VBOX_OGL_GEN_OP2(op, p1, p2) \
54 OGL_CMD(op, 2, sizeof(p1)+sizeof(p2)); \
55 OGL_PARAM(p1, sizeof(p1)); \
56 OGL_PARAM(p2, sizeof(p2)); \
57 OGL_CMD_END(op);
58
59#define VBOX_OGL_GEN_OP3(op, p1, p2, p3) \
60 OGL_CMD(op, 3, sizeof(p1)+sizeof(p2)+sizeof(p3)); \
61 OGL_PARAM(p1, sizeof(p1)); \
62 OGL_PARAM(p2, sizeof(p2)); \
63 OGL_PARAM(p3, sizeof(p3)); \
64 OGL_CMD_END(op);
65
66#define VBOX_OGL_GEN_OP4(op, p1, p2, p3, p4) \
67 OGL_CMD(op, 4, sizeof(p1)+sizeof(p2)+sizeof(p3)+sizeof(p4)); \
68 OGL_PARAM(p1, sizeof(p1)); \
69 OGL_PARAM(p2, sizeof(p2)); \
70 OGL_PARAM(p3, sizeof(p3)); \
71 OGL_PARAM(p4, sizeof(p4)); \
72 OGL_CMD_END(op);
73
74#define VBOX_OGL_GEN_OP5(op, p1, p2, p3, p4, p5) \
75 OGL_CMD(op, 5, sizeof(p1)+sizeof(p2)+sizeof(p3)+sizeof(p4)+sizeof(p5)); \
76 OGL_PARAM(p1, sizeof(p1)); \
77 OGL_PARAM(p2, sizeof(p2)); \
78 OGL_PARAM(p3, sizeof(p3)); \
79 OGL_PARAM(p4, sizeof(p4)); \
80 OGL_PARAM(p5, sizeof(p5)); \
81 OGL_CMD_END(op);
82
83#define VBOX_OGL_GEN_OP6(op, p1, p2, p3, p4, p5, p6) \
84 OGL_CMD(op, 6, sizeof(p1)+sizeof(p2)+sizeof(p3)+sizeof(p4)+sizeof(p5)+sizeof(p6)); \
85 OGL_PARAM(p1, sizeof(p1)); \
86 OGL_PARAM(p2, sizeof(p2)); \
87 OGL_PARAM(p3, sizeof(p3)); \
88 OGL_PARAM(p4, sizeof(p4)); \
89 OGL_PARAM(p5, sizeof(p5)); \
90 OGL_PARAM(p6, sizeof(p6)); \
91 OGL_CMD_END(op);
92
93#define VBOX_OGL_GEN_OP7(op, p1, p2, p3, p4, p5, p6, p7) \
94 OGL_CMD(op, 7, sizeof(p1)+sizeof(p2)+sizeof(p3)+sizeof(p4)+sizeof(p5)+sizeof(p6)+sizeof(p7)); \
95 OGL_PARAM(p1, sizeof(p1)); \
96 OGL_PARAM(p2, sizeof(p2)); \
97 OGL_PARAM(p3, sizeof(p3)); \
98 OGL_PARAM(p4, sizeof(p4)); \
99 OGL_PARAM(p5, sizeof(p5)); \
100 OGL_PARAM(p6, sizeof(p6)); \
101 OGL_PARAM(p7, sizeof(p7)); \
102 OGL_CMD_END(op);
103
104#define VBOX_OGL_GEN_OP8(op, p1, p2, p3, p4, p5, p6, p7, p8) \
105 OGL_CMD(op, 8, sizeof(p1)+sizeof(p2)+sizeof(p3)+sizeof(p4)+sizeof(p5)+sizeof(p6)+sizeof(p7)+sizeof(p8)); \
106 OGL_PARAM(p1, sizeof(p1)); \
107 OGL_PARAM(p2, sizeof(p2)); \
108 OGL_PARAM(p3, sizeof(p3)); \
109 OGL_PARAM(p4, sizeof(p4)); \
110 OGL_PARAM(p5, sizeof(p5)); \
111 OGL_PARAM(p6, sizeof(p6)); \
112 OGL_PARAM(p7, sizeof(p7)); \
113 OGL_PARAM(p8, sizeof(p8)); \
114 OGL_CMD_END(op);
115
116
117/* last parameter is a memory block */
118#define VBOX_OGL_GEN_OP1PTR(op, size, p1ptr) \
119 OGL_CMD(op, 1, size); \
120 OGL_MEMPARAM(p1ptr, size); \
121 OGL_CMD_END(op);
122
123#define VBOX_OGL_GEN_OP2PTR(op, p1, size, p2ptr) \
124 OGL_CMD(op, 2, sizeof(p1)+size); \
125 OGL_PARAM(p1, sizeof(p1)); \
126 OGL_MEMPARAM(p2ptr, size); \
127 OGL_CMD_END(op);
128
129#define VBOX_OGL_GEN_OP3PTR(op, p1, p2, size, p3ptr) \
130 OGL_CMD(op, 3, sizeof(p1)+sizeof(p2)+size); \
131 OGL_PARAM(p1, sizeof(p1)); \
132 OGL_PARAM(p2, sizeof(p2)); \
133 OGL_MEMPARAM(p3ptr, size); \
134 OGL_CMD_END(op);
135
136#define VBOX_OGL_GEN_OP4PTR(op, p1, p2, p3, size, p4ptr) \
137 OGL_CMD(op, 4, sizeof(p1)+sizeof(p2)+sizeof(p3)+size); \
138 OGL_PARAM(p1, sizeof(p1)); \
139 OGL_PARAM(p2, sizeof(p2)); \
140 OGL_PARAM(p3, sizeof(p3)); \
141 OGL_MEMPARAM(p4ptr, size); \
142 OGL_CMD_END(op);
143
144#define VBOX_OGL_GEN_OP5PTR(op, p1, p2, p3, p4, size, p5ptr) \
145 OGL_CMD(op, 5, sizeof(p1)+sizeof(p2)+sizeof(p3)+sizeof(p4)+size); \
146 OGL_PARAM(p1, sizeof(p1)); \
147 OGL_PARAM(p2, sizeof(p2)); \
148 OGL_PARAM(p3, sizeof(p3)); \
149 OGL_PARAM(p4, sizeof(p4)); \
150 OGL_MEMPARAM(p5ptr, size); \
151 OGL_CMD_END(op);
152
153#define VBOX_OGL_GEN_OP6PTR(op, p1, p2, p3, p4, p5, size, p6ptr) \
154 OGL_CMD(op, 6, sizeof(p1)+sizeof(p2)+sizeof(p3)+sizeof(p4)+sizeof(p5)+size); \
155 OGL_PARAM(p1, sizeof(p1)); \
156 OGL_PARAM(p2, sizeof(p2)); \
157 OGL_PARAM(p3, sizeof(p3)); \
158 OGL_PARAM(p4, sizeof(p4)); \
159 OGL_PARAM(p5, sizeof(p5)); \
160 OGL_MEMPARAM(p6ptr, size); \
161 OGL_CMD_END(op);
162
163#define VBOX_OGL_GEN_OP7PTR(op, p1, p2, p3, p4, p5, p6, size, p7ptr) \
164 OGL_CMD(op, 7, sizeof(p1)+sizeof(p2)+sizeof(p3)+sizeof(p4)+sizeof(p5)+sizeof(p6)+size); \
165 OGL_PARAM(p1, sizeof(p1)); \
166 OGL_PARAM(p2, sizeof(p2)); \
167 OGL_PARAM(p3, sizeof(p3)); \
168 OGL_PARAM(p4, sizeof(p4)); \
169 OGL_PARAM(p5, sizeof(p5)); \
170 OGL_PARAM(p6, sizeof(p6)); \
171 OGL_MEMPARAM(p7ptr, size); \
172 OGL_CMD_END(op);
173
174#define VBOX_OGL_GEN_OP8PTR(op, p1, p2, p3, p4, p5, p6, p7, size, p8ptr) \
175 OGL_CMD(op, 8, sizeof(p1)+sizeof(p2)+sizeof(p3)+sizeof(p4)+sizeof(p5)+sizeof(p6)+sizeof(p7)+size); \
176 OGL_PARAM(p1, sizeof(p1)); \
177 OGL_PARAM(p2, sizeof(p2)); \
178 OGL_PARAM(p3, sizeof(p3)); \
179 OGL_PARAM(p4, sizeof(p4)); \
180 OGL_PARAM(p5, sizeof(p5)); \
181 OGL_PARAM(p6, sizeof(p6)); \
182 OGL_PARAM(p7, sizeof(p7)); \
183 OGL_MEMPARAM(p8ptr, size); \
184 OGL_CMD_END(op);
185
186#define VBOX_OGL_GEN_OP9PTR(op, p1, p2, p3, p4, p5, p6, p7, p8, size, p9ptr) \
187 OGL_CMD(op, 9, sizeof(p1)+sizeof(p2)+sizeof(p3)+sizeof(p4)+sizeof(p5)+sizeof(p6)+sizeof(p7)+sizeof(p8)+size); \
188 OGL_PARAM(p1, sizeof(p1)); \
189 OGL_PARAM(p2, sizeof(p2)); \
190 OGL_PARAM(p3, sizeof(p3)); \
191 OGL_PARAM(p4, sizeof(p4)); \
192 OGL_PARAM(p5, sizeof(p5)); \
193 OGL_PARAM(p6, sizeof(p6)); \
194 OGL_PARAM(p7, sizeof(p7)); \
195 OGL_PARAM(p8, sizeof(p8)); \
196 OGL_MEMPARAM(p9ptr, size); \
197 OGL_CMD_END(op);
198
199#define VBOX_OGL_GEN_OP10PTR(op, p1, p2, p3, p4, p5, p6, p7, p8, p9, size, p10ptr) \
200 OGL_CMD(op, 10, sizeof(p1)+sizeof(p2)+sizeof(p3)+sizeof(p4)+sizeof(p5)+sizeof(p6)+sizeof(p7)+sizeof(p8)+sizeof(p9)+size); \
201 OGL_PARAM(p1, sizeof(p1)); \
202 OGL_PARAM(p2, sizeof(p2)); \
203 OGL_PARAM(p3, sizeof(p3)); \
204 OGL_PARAM(p4, sizeof(p4)); \
205 OGL_PARAM(p5, sizeof(p5)); \
206 OGL_PARAM(p6, sizeof(p6)); \
207 OGL_PARAM(p7, sizeof(p7)); \
208 OGL_PARAM(p8, sizeof(p8)); \
209 OGL_PARAM(p9, sizeof(p9)); \
210 OGL_MEMPARAM(p10ptr, size); \
211 OGL_CMD_END(op);
212
213
214/* two memory blocks */
215#define VBOX_OGL_GEN_OP2PTRPTR(op, size1, p1ptr, size2, p2ptr) \
216 OGL_CMD(op, 2, size1+size2); \
217 OGL_MEMPARAM(p1ptr, size1); \
218 OGL_MEMPARAM(p2ptr, size2); \
219 OGL_CMD_END(op);
220
221#define VBOX_OGL_GEN_OP3PTRPTR(op, p1, size2, p2ptr, size3, p3ptr) \
222 OGL_CMD(op, 3, sizeof(p1)+size2+size3); \
223 OGL_PARAM(p1, sizeof(p1)); \
224 OGL_MEMPARAM(p2ptr, size2); \
225 OGL_MEMPARAM(p3ptr, size3); \
226 OGL_CMD_END(op);
227
228/* Note: sync operations always set the last error */
229/* sync operation that returns a value */
230#define VBOX_OGL_GEN_SYNC_OP_RET(rettype, op) \
231 VBOX_OGL_GEN_OP(op) \
232 rettype retval = (rettype)VBoxOGLFlush();
233
234#define VBOX_OGL_GEN_SYNC_OP1_RET(rettype, op, p1) \
235 VBOX_OGL_GEN_OP1(op, p1) \
236 rettype retval = (rettype)VBoxOGLFlush();
237
238#define VBOX_OGL_GEN_SYNC_OP2_RET(rettype, op, p1, p2) \
239 VBOX_OGL_GEN_OP2(op, p1, p2) \
240 rettype retval = (rettype)VBoxOGLFlush();
241
242#define VBOX_OGL_GEN_SYNC_OP3_RET(rettype, op, p1, p2, p3) \
243 VBOX_OGL_GEN_OP3(op, p1, p2, p3) \
244 rettype retval = (rettype)VBoxOGLFlush();
245
246#define VBOX_OGL_GEN_SYNC_OP4_RET(rettype, op, p1, p2, p3, p4) \
247 VBOX_OGL_GEN_OP4(op, p1, p2, p3, p4) \
248 rettype retval = (rettype)VBoxOGLFlush();
249
250#define VBOX_OGL_GEN_SYNC_OP5_RET(rettype, op, p1, p2, p3, p4, p5) \
251 VBOX_OGL_GEN_OP5(op, p1, p2, p3, p4, p5) \
252 rettype retval = (rettype)VBoxOGLFlush();
253
254#define VBOX_OGL_GEN_SYNC_OP6_RET(rettype, op, p1, p2, p3, p4, p5, p6) \
255 VBOX_OGL_GEN_OP6(op, p1, p2, p3, p4, p5, p6) \
256 rettype retval = (rettype)VBoxOGLFlush();
257
258#define VBOX_OGL_GEN_SYNC_OP7_RET(rettype, op, p1, p2, p3, p4, p5, p6, p7) \
259 VBOX_OGL_GEN_OP7(op, p1, p2, p3, p4, p5, p6, p7) \
260 rettype retval = (rettype)VBoxOGLFlush();
261
262
263#define VBOX_OGL_GEN_SYNC_OP(op) \
264 VBOX_OGL_GEN_OP(op) \
265 VBoxOGLFlush();
266
267#define VBOX_OGL_GEN_SYNC_OP1(op, p1) \
268 VBOX_OGL_GEN_OP1(op, p1) \
269 VBoxOGLFlush();
270
271#define VBOX_OGL_GEN_SYNC_OP2(op, p1, p2) \
272 VBOX_OGL_GEN_OP2(op, p1, p2) \
273 VBoxOGLFlush();
274
275
276/* Sync operation whose last parameter is a block of memory */
277#define VBOX_OGL_GEN_SYNC_OP2_PTR(op, p1, size, p2ptr) \
278 VBOX_OGL_GEN_OP2PTR(op, p1, size, p2ptr); \
279 VBoxOGLFlush();
280
281#define VBOX_OGL_GEN_SYNC_OP5_PTR(op, p1, p2, p3, p4, size, p5ptr) \
282 VBOX_OGL_GEN_OP2PTR(op, p1, p2, p3, p4, size, p5ptr); \
283 VBoxOGLFlush();
284
285#define VBOX_OGL_GEN_SYNC_OP6_PTR(op, p1, p2, p3, p4, p5, size, p6ptr) \
286 VBOX_OGL_GEN_OP6PTR(op, p1, p2, p3, p4, p5, size, p6ptr); \
287 VBoxOGLFlush();
288
289#define VBOX_OGL_GEN_SYNC_OP7_PTR(op, p1, p2, p3, p4, p5, p6, size, p7ptr) \
290 VBOX_OGL_GEN_OP7PTR(op, p1, p2, p3, p4, p5, p6, size, p7ptr); \
291 VBoxOGLFlush();
292
293/* Sync operation whose last parameter is a block of memory in which results are returned */
294#define VBOX_OGL_GEN_SYNC_OP1_PASS_PTR(op, size, p1ptr) \
295 VBOX_OGL_GEN_OP(op); \
296 VBoxOGLFlushPtr(p1ptr, size);
297
298#define VBOX_OGL_GEN_SYNC_OP2_PASS_PTR(op, p1, size, p2ptr) \
299 VBOX_OGL_GEN_OP1(op, p1); \
300 VBoxOGLFlushPtr(p2ptr, size);
301
302#define VBOX_OGL_GEN_SYNC_OP3_PASS_PTR(op, p1, p2, size, p3ptr) \
303 VBOX_OGL_GEN_OP2(op, p1, p2); \
304 VBoxOGLFlushPtr(p3ptr, size);
305
306#define VBOX_OGL_GEN_SYNC_OP4_PASS_PTR(op, p1, p2, p3, size, p4ptr) \
307 VBOX_OGL_GEN_OP3(op, p1, p2, p3); \
308 VBoxOGLFlushPtr(p4ptr, size);
309
310#define VBOX_OGL_GEN_SYNC_OP5_PASS_PTR(op, p1, p2, p3, p4, size, p5ptr) \
311 VBOX_OGL_GEN_OP4(op, p1, p2, p3, p4); \
312 VBoxOGLFlushPtr(p5ptr, size);
313
314#define VBOX_OGL_GEN_SYNC_OP6_PASS_PTR(op, p1, p2, p3, p4, p5, size, p6ptr) \
315 VBOX_OGL_GEN_OP5(op, p1, p2, p3, p4, p5); \
316 VBoxOGLFlushPtr(p6ptr, size);
317
318#define VBOX_OGL_GEN_SYNC_OP7_PASS_PTR(op, p1, p2, p3, p4, p5, p6, size, p7ptr) \
319 VBOX_OGL_GEN_OP6(op, p1, p2, p3, p4, p5, p6); \
320 VBoxOGLFlushPtr(p7ptr, size);
321
322
323/* Sync operation whose last parameter is a block of memory and return a value */
324#define VBOX_OGL_GEN_SYNC_OP2_PTR_RET(rettype, op, p1, size, p2ptr) \
325 VBOX_OGL_GEN_OP2PTR(op, p1, size, p2ptr); \
326 rettype retval = (rettype)VBoxOGLFlush();
327
328#define VBOX_OGL_GEN_SYNC_OP4_PTR_RET(rettype, op, p1, p2, p3, size, p4ptr) \
329 VBOX_OGL_GEN_OP4PTR(op, p1, p2, p3, size, p4ptr); \
330 rettype retval = (rettype)VBoxOGLFlush();
331
332#define VBOX_OGL_GEN_SYNC_OP5_PTR_RET(rettype, op, p1, p2, p3, p4, size, p5ptr) \
333 VBOX_OGL_GEN_OP5PTR(op, p1, p2, p3, p4, size, p5ptr); \
334 rettype retval = (rettype)VBoxOGLFlush();
335
336#define VBOX_OGL_GEN_SYNC_OP6_PTR_RET(rettype, op, p1, p2, p3, p4, p5, size, p6ptr) \
337 VBOX_OGL_GEN_OP6PTR(op, p1, p2, p3, p4, p5, size, p6ptr); \
338 rettype retval = (rettype)VBoxOGLFlush();
339
340#define VBOX_OGL_GEN_SYNC_OP7_PTR_RET(rettype, op, p1, p2, p3, p4, p5, p6, size, p7ptr) \
341 VBOX_OGL_GEN_OP7PTR(op, p1, p2, p3, p4, p5, p6, size, p7ptr); \
342 rettype retval = (rettype)VBoxOGLFlush();
343
344
345/* Sync operation whose last parameter is a block of memory in which results are returned and return a value */
346#define VBOX_OGL_GEN_SYNC_OP2_PASS_PTR_RET(rettype, op, p1, size, p2ptr) \
347 VBOX_OGL_GEN_OP1(op, p1); \
348 rettype retval = (rettype)VBoxOGLFlushPtr(p2ptr, size);
349
350#define VBOX_OGL_GEN_SYNC_OP4_PASS_PTR_RET(rettype, op, p1, p2, p3, size, p4ptr) \
351 VBOX_OGL_GEN_OP3(op, p1, p2, p3); \
352 rettype retval = (rettype)VBoxOGLFlushPtr(p4ptr, size);
353
354#define VBOX_OGL_GEN_SYNC_OP5_PASS_PTR_RET(rettype, op, p1, p2, p3, p4, size, p5ptr) \
355 VBOX_OGL_GEN_OP4(op, p1, p2, p3, p4); \
356 rettype retval = (rettype)VBoxOGLFlushPtr(p5ptr, size);
357
358#define VBOX_OGL_GEN_SYNC_OP6_PASS_PTR_RET(rettype, op, p1, p2, p3, p4, p5, size, p6ptr) \
359 VBOX_OGL_GEN_OP5(op, p1, p2, p3, p4, p5); \
360 rettype retval = (rettype)VBoxOGLFlushPtr(p6ptr, size);
361
362#define VBOX_OGL_GEN_SYNC_OP7_PASS_PTR_RET(rettype, op, p1, p2, p3, p4, p5, p6, size, p7ptr) \
363 VBOX_OGL_GEN_OP6(op, p1, p2, p3, p4, p5, p6); \
364 rettype retval = (rettype)VBoxOGLFlushPtr(p7ptr, size);
365
366
367/* Generate async functions elements in the command queue */
368#define GL_GEN_FUNC(Function) \
369 void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (void) \
370 { \
371 VBOX_OGL_GEN_OP(Function); \
372 }
373
374#define GL_GEN_FUNC1(Function, Type) \
375 void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type a) \
376 { \
377 VBOX_OGL_GEN_OP1(Function, a); \
378 }
379
380#define GL_GEN_FUNC1V(Function, Type) \
381 void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type a) \
382 { \
383 VBOX_OGL_GEN_OP1(Function, a); \
384 } \
385 void APIENTRY VBOX_OGL_NAME_PREFIX(Function)##v (const Type *v) \
386 { \
387 VBOX_OGL_GEN_OP1(Function, v[0]); \
388 } \
389
390#define GL_GEN_FUNC2(Function, Type) \
391 void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type a, Type b) \
392 { \
393 VBOX_OGL_GEN_OP2(Function, a, b); \
394 }
395
396#define GL_GEN_FUNC2V(Function, Type) \
397 void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type a, Type b) \
398 { \
399 VBOX_OGL_GEN_OP2(Function, a, b); \
400 } \
401 void APIENTRY VBOX_OGL_NAME_PREFIX(Function)##v (const Type *v) \
402 { \
403 VBOX_OGL_GEN_OP2(Function, v[0], v[1]); \
404 } \
405
406#define GL_GEN_FUNC3(Function, Type) \
407 void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type a, Type b, Type c) \
408 { \
409 VBOX_OGL_GEN_OP3(Function, a, b, c); \
410 }
411
412#define GL_GEN_FUNC3V(Function, Type) \
413 void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type a, Type b, Type c) \
414 { \
415 VBOX_OGL_GEN_OP3(Function, a, b, c); \
416 } \
417 void APIENTRY VBOX_OGL_NAME_PREFIX(Function)##v (const Type *v) \
418 { \
419 VBOX_OGL_GEN_OP3(Function, v[0], v[1], v[2]); \
420 } \
421
422#define GL_GEN_FUNC4(Function, Type) \
423 void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type a, Type b, Type c, Type d) \
424 { \
425 VBOX_OGL_GEN_OP4(Function, a, b, c, d); \
426 }
427
428#define GL_GEN_FUNC4V(Function, Type) \
429 void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type a, Type b, Type c, Type d) \
430 { \
431 VBOX_OGL_GEN_OP4(Function, a, b, c, d); \
432 } \
433 void APIENTRY VBOX_OGL_NAME_PREFIX(Function)##v (const Type *v) \
434 { \
435 VBOX_OGL_GEN_OP4(Function, v[0], v[1], v[2], v[3]); \
436 } \
437
438#define GL_GEN_FUNC6(Function, Type) \
439 void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type a, Type b, Type c, Type d, Type e, Type f) \
440 { \
441 VBOX_OGL_GEN_OP6(Function, a, b, c, d, e, f); \
442 }
443
444#define GL_GEN_VPAR_FUNC2(Function, Type1, Type2) \
445 void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type1 a, Type2 b) \
446 { \
447 VBOX_OGL_GEN_OP2(Function, a, b); \
448 }
449
450#define GL_GEN_VPAR_FUNC2V(Function, Type1, Type2) \
451 void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type1 a, Type2 b) \
452 { \
453 VBOX_OGL_GEN_OP2(Function, a, b); \
454 } \
455 void APIENTRY VBOX_OGL_NAME_PREFIX(Function)##v (Type1 a, const Type2 *v) \
456 { \
457 VBOX_OGL_GEN_OP3(Function, a, v[0], v[1]); \
458 } \
459
460#define GL_GEN_VPAR_FUNC3(Function, Type1, Type2, Type3) \
461 void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type1 a, Type2 b, Type3 c) \
462 { \
463 VBOX_OGL_GEN_OP3(Function, a, b, c); \
464 }
465
466#define GL_GEN_VPAR_FUNC3V(Function, Type1, Type2, Type3) \
467 void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type1 a, Type2 b, Type3 c) \
468 { \
469 VBOX_OGL_GEN_OP3(Function, a, b, c); \
470 } \
471 void APIENTRY VBOX_OGL_NAME_PREFIX(Function)##v (Type1 a, Type2 b, const Type3 *v) \
472 { \
473 VBOX_OGL_GEN_OP3(Function, a, v[0], v[1]); \
474 } \
475
476#define GL_GEN_VPAR_FUNC4(Function, Type1, Type2, Type3, Type4) \
477 void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type1 a, Type2 b, Type3 c, Type4 d) \
478 { \
479 VBOX_OGL_GEN_OP4(Function, a, b, c, d); \
480 }
481
482#define GL_GEN_VPAR_FUNC5(Function, Type1, Type2, Type3, Type4, Type5) \
483 void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type1 a, Type2 b, Type3 c, Type4 d, Type5 e) \
484 { \
485 VBOX_OGL_GEN_OP5(Function, a, b, c, d, e); \
486 }
487
488#define GL_GEN_VPAR_FUNC6(Function, Type1, Type2, Type3, Type4, Type5, Type6) \
489 void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type1 a, Type2 b, Type3 c, Type4 d, Type5 e, Type6 f) \
490 { \
491 VBOX_OGL_GEN_OP6(Function, a, b, c, d, e, f); \
492 }
493
494#define GL_GEN_VPAR_FUNC7(Function, Type1, Type2, Type3, Type4, Type5, Type6, Type7) \
495 void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type1 a, Type2 b, Type3 c, Type4 d, Type5 e, Type6 f, Type7 g) \
496 { \
497 VBOX_OGL_GEN_OP7(Function, a, b, c, d, e, f, g); \
498 }
499
500#define GL_GEN_VPAR_FUNC8(Function, Type1, Type2, Type3, Type4, Type5, Type6, Type7, Type8) \
501 void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type1 a, Type2 b, Type3 c, Type4 d, Type5 e, Type6 f, Type7 g, Type8 h) \
502 { \
503 VBOX_OGL_GEN_OP8(Function, a, b, c, d, e, f, g, h); \
504 }
505
506#define GL_GEN_VPAR_FUNC9(Function, Type1, Type2, Type3, Type4, Type5, Type6, Type7, Type8 ,Type9) \
507 void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type1 a, Type2 b, Type3 c, Type4 d, Type5 e, Type6 f, Type7 g, Type8 h, Type9 i) \
508 { \
509 VBOX_OGL_GEN_OP9(Function, a, b, c, d, e, f, g, h, i); \
510 }
511
512#elif VBOX_OGL_HOST_SIDE
513
514/************************************************************************************************************
515 * Host side macro's for generating OpenGL function calls from the packed commands in the command buffer. *
516 * *
517 ************************************************************************************************************/
518
519#include <iprt/assert.h>
520
521#define VBOX_OGL_NAME_PREFIX(Function) vboxgl##Function
522
523#ifdef VBOX_OGL_CMD_STRICT
524#define VBOX_OGL_CHECK_MAGIC(pParVal) Assert(pParVal->Magic == VBOX_OGL_CMD_MAGIC)
525#else
526#define VBOX_OGL_CHECK_MAGIC(pParVal)
527#endif
528
529#define OGL_CMD(op, numpar) \
530 PVBOX_OGL_CMD pCmd = (PVBOX_OGL_CMD)pCmdBuffer; \
531 Assert(pCmd->enmOp == VBOX_OGL_OP_##op); \
532 Assert(pCmd->cParams == numpar); \
533 uint8_t *pParam = (uint8_t *)(pCmd+1); \
534 NOREF(pParam)
535
536#define OGL_PARAM(Type, par) \
537 Type par; \
538 par = *(Type *)pParam; \
539 pParam += sizeof(par); \
540 pParam = RT_ALIGN_PT(pParam, VBOX_OGL_CMD_ALIGN, uint8_t *);
541
542#define OGL_MEMPARAM(Type, par) \
543 PVBOX_OGL_VAR_PARAM pParVal = (PVBOX_OGL_VAR_PARAM)pParam; \
544 Type *par; \
545 VBOX_OGL_CHECK_MAGIC(pParVal); \
546 if (pParVal->cbParam) \
547 par = (Type *)(pParam+1); \
548 else \
549 par = NULL; \
550 pParam += sizeof(*pParVal) + pParVal->cbParam; \
551 pParam = RT_ALIGN_PT(pParam, VBOX_OGL_CMD_ALIGN, uint8_t *);
552
553#define OGL_MEMPARAM_NODEF(Type, par) \
554 pParVal = (PVBOX_OGL_VAR_PARAM)pParam; \
555 Type *par; \
556 VBOX_OGL_CHECK_MAGIC(pParVal); \
557 if (pParVal->cbParam) \
558 par = (Type *)(pParam+1); \
559 else \
560 par = NULL; \
561 pParam += sizeof(*pParVal) + pParVal->cbParam; \
562 pParam = RT_ALIGN_PT(pParam, VBOX_OGL_CMD_ALIGN, uint8_t *);
563
564#define VBOX_OGL_GEN_OP(op) \
565 OGL_CMD(op, 0); \
566 gl##op();
567
568#define VBOX_OGL_GEN_OP1(op, Type1) \
569 OGL_CMD(op, 1); \
570 OGL_PARAM(Type1, p1); \
571 gl##op(p1);
572
573#define VBOX_OGL_GEN_OP2(op, Type1, Type2) \
574 OGL_CMD(op, 2); \
575 OGL_PARAM(Type1, p1); \
576 OGL_PARAM(Type2, p2); \
577 gl##op(p1, p2);
578
579#define VBOX_OGL_GEN_OP3(op, Type1, Type2, Type3) \
580 OGL_CMD(op, 3); \
581 OGL_PARAM(Type1, p1); \
582 OGL_PARAM(Type2, p2); \
583 OGL_PARAM(Type3, p3); \
584 gl##op(p1, p2, p3);
585
586#define VBOX_OGL_GEN_OP4(op, Type1, Type2, Type3, Type4) \
587 OGL_CMD(op, 4); \
588 OGL_PARAM(Type1, p1); \
589 OGL_PARAM(Type2, p2); \
590 OGL_PARAM(Type3, p3); \
591 OGL_PARAM(Type4, p4); \
592 gl##op(p1, p2, p3, p4);
593
594#define VBOX_OGL_GEN_OP5(op, Type1, Type2, Type3, Type4, Type5) \
595 OGL_CMD(op, 5); \
596 OGL_PARAM(Type1, p1); \
597 OGL_PARAM(Type2, p2); \
598 OGL_PARAM(Type3, p3); \
599 OGL_PARAM(Type4, p4); \
600 OGL_PARAM(Type5, p5); \
601 gl##op(p1, p2, p3, p4, p5);
602
603#define VBOX_OGL_GEN_OP6(op, Type1, Type2, Type3, Type4, Type5, Type6) \
604 OGL_CMD(op, 6); \
605 OGL_PARAM(Type1, p1); \
606 OGL_PARAM(Type2, p2); \
607 OGL_PARAM(Type3, p3); \
608 OGL_PARAM(Type4, p4); \
609 OGL_PARAM(Type5, p5); \
610 OGL_PARAM(Type6, p6); \
611 gl##op(p1, p2, p3, p4, p5, p6);
612
613#define VBOX_OGL_GEN_OP7(op, Type1, Type2, Type3, Type4, Type5, Type6, Type7) \
614 OGL_CMD(op, 7); \
615 OGL_PARAM(Type1, p1); \
616 OGL_PARAM(Type2, p2); \
617 OGL_PARAM(Type3, p3); \
618 OGL_PARAM(Type4, p4); \
619 OGL_PARAM(Type5, p5); \
620 OGL_PARAM(Type6, p6); \
621 OGL_PARAM(Type7, p7); \
622 gl##op(p1, p2, p3, p4, p5, p6, p7);
623
624#define VBOX_OGL_GEN_OP8(op, Type1, Type2, Type3, Type4, Type5, Type6, Type7, Type8) \
625 OGL_CMD(op, 8); \
626 OGL_PARAM(Type1, p1); \
627 OGL_PARAM(Type2, p2); \
628 OGL_PARAM(Type3, p3); \
629 OGL_PARAM(Type4, p4); \
630 OGL_PARAM(Type5, p5); \
631 OGL_PARAM(Type6, p6); \
632 OGL_PARAM(Type7, p7); \
633 OGL_PARAM(Type8, p8); \
634 gl##op(p1, p2, p3, p4, p5, p6, p7, p8);
635
636
637/* last parameter is a memory block */
638#define VBOX_OGL_GEN_OP1PTR(op, Type1) \
639 OGL_CMD(op, 1); \
640 OGL_MEMPARAM(Type1, p1); \
641 gl##op(p1);
642
643#define VBOX_OGL_GEN_OP2PTR(op, Type1, Type2) \
644 OGL_CMD(op, 2); \
645 OGL_PARAM(Type1, p1); \
646 OGL_MEMPARAM(Type2, p2); \
647 gl##op(p1, p2);
648
649#define VBOX_OGL_GEN_OP3PTR(op, Type1, Type2, Type3) \
650 OGL_CMD(op, 3); \
651 OGL_PARAM(Type1, p1); \
652 OGL_PARAM(Type2, p2); \
653 OGL_MEMPARAM(Type3, p3); \
654 gl##op(p1, p2, p3);
655
656#define VBOX_OGL_GEN_OP4PTR(op, Type1, Type2, Type3, Type4) \
657 OGL_CMD(op, 4); \
658 OGL_PARAM(Type1, p1); \
659 OGL_PARAM(Type2, p2); \
660 OGL_PARAM(Type3, p3); \
661 OGL_MEMPARAM(Type4, p4); \
662 gl##op(p1, p2, p3, p4);
663
664#define VBOX_OGL_GEN_OP5PTR(op, Type1, Type2, Type3, Type4, Type5) \
665 OGL_CMD(op, 5); \
666 OGL_PARAM(Type1, p1); \
667 OGL_PARAM(Type2, p2); \
668 OGL_PARAM(Type3, p3); \
669 OGL_PARAM(Type4, p4); \
670 OGL_MEMPARAM(Type5, p5); \
671 gl##op(p1, p2, p3, p4, p5);
672
673#define VBOX_OGL_GEN_OP6PTR(op, Type1, Type2, Type3, Type4, Type5, Type6) \
674 OGL_CMD(op, 6); \
675 OGL_PARAM(Type1, p1); \
676 OGL_PARAM(Type2, p2); \
677 OGL_PARAM(Type3, p3); \
678 OGL_PARAM(Type4, p4); \
679 OGL_PARAM(Type5, p5); \
680 OGL_MEMPARAM(Type6, p6); \
681 gl##op(p1, p2, p3, p4, p5, p6);
682
683#define VBOX_OGL_GEN_OP7PTR(op, Type1, Type2, Type3, Type4, Type5, Type6, Type7) \
684 OGL_CMD(op, 7); \
685 OGL_PARAM(Type1, p1); \
686 OGL_PARAM(Type2, p2); \
687 OGL_PARAM(Type3, p3); \
688 OGL_PARAM(Type4, p4); \
689 OGL_PARAM(Type5, p5); \
690 OGL_PARAM(Type6, p6); \
691 OGL_MEMPARAM(Type7, p7); \
692 gl##op(p1, p2, p3, p4, p5, p6, p7);
693
694#define VBOX_OGL_GEN_OP8PTR(op, Type1, Type2, Type3, Type4, Type5, Type6, Type7, Type8) \
695 OGL_CMD(op, 8); \
696 OGL_PARAM(Type1, p1); \
697 OGL_PARAM(Type2, p2); \
698 OGL_PARAM(Type3, p3); \
699 OGL_PARAM(Type4, p4); \
700 OGL_PARAM(Type5, p5); \
701 OGL_PARAM(Type6, p6); \
702 OGL_PARAM(Type7, p7); \
703 OGL_MEMPARAM(Type8, p8); \
704 gl##op(p1, p2, p3, p4, p5, p6, p7, p8);
705
706#define VBOX_OGL_GEN_OP9PTR(op, Type1, Type2, Type3, Type4, Type5, Type6, Type7, Type8, Type9) \
707 OGL_CMD(op, 9); \
708 OGL_PARAM(Type1, p1); \
709 OGL_PARAM(Type2, p2); \
710 OGL_PARAM(Type3, p3); \
711 OGL_PARAM(Type4, p4); \
712 OGL_PARAM(Type5, p5); \
713 OGL_PARAM(Type6, p6); \
714 OGL_PARAM(Type7, p7); \
715 OGL_PARAM(Type8, p8); \
716 OGL_MEMPARAM(Type9, p9); \
717 gl##op(p1, p2, p3, p4, p5, p6, p7, p8 ,p9);
718
719#define VBOX_OGL_GEN_OP10PTR(op, Type1, Type2, Type3, Type4, Type5, Type6, Type7, Type8, Type9, Type10) \
720 OGL_CMD(op, 10); \
721 OGL_PARAM(Type1, p1); \
722 OGL_PARAM(Type2, p2); \
723 OGL_PARAM(Type3, p3); \
724 OGL_PARAM(Type4, p4); \
725 OGL_PARAM(Type5, p5); \
726 OGL_PARAM(Type6, p6); \
727 OGL_PARAM(Type7, p7); \
728 OGL_PARAM(Type8, p8); \
729 OGL_PARAM(Type9, p9); \
730 OGL_MEMPARAM(Type10, p10); \
731 gl##op(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);
732
733
734/* two memory blocks */
735#define VBOX_OGL_GEN_OP2PTRPTR(op, Type1, Type2) \
736 OGL_CMD(op, 2); \
737 OGL_MEMPARAM(Type1, p1); \
738 OGL_MEMPARAM_NODEF(Type2, p2); \
739 gl##op(p1, p2);
740
741#define VBOX_OGL_GEN_OP3PTRPTR(op, Type1, Type2, Type3) \
742 OGL_CMD(op, 3); \
743 OGL_PARAM(Type1, p1); \
744 OGL_MEMPARAM(Type2, p2); \
745 OGL_MEMPARAM_NODEF(Type3, p3); \
746 gl##op(p1, p2, p3);
747
748/* Note: sync operations always set the last error */
749/* sync operation that returns a value */
750#define VBOX_OGL_GEN_SYNC_OP_RET(rettype, op) \
751 OGL_CMD(op, 0); \
752 pClient->lastretval = gl##op();
753
754#define VBOX_OGL_GEN_SYNC_OP1_RET(rettype, op, Type1) \
755 OGL_CMD(op, 1); \
756 OGL_PARAM(Type1, p1); \
757 pClient->lastretval = gl##op(p1);
758
759#define VBOX_OGL_GEN_SYNC_OP2_RET(rettype, op, Type1, Type2) \
760 OGL_CMD(op, 2); \
761 OGL_PARAM(Type1, p1); \
762 OGL_PARAM(Type2, p2); \
763 pClient->lastretval = gl##op(p1, p2);
764
765#define VBOX_OGL_GEN_SYNC_OP3_RET(rettype, op, Type1, Type2, Type3) \
766 OGL_CMD(op, 3); \
767 OGL_PARAM(Type1, p1); \
768 OGL_PARAM(Type2, p2); \
769 OGL_MEMPARAM(Type3, p3); \
770 pClient->lastretval = gl##op(p1, p2, p3);
771
772#define VBOX_OGL_GEN_SYNC_OP(op) \
773 VBOX_OGL_GEN_OP(op);
774
775#define VBOX_OGL_GEN_SYNC_OP1(op, p1) \
776 VBOX_OGL_GEN_OP1(op, p1);
777
778#define VBOX_OGL_GEN_SYNC_OP2(op, p1, p2) \
779 VBOX_OGL_GEN_OP2(op, p1, p2);
780
781
782/* Sync operation whose last parameter is a block of memory */
783#define VBOX_OGL_GEN_SYNC_OP2_PTR(op, p1, p2ptr) \
784 VBOX_OGL_GEN_OP2PTR(op, p1, p2ptr);
785
786#define VBOX_OGL_GEN_SYNC_OP5_PTR(op, p1, p2, p3, p4, p5ptr) \
787 VBOX_OGL_GEN_OP2PTR(op, p1, p2, p3, p4, size, p5ptr);
788
789#define VBOX_OGL_GEN_SYNC_OP6_PTR(op, p1, p2, p3, p4, p5, p6ptr) \
790 VBOX_OGL_GEN_OP6PTR(op, p1, p2, p3, p4, p5, size, p6ptr);
791
792#define VBOX_OGL_GEN_SYNC_OP7_PTR(op, p1, p2, p3, p4, p5, p6, p7ptr) \
793 VBOX_OGL_GEN_OP7PTR(op, p1, p2, p3, p4, p5, p6, p7ptr);
794
795
796/* Sync operation whose last parameter is a block of memory in which results are returned */
797#define VBOX_OGL_GEN_SYNC_OP1_PASS_PTR(op, Type1) \
798 OGL_CMD(op, 0); \
799 Assert(pClient->pLastParam && pClient->cbLastParam); \
800 gl##op((Type1 *)pClient->pLastParam);
801
802#define VBOX_OGL_GEN_SYNC_OP2_PASS_PTR(op, Type1, Type2) \
803 OGL_CMD(op, 1); \
804 OGL_PARAM(Type1, p1); \
805 Assert(pClient->pLastParam && pClient->cbLastParam); \
806 gl##op(p1, (Type2 *)pClient->pLastParam);
807
808#define VBOX_OGL_GEN_SYNC_OP3_PASS_PTR(op, Type1, Type2, Type3) \
809 OGL_CMD(op, 2); \
810 OGL_PARAM(Type1, p1); \
811 OGL_PARAM(Type2, p2); \
812 Assert(pClient->pLastParam && pClient->cbLastParam); \
813 gl##op(p1, p2, (Type3 *)pClient->pLastParam);
814
815#define VBOX_OGL_GEN_SYNC_OP4_PASS_PTR(op, Type1, Type2, Type3, Type4) \
816 OGL_CMD(op, 3); \
817 OGL_PARAM(Type1, p1); \
818 OGL_PARAM(Type2, p2); \
819 OGL_PARAM(Type3, p3); \
820 Assert(pClient->pLastParam && pClient->cbLastParam); \
821 gl##op(p1, p2, p3, (Type4 *)pClient->pLastParam);
822
823#define VBOX_OGL_GEN_SYNC_OP5_PASS_PTR(op, Type1, Type2, Type3, Type4, Type5) \
824 OGL_CMD(op, 4); \
825 OGL_PARAM(Type1, p1); \
826 OGL_PARAM(Type2, p2); \
827 OGL_PARAM(Type3, p3); \
828 OGL_PARAM(Type4, p4); \
829 Assert(pClient->pLastParam && pClient->cbLastParam); \
830 gl##op(p1, p2, p3, p4, (Type5 *)pClient->pLastParam);
831
832#define VBOX_OGL_GEN_SYNC_OP6_PASS_PTR(op, Type1, Type2, Type3, Type4, Type5, Type6) \
833 OGL_CMD(op, 5); \
834 OGL_PARAM(Type1, p1); \
835 OGL_PARAM(Type2, p2); \
836 OGL_PARAM(Type3, p3); \
837 OGL_PARAM(Type4, p4); \
838 OGL_PARAM(Type5, p5); \
839 Assert(pClient->pLastParam && pClient->cbLastParam); \
840 gl##op(p1, p2, p3, p4, p5, (Type6 *)pClient->pLastParam);
841
842#define VBOX_OGL_GEN_SYNC_OP7_PASS_PTR(op, Type1, Type2, Type3, Type4, Type5, Type6, Type7) \
843 OGL_CMD(op, 6); \
844 OGL_PARAM(Type1, p1); \
845 OGL_PARAM(Type2, p2); \
846 OGL_PARAM(Type3, p3); \
847 OGL_PARAM(Type4, p4); \
848 OGL_PARAM(Type5, p5); \
849 OGL_PARAM(Type6, p6); \
850 Assert(pClient->pLastParam && pClient->cbLastParam); \
851 gl##op(p1, p2, p3, p4, p5, p6, (Type7 *)pClient->pLastParam);
852
853
854/* Sync operation whose last parameter is a block of memory and returns a value */
855#define VBOX_OGL_GEN_SYNC_OP2_PTR_RET(rettype, op, Type1, Type2) \
856 OGL_CMD(op, 2); \
857 OGL_PARAM(Type1, p1); \
858 OGL_MEMPARAM(Type2, p2); \
859 pClient->lastretval = gl##op(p1);
860
861#define VBOX_OGL_GEN_SYNC_OP4_PTR_RET(rettype, op, Type1, Type2, Type3, Type4) \
862 OGL_CMD(op, 4); \
863 OGL_PARAM(Type1, p1); \
864 OGL_PARAM(Type2, p2); \
865 OGL_PARAM(Type3, p3); \
866 OGL_MEMPARAM(Type4, p4); \
867 pClient->lastretval = gl##op(p1, p2, p3, p4);
868
869#define VBOX_OGL_GEN_SYNC_OP5_PTR_RET(rettype, op, Type1, Type2, Type3, Type4, Type5) \
870 OGL_CMD(op, 5); \
871 OGL_PARAM(Type1, p1); \
872 OGL_PARAM(Type2, p2); \
873 OGL_PARAM(Type3, p3); \
874 OGL_PARAM(Type4, p4); \
875 OGL_MEMPARAM(Type5, p5); \
876 pClient->lastretval = gl##op(p1, p2, p3, p4, p5);
877
878#define VBOX_OGL_GEN_SYNC_OP6_PTR_RET(rettype, op, Type1, Type2, Type3, Type4, Type5, Type6) \
879 OGL_CMD(op, 6); \
880 OGL_PARAM(Type1, p1); \
881 OGL_PARAM(Type2, p2); \
882 OGL_PARAM(Type3, p3); \
883 OGL_PARAM(Type4, p4); \
884 OGL_PARAM(Type5, p5); \
885 OGL_MEMPARAM(Type6, p6); \
886 pClient->lastretval = gl##op(p1, p2, p3, p4, p5, p6);
887
888#define VBOX_OGL_GEN_SYNC_OP7_PTR_RET(rettype, op, Type1, Type2, Type3, Type4, Type5, Type6, Type7) \
889 OGL_CMD(op, 7); \
890 OGL_PARAM(Type1, p1); \
891 OGL_PARAM(Type2, p2); \
892 OGL_PARAM(Type3, p3); \
893 OGL_PARAM(Type4, p4); \
894 OGL_PARAM(Type5, p5); \
895 OGL_PARAM(Type6, p6); \
896 OGL_MEMPARAM(Type7, p7); \
897 pClient->lastretval = gl##op(p1, p2, p3, p4, p5, p6, p7);
898
899
900
901
902
903/* Generate async functions elements in the command queue */
904#define GL_GEN_FUNC(Function) \
905 void VBOX_OGL_NAME_PREFIX(Function) (VBOXOGLCTX *pClient, uint8_t *pCmdBuffer) \
906 { \
907 VBOX_OGL_GEN_OP(Function); \
908 }
909
910#define GL_GEN_FUNC1(Function, Type) \
911 void VBOX_OGL_NAME_PREFIX(Function) (VBOXOGLCTX *pClient, uint8_t *pCmdBuffer) \
912 { \
913 VBOX_OGL_GEN_OP1(Function, Type); \
914 }
915
916#define GL_GEN_FUNC1V(Function, Type) GL_GEN_FUNC1(Function, Type)
917
918#define GL_GEN_FUNC2(Function, Type) \
919 void VBOX_OGL_NAME_PREFIX(Function) (VBOXOGLCTX *pClient, uint8_t *pCmdBuffer) \
920 { \
921 VBOX_OGL_GEN_OP2(Function, Type, Type); \
922 }
923
924#define GL_GEN_FUNC2V(Function, Type) GL_GEN_FUNC2(Function, Type)
925
926#define GL_GEN_FUNC3(Function, Type) \
927 void VBOX_OGL_NAME_PREFIX(Function) (VBOXOGLCTX *pClient, uint8_t *pCmdBuffer) \
928 { \
929 VBOX_OGL_GEN_OP3(Function, Type, Type, Type); \
930 }
931
932#define GL_GEN_FUNC3V(Function, Type) GL_GEN_FUNC3(Function, Type)
933
934#define GL_GEN_FUNC4(Function, Type) \
935 void VBOX_OGL_NAME_PREFIX(Function) (VBOXOGLCTX *pClient, uint8_t *pCmdBuffer) \
936 { \
937 VBOX_OGL_GEN_OP4(Function, Type, Type, Type, Type); \
938 }
939
940#define GL_GEN_FUNC4V(Function, Type) GL_GEN_FUNC4(Function, Type)
941
942#define GL_GEN_FUNC6(Function, Type) \
943 void VBOX_OGL_NAME_PREFIX(Function) (VBOXOGLCTX *pClient, uint8_t *pCmdBuffer) \
944 { \
945 VBOX_OGL_GEN_OP6(Function, Type, Type, Type, Type, Type, Type); \
946 }
947
948#define GL_GEN_VPAR_FUNC2(Function, Type1, Type2) \
949 void VBOX_OGL_NAME_PREFIX(Function) (VBOXOGLCTX *pClient, uint8_t *pCmdBuffer) \
950 { \
951 VBOX_OGL_GEN_OP2(Function, Type1, Type2); \
952 }
953
954#define GL_GEN_VPAR_FUNC2V(Function, Type) GL_GEN_VPAR_FUNC2(Function, Type)
955
956#define GL_GEN_VPAR_FUNC3(Function, Type1, Type2, Type3) \
957 void VBOX_OGL_NAME_PREFIX(Function) (VBOXOGLCTX *pClient, uint8_t *pCmdBuffer) \
958 { \
959 VBOX_OGL_GEN_OP3(Function, Type1, Type2, Type3); \
960 }
961
962#define GL_GEN_VPAR_FUNC3V(Function, Type) GL_GEN_VPAR_FUNC3(Function, Type)
963
964#define GL_GEN_VPAR_FUNC4(Function, Type1, Type2, Type3, Type4) \
965 void VBOX_OGL_NAME_PREFIX(Function) (VBOXOGLCTX *pClient, uint8_t *pCmdBuffer) \
966 { \
967 VBOX_OGL_GEN_OP4(Function, Type1, Type2, Type3, Type4); \
968 }
969
970#define GL_GEN_VPAR_FUNC5(Function, Type1, Type2, Type3, Type4, Type5) \
971 void VBOX_OGL_NAME_PREFIX(Function) (VBOXOGLCTX *pClient, uint8_t *pCmdBuffer) \
972 { \
973 VBOX_OGL_GEN_OP5(Function, Type1, Type2, Type3, Type4 ,Type5); \
974 }
975
976#define GL_GEN_VPAR_FUNC6(Function, Type1, Type2, Type3, Type4, Type5, Type6) \
977 void VBOX_OGL_NAME_PREFIX(Function) (VBOXOGLCTX *pClient, uint8_t *pCmdBuffer) \
978 { \
979 VBOX_OGL_GEN_OP6(Function, Type1, Type2, Type3, Type4 ,Type5, Type6); \
980 }
981
982#define GL_GEN_VPAR_FUNC7(Function, Type1, Type2, Type3, Type4, Type5, Type6, Type7) \
983 void VBOX_OGL_NAME_PREFIX(Function) (VBOXOGLCTX *pClient, uint8_t *pCmdBuffer) \
984 { \
985 VBOX_OGL_GEN_OP7(Function, Type1, Type2, Type3, Type4 ,Type5, Type6, Type7); \
986 }
987
988#define GL_GEN_VPAR_FUNC8(Function, Type1, Type2, Type3, Type4, Type5, Type6, Type7, Type8) \
989 void VBOX_OGL_NAME_PREFIX(Function) (VBOXOGLCTX *pClient, uint8_t *pCmdBuffer) \
990 { \
991 VBOX_OGL_GEN_OP8(Function, Type1, Type2, Type3, Type4 ,Type5, Type6, Type7, Type8); \
992 }
993
994#define GL_GEN_VPAR_FUNC9(Function, Type1, Type2, Type3, Type4, Type5, Type6, Type7, Type8 ,Type9) \
995 void VBOX_OGL_NAME_PREFIX(Function) (VBOXOGLCTX *pClient, uint8_t *pCmdBuffer) \
996 { \
997 VBOX_OGL_GEN_OP9(Function, Type1, Type2, Type3, Type4 ,Type5, Type6, Type7, Type8, Type9); \
998 }
999
1000#endif /* VBOX_OGL_HOST_SIDE */
1001
1002
1003
1004
1005/* OpenGL opcodes */
1006/* Note: keep all three tables in sync! */
1007typedef enum
1008{
1009 VBOX_OGL_OP_Illegal = 0,
1010 VBOX_OGL_OP_ArrayElement,
1011 VBOX_OGL_OP_Begin,
1012 VBOX_OGL_OP_BindTexture,
1013 VBOX_OGL_OP_BlendFunc,
1014 VBOX_OGL_OP_CallList,
1015 VBOX_OGL_OP_Color3b,
1016 VBOX_OGL_OP_Color3d,
1017 VBOX_OGL_OP_Color3f,
1018 VBOX_OGL_OP_Color3i,
1019 VBOX_OGL_OP_Color3s,
1020 VBOX_OGL_OP_Color3ub,
1021 VBOX_OGL_OP_Color3ui,
1022 VBOX_OGL_OP_Color3us,
1023 VBOX_OGL_OP_Color4b,
1024 VBOX_OGL_OP_Color4d,
1025 VBOX_OGL_OP_Color4f,
1026 VBOX_OGL_OP_Color4i,
1027 VBOX_OGL_OP_Color4s,
1028 VBOX_OGL_OP_Color4ub,
1029 VBOX_OGL_OP_Color4ui,
1030 VBOX_OGL_OP_Color4us,
1031 VBOX_OGL_OP_Clear,
1032 VBOX_OGL_OP_ClearAccum,
1033 VBOX_OGL_OP_ClearColor,
1034 VBOX_OGL_OP_ClearDepth,
1035 VBOX_OGL_OP_ClearIndex,
1036 VBOX_OGL_OP_ClearStencil,
1037 VBOX_OGL_OP_Accum,
1038 VBOX_OGL_OP_AlphaFunc,
1039 VBOX_OGL_OP_Vertex2d,
1040 VBOX_OGL_OP_Vertex2f,
1041 VBOX_OGL_OP_Vertex2i,
1042 VBOX_OGL_OP_Vertex2s,
1043 VBOX_OGL_OP_Vertex3d,
1044 VBOX_OGL_OP_Vertex3f,
1045 VBOX_OGL_OP_Vertex3i,
1046 VBOX_OGL_OP_Vertex3s,
1047 VBOX_OGL_OP_Vertex4d,
1048 VBOX_OGL_OP_Vertex4f,
1049 VBOX_OGL_OP_Vertex4i,
1050 VBOX_OGL_OP_Vertex4s,
1051 VBOX_OGL_OP_TexCoord1d,
1052 VBOX_OGL_OP_TexCoord1f,
1053 VBOX_OGL_OP_TexCoord1i,
1054 VBOX_OGL_OP_TexCoord1s,
1055 VBOX_OGL_OP_TexCoord2d,
1056 VBOX_OGL_OP_TexCoord2f,
1057 VBOX_OGL_OP_TexCoord2i,
1058 VBOX_OGL_OP_TexCoord2s,
1059 VBOX_OGL_OP_TexCoord3d,
1060 VBOX_OGL_OP_TexCoord3f,
1061 VBOX_OGL_OP_TexCoord3i,
1062 VBOX_OGL_OP_TexCoord3s,
1063 VBOX_OGL_OP_TexCoord4d,
1064 VBOX_OGL_OP_TexCoord4f,
1065 VBOX_OGL_OP_TexCoord4i,
1066 VBOX_OGL_OP_TexCoord4s,
1067 VBOX_OGL_OP_Normal3b,
1068 VBOX_OGL_OP_Normal3d,
1069 VBOX_OGL_OP_Normal3f,
1070 VBOX_OGL_OP_Normal3i,
1071 VBOX_OGL_OP_Normal3s,
1072 VBOX_OGL_OP_RasterPos2d,
1073 VBOX_OGL_OP_RasterPos2f,
1074 VBOX_OGL_OP_RasterPos2i,
1075 VBOX_OGL_OP_RasterPos2s,
1076 VBOX_OGL_OP_RasterPos3d,
1077 VBOX_OGL_OP_RasterPos3f,
1078 VBOX_OGL_OP_RasterPos3i,
1079 VBOX_OGL_OP_RasterPos3s,
1080 VBOX_OGL_OP_RasterPos4d,
1081 VBOX_OGL_OP_RasterPos4f,
1082 VBOX_OGL_OP_RasterPos4i,
1083 VBOX_OGL_OP_RasterPos4s,
1084 VBOX_OGL_OP_EvalCoord1d,
1085 VBOX_OGL_OP_EvalCoord1f,
1086 VBOX_OGL_OP_EvalCoord2d,
1087 VBOX_OGL_OP_EvalCoord2f,
1088 VBOX_OGL_OP_EvalPoint1,
1089 VBOX_OGL_OP_EvalPoint2,
1090 VBOX_OGL_OP_Indexd,
1091 VBOX_OGL_OP_Indexf,
1092 VBOX_OGL_OP_Indexi,
1093 VBOX_OGL_OP_Indexs,
1094 VBOX_OGL_OP_Indexub,
1095 VBOX_OGL_OP_Rotated,
1096 VBOX_OGL_OP_Rotatef,
1097 VBOX_OGL_OP_Scaled,
1098 VBOX_OGL_OP_Scalef,
1099 VBOX_OGL_OP_Translated,
1100 VBOX_OGL_OP_Translatef,
1101 VBOX_OGL_OP_DepthFunc,
1102 VBOX_OGL_OP_DepthMask,
1103 VBOX_OGL_OP_Finish,
1104 VBOX_OGL_OP_Flush,
1105 VBOX_OGL_OP_DeleteLists,
1106 VBOX_OGL_OP_CullFace,
1107 VBOX_OGL_OP_DeleteTextures,
1108 VBOX_OGL_OP_DepthRange,
1109 VBOX_OGL_OP_DisableClientState,
1110 VBOX_OGL_OP_EnableClientState,
1111 VBOX_OGL_OP_EvalMesh1,
1112 VBOX_OGL_OP_EvalMesh2,
1113 VBOX_OGL_OP_Fogf,
1114 VBOX_OGL_OP_Fogfv,
1115 VBOX_OGL_OP_Fogi,
1116 VBOX_OGL_OP_Fogiv,
1117 VBOX_OGL_OP_LightModelf,
1118 VBOX_OGL_OP_LightModelfv,
1119 VBOX_OGL_OP_LightModeli,
1120 VBOX_OGL_OP_LightModeliv,
1121 VBOX_OGL_OP_Lightf,
1122 VBOX_OGL_OP_Lightfv,
1123 VBOX_OGL_OP_Lighti,
1124 VBOX_OGL_OP_Lightiv,
1125 VBOX_OGL_OP_LineStipple,
1126 VBOX_OGL_OP_LineWidth,
1127 VBOX_OGL_OP_ListBase,
1128 VBOX_OGL_OP_DrawArrays,
1129 VBOX_OGL_OP_DrawBuffer,
1130 VBOX_OGL_OP_EdgeFlag,
1131 VBOX_OGL_OP_End,
1132 VBOX_OGL_OP_EndList,
1133 VBOX_OGL_OP_CopyTexImage1D,
1134 VBOX_OGL_OP_CopyTexImage2D,
1135 VBOX_OGL_OP_ColorMaterial,
1136 VBOX_OGL_OP_Materiali,
1137 VBOX_OGL_OP_Materialf,
1138 VBOX_OGL_OP_Materialfv,
1139 VBOX_OGL_OP_Materialiv,
1140 VBOX_OGL_OP_PopAttrib,
1141 VBOX_OGL_OP_PopClientAttrib,
1142 VBOX_OGL_OP_PopMatrix,
1143 VBOX_OGL_OP_PopName,
1144 VBOX_OGL_OP_PushAttrib,
1145 VBOX_OGL_OP_PushClientAttrib,
1146 VBOX_OGL_OP_PushMatrix,
1147 VBOX_OGL_OP_PushName,
1148 VBOX_OGL_OP_ReadBuffer,
1149 VBOX_OGL_OP_TexGendv,
1150 VBOX_OGL_OP_TexGenf,
1151 VBOX_OGL_OP_TexGend,
1152 VBOX_OGL_OP_TexGeni,
1153 VBOX_OGL_OP_TexEnvi,
1154 VBOX_OGL_OP_TexEnvf,
1155 VBOX_OGL_OP_TexEnviv,
1156 VBOX_OGL_OP_TexEnvfv,
1157 VBOX_OGL_OP_TexGeniv,
1158 VBOX_OGL_OP_TexGenfv,
1159 VBOX_OGL_OP_TexParameterf,
1160 VBOX_OGL_OP_TexParameteri,
1161 VBOX_OGL_OP_TexParameterfv,
1162 VBOX_OGL_OP_TexParameteriv,
1163 VBOX_OGL_OP_LoadIdentity,
1164 VBOX_OGL_OP_LoadName,
1165 VBOX_OGL_OP_LoadMatrixd,
1166 VBOX_OGL_OP_LoadMatrixf,
1167 VBOX_OGL_OP_StencilFunc,
1168 VBOX_OGL_OP_ShadeModel,
1169 VBOX_OGL_OP_StencilMask,
1170 VBOX_OGL_OP_StencilOp,
1171 VBOX_OGL_OP_Scissor,
1172 VBOX_OGL_OP_Viewport,
1173 VBOX_OGL_OP_Rectd,
1174 VBOX_OGL_OP_Rectf,
1175 VBOX_OGL_OP_Recti,
1176 VBOX_OGL_OP_Rects,
1177 VBOX_OGL_OP_Rectdv,
1178 VBOX_OGL_OP_Rectfv,
1179 VBOX_OGL_OP_Rectiv,
1180 VBOX_OGL_OP_Rectsv,
1181 VBOX_OGL_OP_MultMatrixd,
1182 VBOX_OGL_OP_MultMatrixf,
1183 VBOX_OGL_OP_NewList,
1184 VBOX_OGL_OP_Hint,
1185 VBOX_OGL_OP_IndexMask,
1186 VBOX_OGL_OP_InitNames,
1187 VBOX_OGL_OP_TexCoordPointer,
1188 VBOX_OGL_OP_VertexPointer,
1189 VBOX_OGL_OP_ColorPointer,
1190 VBOX_OGL_OP_EdgeFlagPointer,
1191 VBOX_OGL_OP_IndexPointer,
1192 VBOX_OGL_OP_NormalPointer,
1193 VBOX_OGL_OP_PolygonStipple,
1194 VBOX_OGL_OP_CallLists,
1195 VBOX_OGL_OP_ClipPlane,
1196 VBOX_OGL_OP_Frustum,
1197 VBOX_OGL_OP_GenTextures,
1198 VBOX_OGL_OP_Map1d,
1199 VBOX_OGL_OP_Map1f,
1200 VBOX_OGL_OP_Map2d,
1201 VBOX_OGL_OP_Map2f,
1202 VBOX_OGL_OP_MapGrid1d,
1203 VBOX_OGL_OP_MapGrid1f,
1204 VBOX_OGL_OP_MapGrid2d,
1205 VBOX_OGL_OP_MapGrid2f,
1206 VBOX_OGL_OP_CopyPixels,
1207 VBOX_OGL_OP_TexImage1D,
1208 VBOX_OGL_OP_TexImage2D,
1209 VBOX_OGL_OP_TexSubImage1D,
1210 VBOX_OGL_OP_TexSubImage2D,
1211 VBOX_OGL_OP_FeedbackBuffer,
1212 VBOX_OGL_OP_SelectBuffer,
1213 VBOX_OGL_OP_IsList,
1214 VBOX_OGL_OP_IsTexture,
1215 VBOX_OGL_OP_RenderMode,
1216 VBOX_OGL_OP_ReadPixels,
1217 VBOX_OGL_OP_IsEnabled,
1218 VBOX_OGL_OP_GenLists,
1219 VBOX_OGL_OP_PixelTransferf,
1220 VBOX_OGL_OP_PixelTransferi,
1221 VBOX_OGL_OP_PixelZoom,
1222 VBOX_OGL_OP_PixelStorei,
1223 VBOX_OGL_OP_PixelStoref,
1224 VBOX_OGL_OP_PixelMapfv,
1225 VBOX_OGL_OP_PixelMapuiv,
1226 VBOX_OGL_OP_PixelMapusv,
1227 VBOX_OGL_OP_PointSize,
1228 VBOX_OGL_OP_PolygonMode,
1229 VBOX_OGL_OP_PolygonOffset,
1230 VBOX_OGL_OP_PassThrough,
1231 VBOX_OGL_OP_Ortho,
1232 VBOX_OGL_OP_MatrixMode,
1233 VBOX_OGL_OP_LogicOp,
1234 VBOX_OGL_OP_ColorMask,
1235 VBOX_OGL_OP_CopyTexSubImage1D,
1236 VBOX_OGL_OP_CopyTexSubImage2D,
1237 VBOX_OGL_OP_FrontFace,
1238 VBOX_OGL_OP_Disable,
1239 VBOX_OGL_OP_Enable,
1240 VBOX_OGL_OP_PrioritizeTextures,
1241 VBOX_OGL_OP_GetBooleanv,
1242 VBOX_OGL_OP_GetDoublev,
1243 VBOX_OGL_OP_GetFloatv,
1244 VBOX_OGL_OP_GetIntegerv,
1245 VBOX_OGL_OP_GetLightfv,
1246 VBOX_OGL_OP_GetLightiv,
1247 VBOX_OGL_OP_GetMaterialfv,
1248 VBOX_OGL_OP_GetMaterialiv,
1249 VBOX_OGL_OP_GetPixelMapfv,
1250 VBOX_OGL_OP_GetPixelMapuiv,
1251 VBOX_OGL_OP_GetPixelMapusv,
1252 VBOX_OGL_OP_GetTexEnviv,
1253 VBOX_OGL_OP_GetTexEnvfv,
1254 VBOX_OGL_OP_GetTexGendv,
1255 VBOX_OGL_OP_GetTexGenfv,
1256 VBOX_OGL_OP_GetTexGeniv,
1257 VBOX_OGL_OP_GetTexParameterfv,
1258 VBOX_OGL_OP_GetTexParameteriv,
1259 VBOX_OGL_OP_GetClipPlane,
1260 VBOX_OGL_OP_GetPolygonStipple,
1261 VBOX_OGL_OP_GetTexLevelParameterfv,
1262 VBOX_OGL_OP_GetTexLevelParameteriv,
1263 VBOX_OGL_OP_GetTexImage,
1264
1265 /* Windows ICD exports */
1266 VBOX_OGL_OP_DrvReleaseContext,
1267 VBOX_OGL_OP_DrvCreateContext,
1268 VBOX_OGL_OP_DrvDeleteContext,
1269 VBOX_OGL_OP_DrvCopyContext,
1270 VBOX_OGL_OP_DrvSetContext,
1271 VBOX_OGL_OP_DrvCreateLayerContext,
1272 VBOX_OGL_OP_DrvShareLists,
1273 VBOX_OGL_OP_DrvDescribeLayerPlane,
1274 VBOX_OGL_OP_DrvSetLayerPaletteEntries,
1275 VBOX_OGL_OP_DrvGetLayerPaletteEntries,
1276 VBOX_OGL_OP_DrvRealizeLayerPalette,
1277 VBOX_OGL_OP_DrvSwapLayerBuffers,
1278 VBOX_OGL_OP_DrvDescribePixelFormat,
1279 VBOX_OGL_OP_DrvSetPixelFormat,
1280 VBOX_OGL_OP_DrvSwapBuffers,
1281
1282 /* OpenGL Extensions */
1283 VBOX_OGL_OP_wglSwapIntervalEXT,
1284 VBOX_OGL_OP_wglGetSwapIntervalEXT,
1285
1286 VBOX_OGL_OP_Last,
1287
1288 VBOX_OGL_OP_SizeHack = 0x7fffffff
1289} VBOX_OGL_OP;
1290
1291#if defined(DEBUG) && defined(VBOX_OGL_WITH_CMD_STRINGS)
1292static const char *pszVBoxOGLCmd[VBOX_OGL_OP_Last] =
1293{
1294 "ILLEGAL",
1295 "glArrayElement",
1296 "glBegin",
1297 "glBindTexture",
1298 "glBlendFunc",
1299 "glCallList",
1300 "glColor3b",
1301 "glColor3d",
1302 "glColor3f",
1303 "glColor3i",
1304 "glColor3s",
1305 "glColor3ub",
1306 "glColor3ui",
1307 "glColor3us",
1308 "glColor4b",
1309 "glColor4d",
1310 "glColor4f",
1311 "glColor4i",
1312 "glColor4s",
1313 "glColor4ub",
1314 "glColor4ui",
1315 "glColor4us",
1316 "glClear",
1317 "glClearAccum",
1318 "glClearColor",
1319 "glClearDepth",
1320 "glClearIndex",
1321 "glClearStencil",
1322 "glAccum",
1323 "glAlphaFunc",
1324 "glVertex2d",
1325 "glVertex2f",
1326 "glVertex2i",
1327 "glVertex2s",
1328 "glVertex3d",
1329 "glVertex3f",
1330 "glVertex3i",
1331 "glVertex3s",
1332 "glVertex4d",
1333 "glVertex4f",
1334 "glVertex4i",
1335 "glVertex4s",
1336 "glTexCoord1d",
1337 "glTexCoord1f",
1338 "glTexCoord1i",
1339 "glTexCoord1s",
1340 "glTexCoord2d",
1341 "glTexCoord2f",
1342 "glTexCoord2i",
1343 "glTexCoord2s",
1344 "glTexCoord3d",
1345 "glTexCoord3f",
1346 "glTexCoord3i",
1347 "glTexCoord3s",
1348 "glTexCoord4d",
1349 "glTexCoord4f",
1350 "glTexCoord4i",
1351 "glTexCoord4s",
1352 "glNormal3b",
1353 "glNormal3d",
1354 "glNormal3f",
1355 "glNormal3i",
1356 "glNormal3s",
1357 "glRasterPos2d",
1358 "glRasterPos2f",
1359 "glRasterPos2i",
1360 "glRasterPos2s",
1361 "glRasterPos3d",
1362 "glRasterPos3f",
1363 "glRasterPos3i",
1364 "glRasterPos3s",
1365 "glRasterPos4d",
1366 "glRasterPos4f",
1367 "glRasterPos4i",
1368 "glRasterPos4s",
1369 "glEvalCoord1d",
1370 "glEvalCoord1f",
1371 "glEvalCoord2d",
1372 "glEvalCoord2f",
1373 "glEvalPoint1",
1374 "glEvalPoint2",
1375 "glIndexd",
1376 "glIndexf",
1377 "glIndexi",
1378 "glIndexs",
1379 "glIndexub",
1380 "glRotated",
1381 "glRotatef",
1382 "glScaled",
1383 "glScalef",
1384 "glTranslated",
1385 "glTranslatef",
1386 "glDepthFunc",
1387 "glDepthMask",
1388 "glFinish",
1389 "glFlush",
1390 "glDeleteLists",
1391 "glCullFace",
1392 "glDeleteTextures",
1393 "glDepthRange",
1394 "glDisableClientState",
1395 "glEnableClientState",
1396 "glEvalMesh1",
1397 "glEvalMesh2",
1398 "glFogf",
1399 "glFogfv",
1400 "glFogi",
1401 "glFogiv",
1402 "glLightModelf",
1403 "glLightModelfv",
1404 "glLightModeli",
1405 "glLightModeliv",
1406 "glLightf",
1407 "glLightfv",
1408 "glLighti",
1409 "glLightiv",
1410 "glLineStipple",
1411 "glLineWidth",
1412 "glListBase",
1413 "glDrawArrays",
1414 "glDrawBuffer",
1415 "glEdgeFlag",
1416 "glEnd",
1417 "glEndList",
1418 "glCopyTexImage1D",
1419 "glCopyTexImage2D",
1420 "glColorMaterial",
1421 "glMateriali",
1422 "glMaterialf",
1423 "glMaterialfv",
1424 "glMaterialiv",
1425 "glPopAttrib",
1426 "glPopClientAttrib",
1427 "glPopMatrix",
1428 "glPopName",
1429 "glPushAttrib",
1430 "glPushClientAttrib",
1431 "glPushMatrix",
1432 "glPushName",
1433 "glReadBuffer",
1434 "glTexGendv",
1435 "glTexGenf",
1436 "glTexGend",
1437 "glTexGeni",
1438 "glTexEnvi",
1439 "glTexEnvf",
1440 "glTexEnviv",
1441 "glTexEnvfv",
1442 "glTexGeniv",
1443 "glTexGenfv",
1444 "glTexParameterf",
1445 "glTexParameteri",
1446 "glTexParameterfv",
1447 "glTexParameteriv",
1448 "glLoadIdentity",
1449 "glLoadName",
1450 "glLoadMatrixd",
1451 "glLoadMatrixf",
1452 "glStencilFunc",
1453 "glShadeModel",
1454 "glStencilMask",
1455 "glStencilOp",
1456 "glScissor",
1457 "glViewport",
1458 "glRectd",
1459 "glRectf",
1460 "glRecti",
1461 "glRects",
1462 "glRectdv",
1463 "glRectfv",
1464 "glRectiv",
1465 "glRectsv",
1466 "glMultMatrixd",
1467 "glMultMatrixf",
1468 "glNewList",
1469 "glHint",
1470 "glIndexMask",
1471 "glInitNames",
1472 "glTexCoordPointer",
1473 "glVertexPointer",
1474 "glColorPointer",
1475 "glEdgeFlagPointer",
1476 "glIndexPointer",
1477 "glNormalPointer",
1478 "glPolygonStipple",
1479 "glCallLists",
1480 "glClipPlane",
1481 "glFrustum",
1482 "glGenTextures",
1483 "glMap1d",
1484 "glMap1f",
1485 "glMap2d",
1486 "glMap2f",
1487 "glMapGrid1d",
1488 "glMapGrid1f",
1489 "glMapGrid2d",
1490 "glMapGrid2f",
1491 "glCopyPixels",
1492 "glTexImage1D",
1493 "glTexImage2D",
1494 "glTexSubImage1D",
1495 "glTexSubImage2D",
1496 "glFeedbackBuffer",
1497 "glSelectBuffer",
1498 "glIsList",
1499 "glIsTexture",
1500 "glRenderMode",
1501 "glReadPixels",
1502 "glIsEnabled",
1503 "glGenLists",
1504 "glPixelTransferf",
1505 "glPixelTransferi",
1506 "glPixelZoom",
1507 "glPixelStorei",
1508 "glPixelStoref",
1509 "glPixelMapfv",
1510 "glPixelMapuiv",
1511 "glPixelMapusv",
1512 "glPointSize",
1513 "glPolygonMode",
1514 "glPolygonOffset",
1515 "glPassThrough",
1516 "glOrtho",
1517 "glMatrixMode",
1518 "glLogicOp",
1519 "glColorMask",
1520 "glCopyTexSubImage1D",
1521 "glCopyTexSubImage2D",
1522 "glFrontFace",
1523 "glDisable",
1524 "glEnable",
1525 "glPrioritizeTextures",
1526 "glGetBooleanv",
1527 "glGetDoublev",
1528 "glGetFloatv",
1529 "glGetIntegerv",
1530 "glGetLightfv",
1531 "glGetLightiv",
1532 "glGetMaterialfv",
1533 "glGetMaterialiv",
1534 "glGetPixelMapfv",
1535 "glGetPixelMapuiv",
1536 "glGetPixelMapusv",
1537 "glGetTexEnviv",
1538 "glGetTexEnvfv",
1539 "glGetTexGendv",
1540 "glGetTexGenfv",
1541 "glGetTexGeniv",
1542 "glGetTexParameterfv",
1543 "glGetTexParameteriv",
1544 "glGetClipPlane",
1545 "glGetPolygonStipple",
1546 "glGetTexLevelParameterfv",
1547 "glGetTexLevelParameteriv",
1548 "glGetTexImage",
1549
1550 /* Windows ICD exports */
1551 "DrvReleaseContext",
1552 "DrvCreateContext",
1553 "DrvDeleteContext",
1554 "DrvCopyContext",
1555 "DrvSetContext",
1556 "DrvCreateLayerContext",
1557 "DrvShareLists",
1558 "DrvDescribeLayerPlane",
1559 "DrvSetLayerPaletteEntries",
1560 "DrvGetLayerPaletteEntries",
1561 "DrvRealizeLayerPalette",
1562 "DrvSwapLayerBuffers",
1563 "DrvDescribePixelFormat",
1564 "DrvSetPixelFormat",
1565 "DrvSwapBuffers",
1566
1567 /* OpenGL Extensions */
1568 "wglSwapIntervalEXT",
1569 "wglGetSwapIntervalEXT",
1570};
1571#endif
1572
1573#ifdef VBOX_OGL_WITH_FUNCTION_WRAPPERS
1574/* OpenGL function wrappers. */
1575static PFN_VBOXGLWRAPPER pfnOGLWrapper[VBOX_OGL_OP_Last] =
1576{
1577 NULL,
1578 vboxglArrayElement,
1579 vboxglBegin,
1580 vboxglBindTexture,
1581 vboxglBlendFunc,
1582 vboxglCallList,
1583 vboxglColor3b,
1584 vboxglColor3d,
1585 vboxglColor3f,
1586 vboxglColor3i,
1587 vboxglColor3s,
1588 vboxglColor3ub,
1589 vboxglColor3ui,
1590 vboxglColor3us,
1591 vboxglColor4b,
1592 vboxglColor4d,
1593 vboxglColor4f,
1594 vboxglColor4i,
1595 vboxglColor4s,
1596 vboxglColor4ub,
1597 vboxglColor4ui,
1598 vboxglColor4us,
1599 vboxglClear,
1600 vboxglClearAccum,
1601 vboxglClearColor,
1602 vboxglClearDepth,
1603 vboxglClearIndex,
1604 vboxglClearStencil,
1605 vboxglAccum,
1606 vboxglAlphaFunc,
1607 vboxglVertex2d,
1608 vboxglVertex2f,
1609 vboxglVertex2i,
1610 vboxglVertex2s,
1611 vboxglVertex3d,
1612 vboxglVertex3f,
1613 vboxglVertex3i,
1614 vboxglVertex3s,
1615 vboxglVertex4d,
1616 vboxglVertex4f,
1617 vboxglVertex4i,
1618 vboxglVertex4s,
1619 vboxglTexCoord1d,
1620 vboxglTexCoord1f,
1621 vboxglTexCoord1i,
1622 vboxglTexCoord1s,
1623 vboxglTexCoord2d,
1624 vboxglTexCoord2f,
1625 vboxglTexCoord2i,
1626 vboxglTexCoord2s,
1627 vboxglTexCoord3d,
1628 vboxglTexCoord3f,
1629 vboxglTexCoord3i,
1630 vboxglTexCoord3s,
1631 vboxglTexCoord4d,
1632 vboxglTexCoord4f,
1633 vboxglTexCoord4i,
1634 vboxglTexCoord4s,
1635 vboxglNormal3b,
1636 vboxglNormal3d,
1637 vboxglNormal3f,
1638 vboxglNormal3i,
1639 vboxglNormal3s,
1640 vboxglRasterPos2d,
1641 vboxglRasterPos2f,
1642 vboxglRasterPos2i,
1643 vboxglRasterPos2s,
1644 vboxglRasterPos3d,
1645 vboxglRasterPos3f,
1646 vboxglRasterPos3i,
1647 vboxglRasterPos3s,
1648 vboxglRasterPos4d,
1649 vboxglRasterPos4f,
1650 vboxglRasterPos4i,
1651 vboxglRasterPos4s,
1652 vboxglEvalCoord1d,
1653 vboxglEvalCoord1f,
1654 vboxglEvalCoord2d,
1655 vboxglEvalCoord2f,
1656 vboxglEvalPoint1,
1657 vboxglEvalPoint2,
1658 vboxglIndexd,
1659 vboxglIndexf,
1660 vboxglIndexi,
1661 vboxglIndexs,
1662 vboxglIndexub,
1663 vboxglRotated,
1664 vboxglRotatef,
1665 vboxglScaled,
1666 vboxglScalef,
1667 vboxglTranslated,
1668 vboxglTranslatef,
1669 vboxglDepthFunc,
1670 vboxglDepthMask,
1671 vboxglFinish,
1672 vboxglFlush,
1673 vboxglDeleteLists,
1674 vboxglCullFace,
1675 vboxglDeleteTextures,
1676 vboxglDepthRange,
1677 vboxglDisableClientState,
1678 vboxglEnableClientState,
1679 vboxglEvalMesh1,
1680 vboxglEvalMesh2,
1681 vboxglFogf,
1682 vboxglFogfv,
1683 vboxglFogi,
1684 vboxglFogiv,
1685 vboxglLightModelf,
1686 vboxglLightModelfv,
1687 vboxglLightModeli,
1688 vboxglLightModeliv,
1689 vboxglLightf,
1690 vboxglLightfv,
1691 vboxglLighti,
1692 vboxglLightiv,
1693 vboxglLineStipple,
1694 vboxglLineWidth,
1695 vboxglListBase,
1696 vboxglDrawArrays,
1697 vboxglDrawBuffer,
1698 vboxglEdgeFlag,
1699 vboxglEnd,
1700 vboxglEndList,
1701 vboxglCopyTexImage1D,
1702 vboxglCopyTexImage2D,
1703 vboxglColorMaterial,
1704 vboxglMateriali,
1705 vboxglMaterialf,
1706 vboxglMaterialfv,
1707 vboxglMaterialiv,
1708 vboxglPopAttrib,
1709 vboxglPopClientAttrib,
1710 vboxglPopMatrix,
1711 vboxglPopName,
1712 vboxglPushAttrib,
1713 vboxglPushClientAttrib,
1714 vboxglPushMatrix,
1715 vboxglPushName,
1716 vboxglReadBuffer,
1717 vboxglTexGendv,
1718 vboxglTexGenf,
1719 vboxglTexGend,
1720 vboxglTexGeni,
1721 vboxglTexEnvi,
1722 vboxglTexEnvf,
1723 vboxglTexEnviv,
1724 vboxglTexEnvfv,
1725 vboxglTexGeniv,
1726 vboxglTexGenfv,
1727 vboxglTexParameterf,
1728 vboxglTexParameteri,
1729 vboxglTexParameterfv,
1730 vboxglTexParameteriv,
1731 vboxglLoadIdentity,
1732 vboxglLoadName,
1733 vboxglLoadMatrixd,
1734 vboxglLoadMatrixf,
1735 vboxglStencilFunc,
1736 vboxglShadeModel,
1737 vboxglStencilMask,
1738 vboxglStencilOp,
1739 vboxglScissor,
1740 vboxglViewport,
1741 vboxglRectd,
1742 vboxglRectf,
1743 vboxglRecti,
1744 vboxglRects,
1745 vboxglRectdv,
1746 vboxglRectfv,
1747 vboxglRectiv,
1748 vboxglRectsv,
1749 vboxglMultMatrixd,
1750 vboxglMultMatrixf,
1751 vboxglNewList,
1752 vboxglHint,
1753 vboxglIndexMask,
1754 vboxglInitNames,
1755 vboxglTexCoordPointer,
1756 vboxglVertexPointer,
1757 vboxglColorPointer,
1758 vboxglEdgeFlagPointer,
1759 vboxglIndexPointer,
1760 vboxglNormalPointer,
1761 vboxglPolygonStipple,
1762 vboxglCallLists,
1763 vboxglClipPlane,
1764 vboxglFrustum,
1765 vboxglGenTextures,
1766 vboxglMap1d,
1767 vboxglMap1f,
1768 vboxglMap2d,
1769 vboxglMap2f,
1770 vboxglMapGrid1d,
1771 vboxglMapGrid1f,
1772 vboxglMapGrid2d,
1773 vboxglMapGrid2f,
1774 vboxglCopyPixels,
1775 vboxglTexImage1D,
1776 vboxglTexImage2D,
1777 vboxglTexSubImage1D,
1778 vboxglTexSubImage2D,
1779 vboxglFeedbackBuffer,
1780 vboxglSelectBuffer,
1781 vboxglIsList,
1782 vboxglIsTexture,
1783 vboxglRenderMode,
1784 vboxglReadPixels,
1785 vboxglIsEnabled,
1786 vboxglGenLists,
1787 vboxglPixelTransferf,
1788 vboxglPixelTransferi,
1789 vboxglPixelZoom,
1790 vboxglPixelStorei,
1791 vboxglPixelStoref,
1792 vboxglPixelMapfv,
1793 vboxglPixelMapuiv,
1794 vboxglPixelMapusv,
1795 vboxglPointSize,
1796 vboxglPolygonMode,
1797 vboxglPolygonOffset,
1798 vboxglPassThrough,
1799 vboxglOrtho,
1800 vboxglMatrixMode,
1801 vboxglLogicOp,
1802 vboxglColorMask,
1803 vboxglCopyTexSubImage1D,
1804 vboxglCopyTexSubImage2D,
1805 vboxglFrontFace,
1806 vboxglDisable,
1807 vboxglEnable,
1808 vboxglPrioritizeTextures,
1809 vboxglGetBooleanv,
1810 vboxglGetDoublev,
1811 vboxglGetFloatv,
1812 vboxglGetIntegerv,
1813 vboxglGetLightfv,
1814 vboxglGetLightiv,
1815 vboxglGetMaterialfv,
1816 vboxglGetMaterialiv,
1817 vboxglGetPixelMapfv,
1818 vboxglGetPixelMapuiv,
1819 vboxglGetPixelMapusv,
1820 vboxglGetTexEnviv,
1821 vboxglGetTexEnvfv,
1822 vboxglGetTexGendv,
1823 vboxglGetTexGenfv,
1824 vboxglGetTexGeniv,
1825 vboxglGetTexParameterfv,
1826 vboxglGetTexParameteriv,
1827 vboxglGetClipPlane,
1828 vboxglGetPolygonStipple,
1829 vboxglGetTexLevelParameterfv,
1830 vboxglGetTexLevelParameteriv,
1831 vboxglGetTexImage,
1832
1833 /* Windows ICD exports */
1834 vboxglDrvReleaseContext,
1835 vboxglDrvCreateContext,
1836 vboxglDrvDeleteContext,
1837 vboxglDrvCopyContext,
1838 vboxglDrvSetContext,
1839 vboxglDrvCreateLayerContext,
1840 vboxglDrvShareLists,
1841 vboxglDrvDescribeLayerPlane,
1842 vboxglDrvSetLayerPaletteEntries,
1843 vboxglDrvGetLayerPaletteEntries,
1844 vboxglDrvRealizeLayerPalette,
1845 vboxglDrvSwapLayerBuffers,
1846 vboxglDrvDescribePixelFormat,
1847 vboxglDrvSetPixelFormat,
1848 vboxglDrvSwapBuffers,
1849
1850 /* OpenGL Extensions */
1851 vboxwglSwapIntervalEXT,
1852 vboxwglGetSwapIntervalEXT,
1853
1854};
1855#endif
1856
1857
1858#ifdef VBOX_OGL_WITH_EXTENSION_ARRAY
1859typedef struct
1860{
1861 const char *pszExtName;
1862 const char *pszExtFunctionName;
1863#ifdef VBOX_OGL_GUEST_SIDE
1864 RTUINTPTR pfnFunction;
1865#else
1866 RTUINTPTR *ppfnFunction;
1867#endif
1868 bool fAvailable;
1869} OPENGL_EXT, *POPENGL_EXT;
1870
1871#ifdef VBOX_OGL_GUEST_SIDE
1872#define VBOX_OGL_EXTENSION(a) (RTUINTPTR)a
1873#else
1874#define VBOX_OGL_EXTENSION(a) (RTUINTPTR *)&pfn##a
1875
1876static PFNWGLSWAPINTERVALEXTPROC pfnwglSwapIntervalEXT = NULL;
1877static PFNWGLGETSWAPINTERVALEXTPROC pfnwglGetSwapIntervalEXT = NULL;
1878
1879#endif
1880
1881static OPENGL_EXT OpenGLExtensions[] =
1882{
1883 { "WGL_EXT_swap_control", "wglSwapIntervalEXT", VBOX_OGL_EXTENSION(wglSwapIntervalEXT), false },
1884 { "WGL_EXT_swap_control", "wglGetSwapIntervalEXT", VBOX_OGL_EXTENSION(wglGetSwapIntervalEXT), false },
1885};
1886#endif /* VBOX_OGL_WITH_EXTENSION_ARRAY */
1887
1888#endif /* __VBOXOGLOP_H__ */
1889
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