VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/OpenGL/OGLComplexAsync.cpp@ 4071

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

Biggest check-in ever. New source code headers for all (C) innotek files.

File size: 24.2 KB
Line 
1/** @file
2 *
3 * VirtualBox Windows NT/2000/XP guest OpenGL ICD
4 *
5 * Complex buffered OpenGL functions
6 *
7 * Copyright (C) 2006-2007 innotek GmbH
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License 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#include "VBoxOGL.h"
19#include <iprt/cdefs.h>
20#include <iprt/assert.h>
21
22void APIENTRY glFogfv(GLenum pname, const GLfloat *params)
23{
24 if (pname == GL_FOG_COLOR)
25 {
26 VBOX_OGL_GEN_OP2PTR(Fogfv, pname, 4*sizeof(*params), params);
27 }
28 else
29 {
30 VBOX_OGL_GEN_OP2PTR(Fogfv, pname, 1*sizeof(*params), params);
31 }
32}
33
34void APIENTRY glFogiv(GLenum pname, const GLint *params)
35{
36 if (pname == GL_FOG_COLOR)
37 {
38 VBOX_OGL_GEN_OP2PTR(Fogiv, pname, 4*sizeof(*params), params);
39 }
40 else
41 {
42 VBOX_OGL_GEN_OP2PTR(Fogiv, pname, 1*sizeof(*params), params);
43 }
44}
45
46void APIENTRY glLightModelfv(GLenum pname, const GLfloat *params)
47{
48 if (pname == GL_LIGHT_MODEL_AMBIENT)
49 {
50 VBOX_OGL_GEN_OP2PTR(LightModelfv, pname, 4*sizeof(*params), params);
51 }
52 else
53 {
54 VBOX_OGL_GEN_OP2PTR(LightModelfv, pname, 1*sizeof(*params), params);
55 }
56}
57
58void APIENTRY glLightModeliv(GLenum pname, const GLint *params)
59{
60 if (pname == GL_LIGHT_MODEL_AMBIENT)
61 {
62 VBOX_OGL_GEN_OP2PTR(LightModeliv, pname, 4*sizeof(*params), params);
63 }
64 else
65 {
66 VBOX_OGL_GEN_OP2PTR(LightModeliv, pname, 1*sizeof(*params), params);
67 }
68}
69
70void APIENTRY glLightfv(GLenum light, GLenum pname, const GLfloat *params)
71{
72 uint32_t n = glInternalLightvElem(pname);
73
74 if (!n)
75 {
76 AssertFailed();
77 glLogError(GL_INVALID_ENUM);
78 return;
79 }
80 VBOX_OGL_GEN_OP3PTR(Lightfv, light, pname, n*sizeof(*params), params);
81}
82
83void APIENTRY glLightiv(GLenum light, GLenum pname, const GLint *params)
84{
85 uint32_t n = glInternalLightvElem(pname);
86
87 if (!n)
88 {
89 AssertFailed();
90 glLogError(GL_INVALID_ENUM);
91 return;
92 }
93 VBOX_OGL_GEN_OP3PTR(Lightiv, light, pname, n*sizeof(*params), params);
94}
95
96void APIENTRY glMaterialfv (GLenum face, GLenum pname, const GLfloat *params)
97{
98 uint32_t n = glInternalMaterialvElem(pname);
99
100 if (!n)
101 {
102 AssertFailed();
103 glLogError(GL_INVALID_ENUM);
104 return;
105 }
106 VBOX_OGL_GEN_OP3PTR(Materialfv, face, pname, n*sizeof(*params), params);
107}
108
109
110void APIENTRY glMaterialiv (GLenum face, GLenum pname, const GLint *params)
111{
112 uint32_t n = glInternalMaterialvElem(pname);
113
114 if (!n)
115 {
116 AssertFailed();
117 glLogError(GL_INVALID_ENUM);
118 return;
119 }
120 VBOX_OGL_GEN_OP3PTR(Materialfv, face, pname, n*sizeof(*params), params);
121}
122
123void APIENTRY glPixelMapfv (GLenum map, GLsizei mapsize, const GLfloat *values)
124{
125 VBOX_OGL_GEN_OP2PTR(PixelMapfv, map, mapsize*sizeof(*values), values);
126}
127
128void APIENTRY glPixelMapuiv (GLenum map, GLsizei mapsize, const GLuint *values)
129{
130 VBOX_OGL_GEN_OP2PTR(PixelMapuiv, map, mapsize*sizeof(*values), values);
131}
132
133void APIENTRY glPixelMapusv (GLenum map, GLsizei mapsize, const GLushort *values)
134{
135 VBOX_OGL_GEN_OP2PTR(PixelMapusv, map, mapsize*sizeof(*values), values);
136}
137
138void APIENTRY glDeleteTextures(GLsizei n, const GLuint *textures)
139{
140 VBOX_OGL_GEN_OP1PTR(DeleteTextures, n*sizeof(*textures), textures);
141}
142
143void APIENTRY glTexEnviv (GLenum target, GLenum pname, const GLint *params)
144{
145 uint32_t n = glInternalTexEnvvElem(pname);
146
147 if (!n)
148 {
149 AssertFailed();
150 glLogError(GL_INVALID_ENUM);
151 return;
152 }
153 VBOX_OGL_GEN_OP3PTR(TexEnviv, target, pname, n*sizeof(*params), params);
154 return;
155}
156
157void APIENTRY glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params)
158{
159 uint32_t n = glInternalTexEnvvElem(pname);
160
161 if (!n)
162 {
163 AssertFailed();
164 glLogError(GL_INVALID_ENUM);
165 return;
166 }
167 VBOX_OGL_GEN_OP3PTR(TexEnvfv, target, pname, n*sizeof(*params), params);
168}
169
170void APIENTRY glTexGendv (GLenum coord, GLenum pname, const GLdouble *params)
171{
172 uint32_t n = glInternalTexGenvElem(pname);
173
174 if (!n)
175 {
176 AssertFailed();
177 glLogError(GL_INVALID_ENUM);
178 return;
179 }
180 VBOX_OGL_GEN_OP3PTR(TexGendv, coord, pname, n*sizeof(*params), params);
181 return;
182}
183
184void APIENTRY glTexGenfv (GLenum coord, GLenum pname, const GLfloat *params)
185{
186 uint32_t n = glInternalTexGenvElem(pname);
187
188 if (!n)
189 {
190 AssertFailed();
191 glLogError(GL_INVALID_ENUM);
192 return;
193 }
194 VBOX_OGL_GEN_OP3PTR(TexGenfv, coord, pname, n*sizeof(*params), params);
195 return;
196}
197
198void APIENTRY glTexGeniv (GLenum coord, GLenum pname, const GLint *params)
199{
200 uint32_t n = glInternalTexGenvElem(pname);
201
202 if (!n)
203 {
204 AssertFailed();
205 glLogError(GL_INVALID_ENUM);
206 return;
207 }
208 VBOX_OGL_GEN_OP3PTR(TexGeniv, coord, pname, n*sizeof(*params), params);
209 return;
210}
211
212
213void APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params)
214{
215 uint32_t n = glInternalTexParametervElem(pname);
216
217 if (!n)
218 {
219 AssertFailed();
220 glLogError(GL_INVALID_ENUM);
221 return;
222 }
223 VBOX_OGL_GEN_OP3PTR(TexParameterfv, target, pname, n*sizeof(*params), params);
224 return;
225}
226
227void APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params)
228{
229 uint32_t n = glInternalTexParametervElem(pname);
230
231 if (!n)
232 {
233 AssertFailed();
234 glLogError(GL_INVALID_ENUM);
235 return;
236 }
237 VBOX_OGL_GEN_OP3PTR(TexParameteriv, target, pname, n*sizeof(*params), params);
238 return;
239}
240
241void APIENTRY glLoadMatrixd (const GLdouble *m)
242{
243 VBOX_OGL_GEN_OP1PTR(LoadMatrixd, 16*sizeof(*m), m);
244}
245
246void APIENTRY glLoadMatrixf (const GLfloat *m)
247{
248 VBOX_OGL_GEN_OP1PTR(LoadMatrixf, 16*sizeof(*m), m);
249}
250
251
252void APIENTRY glMultMatrixd (const GLdouble *m)
253{
254 VBOX_OGL_GEN_OP1PTR(MultMatrixd, 16*sizeof(*m), m);
255}
256
257void APIENTRY glMultMatrixf (const GLfloat *m)
258{
259 VBOX_OGL_GEN_OP1PTR(MultMatrixf, 16*sizeof(*m), m);
260}
261
262void APIENTRY glPolygonStipple (const GLubyte *mask)
263{
264 VBOX_OGL_GEN_OP1PTR(PolygonStipple, 32*32/8, mask);
265}
266
267void APIENTRY glClipPlane (GLenum plane, const GLdouble *equation)
268{
269 VBOX_OGL_GEN_OP2PTR(ClipPlane, plane, 4*sizeof(*equation), equation);
270}
271
272
273
274void APIENTRY glDisableClientState(GLenum type)
275{
276 PVBOX_OGL_THREAD_CTX pCtx = VBoxOGLGetThreadCtx();
277 switch(type)
278 {
279 case GL_VERTEX_ARRAY:
280 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_VERTEX].fValid = false;
281 break;
282 case GL_NORMAL_ARRAY:
283 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_NORMAL].fValid = false;
284 break;
285 case GL_COLOR_ARRAY:
286 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_COLOR].fValid = false;
287 break;
288 case GL_INDEX_ARRAY:
289 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_INDEX].fValid = false;
290 break;
291 case GL_TEXTURE_COORD_ARRAY:
292 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_TEXCOORD].fValid = false;
293 break;
294 case GL_EDGE_FLAG_ARRAY:
295 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_EDGEFLAG].fValid = false;
296 break;
297 default:
298 AssertMsgFailed(("invalid type %x\n", type));
299 break;
300 }
301 VBOX_OGL_GEN_OP1(DisableClientState, type);
302}
303
304void APIENTRY glEnableClientState(GLenum type)
305{
306 PVBOX_OGL_THREAD_CTX pCtx = VBoxOGLGetThreadCtx();
307 switch(type)
308 {
309 case GL_VERTEX_ARRAY:
310 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_VERTEX].fValid = true;
311 break;
312 case GL_NORMAL_ARRAY:
313 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_NORMAL].fValid = true;
314 break;
315 case GL_COLOR_ARRAY:
316 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_COLOR].fValid = true;
317 break;
318 case GL_INDEX_ARRAY:
319 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_INDEX].fValid = true;
320 break;
321 case GL_TEXTURE_COORD_ARRAY:
322 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_TEXCOORD].fValid = true;
323 break;
324 case GL_EDGE_FLAG_ARRAY:
325 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_EDGEFLAG].fValid = true;
326 break;
327 default:
328 AssertMsgFailed(("invalid type %x\n", type));
329 break;
330 }
331 VBOX_OGL_GEN_OP1(EnableClientState, type);
332}
333
334void APIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
335{
336 PVBOX_OGL_THREAD_CTX pCtx = VBoxOGLGetThreadCtx();
337
338 if (size < 2 || size > 4)
339 {
340 glLogError(GL_INVALID_VALUE);
341 return;
342 }
343
344 GLint cbDataType = glVBoxGetDataTypeSize(type);
345 if (!cbDataType)
346 {
347 glLogError(GL_INVALID_ENUM);
348 return;
349 }
350
351 GLint minStride = size*cbDataType;
352 if (stride < minStride)
353 {
354 glLogError(GL_INVALID_VALUE);
355 return;
356 }
357
358 if (stride == 0)
359 stride = minStride;
360
361 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_VERTEX].pointer = pointer;
362 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_VERTEX].size = size;
363 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_VERTEX].stride = stride;
364 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_VERTEX].type = type;
365 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_VERTEX].cbDataType = cbDataType;
366 return;
367}
368
369void APIENTRY glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
370{
371 PVBOX_OGL_THREAD_CTX pCtx = VBoxOGLGetThreadCtx();
372 if (size < 1 || size > 4)
373 {
374 glLogError(GL_INVALID_VALUE);
375 return;
376 }
377
378 GLint cbDataType = glVBoxGetDataTypeSize(type);
379
380 if (!cbDataType)
381 {
382 glLogError(GL_INVALID_ENUM);
383 return;
384 }
385
386 GLint minStride = size*cbDataType;
387
388 if (stride < minStride)
389 {
390 glLogError(GL_INVALID_VALUE);
391 return;
392 }
393
394 if (stride == 0)
395 stride = minStride;
396
397 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_TEXCOORD].pointer = pointer;
398 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_TEXCOORD].size = size;
399 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_TEXCOORD].stride = stride;
400 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_TEXCOORD].type = type;
401 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_TEXCOORD].cbDataType = cbDataType;
402 return;
403}
404
405/** @todo might not work as the caller could change the array contents afterwards */
406void APIENTRY glColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
407{
408 PVBOX_OGL_THREAD_CTX pCtx = VBoxOGLGetThreadCtx();
409 if (size < 3 || size > 4)
410 {
411 glLogError(GL_INVALID_VALUE);
412 return;
413 }
414
415 GLint cbDataType = glVBoxGetDataTypeSize(type);
416
417 if (!cbDataType)
418 {
419 glLogError(GL_INVALID_ENUM);
420 return;
421 }
422
423 GLint minStride = size*cbDataType;
424
425 if (stride < minStride)
426 {
427 glLogError(GL_INVALID_VALUE);
428 return;
429 }
430
431 if (stride == 0)
432 stride = minStride;
433
434 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_COLOR].pointer = pointer;
435 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_COLOR].size = size;
436 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_COLOR].stride = stride;
437 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_COLOR].type = type;
438 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_COLOR].cbDataType = cbDataType;
439 return;
440}
441
442void APIENTRY glEdgeFlagPointer (GLsizei stride, const GLvoid *pointer)
443{
444 PVBOX_OGL_THREAD_CTX pCtx = VBoxOGLGetThreadCtx();
445 GLint minStride = sizeof(GLboolean);
446
447 if (stride < minStride)
448 {
449 glLogError(GL_INVALID_VALUE);
450 return;
451 }
452
453 if (stride == 0)
454 stride = minStride;
455
456 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_EDGEFLAG].size = 1;
457 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_EDGEFLAG].pointer = pointer;
458 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_EDGEFLAG].stride = stride;
459 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_EDGEFLAG].cbDataType = sizeof(GLboolean);
460 return;
461}
462
463void APIENTRY glIndexPointer (GLenum type, GLsizei stride, const GLvoid *pointer)
464{
465 PVBOX_OGL_THREAD_CTX pCtx = VBoxOGLGetThreadCtx();
466 GLint cbDataType = glVBoxGetDataTypeSize(type);
467
468 if (!cbDataType)
469 {
470 glLogError(GL_INVALID_ENUM);
471 return;
472 }
473
474 GLint minStride = cbDataType;
475
476 if (stride < minStride)
477 {
478 glLogError(GL_INVALID_VALUE);
479 return;
480 }
481
482 if (stride == 0)
483 stride = minStride;
484
485 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_INDEX].size = 1;
486 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_INDEX].pointer = pointer;
487 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_INDEX].stride = stride;
488 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_INDEX].type = type;
489 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_INDEX].cbDataType = cbDataType;
490}
491
492void APIENTRY glNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer)
493{
494 PVBOX_OGL_THREAD_CTX pCtx = VBoxOGLGetThreadCtx();
495 GLint cbDataType = glVBoxGetDataTypeSize(type);
496
497 if (!cbDataType)
498 {
499 glLogError(GL_INVALID_ENUM);
500 return;
501 }
502
503 GLint minStride = cbDataType;
504
505 if (stride < minStride)
506 {
507 glLogError(GL_INVALID_VALUE);
508 return;
509 }
510
511 if (stride == 0)
512 stride = minStride;
513
514 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_NORMAL].size = 1;
515 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_NORMAL].pointer = pointer;
516 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_NORMAL].stride = stride;
517 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_NORMAL].type = type;
518 pCtx->Pointer[VBOX_OGL_DRAWELEMENT_NORMAL].cbDataType = cbDataType;
519 return;
520}
521
522void APIENTRY glCallLists (GLsizei n, GLenum type, const GLvoid *lists)
523{
524 GLint cbDataType = glVBoxGetDataTypeSize(type);
525
526 if (!cbDataType)
527 {
528 glLogError(GL_INVALID_ENUM);
529 return;
530 }
531 VBOX_OGL_GEN_OP3PTR(CallLists, n, type, n * cbDataType, lists);
532 return;
533}
534
535
536void APIENTRY glMap1d (GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points)
537{
538 GLint cElement, minStride;
539
540 switch (target)
541 {
542 case GL_MAP1_INDEX:
543 case GL_MAP1_TEXTURE_COORD_1:
544 cElement = 1;
545 break;
546
547 case GL_MAP1_TEXTURE_COORD_2:
548 cElement = 2;
549 break;
550
551 case GL_MAP1_NORMAL:
552 case GL_MAP1_TEXTURE_COORD_3:
553 case GL_MAP1_VERTEX_3:
554 cElement = 3;
555 break;
556
557 case GL_MAP1_TEXTURE_COORD_4:
558 case GL_MAP1_VERTEX_4:
559 case GL_MAP1_COLOR_4:
560 cElement = 4;
561 break;
562
563 default:
564 glLogError(GL_INVALID_ENUM);
565 break;
566 }
567 minStride = cElement;
568
569 if ( stride < minStride
570 || order < 0)
571 {
572 glLogError(GL_INVALID_VALUE);
573 return;
574 }
575 /* stride is in doubles/floats this time */
576 if (stride == 0)
577 stride = minStride;
578
579 VBOX_OGL_GEN_OP6PTR(Map1d, target, u1, u2, stride, order, stride*order*sizeof(*points), points);
580 return;
581}
582
583void APIENTRY glMap1f (GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points)
584{
585 GLint cElement, minStride;
586
587 switch (target)
588 {
589 case GL_MAP1_INDEX:
590 case GL_MAP1_TEXTURE_COORD_1:
591 cElement = 1;
592 break;
593
594 case GL_MAP1_TEXTURE_COORD_2:
595 cElement = 2;
596 break;
597
598 case GL_MAP1_NORMAL:
599 case GL_MAP1_TEXTURE_COORD_3:
600 case GL_MAP1_VERTEX_3:
601 cElement = 3;
602 break;
603
604 case GL_MAP1_TEXTURE_COORD_4:
605 case GL_MAP1_VERTEX_4:
606 case GL_MAP1_COLOR_4:
607 cElement = 4;
608 break;
609
610 default:
611 glLogError(GL_INVALID_ENUM);
612 break;
613 }
614 minStride = cElement;
615
616 if ( stride < minStride
617 || order < 0)
618 {
619 glLogError(GL_INVALID_VALUE);
620 return;
621 }
622 /* stride is in doubles/floats this time */
623 if (stride == 0)
624 stride = minStride;
625
626 VBOX_OGL_GEN_OP6PTR(Map1f, target, u1, u2, stride, order, stride*order*sizeof(*points), points);
627 return;
628}
629
630void APIENTRY glMap2d (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points)
631{
632 GLint cElement, minuStride, minvStride;
633
634 switch (target)
635 {
636 case GL_MAP2_INDEX:
637 case GL_MAP2_TEXTURE_COORD_1:
638 cElement = 1;
639 break;
640
641 case GL_MAP2_TEXTURE_COORD_2:
642 cElement = 2;
643 break;
644
645 case GL_MAP2_NORMAL:
646 case GL_MAP2_TEXTURE_COORD_3:
647 case GL_MAP2_VERTEX_3:
648 cElement = 3;
649 break;
650
651 case GL_MAP2_TEXTURE_COORD_4:
652 case GL_MAP2_VERTEX_4:
653 case GL_MAP2_COLOR_4:
654 cElement = 4;
655 break;
656
657 default:
658 glLogError(GL_INVALID_ENUM);
659 break;
660 }
661 minuStride = cElement;
662 minvStride = minuStride*uorder;
663
664 if ( ustride < minuStride
665 || uorder < 0
666 || vstride < minvStride
667 || vorder < 0)
668 {
669 glLogError(GL_INVALID_VALUE);
670 return;
671 }
672 /* stride is in doubles/floats this time */
673 if (ustride == 0)
674 ustride = minuStride;
675
676 if (vstride == 0)
677 vstride = minuStride*uorder;
678
679 VBOX_OGL_GEN_OP10PTR(Map2d, target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, ustride*uorder * vstride*vorder * sizeof(*points), points);
680 return;
681}
682
683void APIENTRY glMap2f (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points)
684{
685 GLint cElement, minuStride, minvStride;
686
687 switch (target)
688 {
689 case GL_MAP2_INDEX:
690 case GL_MAP2_TEXTURE_COORD_1:
691 cElement = 1;
692 break;
693
694 case GL_MAP2_TEXTURE_COORD_2:
695 cElement = 2;
696 break;
697
698 case GL_MAP2_NORMAL:
699 case GL_MAP2_TEXTURE_COORD_3:
700 case GL_MAP2_VERTEX_3:
701 cElement = 3;
702 break;
703
704 case GL_MAP2_TEXTURE_COORD_4:
705 case GL_MAP2_VERTEX_4:
706 case GL_MAP2_COLOR_4:
707 cElement = 4;
708 break;
709
710 default:
711 glLogError(GL_INVALID_ENUM);
712 break;
713 }
714 minuStride = cElement;
715 minvStride = minuStride*uorder;
716
717 if ( ustride < minuStride
718 || uorder < 0
719 || vstride < minvStride
720 || vorder < 0)
721 {
722 glLogError(GL_INVALID_VALUE);
723 return;
724 }
725 /* stride is in doubles/floats this time */
726 if (ustride == 0)
727 ustride = minuStride;
728
729 if (vstride == 0)
730 vstride = minuStride*uorder;
731
732 VBOX_OGL_GEN_OP10PTR(Map2f, target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, ustride*uorder * vstride*vorder * sizeof(*points), points);
733 return;
734}
735
736void APIENTRY glTexImage1D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
737{
738 GLint cbDataType = glVBoxGetDataTypeSize(type);
739
740 if (!cbDataType)
741 {
742 glLogError(GL_INVALID_ENUM);
743 return;
744 }
745 if (target != GL_TEXTURE_1D)
746 {
747 glLogError(GL_INVALID_ENUM);
748 return;
749 }
750 if ( level < 0
751 || (border != 0 && border != 1))
752 {
753 glLogError(GL_INVALID_VALUE);
754 return;
755 }
756 if ( width < 0
757 || width > glInternalGetIntegerv(GL_MAX_TEXTURE_SIZE)+2)
758 {
759 glLogError(GL_INVALID_VALUE);
760 return;
761 }
762 GLint cbPixel = cbDataType * glInternalGetPixelFormatElements(format);
763
764 VBOX_OGL_GEN_OP8PTR(TexImage1D, target, level, internalformat, width, border, format, type, cbPixel*width, pixels);
765 return;
766}
767
768void APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
769{
770 GLint maxTextureSize = glInternalGetIntegerv(GL_MAX_TEXTURE_SIZE) + 2;
771 GLint cbDataType = glVBoxGetDataTypeSize(type);
772
773 if (!cbDataType)
774 {
775 glLogError(GL_INVALID_ENUM);
776 return;
777 }
778 if (target != GL_TEXTURE_1D)
779 {
780 glLogError(GL_INVALID_ENUM);
781 return;
782 }
783 if ( level < 0
784 || (border != 0 && border != 1))
785 {
786 glLogError(GL_INVALID_VALUE);
787 return;
788 }
789 if ( width < 0
790 || width > maxTextureSize
791 || height < 0
792 || height > maxTextureSize)
793 {
794 glLogError(GL_INVALID_VALUE);
795 return;
796 }
797 GLint cbPixel = cbDataType * glInternalGetPixelFormatElements(format);
798
799 VBOX_OGL_GEN_OP9PTR(TexImage2D, target, level, internalformat, width, height, border, format, type, cbPixel*width*height, pixels);
800 return;
801}
802
803
804void APIENTRY glTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)
805{
806 GLint w = glInternalGetTexLevelParameteriv(GL_TEXTURE_WIDTH);
807 GLint b = glInternalGetTexLevelParameteriv(GL_TEXTURE_BORDER);
808 GLint cbDataType = glVBoxGetDataTypeSize(type);
809
810 if (!cbDataType)
811 {
812 glLogError(GL_INVALID_ENUM);
813 return;
814 }
815 if (target != GL_TEXTURE_1D)
816 {
817 glLogError(GL_INVALID_ENUM);
818 return;
819 }
820 if ( level < 0
821 || xoffset < -b
822 || (xoffset + width) > (w - b))
823 {
824 glLogError(GL_INVALID_VALUE);
825 return;
826 }
827 if ( width < 0
828 || width > glInternalGetIntegerv(GL_MAX_TEXTURE_SIZE)+2)
829 {
830 glLogError(GL_INVALID_VALUE);
831 return;
832 }
833 GLint cbFormat = glInternalGetPixelFormatElements(format);
834 if (cbFormat == 0)
835 {
836 glLogError(GL_INVALID_ENUM);
837 return;
838 }
839
840 GLint cbPixel = cbDataType * cbFormat;
841
842 /** @todo could optimize by skipping unused texture data */
843 VBOX_OGL_GEN_OP7PTR(TexSubImage1D, target, level, xoffset, width, format, type, cbPixel*width, pixels);
844 return;
845}
846
847void APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
848{
849 GLint w = glInternalGetTexLevelParameteriv(GL_TEXTURE_WIDTH);
850 GLint h = glInternalGetTexLevelParameteriv(GL_TEXTURE_HEIGHT);
851 GLint b = glInternalGetTexLevelParameteriv(GL_TEXTURE_BORDER);
852 GLint cbDataType = glVBoxGetDataTypeSize(type);
853
854 if (!cbDataType)
855 {
856 glLogError(GL_INVALID_ENUM);
857 return;
858 }
859 if (target != GL_TEXTURE_1D)
860 {
861 glLogError(GL_INVALID_ENUM);
862 return;
863 }
864 if ( level < 0
865 || xoffset < -b
866 || (xoffset + width) > (w - b)
867 || yoffset < -b
868 || (yoffset + height) > (h - b))
869 {
870 glLogError(GL_INVALID_VALUE);
871 return;
872 }
873 if ( width < 0
874 || width > glInternalGetIntegerv(GL_MAX_TEXTURE_SIZE)+2)
875 {
876 glLogError(GL_INVALID_VALUE);
877 return;
878 }
879 GLint cbFormat = glInternalGetPixelFormatElements(format);
880 if (cbFormat == 0)
881 {
882 glLogError(GL_INVALID_ENUM);
883 return;
884 }
885
886 GLint cbPixel = cbDataType * cbFormat;
887
888 /** @todo could optimize by skipping unused texture data */
889 VBOX_OGL_GEN_OP9PTR(TexSubImage2D, target, level, xoffset, yoffset, width, height, format, type, cbPixel*width*height, pixels);
890 return;
891}
892
893void APIENTRY glPrioritizeTextures (GLsizei n, const GLuint *textures, const GLclampf *priorities)
894{
895 if (n < 0)
896 {
897 glLogError(GL_INVALID_VALUE);
898 return;
899 }
900 VBOX_OGL_GEN_OP3PTRPTR(PrioritizeTextures, n, n*sizeof(*textures), textures, n*sizeof(*priorities), priorities);
901 return;
902}
903
904
905void APIENTRY glRectdv (const GLdouble *v1, const GLdouble *v2)
906{
907 VBOX_OGL_GEN_OP2PTRPTR(Rectdv, sizeof(GLdouble)*2, v1, sizeof(GLdouble)*2, v2);
908}
909
910void APIENTRY glRectfv (const GLfloat *v1, const GLfloat *v2)
911{
912 VBOX_OGL_GEN_OP2PTRPTR(Rectfv, sizeof(GLfloat)*2, v1, sizeof(GLfloat)*2, v2);
913}
914
915void APIENTRY glRectiv (const GLint *v1, const GLint *v2)
916{
917 VBOX_OGL_GEN_OP2PTRPTR(Rectiv, sizeof(GLint)*2, v1, sizeof(GLint)*2, v2);
918}
919
920void APIENTRY glRectsv (const GLshort *v1, const GLshort *v2)
921{
922 VBOX_OGL_GEN_OP2PTRPTR(Rectsv, sizeof(GLshort)*2, v1, sizeof(GLshort)*2, v2);
923}
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