VirtualBox

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

Last change on this file since 4878 was 4172, checked in by vboxsync, 17 years ago

eol-style native

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