VirtualBox

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

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

eol

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