VirtualBox

root/trunk/include/VBox/HostServices/VBoxOGLOp.h

Revision 8155, 89.2 kB (checked in by vboxsync, 9 months ago)

The Big Sun Rebranding Header Change

  • Property svn:eol-style set to native
Line 
1 /** @file
2  * VirtualBox OpenGL command pack/unpack header
3  */
4
5 /*
6  *
7  * Copyright (C) 2006-2007 Sun Microsystems, Inc.
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  * The contents of this file may alternatively be used under the terms
18  * of the Common Development and Distribution License Version 1.0
19  * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20  * VirtualBox OSE distribution, in which case the provisions of the
21  * CDDL are applicable instead of those of the GPL.
22  *
23  * You may elect to license modified versions of this file under the
24  * terms and conditions of either the GPL or the CDDL or both.
25  *
26  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
27  * Clara, CA 95054 USA or visit http://www.sun.com if you need
28  * additional information or have any questions.
29  */
30
31 #ifndef ___VBox_HostService_VBoxOGLOp_h
32 #define ___VBox_HostService_VBoxOGLOp_h
33
34 #ifdef VBOX_OGL_GUEST_SIDE
35 /************************************************************************************************************
36  * Guest side macro's for packing OpenGL function calls into the command buffer.                            *
37  *                                                                                                          *
38  ************************************************************************************************************/
39
40 #define VBOX_OGL_NAME_PREFIX(Function)                    gl##Function
41
42 #define OGL_CMD(op, numpar, size)                                                           \
43     VBoxCmdStart(VBOX_OGL_OP_##op, numpar, size);
44
45 #define OGL_PARAM(val, size)                                                                \
46     VBoxCmdSaveParameter((uint8_t *)&val, size);
47
48 #define OGL_MEMPARAM(ptr, size)                                                             \
49     VBoxCmdSaveMemParameter((uint8_t *)ptr, size);
50
51 #define OGL_CMD_END(op)                                                                     \
52     VBoxCmdStop(VBOX_OGL_OP_##op);
53
54
55 #define VBOX_OGL_GEN_OP(op)                                                                 \
56     OGL_CMD(op, 0, 0);                                                                      \
57     OGL_CMD_END(op);
58    
59 #define VBOX_OGL_GEN_OP1(op, p1)                                                            \
60     OGL_CMD(op, 1, sizeof(p1));                                                             \
61     OGL_PARAM(p1, sizeof(p1));                                                              \
62     OGL_CMD_END(op);
63
64 #define VBOX_OGL_GEN_OP2(op, p1, p2)                                                        \
65     OGL_CMD(op, 2, sizeof(p1)+sizeof(p2));                                                  \
66     OGL_PARAM(p1, sizeof(p1));                                                              \
67     OGL_PARAM(p2, sizeof(p2));                                                              \
68     OGL_CMD_END(op);
69
70 #define VBOX_OGL_GEN_OP3(op, p1, p2, p3)                                                    \
71     OGL_CMD(op, 3, sizeof(p1)+sizeof(p2)+sizeof(p3));                                       \
72     OGL_PARAM(p1, sizeof(p1));                                                              \
73     OGL_PARAM(p2, sizeof(p2));                                                              \
74     OGL_PARAM(p3, sizeof(p3));                                                              \
75     OGL_CMD_END(op);
76
77 #define VBOX_OGL_GEN_OP4(op, p1, p2, p3, p4)                                                \
78     OGL_CMD(op, 4, sizeof(p1)+sizeof(p2)+sizeof(p3)+sizeof(p4));                            \
79     OGL_PARAM(p1, sizeof(p1));                                                              \
80     OGL_PARAM(p2, sizeof(p2));                                                              \
81     OGL_PARAM(p3, sizeof(p3));                                                              \
82     OGL_PARAM(p4, sizeof(p4));                                                              \
83     OGL_CMD_END(op);
84
85 #define VBOX_OGL_GEN_OP5(op, p1, p2, p3, p4, p5)                                            \
86     OGL_CMD(op, 5, sizeof(p1)+sizeof(p2)+sizeof(p3)+sizeof(p4)+sizeof(p5));                 \
87     OGL_PARAM(p1, sizeof(p1));                                                              \
88     OGL_PARAM(p2, sizeof(p2));                                                              \
89     OGL_PARAM(p3, sizeof(p3));                                                              \
90     OGL_PARAM(p4, sizeof(p4));                                                              \
91     OGL_PARAM(p5, sizeof(p5));                                                              \
92     OGL_CMD_END(op);
93
94 #define VBOX_OGL_GEN_OP6(op, p1, p2, p3, p4, p5, p6)                                        \
95     OGL_CMD(op, 6, sizeof(p1)+sizeof(p2)+sizeof(p3)+sizeof(p4)+sizeof(p5)+sizeof(p6));      \
96     OGL_PARAM(p1, sizeof(p1));                                                              \
97     OGL_PARAM(p2, sizeof(p2));                                                              \
98     OGL_PARAM(p3, sizeof(p3));                                                              \
99     OGL_PARAM(p4, sizeof(p4));                                                              \
100     OGL_PARAM(p5, sizeof(p5));                                                              \
101     OGL_PARAM(p6, sizeof(p6));                                                              \
102     OGL_CMD_END(op);
103
104 #define VBOX_OGL_GEN_OP7(op, p1, p2, p3, p4, p5, p6, p7)                                    \
105     OGL_CMD(op, 7, sizeof(p1)+sizeof(p2)+sizeof(p3)+sizeof(p4)+sizeof(p5)+sizeof(p6)+sizeof(p7));    \
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_CMD_END(op);
114
115 #define VBOX_OGL_GEN_OP8(op, p1, p2, p3, p4, p5, p6, p7, p8)                                \
116     OGL_CMD(op, 8, sizeof(p1)+sizeof(p2)+sizeof(p3)+sizeof(p4)+sizeof(p5)+sizeof(p6)+sizeof(p7)+sizeof(p8));    \
117     OGL_PARAM(p1, sizeof(p1));                                                              \
118     OGL_PARAM(p2, sizeof(p2));                                                              \
119     OGL_PARAM(p3, sizeof(p3));                                                              \
120     OGL_PARAM(p4, sizeof(p4));                                                              \
121     OGL_PARAM(p5, sizeof(p5));                                                              \
122     OGL_PARAM(p6, sizeof(p6));                                                              \
123     OGL_PARAM(p7, sizeof(p7));                                                              \
124     OGL_PARAM(p8, sizeof(p8));                                                              \
125     OGL_CMD_END(op);
126
127
128 /* last parameter is a memory block */
129 #define VBOX_OGL_GEN_OP1PTR(op, size, p1ptr)                                                        \
130     OGL_CMD(op, 1, size);                                                                         \
131     OGL_MEMPARAM(p1ptr, size);                                                                     \
132     OGL_CMD_END(op);
133
134 #define VBOX_OGL_GEN_OP2PTR(op, p1, size, p2ptr)                                                    \
135     OGL_CMD(op, 2, sizeof(p1)+size);                                                              \
136     OGL_PARAM(p1, sizeof(p1));                                                                     \
137     OGL_MEMPARAM(p2ptr, size);                                                                     \
138     OGL_CMD_END(op);
139
140 #define VBOX_OGL_GEN_OP3PTR(op, p1, p2, size, p3ptr)                                                \
141     OGL_CMD(op, 3, sizeof(p1)+sizeof(p2)+size);                                                   \
142     OGL_PARAM(p1, sizeof(p1));                                                                     \
143     OGL_PARAM(p2, sizeof(p2));                                                                     \
144     OGL_MEMPARAM(p3ptr, size);                                                                     \
145     OGL_CMD_END(op);
146
147 #define VBOX_OGL_GEN_OP4PTR(op, p1, p2, p3, size, p4ptr)                                            \
148     OGL_CMD(op, 4, sizeof(p1)+sizeof(p2)+sizeof(p3)+size);                                        \
149     OGL_PARAM(p1, sizeof(p1));                                                                     \
150     OGL_PARAM(p2, sizeof(p2));                                                                     \
151     OGL_PARAM(p3, sizeof(p3));                                                                     \
152     OGL_MEMPARAM(p4ptr, size);                                                                     \
153     OGL_CMD_END(op);
154
155 #define VBOX_OGL_GEN_OP5PTR(op, p1, p2, p3, p4, size, p5ptr)                                        \
156     OGL_CMD(op, 5, sizeof(p1)+sizeof(p2)+sizeof(p3)+sizeof(p4)+size);                             \
157     OGL_PARAM(p1, sizeof(p1));                                                                     \
158     OGL_PARAM(p2, sizeof(p2));                                                                     \
159     OGL_PARAM(p3, sizeof(p3));                                                                     \
160     OGL_PARAM(p4, sizeof(p4));                                                                     \
161     OGL_MEMPARAM(p5ptr, size);                                                                     \
162     OGL_CMD_END(op);
163
164 #define VBOX_OGL_GEN_OP6PTR(op, p1, p2, p3, p4, p5, size, p6ptr)                                    \
165     OGL_CMD(op, 6, sizeof(p1)+sizeof(p2)+sizeof(p3)+sizeof(p4)+sizeof(p5)+size);                  \
166     OGL_PARAM(p1, sizeof(p1));                                                                     \
167     OGL_PARAM(p2, sizeof(p2));                                                                     \
168     OGL_PARAM(p3, sizeof(p3));                                                                     \
169     OGL_PARAM(p4, sizeof(p4));                                                                     \
170     OGL_PARAM(p5, sizeof(p5));                                                                     \
171     OGL_MEMPARAM(p6ptr, size);                                                                     \
172     OGL_CMD_END(op);
173
174 #define VBOX_OGL_GEN_OP7PTR(op, p1, p2, p3, p4, p5, p6, size, p7ptr)                                \
175     OGL_CMD(op, 7, sizeof(p1)+sizeof(p2)+sizeof(p3)+sizeof(p4)+sizeof(p5)+sizeof(p6)+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_MEMPARAM(p7ptr, size);                                                                     \
183     OGL_CMD_END(op);
184
185 #define VBOX_OGL_GEN_OP8PTR(op, p1, p2, p3, p4, p5, p6, p7, size, p8ptr)                            \
186     OGL_CMD(op, 8, sizeof(p1)+sizeof(p2)+sizeof(p3)+sizeof(p4)+sizeof(p5)+sizeof(p6)+sizeof(p7)+size);       \
187     OGL_PARAM(p1, sizeof(p1));                                                                     \
188     OGL_PARAM(p2, sizeof(p2));                                                                     \
189     OGL_PARAM(p3, sizeof(p3));                                                                     \
190     OGL_PARAM(p4, sizeof(p4));                                                                     \
191     OGL_PARAM(p5, sizeof(p5));                                                                     \
192     OGL_PARAM(p6, sizeof(p6));                                                                     \
193     OGL_PARAM(p7, sizeof(p7));                                                                     \
194     OGL_MEMPARAM(p8ptr, size);                                                                     \
195     OGL_CMD_END(op);
196
197 #define VBOX_OGL_GEN_OP9PTR(op, p1, p2, p3, p4, p5, p6, p7, p8, size, p9ptr)                        \
198     OGL_CMD(op, 9, sizeof(p1)+sizeof(p2)+sizeof(p3)+sizeof(p4)+sizeof(p5)+sizeof(p6)+sizeof(p7)+sizeof(p8)+size);       \
199     OGL_PARAM(p1, sizeof(p1));                                                                     \
200     OGL_PARAM(p2, sizeof(p2));                                                                     \
201     OGL_PARAM(p3, sizeof(p3));                                                                     \
202     OGL_PARAM(p4, sizeof(p4));                                                                     \
203     OGL_PARAM(p5, sizeof(p5));                                                                     \
204     OGL_PARAM(p6, sizeof(p6));                                                                     \
205     OGL_PARAM(p7, sizeof(p7));                                                                     \
206     OGL_PARAM(p8, sizeof(p8));                                                                     \
207     OGL_MEMPARAM(p9ptr, size);                                                                     \
208     OGL_CMD_END(op);
209
210 #define VBOX_OGL_GEN_OP10PTR(op, p1, p2, p3, p4, p5, p6, p7, p8, p9, size, p10ptr)                  \
211     OGL_CMD(op, 10, sizeof(p1)+sizeof(p2)+sizeof(p3)+sizeof(p4)+sizeof(p5)+sizeof(p6)+sizeof(p7)+sizeof(p8)+sizeof(p9)+size);       \
212     OGL_PARAM(p1, sizeof(p1));                                                                     \
213     OGL_PARAM(p2, sizeof(p2));                                                                     \
214     OGL_PARAM(p3, sizeof(p3));                                                                     \
215     OGL_PARAM(p4, sizeof(p4));                                                                     \
216     OGL_PARAM(p5, sizeof(p5));                                                                     \
217     OGL_PARAM(p6, sizeof(p6));                                                                     \
218     OGL_PARAM(p7, sizeof(p7));                                                                     \
219     OGL_PARAM(p8, sizeof(p8));                                                                     \
220     OGL_PARAM(p9, sizeof(p9));                                                                     \
221     OGL_MEMPARAM(p10ptr, size);                                                                    \
222     OGL_CMD_END(op);
223
224
225 /* two memory blocks */
226 #define VBOX_OGL_GEN_OP2PTRPTR(op, size1, p1ptr, size2, p2ptr)                                      \
227     OGL_CMD(op, 2, size1+size2);                                                                    \
228     OGL_MEMPARAM(p1ptr, size1);                                                                     \
229     OGL_MEMPARAM(p2ptr, size2);                                                                     \
230     OGL_CMD_END(op);
231
232 #define VBOX_OGL_GEN_OP3PTRPTR(op, p1, size2, p2ptr, size3, p3ptr)                                  \
233     OGL_CMD(op, 3, sizeof(p1)+size2+size3);                                                         \
234     OGL_PARAM(p1, sizeof(p1));                                                                      \
235     OGL_MEMPARAM(p2ptr, size2);                                                                     \
236     OGL_MEMPARAM(p3ptr, size3);                                                                     \
237     OGL_CMD_END(op);
238
239 /* Note: sync operations always set the last error */
240 /* sync operation that returns a value */
241 #define VBOX_OGL_GEN_SYNC_OP_RET(rettype, op)                                                       \
242     VBOX_OGL_GEN_OP(op)                                                                             \
243     rettype retval = (rettype)VBoxOGLFlush();
244
245 #define VBOX_OGL_GEN_SYNC_OP1_RET(rettype, op, p1)                                                  \
246     VBOX_OGL_GEN_OP1(op, p1)                                                                        \
247     rettype retval = (rettype)VBoxOGLFlush();
248
249 #define VBOX_OGL_GEN_SYNC_OP2_RET(rettype, op, p1, p2)                                              \
250     VBOX_OGL_GEN_OP2(op, p1, p2)                                                                    \
251     rettype retval = (rettype)VBoxOGLFlush();
252
253 #define VBOX_OGL_GEN_SYNC_OP3_RET(rettype, op, p1, p2, p3)                                          \
254     VBOX_OGL_GEN_OP3(op, p1, p2, p3)                                                                \
255     rettype retval = (rettype)VBoxOGLFlush();
256
257 #define VBOX_OGL_GEN_SYNC_OP4_RET(rettype, op, p1, p2, p3, p4)                                      \
258     VBOX_OGL_GEN_OP4(op, p1, p2, p3, p4)                                                            \
259     rettype retval = (rettype)VBoxOGLFlush();
260
261 #define VBOX_OGL_GEN_SYNC_OP5_RET(rettype, op, p1, p2, p3, p4, p5)                                  \
262     VBOX_OGL_GEN_OP5(op, p1, p2, p3, p4, p5)                                                        \
263     rettype retval = (rettype)VBoxOGLFlush();
264
265 #define VBOX_OGL_GEN_SYNC_OP6_RET(rettype, op, p1, p2, p3, p4, p5, p6)                              \
266     VBOX_OGL_GEN_OP6(op, p1, p2, p3, p4, p5, p6)                                                    \
267     rettype retval = (rettype)VBoxOGLFlush();
268
269 #define VBOX_OGL_GEN_SYNC_OP7_RET(rettype, op, p1, p2, p3, p4, p5, p6, p7)                          \
270     VBOX_OGL_GEN_OP7(op, p1, p2, p3, p4, p5, p6, p7)                                                \
271     rettype retval = (rettype)VBoxOGLFlush();
272
273
274 #define VBOX_OGL_GEN_SYNC_OP(op)                                                                    \
275     VBOX_OGL_GEN_OP(op)                                                                             \
276     VBoxOGLFlush();
277
278 #define VBOX_OGL_GEN_SYNC_OP1(op, p1)                                                               \
279     VBOX_OGL_GEN_OP1(op, p1)                                                                        \
280     VBoxOGLFlush();
281
282 #define VBOX_OGL_GEN_SYNC_OP2(op, p1, p2)                                                           \
283     VBOX_OGL_GEN_OP2(op, p1, p2)                                                                    \
284     VBoxOGLFlush();
285
286
287 /* Sync operation whose last parameter is a block of memory */
288 #define VBOX_OGL_GEN_SYNC_OP2_PTR(op, p1, size, p2ptr)                                              \
289     VBOX_OGL_GEN_OP2PTR(op, p1, size, p2ptr);                                                       \
290     VBoxOGLFlush();
291
292 #define VBOX_OGL_GEN_SYNC_OP5_PTR(op, p1, p2, p3, p4, size, p5ptr)                                  \
293     VBOX_OGL_GEN_OP2PTR(op, p1, p2, p3, p4, size, p5ptr);                                           \
294     VBoxOGLFlush();
295
296 #define VBOX_OGL_GEN_SYNC_OP6_PTR(op, p1, p2, p3, p4, p5, size, p6ptr)                              \
297     VBOX_OGL_GEN_OP6PTR(op, p1, p2, p3, p4, p5, size, p6ptr);                                       \
298     VBoxOGLFlush();
299
300 #define VBOX_OGL_GEN_SYNC_OP7_PTR(op, p1, p2, p3, p4, p5, p6, size, p7ptr)                          \
301     VBOX_OGL_GEN_OP7PTR(op, p1, p2, p3, p4, p5, p6, size, p7ptr);                                   \
302     VBoxOGLFlush();
303
304 /* Sync operation whose last parameter is a block of memory in which results are returned */
305 #define VBOX_OGL_GEN_SYNC_OP1_PASS_PTR(op, size, p1ptr)                                             \
306     VBOX_OGL_GEN_OP(op);                                                                            \
307     VBoxOGLFlushPtr(p1ptr, size);
308
309 #define VBOX_OGL_GEN_SYNC_OP2_PASS_PTR(op, p1, size, p2ptr)                                         \
310     VBOX_OGL_GEN_OP1(op, p1);                                                                       \
311     VBoxOGLFlushPtr(p2ptr, size);
312
313 #define VBOX_OGL_GEN_SYNC_OP3_PASS_PTR(op, p1, p2, size, p3ptr)                                     \
314     VBOX_OGL_GEN_OP2(op, p1, p2);                                                                   \
315     VBoxOGLFlushPtr(p3ptr, size);
316
317 #define VBOX_OGL_GEN_SYNC_OP4_PASS_PTR(op, p1, p2, p3, size, p4ptr)                                 \
318     VBOX_OGL_GEN_OP3(op, p1, p2, p3);                                                               \
319     VBoxOGLFlushPtr(p4ptr, size);
320
321 #define VBOX_OGL_GEN_SYNC_OP5_PASS_PTR(op, p1, p2, p3, p4, size, p5ptr)                             \
322     VBOX_OGL_GEN_OP4(op, p1, p2, p3, p4);                                                           \
323     VBoxOGLFlushPtr(p5ptr, size);
324
325 #define VBOX_OGL_GEN_SYNC_OP6_PASS_PTR(op, p1, p2, p3, p4, p5, size, p6ptr)                         \
326     VBOX_OGL_GEN_OP5(op, p1, p2, p3, p4, p5);                                                       \
327     VBoxOGLFlushPtr(p6ptr, size);
328
329 #define VBOX_OGL_GEN_SYNC_OP7_PASS_PTR(op, p1, p2, p3, p4, p5, p6, size, p7ptr)                     \
330     VBOX_OGL_GEN_OP6(op, p1, p2, p3, p4, p5, p6);                                                   \
331     VBoxOGLFlushPtr(p7ptr, size);
332
333
334 /* Sync operation whose last parameter is a block of memory and return a value */
335 #define VBOX_OGL_GEN_SYNC_OP2_PTR_RET(rettype, op, p1, size, p2ptr)                                 \
336     VBOX_OGL_GEN_OP2PTR(op, p1, size, p2ptr);                                                       \
337     rettype retval = (rettype)VBoxOGLFlush();
338
339 #define VBOX_OGL_GEN_SYNC_OP4_PTR_RET(rettype, op, p1, p2, p3, size, p4ptr)                         \
340     VBOX_OGL_GEN_OP4PTR(op, p1, p2, p3, size, p4ptr);                                               \
341     rettype retval = (rettype)VBoxOGLFlush();
342
343 #define VBOX_OGL_GEN_SYNC_OP5_PTR_RET(rettype, op, p1, p2, p3, p4, size, p5ptr)                     \
344     VBOX_OGL_GEN_OP5PTR(op, p1, p2, p3, p4, size, p5ptr);                                           \
345     rettype retval = (rettype)VBoxOGLFlush();
346
347 #define VBOX_OGL_GEN_SYNC_OP6_PTR_RET(rettype, op, p1, p2, p3, p4, p5, size, p6ptr)                 \
348     VBOX_OGL_GEN_OP6PTR(op, p1, p2, p3, p4, p5, size, p6ptr);                                       \
349     rettype retval = (rettype)VBoxOGLFlush();
350
351 #define VBOX_OGL_GEN_SYNC_OP7_PTR_RET(rettype, op, p1, p2, p3, p4, p5, p6, size, p7ptr)             \
352     VBOX_OGL_GEN_OP7PTR(op, p1, p2, p3, p4, p5, p6, size, p7ptr);                                   \
353     rettype retval = (rettype)VBoxOGLFlush();
354
355
356 /* Sync operation whose last parameter is a block of memory in which results are returned and return a value */
357 #define VBOX_OGL_GEN_SYNC_OP2_PASS_PTR_RET(rettype, op, p1, size, p2ptr)                            \
358     VBOX_OGL_GEN_OP1(op, p1);                                                                       \
359     rettype retval = (rettype)VBoxOGLFlushPtr(p2ptr, size);
360
361 #define VBOX_OGL_GEN_SYNC_OP4_PASS_PTR_RET(rettype, op, p1, p2, p3, size, p4ptr)                    \
362     VBOX_OGL_GEN_OP3(op, p1, p2, p3);                                                               \
363     rettype retval = (rettype)VBoxOGLFlushPtr(p4ptr, size);
364
365 #define VBOX_OGL_GEN_SYNC_OP5_PASS_PTR_RET(rettype, op, p1, p2, p3, p4, size, p5ptr)                \
366     VBOX_OGL_GEN_OP4(op, p1, p2, p3, p4);                                                           \
367     rettype retval = (rettype)VBoxOGLFlushPtr(p5ptr, size);
368
369 #define VBOX_OGL_GEN_SYNC_OP6_PASS_PTR_RET(rettype, op, p1, p2, p3, p4, p5, size, p6ptr)            \
370     VBOX_OGL_GEN_OP5(op, p1, p2, p3, p4, p5);                                                       \
371     rettype retval = (rettype)VBoxOGLFlushPtr(p6ptr, size);
372
373 #define VBOX_OGL_GEN_SYNC_OP7_PASS_PTR_RET(rettype, op, p1, p2, p3, p4, p5, p6, size, p7ptr)        \
374     VBOX_OGL_GEN_OP6(op, p1, p2, p3, p4, p5, p6);                                                   \
375     rettype retval = (rettype)VBoxOGLFlushPtr(p7ptr, size);
376
377
378 /* Generate async functions elements in the command queue */
379 #define GL_GEN_FUNC(Function)                                                       \
380     void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (void)                                               \
381     {                                                                               \
382         VBOX_OGL_GEN_OP(Function);                                                  \
383     }
384
385 #define GL_GEN_FUNC1(Function, Type)                                                \
386     void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type a)                                             \
387     {                                                                               \
388         VBOX_OGL_GEN_OP1(Function, a);                                              \
389     }
390
391 #define GL_GEN_FUNC1V(Function, Type)                                               \
392     void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type a)                                             \
393     {                                                                               \
394         VBOX_OGL_GEN_OP1(Function, a);                                              \
395     }                                                                               \
396     void APIENTRY VBOX_OGL_NAME_PREFIX(Function)##v (const Type *v)                                   \
397     {                                                                               \
398         VBOX_OGL_GEN_OP1(Function, v[0]);                                           \
399     }                                                                               \
400
401 #define GL_GEN_FUNC2(Function, Type)                                                \
402     void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type a, Type b)                                     \
403     {                                                                               \
404         VBOX_OGL_GEN_OP2(Function, a, b);                                           \
405     }
406
407 #define GL_GEN_FUNC2V(Function, Type)                                               \
408     void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type a, Type b)                                     \
409     {                                                                               \
410         VBOX_OGL_GEN_OP2(Function, a, b);                                           \
411     }                                                                               \
412     void APIENTRY VBOX_OGL_NAME_PREFIX(Function)##v (const Type *v)                                   \
413     {                                                                               \
414         VBOX_OGL_GEN_OP2(Function, v[0], v[1]);                                     \
415     }                                                                               \
416
417 #define GL_GEN_FUNC3(Function, Type)                                                \
418     void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type a, Type b, Type c)                             \
419     {                                                                               \
420         VBOX_OGL_GEN_OP3(Function, a, b, c);                                        \
421     }
422
423 #define GL_GEN_FUNC3V(Function, Type)                                               \
424     void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type a, Type b, Type c)                             \
425     {                                                                               \
426         VBOX_OGL_GEN_OP3(Function, a, b, c);                                        \
427     }                                                                               \
428     void APIENTRY VBOX_OGL_NAME_PREFIX(Function)##v (const Type *v)                                   \
429     {                                                                               \
430         VBOX_OGL_GEN_OP3(Function, v[0], v[1], v[2]);                               \
431     }                                                                               \
432
433 #define GL_GEN_FUNC4(Function, Type)                                                \
434     void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type a, Type b, Type c, Type d)                     \
435     {                                                                               \
436         VBOX_OGL_GEN_OP4(Function, a, b, c, d);                                     \
437     }
438
439 #define GL_GEN_FUNC4V(Function, Type)                                               \
440     void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type a, Type b, Type c, Type d)                     \
441     {                                                                               \
442         VBOX_OGL_GEN_OP4(Function, a, b, c, d);                                     \
443     }                                                                               \
444     void APIENTRY VBOX_OGL_NAME_PREFIX(Function)##v (const Type *v)                                   \
445     {                                                                               \
446         VBOX_OGL_GEN_OP4(Function, v[0], v[1], v[2], v[3]);                         \
447     }                                                                               \
448
449 #define GL_GEN_FUNC6(Function, Type)                                                \
450     void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type a, Type b, Type c, Type d, Type e, Type f)     \
451     {                                                                               \
452         VBOX_OGL_GEN_OP6(Function, a, b, c, d, e, f);                               \
453     }
454
455 #define GL_GEN_VPAR_FUNC2(Function, Type1, Type2)                                   \
456     void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type1 a, Type2 b)                                   \
457     {                                                                               \
458         VBOX_OGL_GEN_OP2(Function, a, b);                                           \
459     }
460
461 #define GL_GEN_VPAR_FUNC2V(Function, Type1, Type2)                                  \
462     void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type1 a, Type2 b)                                   \
463     {                                                                               \
464         VBOX_OGL_GEN_OP2(Function, a, b);                                           \
465     }                                                                               \
466     void APIENTRY VBOX_OGL_NAME_PREFIX(Function)##v (Type1 a, const Type2 *v)                         \
467     {                                                                               \
468         VBOX_OGL_GEN_OP3(Function, a, v[0], v[1]);                                  \
469     }                                                                               \
470
471 #define GL_GEN_VPAR_FUNC3(Function, Type1, Type2, Type3)                            \
472     void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type1 a, Type2 b, Type3 c)                          \
473     {                                                                               \
474         VBOX_OGL_GEN_OP3(Function, a, b, c);                                        \
475     }
476
477 #define GL_GEN_VPAR_FUNC3V(Function, Type1, Type2, Type3)                           \
478     void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type1 a, Type2 b, Type3 c)                          \
479     {                                                                               \
480         VBOX_OGL_GEN_OP3(Function, a, b, c);                                        \
481     }                                                                               \
482     void APIENTRY VBOX_OGL_NAME_PREFIX(Function)##v (Type1 a, Type2 b, const Type3 *v)                \
483     {                                                                               \
484         VBOX_OGL_GEN_OP3(Function, a, v[0], v[1]);                                  \
485     }                                                                               \
486
487 #define GL_GEN_VPAR_FUNC4(Function, Type1, Type2, Type3, Type4)                     \
488     void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type1 a, Type2 b, Type3 c, Type4 d)                 \
489     {                                                                               \
490         VBOX_OGL_GEN_OP4(Function, a, b, c, d);                                     \
491     }
492
493 #define GL_GEN_VPAR_FUNC5(Function, Type1, Type2, Type3, Type4, Type5)              \
494     void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type1 a, Type2 b, Type3 c, Type4 d, Type5 e)        \
495     {                                                                               \
496         VBOX_OGL_GEN_OP5(Function, a, b, c, d, e);                                  \
497     }
498
499 #define GL_GEN_VPAR_FUNC6(Function, Type1, Type2, Type3, Type4, Type5, Type6)       \
500     void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type1 a, Type2 b, Type3 c, Type4 d, Type5 e, Type6 f)        \
501     {                                                                               \
502         VBOX_OGL_GEN_OP6(Function, a, b, c, d, e, f);                               \
503     }
504
505 #define GL_GEN_VPAR_FUNC7(Function, Type1, Type2, Type3, Type4, Type5, Type6, Type7)       \
506     void APIENTRY VBOX_OGL_NAME_PREFIX(Function) (Type1 a, Type2 b, Type3 c, Type4 d, Type5 e, Type6 f, Type7 g)        \
507     {                                                                               \
508         VBOX_OGL_GEN_OP7(Function, a, b, c, d, e, f, g);        &