VirtualBox

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

Last change on this file since 69475 was 69475, checked in by vboxsync, 7 years ago

*: scm updates - header files should have 'svn:keywords=Id Revision' too (doesn't mean they have to use them).

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