2 * Copyright © 2005 Novell, Inc.
4 * Permission to use, copy, modify, distribute, and sell this software
5 * and its documentation for any purpose is hereby granted without
6 * fee, provided that the above copyright notice appear in all copies
7 * and that both that copyright notice and this permission notice
8 * appear in supporting documentation, and that the name of
9 * Novell, Inc. not be used in advertising or publicity pertaining to
10 * distribution of the software without specific, written prior permission.
11 * Novell, Inc. makes no representations about the suitability of this
12 * software for any purpose. It is provided "as is" without express or
15 * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
17 * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
19 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
20 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
21 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 * Author: David Reveman <davidr@novell.com>
28 #include "xglglxext.h"
32 #include <GL/internal/glcore.h>
34 #include "glxserver.h"
35 #include "glxdrawable.h"
36 #include "glxscreens.h"
39 #include "g_disptab.h"
40 #include "glapitable.h"
44 #define XGL_MAX_TEXTURE_UNITS 8
45 #define XGL_MAX_ATTRIB_STACK_DEPTH 16
47 #define XGL_TEXTURE_1D_BIT (1 << 0)
48 #define XGL_TEXTURE_2D_BIT (1 << 1)
49 #define XGL_TEXTURE_3D_BIT (1 << 2)
50 #define XGL_TEXTURE_RECTANGLE_BIT (1 << 3)
51 #define XGL_TEXTURE_CUBE_MAP_BIT (1 << 4)
53 typedef Bool (*GLXScreenProbeProc
) (int screen
);
54 typedef __GLinterface
*(*GLXCreateContextProc
) (__GLimports
*imports
,
55 __GLcontextModes
*modes
,
56 __GLinterface
*shareGC
);
57 typedef void (*GLXCreateBufferProc
) (__GLXdrawablePrivate
*glxPriv
);
58 typedef GLboolean (*GLXSwapBuffersProc
) (__GLXdrawablePrivate
*glxPriv
);
59 typedef int (*GLXBindBuffersProc
) (__GLXdrawablePrivate
*glxPriv
,
61 typedef int (*GLXReleaseBuffersProc
) (__GLXdrawablePrivate
*glxPriv
,
64 typedef struct _xglGLXScreenInfo
{
65 GLXScreenProbeProc screenProbe
;
66 GLXCreateContextProc createContext
;
67 GLXCreateBufferProc createBuffer
;
68 } xglGLXScreenInfoRec
, *xglGLXScreenInfoPtr
;
70 extern __GLXscreenInfo
*__xglScreenInfoPtr
;
72 static xglGLXScreenInfoRec screenInfoPriv
;
74 //extern __GLXscreenInfo __glDDXScreenInfo;
76 typedef GLboolean (*GLResizeBuffersProc
) (__GLdrawableBuffer
*buffer
,
81 __GLdrawablePrivate
*glPriv
,
83 typedef void (*GLFreeBuffersProc
) (__GLdrawablePrivate
*glPriv
);
85 typedef struct _xglGLBuffer
{
86 GLXSwapBuffersProc swapBuffers
;
87 GLXBindBuffersProc bindBuffers
;
88 GLXReleaseBuffersProc releaseBuffers
;
89 GLResizeBuffersProc resizeBuffers
;
90 GLFreeBuffersProc freeBuffers
;
92 DrawablePtr pDrawable
;
94 glitz_drawable_t
*drawable
;
95 glitz_surface_t
*backSurface
;
100 int screenX
, screenY
;
103 } xglGLBufferRec
, *xglGLBufferPtr
;
105 typedef int xglGLXVisualConfigRec
, *xglGLXVisualConfigPtr
;
106 typedef struct _xglDisplayList
*xglDisplayListPtr
;
108 #define XGL_LIST_OP_CALLS 0
109 #define XGL_LIST_OP_DRAW 1
110 #define XGL_LIST_OP_GL 2
111 #define XGL_LIST_OP_LIST 3
113 typedef struct _xglGLOp
{
114 void (*glProc
) (struct _xglGLOp
*pOp
);
144 GLenum internalformat
;
153 GLenum internalformat
;
167 } copy_tex_sub_image_1d
;
177 } copy_tex_sub_image_2d
;
180 GLenum internalformat
;
191 } copy_color_sub_table
;
194 GLenum internalformat
;
198 } copy_convolution_filter_1d
;
201 GLenum internalformat
;
206 } copy_convolution_filter_2d
;
217 } copy_tex_sub_image_3d
;
224 } xglGLOpRec
, *xglGLOpPtr
;
226 typedef struct _xglListOp
{
232 } xglListOpRec
, *xglListOpPtr
;
234 typedef struct _xglDisplayList
{
240 typedef struct _xglTexObj
{
244 glitz_texture_object_t
*object
;
246 } xglTexObjRec
, *xglTexObjPtr
;
248 typedef struct _xglTexUnit
{
254 xglTexObjPtr pCubeMap
;
255 } xglTexUnitRec
, *xglTexUnitPtr
;
257 typedef struct _xglGLAttributes
{
263 GLboolean scissorTest
;
264 xglTexUnitRec texUnits
[XGL_MAX_TEXTURE_UNITS
];
265 } xglGLAttributesRec
, *xglGLAttributesPtr
;
267 typedef struct _xglGLContext
{
269 __GLinterface
*mIface
;
271 struct _xglGLContext
*shared
;
272 glitz_context_t
*context
;
273 struct _glapi_table glRenderTable
;
274 PFNGLACTIVETEXTUREARBPROC ActiveTextureARB
;
275 PFNGLWINDOWPOS3FMESAPROC WindowPos3fMESA
;
277 xglGLBufferPtr pDrawBuffer
;
278 xglGLBufferPtr pReadBuffer
;
279 int drawXoff
, drawYoff
;
280 __GLdrawablePrivate
*readPriv
;
281 __GLdrawablePrivate
*drawPriv
;
284 GLboolean doubleBuffer
;
287 xglHashTablePtr texObjects
;
288 xglHashTablePtr displayLists
;
292 xglDisplayListPtr pList
;
294 xglGLAttributesRec attrib
;
295 xglGLAttributesRec attribStack
[XGL_MAX_ATTRIB_STACK_DEPTH
];
299 GLint maxListNesting
;
300 GLint maxAttribStackDepth
;
301 } xglGLContextRec
, *xglGLContextPtr
;
303 static xglGLContextPtr cctx
= NULL
;
306 xglSetCurrentContext (xglGLContextPtr pContext
);
308 #define XGL_GLX_DRAW_PROLOGUE_WITHOUT_TEXTURES(pBox, nBox, pScissorBox) \
309 (pBox) = REGION_RECTS (cctx->pDrawBuffer->pGC->pCompositeClip); \
310 (nBox) = REGION_NUM_RECTS (cctx->pDrawBuffer->pGC->pCompositeClip); \
311 (pScissorBox)->x1 = cctx->attrib.scissor.x + cctx->pDrawBuffer->xOff; \
312 (pScissorBox)->x2 = (pScissorBox)->x1 + cctx->attrib.scissor.width; \
313 (pScissorBox)->y2 = cctx->attrib.scissor.y + cctx->pDrawBuffer->yOff; \
314 (pScissorBox)->y2 = cctx->pDrawBuffer->yFlip - (pScissorBox)->y2; \
315 (pScissorBox)->y1 = (pScissorBox)->y2 - cctx->attrib.scissor.height
317 #define XGL_GLX_DRAW_PROLOGUE(pBox, nBox, pScissorBox) \
318 XGL_GLX_DRAW_PROLOGUE_WITHOUT_TEXTURES (pBox, nBox, pScissorBox); \
321 #define XGL_GLX_DRAW_BOX(pBox1, pBox2) \
322 (pBox1)->x1 = cctx->pDrawBuffer->screenX + (pBox2)->x1; \
323 (pBox1)->y1 = cctx->pDrawBuffer->screenY + (pBox2)->y1; \
324 (pBox1)->x2 = cctx->pDrawBuffer->screenX + (pBox2)->x2; \
325 (pBox1)->y2 = cctx->pDrawBuffer->screenY + (pBox2)->y2
327 #define XGL_GLX_INTERSECT_BOX(pBox1, pBox2) \
329 if ((pBox1)->x1 < (pBox2)->x1) \
330 (pBox1)->x1 = (pBox2)->x1; \
331 if ((pBox1)->y1 < (pBox2)->y1) \
332 (pBox1)->y1 = (pBox2)->y1; \
333 if ((pBox1)->x2 > (pBox2)->x2) \
334 (pBox1)->x2 = (pBox2)->x2; \
335 if ((pBox1)->y2 > (pBox2)->y2) \
336 (pBox1)->y2 = (pBox2)->y2; \
339 #define XGL_GLX_SET_SCISSOR_BOX(pBox) \
340 glScissor ((pBox)->x1, \
341 cctx->pDrawBuffer->yFlip - (pBox)->y2, \
342 (pBox)->x2 - (pBox)->x1, \
343 (pBox)->y2 - (pBox)->y1)
345 #define XGL_GLX_DRAW_DAMAGE(pBox, pRegion) \
346 if (cctx->attrib.drawBuffer != GL_BACK) \
348 (pRegion)->extents.x1 = (pBox)->x1 - cctx->pDrawBuffer->screenX; \
349 (pRegion)->extents.y1 = (pBox)->y1 - cctx->pDrawBuffer->screenY; \
350 (pRegion)->extents.x2 = (pBox)->x2 - cctx->pDrawBuffer->screenX; \
351 (pRegion)->extents.y2 = (pBox)->y2 - cctx->pDrawBuffer->screenY; \
352 (pRegion)->data = (RegDataPtr) NULL; \
353 REGION_UNION (cctx->pDrawBuffer->pGC->pScreen, \
354 &cctx->pDrawBuffer->damage, \
355 &cctx->pDrawBuffer->damage, \
357 xglAddBitDamage (cctx->pDrawBuffer->pDrawable, pRegion); \
361 xglRecordError (GLenum error
)
363 if (cctx
->errorValue
== GL_NO_ERROR
)
364 cctx
->errorValue
= error
;
367 static xglDisplayListPtr
370 xglDisplayListPtr pDisplayList
;
372 pDisplayList
= xalloc (sizeof (xglDisplayListRec
));
376 pDisplayList
->pOp
= NULL
;
377 pDisplayList
->nOp
= 0;
378 pDisplayList
->size
= 0;
384 xglDestroyList (xglDisplayListPtr pDisplayList
)
386 xglListOpPtr pOp
= pDisplayList
->pOp
;
387 int nOp
= pDisplayList
->nOp
;
392 case XGL_LIST_OP_CALLS
:
393 case XGL_LIST_OP_DRAW
:
394 glDeleteLists (pOp
->u
.list
, 1);
399 case XGL_LIST_OP_LIST
:
406 if (pDisplayList
->pOp
)
407 xfree (pDisplayList
->pOp
);
409 xfree (pDisplayList
);
413 xglResizeList (xglDisplayListPtr pDisplayList
,
416 if (pDisplayList
->size
< nOp
)
418 int size
= pDisplayList
->nOp
? pDisplayList
->nOp
: 4;
423 pDisplayList
->pOp
= xrealloc (pDisplayList
->pOp
,
424 sizeof (xglListOpRec
) * size
);
425 if (!pDisplayList
->pOp
)
428 pDisplayList
->size
= size
;
435 xglStartList (int type
,
438 if (!xglResizeList (cctx
->pList
, cctx
->pList
->nOp
+ 1))
440 xglRecordError (GL_OUT_OF_MEMORY
);
444 cctx
->pList
->pOp
[cctx
->pList
->nOp
].type
= type
;
445 cctx
->pList
->pOp
[cctx
->pList
->nOp
].u
.list
= glGenLists (1);
447 glNewList (cctx
->pList
->pOp
[cctx
->pList
->nOp
].u
.list
, mode
);
453 xglGLOp (xglGLOpPtr pOp
)
459 pGLOp
= xalloc (sizeof (xglGLOpRec
));
462 xglRecordError (GL_OUT_OF_MEMORY
);
466 if (!xglResizeList (cctx
->pList
, cctx
->pList
->nOp
+ 1))
469 xglRecordError (GL_OUT_OF_MEMORY
);
477 cctx
->pList
->pOp
[cctx
->pList
->nOp
].type
= XGL_LIST_OP_GL
;
478 cctx
->pList
->pOp
[cctx
->pList
->nOp
].u
.gl
= pGLOp
;
481 if (cctx
->listMode
== GL_COMPILE_AND_EXECUTE
)
482 (*pOp
->glProc
) (pOp
);
484 xglStartList (XGL_LIST_OP_CALLS
, cctx
->listMode
);
487 (*pOp
->glProc
) (pOp
);
491 xglViewportProc (xglGLOpPtr pOp
)
493 cctx
->attrib
.viewport
.x
= pOp
->u
.rect
.x
;
494 cctx
->attrib
.viewport
.y
= pOp
->u
.rect
.y
;
495 cctx
->attrib
.viewport
.width
= pOp
->u
.rect
.width
;
496 cctx
->attrib
.viewport
.height
= pOp
->u
.rect
.height
;
498 glViewport (pOp
->u
.rect
.x
+ cctx
->pDrawBuffer
->xOff
,
499 pOp
->u
.rect
.y
+ cctx
->pDrawBuffer
->yOff
,
505 xglViewport (GLint x
,
512 gl
.glProc
= xglViewportProc
;
516 gl
.u
.rect
.width
= width
;
517 gl
.u
.rect
.height
= height
;
523 xglScissorProc (xglGLOpPtr pOp
)
525 cctx
->attrib
.scissor
.x
= pOp
->u
.rect
.x
;
526 cctx
->attrib
.scissor
.y
= pOp
->u
.rect
.y
;
527 cctx
->attrib
.scissor
.width
= pOp
->u
.rect
.width
;
528 cctx
->attrib
.scissor
.height
= pOp
->u
.rect
.height
;
539 gl
.glProc
= xglScissorProc
;
543 gl
.u
.rect
.width
= width
;
544 gl
.u
.rect
.height
= height
;
550 xglDrawBufferProc (xglGLOpPtr pOp
)
552 glitz_drawable_buffer_t buffers
[2];
554 switch (pOp
->u
.enumeration
) {
556 buffers
[0] = GLITZ_DRAWABLE_BUFFER_FRONT_COLOR
;
557 glitz_context_draw_buffers (cctx
->context
, buffers
, 1);
559 case GL_FRONT_AND_BACK
:
560 buffers
[0] = GLITZ_DRAWABLE_BUFFER_FRONT_COLOR
;
561 if (cctx
->doubleBuffer
)
563 buffers
[1] = GLITZ_DRAWABLE_BUFFER_BACK_COLOR
;
564 glitz_context_draw_buffers (cctx
->context
, buffers
, 2);
567 glitz_context_draw_buffers (cctx
->context
, buffers
, 1);
570 if (!cctx
->doubleBuffer
)
572 xglRecordError (GL_INVALID_OPERATION
);
575 buffers
[0] = GLITZ_DRAWABLE_BUFFER_BACK_COLOR
;
576 glitz_context_draw_buffers (cctx
->context
, buffers
, 1);
579 xglRecordError (GL_INVALID_ENUM
);
583 cctx
->attrib
.drawBuffer
= pOp
->u
.enumeration
;
587 xglDrawBuffer (GLenum mode
)
591 gl
.glProc
= xglDrawBufferProc
;
593 gl
.u
.enumeration
= mode
;
599 xglReadBufferProc (xglGLOpPtr pOp
)
601 switch (pOp
->u
.enumeration
) {
603 glitz_context_read_buffer (cctx
->context
,
604 GLITZ_DRAWABLE_BUFFER_FRONT_COLOR
);
607 if (!cctx
->doubleBuffer
)
609 xglRecordError (GL_INVALID_OPERATION
);
612 glitz_context_read_buffer (cctx
->context
,
613 GLITZ_DRAWABLE_BUFFER_BACK_COLOR
);
616 xglRecordError (GL_INVALID_ENUM
);
620 cctx
->attrib
.readBuffer
= pOp
->u
.enumeration
;
624 xglReadBuffer (GLenum mode
)
628 gl
.glProc
= xglReadBufferProc
;
630 gl
.u
.enumeration
= mode
;
636 xglDisableProc (xglGLOpPtr pOp
)
638 xglTexUnitPtr pTexUnit
= &cctx
->attrib
.texUnits
[cctx
->activeTexUnit
];
640 switch (pOp
->u
.enumeration
) {
641 case GL_SCISSOR_TEST
:
642 cctx
->attrib
.scissorTest
= GL_FALSE
;
645 pTexUnit
->enabled
&= ~XGL_TEXTURE_1D_BIT
;
648 pTexUnit
->enabled
&= ~XGL_TEXTURE_2D_BIT
;
651 pTexUnit
->enabled
&= ~XGL_TEXTURE_3D_BIT
;
653 case GL_TEXTURE_RECTANGLE_NV
:
654 pTexUnit
->enabled
&= ~XGL_TEXTURE_RECTANGLE_BIT
;
656 case GL_TEXTURE_CUBE_MAP_ARB
:
657 pTexUnit
->enabled
&= ~XGL_TEXTURE_CUBE_MAP_BIT
;
663 glDisable (pOp
->u
.enumeration
);
667 xglDisable (GLenum cap
)
671 gl
.glProc
= xglDisableProc
;
673 gl
.u
.enumeration
= cap
;
679 xglEnableProc (xglGLOpPtr pOp
)
681 xglTexUnitPtr pTexUnit
= &cctx
->attrib
.texUnits
[cctx
->activeTexUnit
];
683 switch (pOp
->u
.enumeration
) {
684 case GL_SCISSOR_TEST
:
685 cctx
->attrib
.scissorTest
= GL_TRUE
;
688 if (!cctx
->depthBits
)
690 case GL_STENCIL_TEST
:
691 if (!cctx
->stencilBits
)
694 pTexUnit
->enabled
|= XGL_TEXTURE_1D_BIT
;
697 pTexUnit
->enabled
|= XGL_TEXTURE_2D_BIT
;
700 pTexUnit
->enabled
|= XGL_TEXTURE_3D_BIT
;
702 case GL_TEXTURE_RECTANGLE_NV
:
703 pTexUnit
->enabled
|= XGL_TEXTURE_RECTANGLE_BIT
;
705 case GL_TEXTURE_CUBE_MAP_ARB
:
706 pTexUnit
->enabled
|= XGL_TEXTURE_CUBE_MAP_BIT
;
712 glEnable (pOp
->u
.enumeration
);
716 xglEnable (GLenum cap
)
720 gl
.glProc
= xglEnableProc
;
722 gl
.u
.enumeration
= cap
;
728 xglDeleteTexObj (xglTexObjPtr pTexObj
)
730 if (pTexObj
->pPixmap
)
732 ScreenPtr pScreen
= pTexObj
->pPixmap
->drawable
.pScreen
;
734 (*pScreen
->DestroyPixmap
) (pTexObj
->pPixmap
);
736 glitz_texture_object_destroy (pTexObj
->object
);
741 glDeleteTextures (1, &pTexObj
->name
);
746 pTexObj
->pPixmap
= NULL
;
747 pTexObj
->object
= NULL
;
751 xglRefTexObj (xglTexObjPtr pTexObj
)
760 xglUnrefTexObj (xglTexObjPtr pTexObj
)
769 xglDeleteTexObj (pTexObj
);
775 xglPushAttribProc (xglGLOpPtr pOp
)
777 xglGLAttributesPtr pAttrib
;
779 if (cctx
->nAttribStack
== cctx
->maxAttribStackDepth
)
781 xglRecordError (GL_STACK_OVERFLOW
);
785 pAttrib
= &cctx
->attribStack
[cctx
->nAttribStack
];
787 *pAttrib
= cctx
->attrib
;
788 pAttrib
->mask
= pOp
->u
.bitfield
;
790 if (pOp
->u
.bitfield
& GL_TEXTURE_BIT
)
794 for (i
= 0; i
< cctx
->maxTexUnits
; i
++)
796 xglRefTexObj (pAttrib
->texUnits
[i
].p1D
);
797 xglRefTexObj (pAttrib
->texUnits
[i
].p2D
);
798 xglRefTexObj (pAttrib
->texUnits
[i
].p3D
);
799 xglRefTexObj (pAttrib
->texUnits
[i
].pRect
);
800 xglRefTexObj (pAttrib
->texUnits
[i
].pCubeMap
);
804 cctx
->nAttribStack
++;
806 glPushAttrib (pOp
->u
.bitfield
);
810 xglPushAttrib (GLbitfield mask
)
814 gl
.glProc
= xglPushAttribProc
;
816 gl
.u
.bitfield
= mask
;
822 xglPopAttribProc (xglGLOpPtr pOp
)
824 xglGLAttributesPtr pAttrib
;
827 if (!cctx
->nAttribStack
)
829 xglRecordError (GL_STACK_UNDERFLOW
);
833 cctx
->nAttribStack
--;
835 pAttrib
= &cctx
->attribStack
[cctx
->nAttribStack
];
836 mask
= pAttrib
->mask
;
838 if (mask
& GL_COLOR_BUFFER_BIT
)
839 xglDrawBuffer (pAttrib
->drawBuffer
);
841 if (mask
& GL_PIXEL_MODE_BIT
)
842 xglReadBuffer (pAttrib
->readBuffer
);
844 if (mask
& GL_SCISSOR_BIT
)
846 xglScissor (pAttrib
->scissor
.x
,
848 pAttrib
->scissor
.width
,
849 pAttrib
->scissor
.height
);
851 if (pAttrib
->scissorTest
)
852 xglEnable (GL_SCISSOR_TEST
);
854 xglDisable (GL_SCISSOR_TEST
);
856 else if (mask
& GL_ENABLE_BIT
)
858 if (pAttrib
->scissorTest
)
859 xglEnable (GL_SCISSOR_TEST
);
861 xglDisable (GL_SCISSOR_TEST
);
864 if (mask
& GL_VIEWPORT_BIT
)
865 xglViewport (pAttrib
->viewport
.x
,
867 pAttrib
->viewport
.width
,
868 pAttrib
->viewport
.height
);
870 if (mask
& GL_TEXTURE_BIT
)
874 for (i
= 0; i
< cctx
->maxTexUnits
; i
++)
876 xglUnrefTexObj (cctx
->attrib
.texUnits
[i
].p1D
);
877 xglUnrefTexObj (cctx
->attrib
.texUnits
[i
].p2D
);
878 xglUnrefTexObj (cctx
->attrib
.texUnits
[i
].p3D
);
879 xglUnrefTexObj (cctx
->attrib
.texUnits
[i
].pRect
);
880 xglUnrefTexObj (cctx
->attrib
.texUnits
[i
].pCubeMap
);
882 cctx
->attrib
.texUnits
[i
] = pAttrib
->texUnits
[i
];
885 else if (mask
& GL_ENABLE_BIT
)
889 for (i
= 0; i
< cctx
->maxTexUnits
; i
++)
890 cctx
->attrib
.texUnits
[i
].enabled
= pAttrib
->texUnits
[i
].enabled
;
901 gl
.glProc
= xglPopAttribProc
;
907 xglActiveTextureBinding (GLenum target
)
909 xglTexObjPtr pTexObj
;
912 case GL_TEXTURE_BINDING_1D
:
913 pTexObj
= cctx
->attrib
.texUnits
[cctx
->activeTexUnit
].p1D
;
915 case GL_TEXTURE_BINDING_2D
:
916 pTexObj
= cctx
->attrib
.texUnits
[cctx
->activeTexUnit
].p2D
;
918 case GL_TEXTURE_BINDING_3D
:
919 pTexObj
= cctx
->attrib
.texUnits
[cctx
->activeTexUnit
].p3D
;
921 case GL_TEXTURE_BINDING_RECTANGLE_NV
:
922 pTexObj
= cctx
->attrib
.texUnits
[cctx
->activeTexUnit
].pRect
;
924 case GL_TEXTURE_BINDING_CUBE_MAP_ARB
:
925 pTexObj
= cctx
->attrib
.texUnits
[cctx
->activeTexUnit
].pCubeMap
;
937 #define DOUBLE_TO_BOOLEAN(X) ((X) ? GL_TRUE : GL_FALSE)
938 #define INT_TO_BOOLEAN(I) ((I) ? GL_TRUE : GL_FALSE)
939 #define ENUM_TO_BOOLEAN(E) ((E) ? GL_TRUE : GL_FALSE)
942 xglGetBooleanv (GLenum pname
,
946 case GL_CURRENT_RASTER_POSITION
:
950 glGetDoublev (GL_CURRENT_RASTER_POSITION
, v
);
952 params
[0] = DOUBLE_TO_BOOLEAN (v
[0] - (GLdouble
) cctx
->drawXoff
);
953 params
[1] = DOUBLE_TO_BOOLEAN (v
[1] - (GLdouble
) cctx
->drawYoff
);
954 params
[2] = DOUBLE_TO_BOOLEAN (v
[2]);
955 params
[3] = DOUBLE_TO_BOOLEAN (v
[3]);
957 case GL_DOUBLEBUFFER
:
958 params
[0] = cctx
->doubleBuffer
;
961 params
[0] = INT_TO_BOOLEAN (cctx
->depthBits
);
963 case GL_STENCIL_BITS
:
964 params
[0] = INT_TO_BOOLEAN (cctx
->stencilBits
);
967 params
[0] = ENUM_TO_BOOLEAN (cctx
->attrib
.drawBuffer
);
970 params
[0] = ENUM_TO_BOOLEAN (cctx
->attrib
.readBuffer
);
973 params
[0] = INT_TO_BOOLEAN (cctx
->attrib
.scissor
.x
);
974 params
[1] = INT_TO_BOOLEAN (cctx
->attrib
.scissor
.y
);
975 params
[2] = INT_TO_BOOLEAN (cctx
->attrib
.scissor
.width
);
976 params
[3] = INT_TO_BOOLEAN (cctx
->attrib
.scissor
.height
);
978 case GL_SCISSOR_TEST
:
979 params
[0] = cctx
->attrib
.scissorTest
;
982 params
[0] = INT_TO_BOOLEAN (cctx
->attrib
.viewport
.x
);
983 params
[1] = INT_TO_BOOLEAN (cctx
->attrib
.viewport
.y
);
984 params
[2] = INT_TO_BOOLEAN (cctx
->attrib
.viewport
.width
);
985 params
[3] = INT_TO_BOOLEAN (cctx
->attrib
.viewport
.height
);
987 case GL_TEXTURE_BINDING_1D
:
988 case GL_TEXTURE_BINDING_2D
:
989 case GL_TEXTURE_BINDING_3D
:
990 case GL_TEXTURE_BINDING_RECTANGLE_NV
:
991 case GL_TEXTURE_BINDING_CUBE_MAP_ARB
:
992 /* should be safe to fall-through here */
994 glGetBooleanv (pname
, params
);
998 #define INT_TO_DOUBLE(I) ((GLdouble) (I))
999 #define ENUM_TO_DOUBLE(E) ((GLdouble) (E))
1000 #define BOOLEAN_TO_DOUBLE(B) ((B) ? 1.0F : 0.0F)
1003 xglGetDoublev (GLenum pname
,
1007 case GL_CURRENT_RASTER_POSITION
:
1008 glGetDoublev (GL_CURRENT_RASTER_POSITION
, params
);
1010 params
[0] -= (GLdouble
) cctx
->drawXoff
;
1011 params
[1] -= (GLdouble
) cctx
->drawYoff
;
1013 case GL_DOUBLEBUFFER
:
1014 params
[0] = BOOLEAN_TO_DOUBLE (cctx
->doubleBuffer
);
1017 params
[0] = INT_TO_DOUBLE (cctx
->depthBits
);
1019 case GL_STENCIL_BITS
:
1020 params
[0] = INT_TO_DOUBLE (cctx
->stencilBits
);
1022 case GL_DRAW_BUFFER
:
1023 params
[0] = ENUM_TO_DOUBLE (cctx
->attrib
.drawBuffer
);
1025 case GL_READ_BUFFER
:
1026 params
[0] = ENUM_TO_DOUBLE (cctx
->attrib
.readBuffer
);
1028 case GL_SCISSOR_BOX
:
1029 params
[0] = cctx
->attrib
.scissor
.x
;
1030 params
[1] = cctx
->attrib
.scissor
.y
;
1031 params
[2] = cctx
->attrib
.scissor
.width
;
1032 params
[3] = cctx
->attrib
.scissor
.height
;
1034 case GL_SCISSOR_TEST
:
1035 params
[0] = BOOLEAN_TO_DOUBLE (cctx
->attrib
.scissorTest
);
1038 params
[0] = cctx
->attrib
.viewport
.x
;
1039 params
[1] = cctx
->attrib
.viewport
.y
;
1040 params
[2] = cctx
->attrib
.viewport
.width
;
1041 params
[3] = cctx
->attrib
.viewport
.height
;
1043 case GL_TEXTURE_BINDING_1D
:
1044 case GL_TEXTURE_BINDING_2D
:
1045 case GL_TEXTURE_BINDING_3D
:
1046 case GL_TEXTURE_BINDING_RECTANGLE_NV
:
1047 case GL_TEXTURE_BINDING_CUBE_MAP_ARB
:
1048 params
[0] = xglActiveTextureBinding (pname
);
1050 case GL_MAX_TEXTURE_UNITS_ARB
:
1051 params
[0] = cctx
->maxTexUnits
;
1053 case GL_MAX_ATTRIB_STACK_DEPTH
:
1054 params
[0] = cctx
->maxAttribStackDepth
;
1057 glGetDoublev (pname
, params
);
1061 #define INT_TO_FLOAT(I) ((GLfloat) (I))
1062 #define ENUM_TO_FLOAT(E) ((GLfloat) (E))
1063 #define BOOLEAN_TO_FLOAT(B) ((B) ? 1.0F : 0.0F)
1066 xglGetFloatv (GLenum pname
,
1070 case GL_CURRENT_RASTER_POSITION
:
1071 glGetFloatv (GL_CURRENT_RASTER_POSITION
, params
);
1073 params
[0] -= (GLfloat
) cctx
->drawXoff
;
1074 params
[1] -= (GLfloat
) cctx
->drawYoff
;
1076 case GL_DOUBLEBUFFER
:
1077 params
[0] = BOOLEAN_TO_FLOAT (cctx
->doubleBuffer
);
1080 params
[0] = INT_TO_FLOAT (cctx
->depthBits
);
1082 case GL_STENCIL_BITS
:
1083 params
[0] = INT_TO_FLOAT (cctx
->stencilBits
);
1085 case GL_DRAW_BUFFER
:
1086 params
[0] = ENUM_TO_FLOAT (cctx
->attrib
.drawBuffer
);
1088 case GL_READ_BUFFER
:
1089 params
[0] = ENUM_TO_FLOAT (cctx
->attrib
.readBuffer
);
1091 case GL_SCISSOR_BOX
:
1092 params
[0] = cctx
->attrib
.scissor
.x
;
1093 params
[1] = cctx
->attrib
.scissor
.y
;
1094 params
[2] = cctx
->attrib
.scissor
.width
;
1095 params
[3] = cctx
->attrib
.scissor
.height
;
1097 case GL_SCISSOR_TEST
:
1098 params
[0] = BOOLEAN_TO_FLOAT (cctx
->attrib
.scissorTest
);
1101 params
[0] = cctx
->attrib
.viewport
.x
;
1102 params
[1] = cctx
->attrib
.viewport
.y
;
1103 params
[2] = cctx
->attrib
.viewport
.width
;
1104 params
[3] = cctx
->attrib
.viewport
.height
;
1106 case GL_TEXTURE_BINDING_1D
:
1107 case GL_TEXTURE_BINDING_2D
:
1108 case GL_TEXTURE_BINDING_3D
:
1109 case GL_TEXTURE_BINDING_RECTANGLE_NV
:
1110 case GL_TEXTURE_BINDING_CUBE_MAP_ARB
:
1111 params
[0] = xglActiveTextureBinding (pname
);
1113 case GL_MAX_TEXTURE_UNITS_ARB
:
1114 params
[0] = cctx
->maxTexUnits
;
1116 case GL_MAX_ATTRIB_STACK_DEPTH
:
1117 params
[0] = cctx
->maxAttribStackDepth
;
1120 glGetFloatv (pname
, params
);
1124 #define ENUM_TO_INT(E) ((GLint) (E))
1125 #define BOOLEAN_TO_INT(B) ((GLint) (B))
1128 xglGetIntegerv (GLenum pname
,
1132 case GL_CURRENT_RASTER_POSITION
:
1133 glGetIntegerv (GL_CURRENT_RASTER_POSITION
, params
);
1135 params
[0] -= (GLint
) cctx
->drawXoff
;
1136 params
[1] -= (GLint
) cctx
->drawYoff
;
1138 case GL_DOUBLEBUFFER
:
1139 params
[0] = BOOLEAN_TO_INT (cctx
->doubleBuffer
);
1142 params
[0] = cctx
->depthBits
;
1144 case GL_STENCIL_BITS
:
1145 params
[0] = cctx
->stencilBits
;
1147 case GL_DRAW_BUFFER
:
1148 params
[0] = ENUM_TO_INT (cctx
->attrib
.drawBuffer
);
1150 case GL_READ_BUFFER
:
1151 params
[0] = ENUM_TO_INT (cctx
->attrib
.readBuffer
);
1153 case GL_SCISSOR_BOX
:
1154 params
[0] = cctx
->attrib
.scissor
.x
;
1155 params
[1] = cctx
->attrib
.scissor
.y
;
1156 params
[2] = cctx
->attrib
.scissor
.width
;
1157 params
[3] = cctx
->attrib
.scissor
.height
;
1159 case GL_SCISSOR_TEST
:
1160 params
[0] = BOOLEAN_TO_INT (cctx
->attrib
.scissorTest
);
1163 params
[0] = cctx
->attrib
.viewport
.x
;
1164 params
[1] = cctx
->attrib
.viewport
.y
;
1165 params
[2] = cctx
->attrib
.viewport
.width
;
1166 params
[3] = cctx
->attrib
.viewport
.height
;
1168 case GL_TEXTURE_BINDING_1D
:
1169 case GL_TEXTURE_BINDING_2D
:
1170 case GL_TEXTURE_BINDING_3D
:
1171 case GL_TEXTURE_BINDING_RECTANGLE_NV
:
1172 case GL_TEXTURE_BINDING_CUBE_MAP_ARB
:
1173 params
[0] = xglActiveTextureBinding (pname
);
1175 case GL_MAX_TEXTURE_UNITS_ARB
:
1176 params
[0] = cctx
->maxTexUnits
;
1178 case GL_MAX_ATTRIB_STACK_DEPTH
:
1179 params
[0] = cctx
->maxAttribStackDepth
;
1182 glGetIntegerv (pname
, params
);
1187 xglIsEnabled (GLenum cap
)
1190 case GL_SCISSOR_TEST
:
1191 return cctx
->attrib
.scissorTest
;
1193 return glIsEnabled (cap
);
1200 GLenum error
= cctx
->errorValue
;
1202 if (error
!= GL_NO_ERROR
)
1204 cctx
->errorValue
= GL_NO_ERROR
;
1208 return glGetError ();
1211 static const GLubyte
*
1212 xglGetString (GLenum name
)
1216 if (!cctx
->versionString
)
1218 static char *version
= "1.2 (%s)";
1219 char *nativeVersion
= (char *) glGetString (GL_VERSION
);
1221 cctx
->versionString
= xalloc (strlen (version
) +
1222 strlen (nativeVersion
));
1223 if (cctx
->versionString
)
1224 sprintf (cctx
->versionString
, version
, nativeVersion
);
1226 return (GLubyte
*) cctx
->versionString
;
1228 return glGetString (name
);
1233 xglGenTextures (GLsizei n
,
1236 xglTexObjPtr pTexObj
;
1239 name
= xglHashFindFreeKeyBlock (cctx
->shared
->texObjects
, n
);
1241 glGenTextures (n
, textures
);
1245 pTexObj
= xalloc (sizeof (xglTexObjRec
));
1248 pTexObj
->key
= name
;
1249 pTexObj
->name
= *textures
;
1250 pTexObj
->pPixmap
= NULL
;
1251 pTexObj
->object
= NULL
;
1252 pTexObj
->refcnt
= 1;
1254 xglHashInsert (cctx
->shared
->texObjects
, name
, pTexObj
);
1258 xglRecordError (GL_OUT_OF_MEMORY
);
1261 *textures
++ = name
++;
1266 xglBindTextureProc (xglGLOpPtr pOp
)
1268 xglTexObjPtr
*ppTexObj
;
1270 switch (pOp
->u
.bind_texture
.target
) {
1272 ppTexObj
= &cctx
->attrib
.texUnits
[cctx
->activeTexUnit
].p1D
;
1275 ppTexObj
= &cctx
->attrib
.texUnits
[cctx
->activeTexUnit
].p2D
;
1278 ppTexObj
= &cctx
->attrib
.texUnits
[cctx
->activeTexUnit
].p3D
;
1280 case GL_TEXTURE_RECTANGLE_NV
:
1281 ppTexObj
= &cctx
->attrib
.texUnits
[cctx
->activeTexUnit
].pRect
;
1283 case GL_TEXTURE_CUBE_MAP_ARB
:
1284 ppTexObj
= &cctx
->attrib
.texUnits
[cctx
->activeTexUnit
].pCubeMap
;
1287 xglRecordError (GL_INVALID_ENUM
);
1291 if (pOp
->u
.bind_texture
.texture
)
1293 if (!*ppTexObj
|| pOp
->u
.bind_texture
.texture
!= (*ppTexObj
)->key
)
1295 xglTexObjPtr pTexObj
;
1297 pTexObj
= (xglTexObjPtr
)
1298 xglHashLookup (cctx
->shared
->texObjects
,
1299 pOp
->u
.bind_texture
.texture
);
1302 pTexObj
= xalloc (sizeof (xglTexObjRec
));
1305 xglRecordError (GL_OUT_OF_MEMORY
);
1309 pTexObj
->key
= pOp
->u
.bind_texture
.texture
;
1310 pTexObj
->pPixmap
= NULL
;
1311 pTexObj
->object
= NULL
;
1312 pTexObj
->refcnt
= 1;
1314 glGenTextures (1, &pTexObj
->name
);
1316 xglHashInsert (cctx
->shared
->texObjects
,
1317 pOp
->u
.bind_texture
.texture
,
1321 xglRefTexObj (pTexObj
);
1322 xglUnrefTexObj (*ppTexObj
);
1323 *ppTexObj
= pTexObj
;
1325 glBindTexture (pOp
->u
.bind_texture
.target
, pTexObj
->name
);
1330 xglUnrefTexObj (*ppTexObj
);
1333 glBindTexture (pOp
->u
.bind_texture
.target
, 0);
1338 xglBindTexture (GLenum target
,
1343 gl
.glProc
= xglBindTextureProc
;
1345 gl
.u
.bind_texture
.target
= target
;
1346 gl
.u
.bind_texture
.texture
= texture
;
1352 xglSetupTextures (void)
1354 xglGLContextPtr pContext
= cctx
;
1355 xglTexUnitPtr pTexUnit
;
1356 xglTexObjPtr pTexObj
[XGL_MAX_TEXTURE_UNITS
];
1357 int i
, activeTexUnit
;
1359 for (i
= 0; i
< pContext
->maxTexUnits
; i
++)
1363 pTexUnit
= &pContext
->attrib
.texUnits
[i
];
1364 if (pTexUnit
->enabled
)
1366 if (pTexUnit
->enabled
& XGL_TEXTURE_RECTANGLE_BIT
)
1367 pTexObj
[i
] = pTexUnit
->pRect
;
1368 else if (pTexUnit
->enabled
& XGL_TEXTURE_2D_BIT
)
1369 pTexObj
[i
] = pTexUnit
->p2D
;
1371 if (pTexObj
[i
] && pTexObj
[i
]->pPixmap
)
1373 if (!xglSyncSurface (&pTexObj
[i
]->pPixmap
->drawable
))
1381 if (pContext
!= cctx
)
1383 XGL_SCREEN_PRIV (pContext
->pDrawBuffer
->pGC
->pScreen
);
1385 glitz_drawable_finish (pScreenPriv
->drawable
);
1387 xglSetCurrentContext (pContext
);
1390 activeTexUnit
= cctx
->activeTexUnit
;
1391 for (i
= 0; i
< pContext
->maxTexUnits
; i
++)
1395 if (i
!= activeTexUnit
)
1397 cctx
->ActiveTextureARB (GL_TEXTURE0_ARB
+ i
);
1400 glitz_context_bind_texture (cctx
->context
, pTexObj
[i
]->object
);
1404 if (activeTexUnit
!= cctx
->activeTexUnit
)
1405 cctx
->ActiveTextureARB (cctx
->activeTexUnit
);
1409 xglAreTexturesResident (GLsizei n
,
1410 const GLuint
*textures
,
1411 GLboolean
*residences
)
1413 GLboolean allResident
= GL_TRUE
;
1418 xglRecordError (GL_INVALID_VALUE
);
1422 if (!textures
|| !residences
)
1425 for (i
= 0; i
< n
; i
++)
1427 xglTexObjPtr pTexObj
;
1432 xglRecordError (GL_INVALID_VALUE
);
1436 pTexObj
= (xglTexObjPtr
) xglHashLookup (cctx
->shared
->texObjects
,
1440 xglRecordError (GL_INVALID_VALUE
);
1444 if (pTexObj
->name
== 0 ||
1445 glAreTexturesResident (1, &pTexObj
->name
, &resident
))
1448 residences
[i
] = GL_TRUE
;
1454 allResident
= GL_FALSE
;
1456 for (j
= 0; j
< i
; j
++)
1457 residences
[j
] = GL_TRUE
;
1459 residences
[i
] = GL_FALSE
;
1467 xglDeleteTextures (GLsizei n
,
1468 const GLuint
*textures
)
1470 xglTexObjPtr pTexObj
;
1477 pTexObj
= (xglTexObjPtr
) xglHashLookup (cctx
->shared
->texObjects
,
1481 xglDeleteTexObj (pTexObj
);
1482 xglUnrefTexObj (pTexObj
);
1483 xglHashRemove (cctx
->shared
->texObjects
, *textures
);
1490 xglIsTexture (GLuint texture
)
1492 xglTexObjPtr pTexObj
;
1497 pTexObj
= (xglTexObjPtr
) xglHashLookup (cctx
->shared
->texObjects
, texture
);
1505 xglPrioritizeTextures (GLsizei n
,
1506 const GLuint
*textures
,
1507 const GLclampf
*priorities
)
1509 xglTexObjPtr pTexObj
;
1514 xglRecordError (GL_INVALID_VALUE
);
1521 for (i
= 0; i
< n
; i
++)
1526 pTexObj
= (xglTexObjPtr
) xglHashLookup (cctx
->shared
->texObjects
,
1528 if (pTexObj
&& pTexObj
->name
)
1529 glPrioritizeTextures (1, &pTexObj
->name
, &priorities
[i
]);
1533 static glitz_texture_filter_t
1534 xglTextureFilter (GLenum param
)
1538 return GLITZ_TEXTURE_FILTER_LINEAR
;
1541 return GLITZ_TEXTURE_FILTER_NEAREST
;
1545 static glitz_texture_wrap_t
1546 xglTextureWrap (GLenum param
)
1549 case GL_CLAMP_TO_EDGE
:
1550 return GLITZ_TEXTURE_WRAP_CLAMP_TO_EDGE
;
1551 case GL_CLAMP_TO_BORDER
:
1552 return GLITZ_TEXTURE_WRAP_CLAMP_TO_BORDER
;
1554 return GLITZ_TEXTURE_WRAP_REPEAT
;
1555 case GL_MIRRORED_REPEAT
:
1556 return GLITZ_TEXTURE_WRAP_MIRRORED_REPEAT
;
1559 return GLITZ_TEXTURE_WRAP_CLAMP
;
1564 xglTexParameterfvProc (xglGLOpPtr pOp
)
1566 xglTexObjPtr pTexObj
;
1568 glTexParameterfv (pOp
->u
.tex_parameter_fv
.target
,
1569 pOp
->u
.tex_parameter_fv
.pname
,
1570 pOp
->u
.tex_parameter_fv
.params
);
1572 switch (pOp
->u
.tex_parameter_fv
.target
) {
1574 pTexObj
= cctx
->attrib
.texUnits
[cctx
->activeTexUnit
].p2D
;
1576 case GL_TEXTURE_RECTANGLE_NV
:
1577 pTexObj
= cctx
->attrib
.texUnits
[cctx
->activeTexUnit
].pRect
;
1584 if (pTexObj
&& pTexObj
->pPixmap
)
1586 GLfloat
*params
= pOp
->u
.tex_parameter_fv
.params
;
1588 switch (pOp
->u
.tex_parameter_fv
.pname
) {
1589 case GL_TEXTURE_MIN_FILTER
:
1590 glitz_texture_object_set_filter (pTexObj
->object
,
1591 GLITZ_TEXTURE_FILTER_TYPE_MIN
,
1592 xglTextureFilter (params
[0]));
1594 case GL_TEXTURE_MAG_FILTER
:
1595 glitz_texture_object_set_filter (pTexObj
->object
,
1596 GLITZ_TEXTURE_FILTER_TYPE_MAG
,
1597 xglTextureFilter (params
[0]));
1599 case GL_TEXTURE_WRAP_S
:
1600 glitz_texture_object_set_wrap (pTexObj
->object
,
1601 GLITZ_TEXTURE_WRAP_TYPE_S
,
1602 xglTextureWrap (params
[0]));
1604 case GL_TEXTURE_WRAP_T
:
1605 glitz_texture_object_set_wrap (pTexObj
->object
,
1606 GLITZ_TEXTURE_WRAP_TYPE_T
,
1607 xglTextureWrap (params
[0]));
1609 case GL_TEXTURE_BORDER_COLOR
: {
1610 glitz_color_t color
;
1612 color
.red
= params
[0] * 0xffff;
1613 color
.green
= params
[1] * 0xffff;
1614 color
.blue
= params
[2] * 0xffff;
1615 color
.alpha
= params
[3] * 0xffff;
1617 glitz_texture_object_set_border_color (pTexObj
->object
, &color
);
1626 xglTexParameterfv (GLenum target
,
1628 const GLfloat
*params
)
1632 gl
.glProc
= xglTexParameterfvProc
;
1634 gl
.u
.tex_parameter_fv
.target
= target
;
1635 gl
.u
.tex_parameter_fv
.pname
= pname
;
1638 case GL_TEXTURE_BORDER_COLOR
:
1639 gl
.u
.tex_parameter_fv
.params
[3] = params
[3];
1640 gl
.u
.tex_parameter_fv
.params
[2] = params
[2];
1641 gl
.u
.tex_parameter_fv
.params
[1] = params
[1];
1644 gl
.u
.tex_parameter_fv
.params
[0] = params
[0];
1652 xglTexParameteriv (GLenum target
,
1654 const GLint
*params
)
1658 gl
.glProc
= xglTexParameterfvProc
;
1660 gl
.u
.tex_parameter_fv
.target
= target
;
1661 gl
.u
.tex_parameter_fv
.pname
= pname
;
1664 case GL_TEXTURE_BORDER_COLOR
:
1665 gl
.u
.tex_parameter_fv
.params
[3] = (GLfloat
) params
[3] / INT_MAX
;
1666 gl
.u
.tex_parameter_fv
.params
[2] = (GLfloat
) params
[2] / INT_MAX
;
1667 gl
.u
.tex_parameter_fv
.params
[1] = (GLfloat
) params
[1] / INT_MAX
;
1668 gl
.u
.tex_parameter_fv
.params
[0] = (GLfloat
) params
[0] / INT_MAX
;
1671 gl
.u
.tex_parameter_fv
.params
[0] = params
[0];
1679 xglTexParameterf (GLenum target
,
1683 xglTexParameterfv (target
, pname
, (const GLfloat
*) ¶m
);
1687 xglTexParameteri (GLenum target
,
1691 xglTexParameteriv (target
, pname
, (const GLint
*) ¶m
);
1695 xglGetTexLevelParameterfv (GLenum target
,
1700 xglTexObjPtr pTexObj
;
1704 pTexObj
= cctx
->attrib
.texUnits
[cctx
->activeTexUnit
].p2D
;
1706 case GL_TEXTURE_RECTANGLE_NV
:
1707 pTexObj
= cctx
->attrib
.texUnits
[cctx
->activeTexUnit
].pRect
;
1714 if (pTexObj
&& pTexObj
->pPixmap
)
1716 glitz_context_bind_texture (cctx
->context
, pTexObj
->object
);
1718 glGetTexLevelParameterfv (target
, level
, pname
, params
);
1719 glBindTexture (target
, pTexObj
->name
);
1722 glGetTexLevelParameterfv (target
, level
, pname
, params
);
1726 xglGetTexLevelParameteriv (GLenum target
,
1731 xglTexObjPtr pTexObj
;
1735 pTexObj
= cctx
->attrib
.texUnits
[cctx
->activeTexUnit
].p2D
;
1737 case GL_TEXTURE_RECTANGLE_NV
:
1738 pTexObj
= cctx
->attrib
.texUnits
[cctx
->activeTexUnit
].pRect
;
1745 if (pTexObj
&& pTexObj
->pPixmap
)
1747 glitz_context_bind_texture (cctx
->context
, pTexObj
->object
);
1749 glGetTexLevelParameteriv (target
, level
, pname
, params
);
1750 glBindTexture (target
, pTexObj
->name
);
1753 glGetTexLevelParameteriv (target
, level
, pname
, params
);
1757 xglGenLists (GLsizei range
)
1759 xglDisplayListPtr pDisplayList
;
1762 first
= xglHashFindFreeKeyBlock (cctx
->shared
->displayLists
, range
);
1765 for (name
= first
; range
--; name
++)
1767 pDisplayList
= xglCreateList ();
1770 xglHashInsert (cctx
->shared
->displayLists
, name
, pDisplayList
);
1774 xglRecordError (GL_OUT_OF_MEMORY
);
1782 xglNewList (GLuint list
,
1787 xglRecordError (GL_INVALID_VALUE
);
1793 xglRecordError (GL_INVALID_OPERATION
);
1797 cctx
->pList
= xglCreateList ();
1800 xglRecordError (GL_OUT_OF_MEMORY
);
1805 cctx
->listMode
= mode
;
1807 xglStartList (XGL_LIST_OP_CALLS
, mode
);
1813 xglDisplayListPtr pDisplayList
;
1817 xglRecordError (GL_INVALID_OPERATION
);
1823 pDisplayList
= (xglDisplayListPtr
)
1824 xglHashLookup (cctx
->shared
->displayLists
, cctx
->list
);
1827 xglHashRemove (cctx
->shared
->displayLists
, cctx
->list
);
1828 xglDestroyList (pDisplayList
);
1831 xglHashInsert (cctx
->shared
->displayLists
, cctx
->list
, cctx
->pList
);
1837 xglDrawList (GLuint list
)
1840 BoxRec scissor
, box
;
1844 XGL_GLX_DRAW_PROLOGUE (pBox
, nBox
, &scissor
);
1848 XGL_GLX_DRAW_BOX (&box
, pBox
);
1852 if (cctx
->attrib
.scissorTest
)
1853 XGL_GLX_INTERSECT_BOX (&box
, &scissor
);
1855 if (box
.x1
< box
.x2
&& box
.y1
< box
.y2
)
1857 XGL_GLX_SET_SCISSOR_BOX (&box
);
1861 XGL_GLX_DRAW_DAMAGE (&box
, ®ion
);
1867 xglCallDisplayList (GLuint list
,
1870 if (nesting
> cctx
->maxListNesting
)
1875 xglRecordError (GL_INVALID_VALUE
);
1881 if (!xglResizeList (cctx
->pList
, cctx
->pList
->nOp
+ 1))
1883 xglRecordError (GL_OUT_OF_MEMORY
);
1887 cctx
->pList
->pOp
[cctx
->pList
->nOp
].type
= XGL_LIST_OP_LIST
;
1888 cctx
->pList
->pOp
[cctx
->pList
->nOp
].u
.list
= list
;
1893 xglDisplayListPtr pDisplayList
;
1895 pDisplayList
= (xglDisplayListPtr
)
1896 xglHashLookup (cctx
->shared
->displayLists
, list
);
1899 xglListOpPtr pOp
= pDisplayList
->pOp
;
1900 int nOp
= pDisplayList
->nOp
;
1904 switch (pOp
->type
) {
1905 case XGL_LIST_OP_CALLS
:
1906 glCallList (pOp
->u
.list
);
1908 case XGL_LIST_OP_DRAW
:
1909 xglDrawList (pOp
->u
.list
);
1911 case XGL_LIST_OP_GL
:
1912 (*pOp
->u
.gl
->glProc
) (pOp
->u
.gl
);
1914 case XGL_LIST_OP_LIST
:
1915 xglCallDisplayList (pOp
->u
.list
, nesting
+ 1);
1926 xglCallList (GLuint list
)
1928 xglCallDisplayList (list
, 1);
1932 xglCallLists (GLsizei n
,
1934 const GLvoid
*lists
)
1939 glGetIntegerv (GL_LIST_BASE
, &base
);
1941 for (i
= 0; i
< n
; i
++)
1945 list
= (GLuint
) *(((GLbyte
*) lists
) + n
);
1947 case GL_UNSIGNED_BYTE
:
1948 list
= (GLuint
) *(((GLubyte
*) lists
) + n
);
1951 list
= (GLuint
) *(((GLshort
*) lists
) + n
);
1953 case GL_UNSIGNED_SHORT
:
1954 list
= (GLuint
) *(((GLushort
*) lists
) + n
);
1957 list
= (GLuint
) *(((GLint
*) lists
) + n
);
1959 case GL_UNSIGNED_INT
:
1960 list
= (GLuint
) *(((GLuint
*) lists
) + n
);
1963 list
= (GLuint
) *(((GLfloat
*) lists
) + n
);
1967 GLubyte
*ubptr
= ((GLubyte
*) lists
) + 2 * n
;
1968 list
= (GLuint
) *ubptr
* 256 + (GLuint
) *(ubptr
+ 1);
1972 GLubyte
*ubptr
= ((GLubyte
*) lists
) + 3 * n
;
1973 list
= (GLuint
) * ubptr
* 65536
1974 + (GLuint
) * (ubptr
+ 1) * 256
1975 + (GLuint
) * (ubptr
+ 2);
1979 GLubyte
*ubptr
= ((GLubyte
*) lists
) + 4 * n
;
1980 list
= (GLuint
) * ubptr
* 16777216
1981 + (GLuint
) * (ubptr
+ 1) * 65536
1982 + (GLuint
) * (ubptr
+ 2) * 256
1983 + (GLuint
) * (ubptr
+ 3);
1986 xglRecordError (GL_INVALID_ENUM
);
1990 xglCallDisplayList (base
+ list
, 1);
1995 xglDeleteLists (GLuint list
,
1998 xglDisplayListPtr pDisplayList
;
2003 xglRecordError (GL_INVALID_VALUE
);
2007 for (i
= list
; i
< list
+ range
; i
++)
2012 pDisplayList
= (xglDisplayListPtr
)
2013 xglHashLookup (cctx
->shared
->displayLists
, i
);
2016 xglHashRemove (cctx
->shared
->displayLists
, i
);
2017 xglDestroyList (pDisplayList
);
2023 xglIsList (GLuint list
)
2025 xglDisplayListPtr pDisplayList
;
2030 pDisplayList
= (xglDisplayListPtr
)
2031 xglHashLookup (cctx
->shared
->displayLists
, list
);
2043 if (cctx
&& cctx
->pDrawBuffer
->pDrawable
)
2045 xglGLBufferPtr pBuffer
= cctx
->pDrawBuffer
;
2047 if (REGION_NOTEMPTY (pBuffer
->pDrawable
->pScreen
, &pBuffer
->damage
))
2049 XGL_DRAWABLE_PIXMAP_PRIV (pBuffer
->pDrawable
);
2051 DamageDamageRegion (pBuffer
->pDrawable
, &pBuffer
->damage
);
2052 REGION_EMPTY (pBuffer
->pDrawable
->pScreen
, &pBuffer
->damage
);
2054 pPixmapPriv
->damageBox
= miEmptyBox
;
2064 if (cctx
&& cctx
->pDrawBuffer
->pDrawable
)
2066 xglGLBufferPtr pBuffer
= cctx
->pDrawBuffer
;
2068 if (REGION_NOTEMPTY (pBuffer
->pDrawable
->pScreen
, &pBuffer
->damage
))
2070 XGL_DRAWABLE_PIXMAP_PRIV (pBuffer
->pDrawable
);
2072 DamageDamageRegion (pBuffer
->pDrawable
, &pBuffer
->damage
);
2073 REGION_EMPTY (pBuffer
->pDrawable
->pScreen
, &pBuffer
->damage
);
2075 pPixmapPriv
->damageBox
= miEmptyBox
;
2081 xglClear (GLbitfield mask
)
2088 xglStartList (XGL_LIST_OP_DRAW
, GL_COMPILE
);
2092 mode
= cctx
->listMode
;
2095 mode
= GL_COMPILE_AND_EXECUTE
;
2097 if (mode
== GL_COMPILE_AND_EXECUTE
)
2100 BoxRec scissor
, box
;
2104 XGL_GLX_DRAW_PROLOGUE_WITHOUT_TEXTURES (pBox
, nBox
, &scissor
);
2108 XGL_GLX_DRAW_BOX (&box
, pBox
);
2112 if (cctx
->attrib
.scissorTest
)
2113 XGL_GLX_INTERSECT_BOX (&box
, &scissor
);
2115 if (box
.x1
< box
.x2
&& box
.y1
< box
.y2
)
2117 XGL_GLX_SET_SCISSOR_BOX (&box
);
2121 if (mask
& GL_COLOR_BUFFER_BIT
)
2122 XGL_GLX_DRAW_DAMAGE (&box
, ®ion
);
2128 xglStartList (XGL_LIST_OP_CALLS
, cctx
->listMode
);
2132 xglAccum (GLenum op
,
2135 if (op
== GL_RETURN
)
2142 xglStartList (XGL_LIST_OP_DRAW
, GL_COMPILE
);
2143 glAccum (GL_RETURN
, value
);
2146 listMode
= cctx
->listMode
;
2149 listMode
= GL_COMPILE_AND_EXECUTE
;
2151 if (listMode
== GL_COMPILE_AND_EXECUTE
)
2154 BoxRec scissor
, box
;
2158 XGL_GLX_DRAW_PROLOGUE_WITHOUT_TEXTURES (pBox
, nBox
, &scissor
);
2162 XGL_GLX_DRAW_BOX (&box
, pBox
);
2166 if (cctx
->attrib
.scissorTest
)
2167 XGL_GLX_INTERSECT_BOX (&box
, &scissor
);
2169 if (box
.x1
< box
.x2
&& box
.y1
< box
.y2
)
2171 XGL_GLX_SET_SCISSOR_BOX (&box
);
2173 glAccum (GL_RETURN
, value
);
2175 XGL_GLX_DRAW_DAMAGE (&box
, ®ion
);
2181 xglStartList (XGL_LIST_OP_CALLS
, cctx
->listMode
);
2184 glAccum (op
, value
);
2188 xglDrawArrays (GLenum mode
,
2197 xglStartList (XGL_LIST_OP_DRAW
, GL_COMPILE
);
2198 glDrawArrays (mode
, first
, count
);
2201 listMode
= cctx
->listMode
;
2204 listMode
= GL_COMPILE_AND_EXECUTE
;
2206 if (listMode
== GL_COMPILE_AND_EXECUTE
)
2209 BoxRec scissor
, box
;
2213 XGL_GLX_DRAW_PROLOGUE (pBox
, nBox
, &scissor
);
2217 XGL_GLX_DRAW_BOX (&box
, pBox
);
2221 if (cctx
->attrib
.scissorTest
)
2222 XGL_GLX_INTERSECT_BOX (&box
, &scissor
);
2224 if (box
.x1
< box
.x2
&& box
.y1
< box
.y2
)
2226 XGL_GLX_SET_SCISSOR_BOX (&box
);
2228 glDrawArrays (mode
, first
, count
);
2230 XGL_GLX_DRAW_DAMAGE (&box
, ®ion
);
2236 xglStartList (XGL_LIST_OP_CALLS
, cctx
->listMode
);
2240 xglDrawElements (GLenum mode
,
2243 const GLvoid
*indices
)
2250 xglStartList (XGL_LIST_OP_DRAW
, GL_COMPILE
);
2251 glDrawElements (mode
, count
, type
, indices
);
2254 listMode
= cctx
->listMode
;
2257 listMode
= GL_COMPILE_AND_EXECUTE
;
2259 if (listMode
== GL_COMPILE_AND_EXECUTE
)
2262 BoxRec scissor
, box
;
2266 XGL_GLX_DRAW_PROLOGUE (pBox
, nBox
, &scissor
);
2270 XGL_GLX_DRAW_BOX (&box
, pBox
);
2274 if (cctx
->attrib
.scissorTest
)
2275 XGL_GLX_INTERSECT_BOX (&box
, &scissor
);
2277 if (box
.x1
< box
.x2
&& box
.y1
< box
.y2
)
2279 XGL_GLX_SET_SCISSOR_BOX (&box
);
2281 glDrawElements (mode
, count
, type
, indices
);
2283 XGL_GLX_DRAW_DAMAGE (&box
, ®ion
);
2289 xglStartList (XGL_LIST_OP_CALLS
, cctx
->listMode
);
2293 xglDrawPixels (GLsizei width
,
2297 const GLvoid
*pixels
)
2304 xglStartList (XGL_LIST_OP_DRAW
, GL_COMPILE
);
2305 glDrawPixels (width
, height
, format
, type
, pixels
);
2308 listMode
= cctx
->listMode
;
2311 listMode
= GL_COMPILE_AND_EXECUTE
;
2313 if (listMode
== GL_COMPILE_AND_EXECUTE
)
2316 BoxRec scissor
, box
;
2320 XGL_GLX_DRAW_PROLOGUE (pBox
, nBox
, &scissor
);
2324 XGL_GLX_DRAW_BOX (&box
, pBox
);
2328 if (cctx
->attrib
.scissorTest
)
2329 XGL_GLX_INTERSECT_BOX (&box
, &scissor
);
2331 if (box
.x1
< box
.x2
&& box
.y1
< box
.y2
)
2333 XGL_GLX_SET_SCISSOR_BOX (&box
);
2335 glDrawPixels (width
, height
, format
, type
, pixels
);
2337 if (format
!= GL_STENCIL_INDEX
)
2338 XGL_GLX_DRAW_DAMAGE (&box
, ®ion
);
2344 xglStartList (XGL_LIST_OP_CALLS
, cctx
->listMode
);
2348 xglBitmap (GLsizei width
,
2354 const GLubyte
*bitmap
)
2361 xglStartList (XGL_LIST_OP_DRAW
, GL_COMPILE
);
2362 glBitmap (width
, height
, xorig
, yorig
, 0, 0, bitmap
);
2365 listMode
= cctx
->listMode
;
2368 listMode
= GL_COMPILE_AND_EXECUTE
;
2370 if (listMode
== GL_COMPILE_AND_EXECUTE
&& width
&& height
)
2373 BoxRec scissor
, box
;
2377 XGL_GLX_DRAW_PROLOGUE (pBox
, nBox
, &scissor
);
2381 XGL_GLX_DRAW_BOX (&box
, pBox
);
2385 if (cctx
->attrib
.scissorTest
)
2386 XGL_GLX_INTERSECT_BOX (&box
, &scissor
);
2388 if (box
.x1
< box
.x2
&& box
.y1
< box
.y2
)
2390 XGL_GLX_SET_SCISSOR_BOX (&box
);
2392 glBitmap (width
, height
, xorig
, yorig
, 0, 0, bitmap
);
2394 XGL_GLX_DRAW_DAMAGE (&box
, ®ion
);
2400 xglStartList (XGL_LIST_OP_CALLS
, cctx
->listMode
);
2402 glBitmap (0, 0, 0, 0, xmove
, ymove
, NULL
);
2406 xglRectdv (const GLdouble
*v1
,
2414 xglStartList (XGL_LIST_OP_DRAW
, GL_COMPILE
);
2418 listMode
= cctx
->listMode
;
2421 listMode
= GL_COMPILE_AND_EXECUTE
;
2423 if (listMode
== GL_COMPILE_AND_EXECUTE
)
2426 BoxRec scissor
, box
;
2430 XGL_GLX_DRAW_PROLOGUE (pBox
, nBox
, &scissor
);
2434 XGL_GLX_DRAW_BOX (&box
, pBox
);
2438 if (cctx
->attrib
.scissorTest
)
2439 XGL_GLX_INTERSECT_BOX (&box
, &scissor
);
2441 if (box
.x1
< box
.x2
&& box
.y1
< box
.y2
)
2443 XGL_GLX_SET_SCISSOR_BOX (&box
);
2447 XGL_GLX_DRAW_DAMAGE (&box
, ®ion
);
2453 xglStartList (XGL_LIST_OP_CALLS
, cctx
->listMode
);
2457 xglRectfv (const GLfloat
*v1
,
2463 dv1
[0] = (GLdouble
) v1
[0];
2464 dv1
[1] = (GLdouble
) v1
[1];
2465 dv2
[0] = (GLdouble
) v2
[0];
2466 dv2
[1] = (GLdouble
) v2
[1];
2468 xglRectdv (dv1
, dv2
);
2472 xglRectiv (const GLint
*v1
,
2478 dv1
[0] = (GLdouble
) v1
[0];
2479 dv1
[1] = (GLdouble
) v1
[1];
2480 dv2
[0] = (GLdouble
) v2
[0];
2481 dv2
[1] = (GLdouble
) v2
[1];
2483 xglRectdv (dv1
, dv2
);
2487 xglRectsv (const GLshort
*v1
,
2493 dv1
[0] = (GLdouble
) v1
[0];
2494 dv1
[1] = (GLdouble
) v1
[1];
2495 dv2
[0] = (GLdouble
) v2
[0];
2496 dv2
[1] = (GLdouble
) v2
[1];
2498 xglRectdv (dv1
, dv2
);
2502 xglBegin (GLenum mode
)
2504 if (mode
> GL_POLYGON
)
2506 xglRecordError (GL_INVALID_ENUM
);
2512 xglRecordError (GL_INVALID_OPERATION
);
2521 xglStartList (XGL_LIST_OP_DRAW
, GL_COMPILE
);
2525 if (REGION_NUM_RECTS (cctx
->pDrawBuffer
->pGC
->pCompositeClip
) == 1)
2527 BoxRec scissor
, box
;
2531 XGL_GLX_DRAW_PROLOGUE (pBox
, nBox
, &scissor
);
2533 XGL_GLX_DRAW_BOX (&box
, pBox
);
2535 if (cctx
->attrib
.scissorTest
)
2536 XGL_GLX_INTERSECT_BOX (&box
, &scissor
);
2538 XGL_GLX_SET_SCISSOR_BOX (&box
);
2542 if (!cctx
->groupList
)
2543 cctx
->groupList
= glGenLists (1);
2545 glNewList (cctx
->groupList
, GL_COMPILE
);
2555 if (!cctx
->beginCnt
)
2557 xglRecordError (GL_INVALID_OPERATION
);
2565 if (!cctx
->list
|| cctx
->listMode
== GL_COMPILE_AND_EXECUTE
)
2568 BoxRec scissor
, box
;
2575 XGL_GLX_DRAW_PROLOGUE (pBox
, nBox
, &scissor
);
2577 list
= cctx
->pList
->pOp
[cctx
->pList
->nOp
- 1].u
.list
;
2581 if (REGION_NUM_RECTS (cctx
->pDrawBuffer
->pGC
->pCompositeClip
) == 1)
2583 XGL_GLX_DRAW_PROLOGUE_WITHOUT_TEXTURES (pBox
, nBox
, &scissor
);
2587 XGL_GLX_DRAW_PROLOGUE (pBox
, nBox
, &scissor
);
2589 list
= cctx
->groupList
;
2598 XGL_GLX_DRAW_BOX (&box
, pBox
);
2602 if (cctx
->attrib
.scissorTest
)
2603 XGL_GLX_INTERSECT_BOX (&box
, &scissor
);
2605 if (box
.x1
< box
.x2
&& box
.y1
< box
.y2
)
2609 XGL_GLX_SET_SCISSOR_BOX (&box
);
2614 XGL_GLX_DRAW_DAMAGE (&box
, ®ion
);
2624 xglStartList (XGL_LIST_OP_CALLS
, cctx
->listMode
);
2628 xglCopyPixelsProc (xglGLOpPtr pOp
)
2631 BoxRec scissor
, box
;
2635 XGL_GLX_DRAW_PROLOGUE (pBox
, nBox
, &scissor
);
2639 XGL_GLX_DRAW_BOX (&box
, pBox
);
2643 if (cctx
->attrib
.scissorTest
)
2644 XGL_GLX_INTERSECT_BOX (&box
, &scissor
);
2646 if (box
.x1
< box
.x2
&& box
.y1
< box
.y2
)
2648 XGL_GLX_SET_SCISSOR_BOX (&box
);
2650 glCopyPixels (pOp
->u
.copy_pixels
.x
+ cctx
->pReadBuffer
->xOff
,
2651 pOp
->u
.copy_pixels
.y
+ cctx
->pReadBuffer
->yOff
,
2652 pOp
->u
.copy_pixels
.width
,
2653 pOp
->u
.copy_pixels
.height
,
2654 pOp
->u
.copy_pixels
.type
);
2656 if (pOp
->u
.copy_pixels
.type
== GL_COLOR
)
2657 XGL_GLX_DRAW_DAMAGE (&box
, ®ion
);
2663 xglCopyPixels (GLint x
,
2671 gl
.glProc
= xglCopyPixelsProc
;
2673 gl
.u
.copy_pixels
.x
= x
;
2674 gl
.u
.copy_pixels
.y
= y
;
2675 gl
.u
.copy_pixels
.width
= width
;
2676 gl
.u
.copy_pixels
.height
= height
;
2677 gl
.u
.copy_pixels
.type
= type
;
2683 xglReadPixels (GLint x
,
2691 glReadPixels (x
+ cctx
->pReadBuffer
->xOff
,
2692 y
+ cctx
->pReadBuffer
->yOff
,
2693 width
, height
, format
, type
, pixels
);
2697 xglCopyTexImage1DProc (xglGLOpPtr pOp
)
2699 glCopyTexImage1D (pOp
->u
.copy_tex_image_1d
.target
,
2700 pOp
->u
.copy_tex_image_1d
.level
,
2701 pOp
->u
.copy_tex_image_1d
.internalformat
,
2702 pOp
->u
.copy_tex_image_1d
.x
+ cctx
->pReadBuffer
->xOff
,
2703 pOp
->u
.copy_tex_image_1d
.y
+ cctx
->pReadBuffer
->yOff
,
2704 pOp
->u
.copy_tex_image_1d
.width
,
2705 pOp
->u
.copy_tex_image_1d
.border
);
2709 xglCopyTexImage1D (GLenum target
,
2711 GLenum internalformat
,
2719 gl
.glProc
= xglCopyTexImage1DProc
;
2721 gl
.u
.copy_tex_image_1d
.target
= target
;
2722 gl
.u
.copy_tex_image_1d
.level
= level
;
2723 gl
.u
.copy_tex_image_1d
.internalformat
= internalformat
;
2724 gl
.u
.copy_tex_image_1d
.x
= x
;
2725 gl
.u
.copy_tex_image_1d
.y
= y
;
2726 gl
.u
.copy_tex_image_1d
.width
= width
;
2727 gl
.u
.copy_tex_image_1d
.border
= border
;
2733 xglCopyTexImage2DProc (xglGLOpPtr pOp
)
2735 glCopyTexImage2D (pOp
->u
.copy_tex_image_2d
.target
,
2736 pOp
->u
.copy_tex_image_2d
.level
,
2737 pOp
->u
.copy_tex_image_2d
.internalformat
,
2738 pOp
->u
.copy_tex_image_2d
.x
+ cctx
->pReadBuffer
->xOff
,
2739 pOp
->u
.copy_tex_image_2d
.y
+ cctx
->pReadBuffer
->yOff
,
2740 pOp
->u
.copy_tex_image_2d
.width
,
2741 pOp
->u
.copy_tex_image_2d
.height
,
2742 pOp
->u
.copy_tex_image_2d
.border
);
2746 xglCopyTexImage2D (GLenum target
,
2748 GLenum internalformat
,
2757 gl
.glProc
= xglCopyTexImage2DProc
;
2759 gl
.u
.copy_tex_image_2d
.target
= target
;
2760 gl
.u
.copy_tex_image_2d
.level
= level
;
2761 gl
.u
.copy_tex_image_2d
.internalformat
= internalformat
;
2762 gl
.u
.copy_tex_image_2d
.x
= x
;
2763 gl
.u
.copy_tex_image_2d
.y
= y
;
2764 gl
.u
.copy_tex_image_2d
.width
= width
;
2765 gl
.u
.copy_tex_image_2d
.height
= height
;
2766 gl
.u
.copy_tex_image_2d
.border
= border
;
2772 xglCopyTexSubImage1DProc (xglGLOpPtr pOp
)
2774 glCopyTexSubImage1D (pOp
->u
.copy_tex_sub_image_1d
.target
,
2775 pOp
->u
.copy_tex_sub_image_1d
.level
,
2776 pOp
->u
.copy_tex_sub_image_1d
.xoffset
,
2777 pOp
->u
.copy_tex_sub_image_1d
.x
+
2778 cctx
->pReadBuffer
->xOff
,
2779 pOp
->u
.copy_tex_sub_image_1d
.y
+
2780 cctx
->pReadBuffer
->yOff
,
2781 pOp
->u
.copy_tex_sub_image_1d
.width
);
2785 xglCopyTexSubImage1D (GLenum target
,
2794 gl
.glProc
= xglCopyTexSubImage1DProc
;
2796 gl
.u
.copy_tex_sub_image_1d
.target
= target
;
2797 gl
.u
.copy_tex_sub_image_1d
.level
= level
;
2798 gl
.u
.copy_tex_sub_image_1d
.xoffset
= xoffset
;
2799 gl
.u
.copy_tex_sub_image_1d
.x
= x
;
2800 gl
.u
.copy_tex_sub_image_1d
.y
= y
;
2801 gl
.u
.copy_tex_sub_image_1d
.width
= width
;
2807 xglCopyTexSubImage2DProc (xglGLOpPtr pOp
)
2809 glCopyTexSubImage2D (pOp
->u
.copy_tex_sub_image_2d
.target
,
2810 pOp
->u
.copy_tex_sub_image_2d
.level
,
2811 pOp
->u
.copy_tex_sub_image_2d
.xoffset
,
2812 pOp
->u
.copy_tex_sub_image_2d
.yoffset
,
2813 pOp
->u
.copy_tex_sub_image_2d
.x
+
2814 cctx
->pReadBuffer
->xOff
,
2815 pOp
->u
.copy_tex_sub_image_2d
.y
+
2816 cctx
->pReadBuffer
->yOff
,
2817 pOp
->u
.copy_tex_sub_image_2d
.width
,
2818 pOp
->u
.copy_tex_sub_image_2d
.height
);
2822 xglCopyTexSubImage2D (GLenum target
,
2833 gl
.glProc
= xglCopyTexSubImage2DProc
;
2835 gl
.u
.copy_tex_sub_image_2d
.target
= target
;
2836 gl
.u
.copy_tex_sub_image_2d
.level
= level
;
2837 gl
.u
.copy_tex_sub_image_2d
.xoffset
= xoffset
;
2838 gl
.u
.copy_tex_sub_image_2d
.yoffset
= yoffset
;
2839 gl
.u
.copy_tex_sub_image_2d
.x
= x
;
2840 gl
.u
.copy_tex_sub_image_2d
.y
= y
;
2841 gl
.u
.copy_tex_sub_image_2d
.width
= width
;
2842 gl
.u
.copy_tex_sub_image_2d
.height
= height
;
2848 xglCopyColorTableProc (xglGLOpPtr pOp
)
2850 glCopyColorTable (pOp
->u
.copy_color_table
.target
,
2851 pOp
->u
.copy_color_table
.internalformat
,
2852 pOp
->u
.copy_color_table
.x
+ cctx
->pReadBuffer
->xOff
,
2853 pOp
->u
.copy_color_table
.y
+ cctx
->pReadBuffer
->yOff
,
2854 pOp
->u
.copy_color_table
.width
);
2858 xglCopyColorTable (GLenum target
,
2859 GLenum internalformat
,
2866 gl
.glProc
= xglCopyColorTableProc
;
2868 gl
.u
.copy_color_table
.target
= target
;
2869 gl
.u
.copy_color_table
.internalformat
= internalformat
;
2870 gl
.u
.copy_color_table
.x
= x
;
2871 gl
.u
.copy_color_table
.y
= y
;
2872 gl
.u
.copy_color_table
.width
= width
;
2878 xglCopyColorSubTableProc (xglGLOpPtr pOp
)
2880 glCopyColorTable (pOp
->u
.copy_color_sub_table
.target
,
2881 pOp
->u
.copy_color_sub_table
.start
,
2882 pOp
->u
.copy_color_sub_table
.x
+ cctx
->pReadBuffer
->xOff
,
2883 pOp
->u
.copy_color_sub_table
.y
+ cctx
->pReadBuffer
->yOff
,
2884 pOp
->u
.copy_color_sub_table
.width
);
2888 xglCopyColorSubTable (GLenum target
,
2896 gl
.glProc
= xglCopyColorSubTableProc
;
2898 gl
.u
.copy_color_sub_table
.target
= target
;
2899 gl
.u
.copy_color_sub_table
.start
= start
;
2900 gl
.u
.copy_color_sub_table
.x
= x
;
2901 gl
.u
.copy_color_sub_table
.y
= y
;
2902 gl
.u
.copy_color_sub_table
.width
= width
;
2908 xglCopyConvolutionFilter1DProc (xglGLOpPtr pOp
)
2910 GLenum internalformat
= pOp
->u
.copy_convolution_filter_1d
.internalformat
;
2912 glCopyConvolutionFilter1D (pOp
->u
.copy_convolution_filter_1d
.target
,
2914 pOp
->u
.copy_convolution_filter_1d
.x
+
2915 cctx
->pReadBuffer
->xOff
,
2916 pOp
->u
.copy_convolution_filter_1d
.y
+
2917 cctx
->pReadBuffer
->yOff
,
2918 pOp
->u
.copy_convolution_filter_1d
.width
);
2922 xglCopyConvolutionFilter1D (GLenum target
,
2923 GLenum internalformat
,
2930 gl
.glProc
= xglCopyConvolutionFilter1DProc
;
2932 gl
.u
.copy_convolution_filter_1d
.target
= target
;
2933 gl
.u
.copy_convolution_filter_1d
.internalformat
= internalformat
;
2934 gl
.u
.copy_convolution_filter_1d
.x
= x
;
2935 gl
.u
.copy_convolution_filter_1d
.y
= y
;
2936 gl
.u
.copy_convolution_filter_1d
.width
= width
;
2942 xglCopyConvolutionFilter2DProc (xglGLOpPtr pOp
)
2944 GLenum internalformat
= pOp
->u
.copy_convolution_filter_2d
.internalformat
;
2946 glCopyConvolutionFilter2D (pOp
->u
.copy_convolution_filter_2d
.target
,
2948 pOp
->u
.copy_convolution_filter_2d
.x
+
2949 cctx
->pReadBuffer
->xOff
,
2950 pOp
->u
.copy_convolution_filter_2d
.y
+
2951 cctx
->pReadBuffer
->yOff
,
2952 pOp
->u
.copy_convolution_filter_2d
.width
,
2953 pOp
->u
.copy_convolution_filter_2d
.height
);
2957 xglCopyConvolutionFilter2D (GLenum target
,
2958 GLenum internalformat
,
2966 gl
.glProc
= xglCopyConvolutionFilter2DProc
;
2968 gl
.u
.copy_convolution_filter_2d
.target
= target
;
2969 gl
.u
.copy_convolution_filter_2d
.internalformat
= internalformat
;
2970 gl
.u
.copy_convolution_filter_2d
.x
= x
;
2971 gl
.u
.copy_convolution_filter_2d
.y
= y
;
2972 gl
.u
.copy_convolution_filter_2d
.width
= width
;
2973 gl
.u
.copy_convolution_filter_2d
.height
= height
;
2979 xglCopyTexSubImage3DProc (xglGLOpPtr pOp
)
2981 glCopyTexSubImage3D (pOp
->u
.copy_tex_sub_image_3d
.target
,
2982 pOp
->u
.copy_tex_sub_image_3d
.level
,
2983 pOp
->u
.copy_tex_sub_image_3d
.xoffset
,
2984 pOp
->u
.copy_tex_sub_image_3d
.yoffset
,
2985 pOp
->u
.copy_tex_sub_image_3d
.zoffset
,
2986 pOp
->u
.copy_tex_sub_image_3d
.x
+
2987 cctx
->pReadBuffer
->xOff
,
2988 pOp
->u
.copy_tex_sub_image_3d
.y
+
2989 cctx
->pReadBuffer
->yOff
,
2990 pOp
->u
.copy_tex_sub_image_3d
.width
,
2991 pOp
->u
.copy_tex_sub_image_3d
.height
);
2995 xglCopyTexSubImage3D (GLenum target
,
3007 gl
.glProc
= xglCopyTexSubImage3DProc
;
3009 gl
.u
.copy_tex_sub_image_3d
.target
= target
;
3010 gl
.u
.copy_tex_sub_image_3d
.level
= level
;
3011 gl
.u
.copy_tex_sub_image_3d
.xoffset
= xoffset
;
3012 gl
.u
.copy_tex_sub_image_3d
.yoffset
= yoffset
;
3013 gl
.u
.copy_tex_sub_image_3d
.zoffset
= zoffset
;
3014 gl
.u
.copy_tex_sub_image_3d
.x
= x
;
3015 gl
.u
.copy_tex_sub_image_3d
.y
= y
;
3016 gl
.u
.copy_tex_sub_image_3d
.width
= width
;
3017 gl
.u
.copy_tex_sub_image_3d
.height
= height
;
3022 /* GL_ARB_multitexture */
3024 xglNoOpActiveTextureARB (GLenum texture
) {}
3026 xglActiveTextureARBProc (xglGLOpPtr pOp
)
3030 texUnit
= pOp
->u
.enumeration
- GL_TEXTURE0
;
3031 if (texUnit
< 0 || texUnit
>= cctx
->maxTexUnits
)
3033 xglRecordError (GL_INVALID_ENUM
);
3037 cctx
->activeTexUnit
= texUnit
;
3038 (*cctx
->ActiveTextureARB
) (pOp
->u
.enumeration
);
3042 xglActiveTextureARB (GLenum texture
)
3046 gl
.glProc
= xglActiveTextureARBProc
;
3048 gl
.u
.enumeration
= texture
;
3053 xglNoOpClientActiveTextureARB (GLenum texture
) {}
3055 xglNoOpMultiTexCoord1dvARB (GLenum target
, const GLdouble
*v
) {}
3057 xglNoOpMultiTexCoord1fvARB (GLenum target
, const GLfloat
*v
) {}
3059 xglNoOpMultiTexCoord1ivARB (GLenum target
, const GLint
*v
) {}
3061 xglNoOpMultiTexCoord1svARB (GLenum target
, const GLshort
*v
) {}
3063 xglNoOpMultiTexCoord2dvARB (GLenum target
, const GLdouble
*v
) {}
3065 xglNoOpMultiTexCoord2fvARB (GLenum target
, const GLfloat
*v
) {}
3067 xglNoOpMultiTexCoord2ivARB (GLenum target
, const GLint
*v
) {}
3069 xglNoOpMultiTexCoord2svARB (GLenum target
, const GLshort
*v
) {}
3071 xglNoOpMultiTexCoord3dvARB (GLenum target
, const GLdouble
*v
) {}
3073 xglNoOpMultiTexCoord3fvARB (GLenum target
, const GLfloat
*v
) {}
3075 xglNoOpMultiTexCoord3ivARB (GLenum target
, const GLint
*v
) {}
3077 xglNoOpMultiTexCoord3svARB (GLenum target
, const GLshort
*v
) {}
3079 xglNoOpMultiTexCoord4dvARB (GLenum target
, const GLdouble
*v
) {}
3081 xglNoOpMultiTexCoord4fvARB (GLenum target
, const GLfloat
*v
) {}
3083 xglNoOpMultiTexCoord4ivARB (GLenum target
, const GLint
*v
) {}
3085 xglNoOpMultiTexCoord4svARB (GLenum target
, const GLshort
*v
) {}
3087 /* GL_ARB_multisample */
3089 xglNoOpSampleCoverageARB (GLclampf value
, GLboolean invert
) {}
3091 /* GL_EXT_texture_object */
3093 xglNoOpAreTexturesResidentEXT (GLsizei n
,
3094 const GLuint
*textures
,
3095 GLboolean
*residences
)
3100 xglNoOpGenTexturesEXT (GLsizei n
, GLuint
*textures
) {}
3102 xglNoOpIsTextureEXT (GLuint texture
)
3107 /* GL_SGIS_multisample */
3109 xglNoOpSampleMaskSGIS (GLclampf value
, GLboolean invert
) {}
3111 xglNoOpSamplePatternSGIS (GLenum pattern
) {}
3113 /* GL_EXT_point_parameters */
3115 xglNoOpPointParameterfEXT (GLenum pname
, GLfloat param
) {}
3117 xglNoOpPointParameterfvEXT (GLenum pname
, const GLfloat
*params
) {}
3119 /* GL_MESA_window_pos */
3121 xglNoOpWindowPos3fMESA (GLfloat x
, GLfloat y
, GLfloat z
) {}
3123 xglWindowPos3fMESAProc (xglGLOpPtr pOp
)
3125 (*cctx
->WindowPos3fMESA
) (pOp
->u
.window_pos_3f
.x
+ cctx
->pDrawBuffer
->xOff
,
3126 pOp
->u
.window_pos_3f
.y
+ cctx
->pDrawBuffer
->yOff
,
3127 pOp
->u
.window_pos_3f
.z
);
3130 xglWindowPos3fMESA (GLfloat x
, GLfloat y
, GLfloat z
)
3134 gl
.glProc
= xglWindowPos3fMESAProc
;
3136 gl
.u
.window_pos_3f
.x
= x
;
3137 gl
.u
.window_pos_3f
.y
= y
;
3138 gl
.u
.window_pos_3f
.z
= z
;
3143 /* GL_EXT_blend_func_separate */
3145 xglNoOpBlendFuncSeparateEXT (GLenum sfactorRGB
, GLenum dfactorRGB
,
3146 GLenum sfactorAlpha
, GLenum dfactorAlpha
) {}
3148 /* GL_EXT_fog_coord */
3150 xglNoOpFogCoordfvEXT (const GLfloat
*coord
) {}
3152 xglNoOpFogCoorddvEXT (const GLdouble
*coord
) {}
3154 xglNoOpFogCoordPointerEXT (GLenum type
, GLsizei stride
,
3155 const GLvoid
*pointer
) {}
3157 /* GL_EXT_secondary_color */
3159 xglNoOpSecondaryColor3bvEXT (const GLbyte
*v
) {}
3161 xglNoOpSecondaryColor3dvEXT (const GLdouble
*v
) {}
3163 xglNoOpSecondaryColor3fvEXT (const GLfloat
*v
) {}
3165 xglNoOpSecondaryColor3ivEXT (const GLint
*v
) {}
3167 xglNoOpSecondaryColor3svEXT (const GLshort
*v
) {}
3169 xglNoOpSecondaryColor3ubvEXT (const GLubyte
*v
) {}
3171 xglNoOpSecondaryColor3uivEXT (const GLuint
*v
) {}
3173 xglNoOpSecondaryColor3usvEXT (const GLushort
*v
) {}
3175 xglNoOpSecondaryColorPointerEXT (GLint size
, GLenum type
, GLsizei stride
,
3176 const GLvoid
*pointer
) {}
3178 /* GL_NV_point_sprite */
3180 xglNoOpPointParameteriNV (GLenum pname
, GLint params
) {}
3182 xglNoOpPointParameterivNV (GLenum pname
, const GLint
*params
) {}
3184 /* GL_EXT_stencil_two_side */
3186 xglNoOpActiveStencilFaceEXT (GLenum face
) {}
3188 /* GL_EXT_framebuffer_object */
3190 xglNoOpIsRenderbufferEXT (GLuint renderbuffer
)
3195 xglNoOpBindRenderbufferEXT (GLenum target
, GLuint renderbuffer
) {}
3197 xglNoOpDeleteRenderbuffersEXT (GLsizei n
, const GLuint
*renderbuffers
) {}
3199 xglNoOpGenRenderbuffersEXT (GLsizei n
, GLuint
*renderbuffers
) {}
3201 xglNoOpRenderbufferStorageEXT (GLenum target
, GLenum internalformat
,
3202 GLsizei width
, GLsizei height
) {}
3204 xglNoOpGetRenderbufferParameterivEXT (GLenum target
, GLenum pname
,
3207 xglNoOpIsFramebufferEXT (GLuint framebuffer
)
3212 xglNoOpBindFramebufferEXT (GLenum target
, GLuint framebuffer
) {}
3214 xglNoOpDeleteFramebuffersEXT (GLsizei n
, const GLuint
*framebuffers
) {}
3216 xglNoOpGenFramebuffersEXT (GLsizei n
, GLuint
*framebuffers
) {}
3218 xglNoOpCheckFramebufferStatusEXT (GLenum target
)
3220 return GL_FRAMEBUFFER_UNSUPPORTED_EXT
;
3223 xglNoOpFramebufferTexture1DEXT (GLenum target
, GLenum attachment
,
3224 GLenum textarget
, GLuint texture
,
3227 xglNoOpFramebufferTexture2DEXT (GLenum target
, GLenum attachment
,
3228 GLenum textarget
, GLuint texture
,
3231 xglNoOpFramebufferTexture3DEXT (GLenum target
, GLenum attachment
,
3232 GLenum textarget
, GLuint texture
,
3233 GLint level
, GLint zoffset
) {}
3235 xglNoOpFramebufferRenderbufferEXT (GLenum target
, GLenum attachment
,
3236 GLenum renderbuffertarget
,
3237 GLuint renderbuffer
) {}
3239 xglNoOpGetFramebufferAttachmentParameterivEXT (GLenum target
,
3244 xglNoOpGenerateMipmapEXT (GLenum target
) {}
3246 static struct _glapi_table __glNativeRenderTable
= {
3309 0, /* glRasterPos2d */
3311 0, /* glRasterPos2f */
3313 0, /* glRasterPos2i */
3315 0, /* glRasterPos2s */
3317 0, /* glRasterPos3d */
3319 0, /* glRasterPos3f */
3321 0, /* glRasterPos3i */
3323 0, /* glRasterPos3s */
3325 0, /* glRasterPos4d */
3327 0, /* glRasterPos4f */
3329 0, /* glRasterPos4i */
3331 0, /* glRasterPos4s */
3341 0, /* glTexCoord1d */
3343 0, /* glTexCoord1f */
3345 0, /* glTexCoord1i */
3347 0, /* glTexCoord1s */
3349 0, /* glTexCoord2d */
3351 0, /* glTexCoord2f */
3353 0, /* glTexCoord2i */
3355 0, /* glTexCoord2s */
3357 0, /* glTexCoord3d */
3359 0, /* glTexCoord3f */
3361 0, /* glTexCoord3i */
3363 0, /* glTexCoord3s */
3365 0, /* glTexCoord4d */
3367 0, /* glTexCoord4f */
3369 0, /* glTexCoord4i */
3371 0, /* glTexCoord4s */
3475 0, /* glEvalCoord1d */
3477 0, /* glEvalCoord1f */
3479 0, /* glEvalCoord2d */
3481 0, /* glEvalCoord2f */
3521 glGetPolygonStipple
,
3529 glGetTexParameterfv
,
3530 glGetTexParameteriv
,
3531 xglGetTexLevelParameterfv
,
3532 xglGetTexLevelParameteriv
,
3556 glDisableClientState
,
3560 glEnableClientState
,
3564 glInterleavedArrays
,
3569 xglAreTexturesResident
,
3572 xglCopyTexSubImage1D
,
3573 xglCopyTexSubImage2D
,
3578 xglPrioritizeTextures
,
3585 0, /* glDrawRangeElements */
3587 glColorTableParameterfv
,
3588 glColorTableParameteriv
,
3591 glGetColorTableParameterfv
,
3592 glGetColorTableParameteriv
,
3594 xglCopyColorSubTable
,
3595 glConvolutionFilter1D
,
3596 glConvolutionFilter2D
,
3597 glConvolutionParameterf
,
3598 glConvolutionParameterfv
,
3599 glConvolutionParameteri
,
3600 glConvolutionParameteriv
,
3601 xglCopyConvolutionFilter1D
,
3602 xglCopyConvolutionFilter2D
,
3603 glGetConvolutionFilter
,
3604 glGetConvolutionParameterfv
,
3605 glGetConvolutionParameteriv
,
3606 glGetSeparableFilter
,
3607 glSeparableFilter2D
,
3609 glGetHistogramParameterfv
,
3610 glGetHistogramParameteriv
,
3612 glGetMinmaxParameterfv
,
3613 glGetMinmaxParameteriv
,
3620 xglCopyTexSubImage3D
,
3621 xglNoOpActiveTextureARB
,
3622 xglNoOpClientActiveTextureARB
,
3623 0, /* glMultiTexCoord1dARB */
3624 xglNoOpMultiTexCoord1dvARB
,
3625 0, /* glMultiTexCoord1fARB */
3626 xglNoOpMultiTexCoord1fvARB
,
3627 0, /* glMultiTexCoord1iARB */
3628 xglNoOpMultiTexCoord1ivARB
,
3629 0, /* glMultiTexCoord1sARB */
3630 xglNoOpMultiTexCoord1svARB
,
3631 0, /* glMultiTexCoord2dARB */
3632 xglNoOpMultiTexCoord2dvARB
,
3633 0, /* glMultiTexCoord2fARB */
3634 xglNoOpMultiTexCoord2fvARB
,
3635 0, /* glMultiTexCoord2iARB */
3636 xglNoOpMultiTexCoord2ivARB
,
3637 0, /* glMultiTexCoord2sARB */
3638 xglNoOpMultiTexCoord2svARB
,
3639 0, /* glMultiTexCoord3dARB */
3640 xglNoOpMultiTexCoord3dvARB
,
3641 0, /* glMultiTexCoord3fARB */
3642 xglNoOpMultiTexCoord3fvARB
,
3643 0, /* glMultiTexCoord3iARB */
3644 xglNoOpMultiTexCoord3ivARB
,
3645 0, /* glMultiTexCoord3sARB */
3646 xglNoOpMultiTexCoord3svARB
,
3647 0, /* glMultiTexCoord4dARB */
3648 xglNoOpMultiTexCoord4dvARB
,
3649 0, /* glMultiTexCoord4fARB */
3650 xglNoOpMultiTexCoord4fvARB
,
3651 0, /* glMultiTexCoord4iARB */
3652 xglNoOpMultiTexCoord4ivARB
,
3653 0, /* glMultiTexCoord4sARB */
3654 xglNoOpMultiTexCoord4svARB
,
3655 0, /* glLoadTransposeMatrixfARB */
3656 0, /* glLoadTransposeMatrixdARB */
3657 0, /* glMultTransposeMatrixfARB */
3658 0, /* glMultTransposeMatrixdARB */
3659 xglNoOpSampleCoverageARB
,
3660 0, /* glDrawBuffersARB */
3661 0, /* glPolygonOffsetEXT */
3662 0, /* glGetTexFilterFuncSGIS */
3663 0, /* glTexFilterFuncSGIS */
3664 0, /* glGetHistogramEXT */
3665 0, /* glGetHistogramParameterfvEXT */
3666 0, /* glGetHistogramParameterivEXT */
3667 0, /* glGetMinmaxEXT */
3668 0, /* glGetMinmaxParameterfvEXT */
3669 0, /* glGetMinmaxParameterivEXT */
3670 0, /* glGetConvolutionFilterEXT */
3671 0, /* glGetConvolutionParameterfvEXT */
3672 0, /* glGetConvolutionParameterivEXT */
3673 0, /* glGetSeparableFilterEXT */
3674 0, /* glGetColorTableSGI */
3675 0, /* glGetColorTableParameterfvSGI */
3676 0, /* glGetColorTableParameterivSGI */
3677 0, /* glPixelTexGenSGIX */
3678 0, /* glPixelTexGenParameteriSGIS */
3679 0, /* glPixelTexGenParameterivSGIS */
3680 0, /* glPixelTexGenParameterfSGIS */
3681 0, /* glPixelTexGenParameterfvSGIS */
3682 0, /* glGetPixelTexGenParameterivSGIS */
3683 0, /* glGetPixelTexGenParameterfvSGIS */
3684 0, /* glTexImage4DSGIS */
3685 0, /* glTexSubImage4DSGIS */
3686 xglNoOpAreTexturesResidentEXT
,
3687 xglNoOpGenTexturesEXT
,
3688 xglNoOpIsTextureEXT
,
3689 0, /* glDetailTexFuncSGIS */
3690 0, /* glGetDetailTexFuncSGIS */
3691 0, /* glSharpenTexFuncSGIS */
3692 0, /* glGetSharpenTexFuncSGIS */
3693 xglNoOpSampleMaskSGIS
,
3694 xglNoOpSamplePatternSGIS
,
3695 0, /* glColorPointerEXT */
3696 0, /* glEdgeFlagPointerEXT */
3697 0, /* glIndexPointerEXT */
3698 0, /* glNormalPointerEXT */
3699 0, /* glTexCoordPointerEXT */
3700 0, /* glVertexPointerEXT */
3701 0, /* glSpriteParameterfSGIX */
3702 0, /* glSpriteParameterfvSGIX */
3703 0, /* glSpriteParameteriSGIX */
3704 0, /* glSpriteParameterivSGIX */
3705 xglNoOpPointParameterfEXT
,
3706 xglNoOpPointParameterfvEXT
,
3707 0, /* glGetInstrumentsSGIX */
3708 0, /* glInstrumentsBufferSGIX */
3709 0, /* glPollInstrumentsSGIX */
3710 0, /* glReadInstrumentsSGIX */
3711 0, /* glStartInstrumentsSGIX */
3712 0, /* glStopInstrumentsSGIX */
3713 0, /* glFrameZoomSGIX */
3714 0, /* glTagSampleBufferSGIX */
3715 0, /* glReferencePlaneSGIX */
3716 0, /* glFlushRasterSGIX */
3717 0, /* glGetListParameterfvSGIX */
3718 0, /* glGetListParameterivSGIX */
3719 0, /* glListParameterfSGIX */
3720 0, /* glListParameterfvSGIX */
3721 0, /* glListParameteriSGIX */
3722 0, /* glListParameterivSGIX */
3723 0, /* glFragmentColorMaterialSGIX */
3724 0, /* glFragmentLightfSGIX */
3725 0, /* glFragmentLightfvSGIX */
3726 0, /* glFragmentLightiSGIX */
3727 0, /* glFragmentLightivSGIX */
3728 0, /* glFragmentLightModelfSGIX */
3729 0, /* glFragmentLightModelfvSGIX */
3730 0, /* glFragmentLightModeliSGIX */
3731 0, /* glFragmentLightModelivSGIX */
3732 0, /* glFragmentMaterialfSGIX */
3733 0, /* glFragmentMaterialfvSGIX */
3734 0, /* glFragmentMaterialiSGIX */
3735 0, /* glFragmentMaterialivSGIX */
3736 0, /* glGetFragmentLightfvSGIX */
3737 0, /* glGetFragmentLightivSGIX */
3738 0, /* glGetFragmentMaterialfvSGIX */
3739 0, /* glGetFragmentMaterialivSGIX */
3740 0, /* glLightEnviSGIX */
3741 0, /* glVertexWeightfEXT */
3742 0, /* glVertexWeightfvEXT */
3743 0, /* glVertexWeightPointerEXT */
3744 0, /* glFlushVertexArrayRangeNV */
3745 0, /* glVertexArrayRangeNV */
3746 0, /* glCombinerParameterfvNV */
3747 0, /* glCombinerParameterfNV */
3748 0, /* glCombinerParameterivNV */
3749 0, /* glCombinerParameteriNV */
3750 0, /* glCombinerInputNV */
3751 0, /* glCombinerOutputNV */
3752 0, /* glFinalCombinerInputNV */
3753 0, /* glGetCombinerInputParameterfvNV */
3754 0, /* glGetCombinerInputParameterivNV */
3755 0, /* glGetCombinerOutputParameterfvNV */
3756 0, /* glGetCombinerOutputParameterivNV */
3757 0, /* glGetFinalCombinerInputParameterfvNV */
3758 0, /* glGetFinalCombinerInputParameterivNV */
3759 0, /* glResizeBuffersMESA */
3760 0, /* glWindowPos2dMESA */
3761 0, /* glWindowPos2dvMESA */
3762 0, /* glWindowPos2fMESA */
3763 0, /* glWindowPos2fvMESA */
3764 0, /* glWindowPos2iMESA */
3765 0, /* glWindowPos2ivMESA */
3766 0, /* glWindowPos2sMESA */
3767 0, /* glWindowPos2svMESA */
3768 0, /* glWindowPos3dMESA */
3769 0, /* glWindowPos3dvMESA */
3770 xglNoOpWindowPos3fMESA
,
3771 0, /* glWindowPos3fvMESA */
3772 0, /* glWindowPos3iMESA */
3773 0, /* glWindowPos3ivMESA */
3774 0, /* glWindowPos3sMESA */
3775 0, /* glWindowPos3svMESA */
3776 0, /* glWindowPos4dMESA */
3777 0, /* glWindowPos4dvMESA */
3778 0, /* glWindowPos4fMESA */
3779 0, /* glWindowPos4fvMESA */
3780 0, /* glWindowPos4iMESA */
3781 0, /* glWindowPos4ivMESA */
3782 0, /* glWindowPos4sMESA */
3783 0, /* glWindowPos4svMESA */
3784 xglNoOpBlendFuncSeparateEXT
,
3785 0, /* glIndexMaterialEXT */
3786 0, /* glIndexFuncEXT */
3787 0, /* glLockArraysEXT */
3788 0, /* glUnlockArraysEXT */
3789 0, /* glCullParameterdvEXT */
3790 0, /* glCullParameterfvEXT */
3792 0, /* glFogCoordfEXT */
3793 xglNoOpFogCoordfvEXT
,
3794 0, /* glFogCoorddEXT */
3795 xglNoOpFogCoorddvEXT
,
3796 xglNoOpFogCoordPointerEXT
,
3797 0, /* glGetColorTableEXT */
3798 0, /* glGetColorTableParameterivEXT */
3799 0, /* glGetColorTableParameterfvEXT */
3800 0, /* glTbufferMask3DFX */
3801 0, /* glCompressedTexImage3DARB */
3802 0, /* glCompressedTexImage2DARB */
3803 0, /* glCompressedTexImage1DARB */
3804 0, /* glCompressedTexSubImage3DARB */
3805 0, /* glCompressedTexSubImage2DARB */
3806 0, /* glCompressedTexSubImage1DARB */
3807 0, /* glGetCompressedTexImageARB */
3808 0, /* glSecondaryColor3bEXT */
3809 xglNoOpSecondaryColor3bvEXT
,
3810 0, /* glSecondaryColor3dEXT */
3811 xglNoOpSecondaryColor3dvEXT
,
3812 0, /* glSecondaryColor3fEXT */
3813 xglNoOpSecondaryColor3fvEXT
,
3814 0, /* glSecondaryColor3iEXT */
3815 xglNoOpSecondaryColor3ivEXT
,
3816 0, /* glSecondaryColor3sEXT */
3817 xglNoOpSecondaryColor3svEXT
,
3818 0, /* glSecondaryColor3ubEXT */
3819 xglNoOpSecondaryColor3ubvEXT
,
3820 0, /* glSecondaryColor3uiEXT */
3821 xglNoOpSecondaryColor3uivEXT
,
3822 0, /* glSecondaryColor3usEXT */
3823 xglNoOpSecondaryColor3usvEXT
,
3824 xglNoOpSecondaryColorPointerEXT
,
3825 0, /* glAreProgramsResidentNV */
3826 0, /* glBindProgramNV */
3827 0, /* glDeleteProgramsNV */
3828 0, /* glExecuteProgramNV */
3829 0, /* glGenProgramsNV */
3830 0, /* glGetProgramParameterdvNV */
3831 0, /* glGetProgramParameterfvNV */
3832 0, /* glGetProgramivNV */
3833 0, /* glGetProgramStringNV */
3834 0, /* glGetTrackMatrixivNV */
3835 0, /* glGetVertexAttribdvARB */
3836 0, /* glGetVertexAttribfvARB */
3837 0, /* glGetVertexAttribivARB */
3838 0, /* glGetVertexAttribPointervNV */
3839 0, /* glIsProgramNV */
3840 0, /* glLoadProgramNV */
3841 0, /* glProgramParameter4dNV */
3842 0, /* glProgramParameter4dvNV */
3843 0, /* glProgramParameter4fNV */
3844 0, /* glProgramParameter4fvNV */
3845 0, /* glProgramParameters4dvNV */
3846 0, /* glProgramParameters4fvNV */
3847 0, /* glRequestResidentProgramsNV */
3848 0, /* glTrackMatrixNV */
3849 0, /* glVertexAttribPointerNV */
3850 0, /* glVertexAttrib1dARB */
3851 0, /* glVertexAttrib1dvARB */
3852 0, /* glVertexAttrib1fARB */
3853 0, /* glVertexAttrib1fvARB */
3854 0, /* glVertexAttrib1sARB */
3855 0, /* glVertexAttrib1svARB */
3856 0, /* glVertexAttrib2dARB */
3857 0, /* glVertexAttrib2dvARB */
3858 0, /* glVertexAttrib2fARB */
3859 0, /* glVertexAttrib2fvARB */
3860 0, /* glVertexAttrib2sARB */
3861 0, /* glVertexAttrib2svARB */
3862 0, /* glVertexAttrib3dARB */
3863 0, /* glVertexAttrib3dvARB */
3864 0, /* glVertexAttrib3fARB */
3865 0, /* glVertexAttrib3fvARB */
3866 0, /* glVertexAttrib3sARB */
3867 0, /* glVertexAttrib3svARB */
3868 0, /* glVertexAttrib4dARB */
3869 0, /* glVertexAttrib4dvARB */
3870 0, /* glVertexAttrib4fARB */
3871 0, /* glVertexAttrib4fvARB */
3872 0, /* glVertexAttrib4sARB */
3873 0, /* glVertexAttrib4svARB */
3874 0, /* glVertexAttrib4NubARB */
3875 0, /* glVertexAttrib4NubvARB */
3876 0, /* glVertexAttribs1dvNV */
3877 0, /* glVertexAttribs1fvNV */
3878 0, /* glVertexAttribs1svNV */
3879 0, /* glVertexAttribs2dvNV */
3880 0, /* glVertexAttribs2fvNV */
3881 0, /* glVertexAttribs2svNV */
3882 0, /* glVertexAttribs3dvNV */
3883 0, /* glVertexAttribs3fvNV */
3884 0, /* glVertexAttribs3svNV */
3885 0, /* glVertexAttribs4dvNV */
3886 0, /* glVertexAttribs4fvNV */
3887 0, /* glVertexAttribs4svNV */
3888 0, /* glVertexAttribs4ubvNV */
3889 xglNoOpPointParameteriNV
,
3890 xglNoOpPointParameterivNV
,
3891 0, /* glMultiDrawArraysEXT */
3892 0, /* glMultiDrawElementsEXT */
3893 xglNoOpActiveStencilFaceEXT
,
3894 0, /* glDeleteFencesNV */
3895 0, /* glGenFencesNV */
3896 0, /* glIsFenceNV */
3897 0, /* glTestFenceNV */
3898 0, /* glGetFenceivNV */
3899 0, /* glFinishFenceNV */
3900 0, /* glSetFenceNV */
3901 0, /* glVertexAttrib4bvARB */
3902 0, /* glVertexAttrib4ivARB */
3903 0, /* glVertexAttrib4ubvARB */
3904 0, /* glVertexAttrib4usvARB */
3905 0, /* glVertexAttrib4uivARB */
3906 0, /* glVertexAttrib4NbvARB */
3907 0, /* glVertexAttrib4NsvARB */
3908 0, /* glVertexAttrib4NivARB */
3909 0, /* glVertexAttrib4NusvARB */
3910 0, /* glVertexAttrib4NuivARB */
3911 0, /* glVertexAttribPointerARB */
3912 0, /* glEnableVertexAttribArrayARB */
3913 0, /* glDisableVertexAttribArrayARB */
3914 0, /* glProgramStringARB */
3915 0, /* glProgramEnvParameter4dARB */
3916 0, /* glProgramEnvParameter4dvARB */
3917 0, /* glProgramEnvParameter4fARB */
3918 0, /* glProgramEnvParameter4fvARB */
3919 0, /* glProgramLocalParameter4dARB */
3920 0, /* glProgramLocalParameter4dvARB */
3921 0, /* glProgramLocalParameter4fARB */
3922 0, /* glProgramLocalParameter4fvARB */
3923 0, /* glGetProgramEnvParameterdvARB */
3924 0, /* glGetProgramEnvParameterfvARB */
3925 0, /* glGetProgramLocalParameterdvARB */
3926 0, /* glGetProgramLocalParameterfvARB */
3927 0, /* glGetProgramivARB */
3928 0, /* glGetProgramStringARB */
3929 0, /* glProgramNamedParameter4fNV */
3930 0, /* glProgramNamedParameter4dNV */
3931 0, /* glProgramNamedParameter4fvNV */
3932 0, /* glProgramNamedParameter4dvNV */
3933 0, /* glGetProgramNamedParameterfvNV */
3934 0, /* glGetProgramNamedParameterdvNV */
3935 0, /* glBindBufferARB */
3936 0, /* glBufferDataARB */
3937 0, /* glBufferSubDataARB */
3938 0, /* glDeleteBuffersARB */
3939 0, /* glGenBuffersARB */
3940 0, /* glGetBufferParameterivARB */
3941 0, /* glGetBufferPointervARB */
3942 0, /* glGetBufferSubDataARB */
3943 0, /* glIsBufferARB */
3944 0, /* glMapBufferARB */
3945 0, /* glUnmapBufferARB */
3946 0, /* glDepthBoundsEXT */
3947 0, /* glGenQueriesARB */
3948 0, /* glDeleteQueriesARB */
3949 0, /* glIsQueryARB */
3950 0, /* glBeginQueryARB */
3951 0, /* glEndQueryARB */
3952 0, /* glGetQueryivARB */
3953 0, /* glGetQueryObjectivARB */
3954 0, /* glGetQueryObjectuivARB */
3955 0, /* glMultiModeDrawArraysIBM */
3956 0, /* glMultiModeDrawElementsIBM */
3957 0, /* glBlendEquationSeparateEXT */
3958 0, /* glDeleteObjectARB */
3959 0, /* glGetHandleARB */
3960 0, /* glDetachObjectARB */
3961 0, /* glCreateShaderObjectARB */
3962 0, /* glShaderSourceARB */
3963 0, /* glCompileShaderARB */
3964 0, /* glCreateProgramObjectARB */
3965 0, /* glAttachObjectARB */
3966 0, /* glLinkProgramARB */
3967 0, /* glUseProgramObjectARB */
3968 0, /* glValidateProgramARB */
3969 0, /* glUniform1fARB */
3970 0, /* glUniform2fARB */
3971 0, /* glUniform3fARB */
3972 0, /* glUniform4fARB */
3973 0, /* glUniform1iARB */
3974 0, /* glUniform2iARB */
3975 0, /* glUniform3iARB */
3976 0, /* glUniform4iARB */
3977 0, /* glUniform1fvARB */
3978 0, /* glUniform2fvARB */
3979 0, /* glUniform3fvARB */
3980 0, /* glUniform4fvARB */
3981 0, /* glUniform1ivARB */
3982 0, /* glUniform2ivARB */
3983 0, /* glUniform3ivARB */
3984 0, /* glUniform4ivARB */
3985 0, /* glUniformMatrix2fvARB */
3986 0, /* glUniformMatrix3fvARB */
3987 0, /* glUniformMatrix4fvARB */
3988 0, /* glGetObjectParameterfvARB */
3989 0, /* glGetObjectParameterivARB */
3990 0, /* glGetInfoLogARB */
3991 0, /* glGetAttachedObjectsARB */
3992 0, /* glGetUniformLocationARB */
3993 0, /* glGetActiveUniformARB */
3994 0, /* glGetUniformfvARB */
3995 0, /* glGetUniformivARB */
3996 0, /* glGetShaderSourceARB */
3997 0, /* glBindAttribLocationARB */
3998 0, /* glGetActiveAttribARB */
3999 0, /* glGetAttribLocationARB */
4000 0, /* glGetVertexAttribdvNV */
4001 0, /* glGetVertexAttribfvNV */
4002 0, /* glGetVertexAttribivNV */
4003 0, /* glVertexAttrib1dNV */
4004 0, /* glVertexAttrib1dvNV */
4005 0, /* glVertexAttrib1fNV */
4006 0, /* glVertexAttrib1fvNV */
4007 0, /* glVertexAttrib1sNV */
4008 0, /* glVertexAttrib1svNV */
4009 0, /* glVertexAttrib2dNV */
4010 0, /* glVertexAttrib2dvNV */
4011 0, /* glVertexAttrib2fNV */
4012 0, /* glVertexAttrib2fvNV */
4013 0, /* glVertexAttrib2sNV */
4014 0, /* glVertexAttrib2svNV */
4015 0, /* glVertexAttrib3dNV */
4016 0, /* glVertexAttrib3dvNV */
4017 0, /* glVertexAttrib3fNV */
4018 0, /* glVertexAttrib3fvNV */
4019 0, /* glVertexAttrib3sNV */
4020 0, /* glVertexAttrib3svNV */
4021 0, /* glVertexAttrib4dNV */
4022 0, /* glVertexAttrib4dvNV */
4023 0, /* glVertexAttrib4fNV */
4024 0, /* glVertexAttrib4fvNV */
4025 0, /* glVertexAttrib4sNV */
4026 0, /* glVertexAttrib4svNV */
4027 0, /* glVertexAttrib4ubNV */
4028 0, /* glVertexAttrib4ubvNV */
4029 0, /* glGenFragmentShadersATI */
4030 0, /* glBindFragmentShaderATI */
4031 0, /* glDeleteFragmentShaderATI */
4032 0, /* glBeginFragmentShaderATI */
4033 0, /* glEndFragmentShaderATI */
4034 0, /* glPassTexCoordATI */
4035 0, /* glSampleMapATI */
4036 0, /* glColorFragmentOp1ATI */
4037 0, /* glColorFragmentOp2ATI */
4038 0, /* glColorFragmentOp3ATI */
4039 0, /* glAlphaFragmentOp1ATI */
4040 0, /* glAlphaFragmentOp2ATI */
4041 0, /* glAlphaFragmentOp3ATI */
4042 0, /* glSetFragmentShaderConstantATI */
4043 xglNoOpIsRenderbufferEXT
,
4044 xglNoOpBindRenderbufferEXT
,
4045 xglNoOpDeleteRenderbuffersEXT
,
4046 xglNoOpGenRenderbuffersEXT
,
4047 xglNoOpRenderbufferStorageEXT
,
4048 xglNoOpGetRenderbufferParameterivEXT
,
4049 xglNoOpIsFramebufferEXT
,
4050 xglNoOpBindFramebufferEXT
,
4051 xglNoOpDeleteFramebuffersEXT
,
4052 xglNoOpGenFramebuffersEXT
,
4053 xglNoOpCheckFramebufferStatusEXT
,
4054 xglNoOpFramebufferTexture1DEXT
,
4055 xglNoOpFramebufferTexture2DEXT
,
4056 xglNoOpFramebufferTexture3DEXT
,
4057 xglNoOpFramebufferRenderbufferEXT
,
4058 xglNoOpGetFramebufferAttachmentParameterivEXT
,
4059 xglNoOpGenerateMipmapEXT
,
4060 0, /* glStencilFuncSeparate */
4061 0, /* glStencilOpSeparate */
4062 0, /* glStencilMaskSeparate */
4063 0, /* glGetQueryObjecti64vEXT */
4064 0 /* glGetQueryObjectui64vEXT */
4068 xglInitExtensions (xglGLContextPtr pContext
)
4070 const char *extensions
;
4072 extensions
= (const char *) glGetString (GL_EXTENSIONS
);
4074 if (strstr (extensions
, "GL_ARB_multitexture"))
4076 pContext
->ActiveTextureARB
=
4077 (PFNGLACTIVETEXTUREARBPROC
)
4078 glitz_context_get_proc_address (pContext
->context
,
4079 "glActiveTextureARB");
4080 pContext
->glRenderTable
.ClientActiveTextureARB
=
4081 (PFNGLCLIENTACTIVETEXTUREARBPROC
)
4082 glitz_context_get_proc_address (pContext
->context
,
4083 "glClientActiveTextureARB");
4084 pContext
->glRenderTable
.MultiTexCoord1dvARB
=
4085 (PFNGLMULTITEXCOORD1DVARBPROC
)
4086 glitz_context_get_proc_address (pContext
->context
,
4087 "glMultiTexCoord1dvARB");
4088 pContext
->glRenderTable
.MultiTexCoord1fvARB
=
4089 (PFNGLMULTITEXCOORD1FVARBPROC
)
4090 glitz_context_get_proc_address (pContext
->context
,
4091 "glMultiTexCoord1fvARB");
4092 pContext
->glRenderTable
.MultiTexCoord1ivARB
=
4093 (PFNGLMULTITEXCOORD1IVARBPROC
)
4094 glitz_context_get_proc_address (pContext
->context
,
4095 "glMultiTexCoord1ivARB");
4096 pContext
->glRenderTable
.MultiTexCoord1svARB
=
4097 (PFNGLMULTITEXCOORD1SVARBPROC
)
4098 glitz_context_get_proc_address (pContext
->context
,
4099 "glMultiTexCoord1svARB");
4100 pContext
->glRenderTable
.MultiTexCoord2dvARB
=
4101 (PFNGLMULTITEXCOORD2DVARBPROC
)
4102 glitz_context_get_proc_address (pContext
->context
,
4103 "glMultiTexCoord2dvARB");
4104 pContext
->glRenderTable
.MultiTexCoord2fvARB
=
4105 (PFNGLMULTITEXCOORD2FVARBPROC
)
4106 glitz_context_get_proc_address (pContext
->context
,
4107 "glMultiTexCoord2fvARB");
4108 pContext
->glRenderTable
.MultiTexCoord2ivARB
=
4109 (PFNGLMULTITEXCOORD2IVARBPROC
)
4110 glitz_context_get_proc_address (pContext
->context
,
4111 "glMultiTexCoord2ivARB");
4112 pContext
->glRenderTable
.MultiTexCoord2svARB
=
4113 (PFNGLMULTITEXCOORD2SVARBPROC
)
4114 glitz_context_get_proc_address (pContext
->context
,
4115 "glMultiTexCoord2svARB");
4116 pContext
->glRenderTable
.MultiTexCoord3dvARB
=
4117 (PFNGLMULTITEXCOORD3DVARBPROC
)
4118 glitz_context_get_proc_address (pContext
->context
,
4119 "glMultiTexCoord3dvARB");
4120 pContext
->glRenderTable
.MultiTexCoord3fvARB
=
4121 (PFNGLMULTITEXCOORD3FVARBPROC
)
4122 glitz_context_get_proc_address (pContext
->context
,
4123 "glMultiTexCoord3fvARB");
4124 pContext
->glRenderTable
.MultiTexCoord3ivARB
=
4125 (PFNGLMULTITEXCOORD3IVARBPROC
)
4126 glitz_context_get_proc_address (pContext
->context
,
4127 "glMultiTexCoord3ivARB");
4128 pContext
->glRenderTable
.MultiTexCoord3svARB
=
4129 (PFNGLMULTITEXCOORD3SVARBPROC
)
4130 glitz_context_get_proc_address (pContext
->context
,
4131 "glMultiTexCoord3svARB");
4132 pContext
->glRenderTable
.MultiTexCoord4dvARB
=
4133 (PFNGLMULTITEXCOORD4DVARBPROC
)
4134 glitz_context_get_proc_address (pContext
->context
,
4135 "glMultiTexCoord4dvARB");
4136 pContext
->glRenderTable
.MultiTexCoord4fvARB
=
4137 (PFNGLMULTITEXCOORD4FVARBPROC
)
4138 glitz_context_get_proc_address (pContext
->context
,
4139 "glMultiTexCoord4fvARB");
4140 pContext
->glRenderTable
.MultiTexCoord4ivARB
=
4141 (PFNGLMULTITEXCOORD4IVARBPROC
)
4142 glitz_context_get_proc_address (pContext
->context
,
4143 "glMultiTexCoord4ivARB");
4144 pContext
->glRenderTable
.MultiTexCoord4svARB
=
4145 (PFNGLMULTITEXCOORD4SVARBPROC
)
4146 glitz_context_get_proc_address (pContext
->context
,
4147 "glMultiTexCoord4svARB");
4149 glGetIntegerv (GL_MAX_TEXTURE_UNITS_ARB
, &pContext
->maxTexUnits
);
4150 if (pContext
->maxTexUnits
> XGL_MAX_TEXTURE_UNITS
)
4151 pContext
->maxTexUnits
= XGL_MAX_TEXTURE_UNITS
;
4153 pContext
->glRenderTable
.ActiveTextureARB
= xglActiveTextureARB
;
4156 pContext
->maxTexUnits
= 1;
4158 if (strstr (extensions
, "GL_ARB_multisample"))
4160 pContext
->glRenderTable
.SampleCoverageARB
=
4161 (PFNGLSAMPLECOVERAGEARBPROC
)
4162 glitz_context_get_proc_address (pContext
->context
,
4163 "glSampleCoverageARB");
4166 if (strstr (extensions
, "GL_EXT_texture_object"))
4168 pContext
->glRenderTable
.AreTexturesResidentEXT
=
4169 xglAreTexturesResident
;
4170 pContext
->glRenderTable
.GenTexturesEXT
= xglGenTextures
;
4171 pContext
->glRenderTable
.IsTextureEXT
= xglIsTexture
;
4174 if (strstr (extensions
, "GL_SGIS_multisample"))
4176 pContext
->glRenderTable
.SampleMaskSGIS
=
4177 (PFNGLSAMPLEMASKSGISPROC
)
4178 glitz_context_get_proc_address (pContext
->context
,
4179 "glSampleMaskSGIS");
4180 pContext
->glRenderTable
.SamplePatternSGIS
=
4181 (PFNGLSAMPLEPATTERNSGISPROC
)
4182 glitz_context_get_proc_address (pContext
->context
,
4183 "glSamplePatternSGIS");
4186 if (strstr (extensions
, "GL_EXT_point_parameters"))
4188 pContext
->glRenderTable
.PointParameterfEXT
=
4189 (PFNGLPOINTPARAMETERFEXTPROC
)
4190 glitz_context_get_proc_address (pContext
->context
,
4191 "glPointParameterfEXT");
4192 pContext
->glRenderTable
.PointParameterfvEXT
=
4193 (PFNGLPOINTPARAMETERFVEXTPROC
)
4194 glitz_context_get_proc_address (pContext
->context
,
4195 "glPointParameterfvEXT");
4198 if (strstr (extensions
, "GL_MESA_window_pos"))
4200 pContext
->WindowPos3fMESA
=
4201 (PFNGLWINDOWPOS3FMESAPROC
)
4202 glitz_context_get_proc_address (pContext
->context
,
4203 "glWindowPos3fMESA");
4205 pContext
->glRenderTable
.WindowPos3fMESA
= xglWindowPos3fMESA
;
4208 if (strstr (extensions
, "GL_EXT_blend_func_separate"))
4210 pContext
->glRenderTable
.BlendFuncSeparateEXT
=
4211 (PFNGLBLENDFUNCSEPARATEEXTPROC
)
4212 glitz_context_get_proc_address (pContext
->context
,
4213 "glBlendFuncSeparateEXT");
4216 if (strstr (extensions
, "GL_EXT_fog_coord"))
4218 pContext
->glRenderTable
.FogCoordfvEXT
=
4219 (PFNGLFOGCOORDFVEXTPROC
)
4220 glitz_context_get_proc_address (pContext
->context
,
4222 pContext
->glRenderTable
.FogCoorddvEXT
=
4223 (PFNGLFOGCOORDDVEXTPROC
)
4224 glitz_context_get_proc_address (pContext
->context
,
4226 pContext
->glRenderTable
.FogCoordPointerEXT
=
4227 (PFNGLFOGCOORDPOINTEREXTPROC
)
4228 glitz_context_get_proc_address (pContext
->context
,
4229 "glFogCoordPointerEXT");
4232 if (strstr (extensions
, "GL_EXT_secondary_color"))
4234 pContext
->glRenderTable
.SecondaryColor3bvEXT
=
4235 (PFNGLSECONDARYCOLOR3BVEXTPROC
)
4236 glitz_context_get_proc_address (pContext
->context
,
4237 "glSecondaryColor3bvEXT");
4238 pContext
->glRenderTable
.SecondaryColor3dvEXT
=
4239 (PFNGLSECONDARYCOLOR3DVEXTPROC
)
4240 glitz_context_get_proc_address (pContext
->context
,
4241 "glSecondaryColor3dvEXT");
4242 pContext
->glRenderTable
.SecondaryColor3fvEXT
=
4243 (PFNGLSECONDARYCOLOR3FVEXTPROC
)
4244 glitz_context_get_proc_address (pContext
->context
,
4245 "glSecondaryColor3fvEXT");
4246 pContext
->glRenderTable
.SecondaryColor3ivEXT
=
4247 (PFNGLSECONDARYCOLOR3IVEXTPROC
)
4248 glitz_context_get_proc_address (pContext
->context
,
4249 "glSecondaryColor3ivEXT");
4250 pContext
->glRenderTable
.SecondaryColor3svEXT
=
4251 (PFNGLSECONDARYCOLOR3SVEXTPROC
)
4252 glitz_context_get_proc_address (pContext
->context
,
4253 "glSecondaryColor3svEXT");
4254 pContext
->glRenderTable
.SecondaryColor3ubvEXT
=
4255 (PFNGLSECONDARYCOLOR3UBVEXTPROC
)
4256 glitz_context_get_proc_address (pContext
->context
,
4257 "glSecondaryColor3ubvEXT");
4258 pContext
->glRenderTable
.SecondaryColor3uivEXT
=
4259 (PFNGLSECONDARYCOLOR3UIVEXTPROC
)
4260 glitz_context_get_proc_address (pContext
->context
,
4261 "glSecondaryColor3uivEXT");
4262 pContext
->glRenderTable
.SecondaryColor3usvEXT
=
4263 (PFNGLSECONDARYCOLOR3USVEXTPROC
)
4264 glitz_context_get_proc_address (pContext
->context
,
4265 "glSecondaryColor3usvEXT");
4266 pContext
->glRenderTable
.SecondaryColorPointerEXT
=
4267 (PFNGLSECONDARYCOLORPOINTEREXTPROC
)
4268 glitz_context_get_proc_address (pContext
->context
,
4269 "glSecondaryColorPointerEXT");
4272 if (strstr (extensions
, "GL_NV_point_sprite"))
4274 pContext
->glRenderTable
.PointParameteriNV
=
4275 (PFNGLPOINTPARAMETERINVPROC
)
4276 glitz_context_get_proc_address (pContext
->context
,
4277 "glPointParameteriNV");
4278 pContext
->glRenderTable
.PointParameterivNV
=
4279 (PFNGLPOINTPARAMETERIVNVPROC
)
4280 glitz_context_get_proc_address (pContext
->context
,
4281 "glPointParameterivNV");
4284 if (strstr (extensions
, "GL_EXT_stencil_two_side"))
4286 pContext
->glRenderTable
.ActiveStencilFaceEXT
=
4287 (PFNGLACTIVESTENCILFACEEXTPROC
)
4288 glitz_context_get_proc_address (pContext
->context
,
4289 "glActiveStencilFaceEXT");
4292 if (strstr (extensions
, "GL_EXT_framebuffer_object"))
4294 pContext
->glRenderTable
.IsRenderbufferEXT
=
4295 (PFNGLISRENDERBUFFEREXTPROC
)
4296 glitz_context_get_proc_address (pContext
->context
,
4297 "glIsRenderbufferEXT");
4298 pContext
->glRenderTable
.BindRenderbufferEXT
=
4299 (PFNGLBINDRENDERBUFFEREXTPROC
)
4300 glitz_context_get_proc_address (pContext
->context
,
4301 "glBindRenderbufferEXT");
4302 pContext
->glRenderTable
.DeleteRenderbuffersEXT
=
4303 (PFNGLDELETERENDERBUFFERSEXTPROC
)
4304 glitz_context_get_proc_address (pContext
->context
,
4305 "glDeleteRenderbuffersEXT");
4306 pContext
->glRenderTable
.GenRenderbuffersEXT
=
4307 (PFNGLGENRENDERBUFFERSEXTPROC
)
4308 glitz_context_get_proc_address (pContext
->context
,
4309 "glGenRenderbuffersEXT");
4310 pContext
->glRenderTable
.RenderbufferStorageEXT
=
4311 (PFNGLRENDERBUFFERSTORAGEEXTPROC
)
4312 glitz_context_get_proc_address (pContext
->context
,
4313 "glRenderbufferStorageEXT");
4314 pContext
->glRenderTable
.GetRenderbufferParameterivEXT
=
4315 (PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC
)
4316 glitz_context_get_proc_address (pContext
->context
,
4317 "glGetRenderbufferParameterivEXT");
4318 pContext
->glRenderTable
.IsFramebufferEXT
=
4319 (PFNGLISFRAMEBUFFEREXTPROC
)
4320 glitz_context_get_proc_address (pContext
->context
,
4321 "glIsFramebufferEXT");
4322 pContext
->glRenderTable
.BindFramebufferEXT
=
4323 (PFNGLBINDFRAMEBUFFEREXTPROC
)
4324 glitz_context_get_proc_address (pContext
->context
,
4325 "glBindFramebufferEXT");
4326 pContext
->glRenderTable
.DeleteFramebuffersEXT
=
4327 (PFNGLDELETEFRAMEBUFFERSEXTPROC
)
4328 glitz_context_get_proc_address (pContext
->context
,
4329 "glDeleteFramebuffersEXT");
4330 pContext
->glRenderTable
.GenFramebuffersEXT
=
4331 (PFNGLGENFRAMEBUFFERSEXTPROC
)
4332 glitz_context_get_proc_address (pContext
->context
,
4333 "glGenFramebuffersEXT");
4334 pContext
->glRenderTable
.CheckFramebufferStatusEXT
=
4335 (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC
)
4336 glitz_context_get_proc_address (pContext
->context
,
4337 "glCheckFramebufferStatusEXT");
4338 pContext
->glRenderTable
.FramebufferTexture1DEXT
=
4339 (PFNGLFRAMEBUFFERTEXTURE1DEXTPROC
)
4340 glitz_context_get_proc_address (pContext
->context
,
4341 "glFramebufferTexture1DEXT");
4342 pContext
->glRenderTable
.FramebufferTexture2DEXT
=
4343 (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC
)
4344 glitz_context_get_proc_address (pContext
->context
,
4345 "glFramebufferTexture2DEXT");
4346 pContext
->glRenderTable
.FramebufferTexture3DEXT
=
4347 (PFNGLFRAMEBUFFERTEXTURE3DEXTPROC
)
4348 glitz_context_get_proc_address (pContext
->context
,
4349 "glFramebufferTexture3DEXT");
4350 pContext
->glRenderTable
.FramebufferRenderbufferEXT
=
4351 (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC
)
4352 glitz_context_get_proc_address (pContext
->context
,
4353 "glFramebufferRenderbufferEXT");
4354 pContext
->glRenderTable
.GetFramebufferAttachmentParameterivEXT
=
4355 (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC
)
4356 glitz_context_get_proc_address (pContext
->context
,
4357 "glGetFramebufferAttachment"
4359 pContext
->glRenderTable
.GenerateMipmapEXT
=
4360 (PFNGLGENERATEMIPMAPEXTPROC
)
4361 glitz_context_get_proc_address (pContext
->context
,
4362 "glGenerateMipmapEXT");
4367 xglSetCurrentContext (xglGLContextPtr pContext
)
4371 glitz_context_make_current (cctx
->context
, cctx
->pDrawBuffer
->drawable
);
4373 GlxSetRenderTables (&cctx
->glRenderTable
);
4377 xglFreeContext (xglGLContextPtr pContext
)
4382 if (pContext
->shared
== pContext
)
4385 if (pContext
->refcnt
)
4388 if (pContext
->shared
!= pContext
)
4389 xglFreeContext (pContext
->shared
);
4391 if (pContext
->texObjects
)
4393 xglTexObjPtr pTexObj
;
4397 key
= xglHashFirstEntry (pContext
->texObjects
);
4400 pTexObj
= (xglTexObjPtr
) xglHashLookup (pContext
->texObjects
,
4403 xglUnrefTexObj (pTexObj
);
4405 xglHashRemove (pContext
->texObjects
, key
);
4409 xglDeleteHashTable (pContext
->texObjects
);
4412 if (pContext
->displayLists
)
4414 xglDisplayListPtr pDisplayList
;
4418 key
= xglHashFirstEntry (pContext
->displayLists
);
4421 pDisplayList
= (xglDisplayListPtr
)
4422 xglHashLookup (pContext
->displayLists
, key
);
4424 xglDestroyList (pDisplayList
);
4426 xglHashRemove (pContext
->displayLists
, key
);
4430 xglDeleteHashTable (pContext
->displayLists
);
4433 for (i
= 0; i
< pContext
->maxTexUnits
; i
++)
4435 xglUnrefTexObj (pContext
->attrib
.texUnits
[i
].p1D
);
4436 xglUnrefTexObj (pContext
->attrib
.texUnits
[i
].p2D
);
4437 xglUnrefTexObj (pContext
->attrib
.texUnits
[i
].p3D
);
4438 xglUnrefTexObj (pContext
->attrib
.texUnits
[i
].pRect
);
4439 xglUnrefTexObj (pContext
->attrib
.texUnits
[i
].pCubeMap
);
4442 if (pContext
->groupList
)
4443 glDeleteLists (pContext
->groupList
, 1);
4445 if (pContext
->context
)
4446 glitz_context_destroy (pContext
->context
);
4448 if (pContext
->versionString
)
4449 xfree (pContext
->versionString
);
4455 xglDestroyContext (__GLcontext
*gc
)
4457 xglGLContextPtr pContext
= (xglGLContextPtr
) gc
;
4458 __GLinterface
*iface
= pContext
->mIface
;
4460 xglFreeContext (pContext
);
4465 return (*iface
->exports
.destroyContext
) ((__GLcontext
*) iface
);
4469 xglLoseCurrent (__GLcontext
*gc
)
4471 xglGLContextPtr pContext
= (xglGLContextPtr
) gc
;
4472 __GLinterface
*iface
= pContext
->mIface
;
4474 GlxFlushContextCache ();
4475 GlxSetRenderTables (0);
4480 return (*iface
->exports
.loseCurrent
) ((__GLcontext
*) iface
);
4484 xglMakeCurrent (__GLcontext
*gc
)
4486 xglGLContextPtr pContext
= (xglGLContextPtr
) gc
;
4487 __GLinterface
*iface
= &pContext
->iface
;
4488 __GLinterface
*mIface
= pContext
->mIface
;
4489 __GLdrawablePrivate
*drawPriv
= iface
->imports
.getDrawablePrivate (gc
);
4490 __GLdrawablePrivate
*readPriv
= iface
->imports
.getReadablePrivate (gc
);
4491 xglGLBufferPtr pDrawBufferPriv
= drawPriv
->private;
4492 xglGLBufferPtr pReadBufferPriv
= readPriv
->private;
4493 GLboolean status
= GL_TRUE
;
4495 if (pReadBufferPriv
->pDrawable
&& pDrawBufferPriv
->pDrawable
)
4497 XID values
[2] = { ClipByChildren
, 0 };
4501 /* XXX: temporary hack for root window drawing using
4503 if (pDrawBufferPriv
->pDrawable
->type
== DRAWABLE_WINDOW
&&
4504 (!((WindowPtr
) (pDrawBufferPriv
->pDrawable
))->parent
))
4505 values
[0] = IncludeInferiors
;
4508 /* this happens if client previously used this context with a buffer
4509 not supported by the native GL stack */
4510 if (!pContext
->context
)
4513 /* XXX: GLX_SGI_make_current_read disabled for now */
4514 if (pDrawBufferPriv
!= pReadBufferPriv
)
4517 if (!pReadBufferPriv
->pGC
)
4518 pReadBufferPriv
->pGC
=
4519 CreateGC (pReadBufferPriv
->pDrawable
,
4520 GCSubwindowMode
| GCGraphicsExposures
, values
,
4523 ValidateGC (pReadBufferPriv
->pDrawable
, pReadBufferPriv
->pGC
);
4525 if (!pDrawBufferPriv
->pGC
)
4526 pDrawBufferPriv
->pGC
=
4527 CreateGC (pDrawBufferPriv
->pDrawable
,
4528 GCSubwindowMode
| GCGraphicsExposures
, values
,
4531 ValidateGC (pDrawBufferPriv
->pDrawable
, pDrawBufferPriv
->pGC
);
4533 pReadBufferPriv
->pPixmap
= (PixmapPtr
) 0;
4534 pDrawBufferPriv
->pPixmap
= (PixmapPtr
) 0;
4536 pContext
->pReadBuffer
= pReadBufferPriv
;
4537 pContext
->pDrawBuffer
= pDrawBufferPriv
;
4539 pContext
->readPriv
= readPriv
;
4540 pContext
->drawPriv
= drawPriv
;
4542 /* from now on this context can only be used with native GL stack */
4545 (*mIface
->exports
.destroyContext
) ((__GLcontext
*) mIface
);
4546 pContext
->mIface
= NULL
;
4551 /* this happens if client previously used this context with a buffer
4552 supported by the native GL stack */
4556 drawPriv
->private = pDrawBufferPriv
->private;
4557 readPriv
->private = pReadBufferPriv
->private;
4559 status
= (*mIface
->exports
.makeCurrent
) ((__GLcontext
*) mIface
);
4561 drawPriv
->private = pDrawBufferPriv
;
4562 readPriv
->private = pReadBufferPriv
;
4564 /* from now on this context can not be used with native GL stack */
4565 if (status
== GL_TRUE
&& pContext
->context
)
4567 glitz_context_destroy (pContext
->context
);
4568 pContext
->context
= NULL
;
4576 xglShareContext (__GLcontext
*gc
,
4577 __GLcontext
*gcShare
)
4579 xglGLContextPtr pContext
= (xglGLContextPtr
) gc
;
4580 xglGLContextPtr pContextShare
= (xglGLContextPtr
) gcShare
;
4581 __GLinterface
*iface
= pContext
->mIface
;
4582 __GLinterface
*ifaceShare
= pContextShare
->mIface
;
4584 if (!iface
|| !ifaceShare
)
4587 return (*iface
->exports
.shareContext
) ((__GLcontext
*) iface
,
4588 (__GLcontext
*) ifaceShare
);
4592 xglCopyContext (__GLcontext
*dst
,
4593 const __GLcontext
*src
,
4596 xglGLContextPtr pDst
= (xglGLContextPtr
) dst
;
4597 xglGLContextPtr pSrc
= (xglGLContextPtr
) src
;
4598 const __GLcontext
*srcCtx
= (const __GLcontext
*) pSrc
->mIface
;
4599 __GLinterface
*dstIface
= (__GLinterface
*) pDst
->mIface
;
4600 GLboolean status
= GL_TRUE
;
4602 if (pSrc
->context
&& pDst
->context
)
4603 glitz_context_copy (pSrc
->context
, pDst
->context
, mask
);
4607 if (dstIface
&& srcCtx
)
4608 status
= (*dstIface
->exports
.copyContext
) ((__GLcontext
*) dstIface
,
4616 xglResizeBuffer (__GLdrawablePrivate
*glPriv
,
4620 unsigned int height
)
4622 xglGLBufferPtr pBufferPriv
= glPriv
->private;
4623 DrawablePtr pDrawable
= pBufferPriv
->pDrawable
;
4625 XGL_SCREEN_PRIV (pDrawable
->pScreen
);
4626 XGL_DRAWABLE_PIXMAP (pBufferPriv
->pDrawable
);
4628 if (pPixmap
!= pScreenPriv
->pScreenPixmap
)
4630 if (!xglCreatePixmapSurface (pPixmap
))
4633 if (pBufferPriv
->drawable
== pScreenPriv
->drawable
)
4635 if (pBufferPriv
->backSurface
)
4636 glitz_surface_destroy (pBufferPriv
->backSurface
);
4638 glitz_drawable_destroy (pBufferPriv
->drawable
);
4640 pBufferPriv
->drawable
= NULL
;
4641 pBufferPriv
->backSurface
= NULL
;
4644 if (pBufferPriv
->drawable
)
4646 glitz_drawable_update_size (pBufferPriv
->drawable
,
4647 pPixmap
->drawable
.width
,
4648 pPixmap
->drawable
.height
);
4652 glitz_drawable_format_t
*format
;
4654 format
= pBufferPriv
->pVisual
->format
.drawable
;
4655 if (pBufferPriv
->pVisual
->pbuffer
)
4657 pBufferPriv
->drawable
=
4658 glitz_create_pbuffer_drawable (pScreenPriv
->drawable
,
4660 pPixmap
->drawable
.width
,
4661 pPixmap
->drawable
.height
);
4665 pBufferPriv
->drawable
=
4666 glitz_create_drawable (pScreenPriv
->drawable
, format
,
4667 pPixmap
->drawable
.width
,
4668 pPixmap
->drawable
.height
);
4670 if (!pBufferPriv
->drawable
)
4673 if (format
->doublebuffer
)
4675 glitz_format_t
*backFormat
;
4677 backFormat
= pBufferPriv
->pVisual
->format
.surface
;
4679 pBufferPriv
->backSurface
=
4680 glitz_surface_create (pScreenPriv
->drawable
, backFormat
,
4681 pPixmap
->drawable
.width
,
4682 pPixmap
->drawable
.height
,
4684 if (pBufferPriv
->backSurface
)
4685 glitz_surface_attach (pBufferPriv
->backSurface
,
4686 pBufferPriv
->drawable
,
4687 GLITZ_DRAWABLE_BUFFER_BACK_COLOR
);
4694 glitz_drawable_reference (pScreenPriv
->drawable
);
4696 if (pBufferPriv
->backSurface
)
4697 glitz_surface_destroy (pBufferPriv
->backSurface
);
4699 if (pBufferPriv
->drawable
)
4700 glitz_drawable_destroy (pBufferPriv
->drawable
);
4702 pBufferPriv
->drawable
= pScreenPriv
->drawable
;
4703 pBufferPriv
->backSurface
= NULL
;
4706 ValidateGC (pDrawable
, pBufferPriv
->pGC
);
4712 xglForceCurrent (__GLcontext
*gc
)
4714 xglGLContextPtr pContext
= (xglGLContextPtr
) gc
;
4715 __GLinterface
*iface
= pContext
->mIface
;
4716 GLboolean status
= GL_TRUE
;
4718 if (pContext
&& pContext
->context
)
4720 __GLdrawablePrivate
*readPriv
, *drawPriv
;
4722 readPriv
= pContext
->readPriv
;
4723 drawPriv
= pContext
->drawPriv
;
4725 drawPriv
->lockDP (drawPriv
, gc
);
4726 if (readPriv
!= drawPriv
)
4727 readPriv
->lockDP (readPriv
, gc
);
4731 if (cctx
->pReadBuffer
->pDrawable
&& cctx
->pDrawBuffer
->pDrawable
)
4733 DrawablePtr pDrawable
= cctx
->pReadBuffer
->pDrawable
;
4734 PixmapPtr pReadPixmap
, pDrawPixmap
;
4736 XGL_SCREEN_PRIV (pDrawable
->pScreen
);
4738 if (pDrawable
->type
!= DRAWABLE_PIXMAP
)
4740 pReadPixmap
= XGL_GET_WINDOW_PIXMAP (pDrawable
);
4741 cctx
->pReadBuffer
->screenX
= __XGL_OFF_X_WIN (pReadPixmap
);
4742 cctx
->pReadBuffer
->screenY
= __XGL_OFF_Y_WIN (pReadPixmap
);
4743 cctx
->pReadBuffer
->xOff
= pDrawable
->x
+
4744 __XGL_OFF_X_WIN (pReadPixmap
);
4745 cctx
->pReadBuffer
->yOff
= pReadPixmap
->drawable
.height
-
4746 ((pDrawable
->y
+ __XGL_OFF_Y_WIN (pReadPixmap
)) +
4748 cctx
->pReadBuffer
->yFlip
= pReadPixmap
->drawable
.height
;
4752 pReadPixmap
= (PixmapPtr
) pDrawable
;
4753 cctx
->pReadBuffer
->screenX
= cctx
->pReadBuffer
->screenY
= 0;
4754 cctx
->pReadBuffer
->xOff
= cctx
->pReadBuffer
->yOff
= 0;
4755 cctx
->pReadBuffer
->yFlip
= pDrawable
->height
;
4758 pDrawable
= cctx
->pDrawBuffer
->pDrawable
;
4759 if (pDrawable
->type
!= DRAWABLE_PIXMAP
)
4761 pDrawPixmap
= XGL_GET_WINDOW_PIXMAP (pDrawable
);
4762 cctx
->pDrawBuffer
->screenX
= __XGL_OFF_X_WIN (pDrawPixmap
);
4763 cctx
->pDrawBuffer
->screenY
= __XGL_OFF_Y_WIN (pDrawPixmap
);
4764 cctx
->pDrawBuffer
->xOff
= pDrawable
->x
+
4765 __XGL_OFF_X_WIN (pDrawPixmap
);
4766 cctx
->pDrawBuffer
->yOff
= pDrawPixmap
->drawable
.height
-
4767 ((pDrawable
->y
+ __XGL_OFF_Y_WIN (pDrawPixmap
)) +
4769 cctx
->pDrawBuffer
->yFlip
= pDrawPixmap
->drawable
.height
;
4773 pDrawPixmap
= (PixmapPtr
) pDrawable
;
4774 cctx
->pDrawBuffer
->screenX
= cctx
->pDrawBuffer
->screenY
= 0;
4775 cctx
->pDrawBuffer
->xOff
= cctx
->pDrawBuffer
->yOff
= 0;
4776 cctx
->pDrawBuffer
->yFlip
= pDrawable
->height
;
4779 /* buffer changed */
4780 if (cctx
->pDrawBuffer
->pPixmap
!= pDrawPixmap
||
4781 cctx
->pReadBuffer
->pPixmap
!= pReadPixmap
)
4783 if (!xglResizeBuffer (drawPriv
,
4789 drawPriv
->unlockDP (drawPriv
);
4790 if (readPriv
!= drawPriv
)
4791 readPriv
->unlockDP (readPriv
);
4796 if (!xglResizeBuffer (readPriv
,
4797 cctx
->pReadBuffer
->pDrawable
->x
,
4798 cctx
->pReadBuffer
->pDrawable
->y
,
4799 cctx
->pReadBuffer
->pDrawable
->width
,
4800 cctx
->pReadBuffer
->pDrawable
->height
))
4802 drawPriv
->unlockDP (drawPriv
);
4803 if (readPriv
!= drawPriv
)
4804 readPriv
->unlockDP (readPriv
);
4809 cctx
->pReadBuffer
->pPixmap
= pReadPixmap
;
4810 cctx
->pDrawBuffer
->pPixmap
= pDrawPixmap
;
4813 if (!xglSyncSurface (pContext
->pDrawBuffer
->pDrawable
))
4815 drawPriv
->unlockDP (drawPriv
);
4816 if (readPriv
!= drawPriv
)
4817 readPriv
->unlockDP (readPriv
);
4822 if (pDrawPixmap
!= pScreenPriv
->pScreenPixmap
)
4824 XGL_PIXMAP_PRIV (pDrawPixmap
);
4826 glitz_surface_attach (pPixmapPriv
->surface
,
4827 pContext
->pDrawBuffer
->drawable
,
4828 GLITZ_DRAWABLE_BUFFER_FRONT_COLOR
);
4830 if (pPixmapPriv
->target
)
4831 pPixmapPriv
->target
= xglPixmapTargetOut
;
4834 xglSetCurrentContext (pContext
);
4840 xglInitExtensions (cctx
);
4842 glGetIntegerv (GL_MAX_LIST_NESTING
, &cctx
->maxListNesting
);
4843 glGetIntegerv (GL_MAX_ATTRIB_STACK_DEPTH
,
4844 &cctx
->maxAttribStackDepth
);
4845 if (cctx
->maxAttribStackDepth
> XGL_MAX_ATTRIB_STACK_DEPTH
)
4846 cctx
->maxAttribStackDepth
= XGL_MAX_ATTRIB_STACK_DEPTH
;
4848 cctx
->attrib
.scissorTest
= GL_FALSE
;
4849 cctx
->attrib
.scissor
.x
= cctx
->attrib
.scissor
.y
= 0;
4850 cctx
->attrib
.scissor
.width
=
4851 cctx
->pDrawBuffer
->pDrawable
->width
;
4852 cctx
->attrib
.scissor
.height
=
4853 cctx
->pDrawBuffer
->pDrawable
->height
;
4854 cctx
->attrib
.viewport
= cctx
->attrib
.scissor
;
4856 cctx
->activeTexUnit
= 0;
4858 for (i
= 0; i
< cctx
->maxTexUnits
; i
++)
4860 cctx
->attrib
.texUnits
[i
].enabled
= 0;
4862 cctx
->attrib
.texUnits
[i
].p1D
= NULL
;
4863 cctx
->attrib
.texUnits
[i
].p2D
= NULL
;
4864 cctx
->attrib
.texUnits
[i
].p3D
= NULL
;
4865 cctx
->attrib
.texUnits
[i
].pRect
= NULL
;
4866 cctx
->attrib
.texUnits
[i
].pCubeMap
= NULL
;
4869 glEnable (GL_SCISSOR_TEST
);
4871 cctx
->needInit
= FALSE
;
4874 /* update viewport and raster position */
4875 if (cctx
->pDrawBuffer
->xOff
!= cctx
->drawXoff
||
4876 cctx
->pDrawBuffer
->yOff
!= cctx
->drawYoff
)
4878 glViewport (cctx
->attrib
.viewport
.x
+ cctx
->pDrawBuffer
->xOff
,
4879 cctx
->attrib
.viewport
.y
+ cctx
->pDrawBuffer
->yOff
,
4880 cctx
->attrib
.viewport
.width
,
4881 cctx
->attrib
.viewport
.height
);
4883 glBitmap (0, 0, 0, 0,
4884 cctx
->pDrawBuffer
->xOff
- cctx
->drawXoff
,
4885 cctx
->pDrawBuffer
->yOff
- cctx
->drawYoff
,
4888 cctx
->drawXoff
= cctx
->pDrawBuffer
->xOff
;
4889 cctx
->drawYoff
= cctx
->pDrawBuffer
->yOff
;
4892 xglDrawBuffer (cctx
->attrib
.drawBuffer
);
4893 xglReadBuffer (cctx
->attrib
.readBuffer
);
4897 xglSetCurrentContext (pContext
);
4900 drawPriv
->unlockDP (drawPriv
);
4901 if (readPriv
!= drawPriv
)
4902 readPriv
->unlockDP (readPriv
);
4907 status
= (*iface
->exports
.forceCurrent
) ((__GLcontext
*) iface
);
4914 xglNotifyResize (__GLcontext
*gc
)
4916 xglGLContextPtr pContext
= (xglGLContextPtr
) gc
;
4917 __GLinterface
*iface
= pContext
->mIface
;
4922 return (*iface
->exports
.notifyResize
) ((__GLcontext
*) iface
);
4926 xglNotifyDestroy (__GLcontext
*gc
)
4928 xglGLContextPtr pContext
= (xglGLContextPtr
) gc
;
4929 __GLinterface
*iface
= pContext
->mIface
;
4931 pContext
->pReadBuffer
->pDrawable
= 0;
4932 pContext
->pDrawBuffer
->pDrawable
= 0;
4935 (*iface
->exports
.notifyDestroy
) ((__GLcontext
*) iface
);
4939 xglNotifySwapBuffers (__GLcontext
*gc
)
4941 xglGLContextPtr pContext
= (xglGLContextPtr
) gc
;
4942 __GLinterface
*iface
= pContext
->mIface
;
4945 (*iface
->exports
.notifySwapBuffers
) ((__GLcontext
*) iface
);
4948 static struct __GLdispatchStateRec
*
4949 xglDispatchExec (__GLcontext
*gc
)
4951 xglGLContextPtr pContext
= (xglGLContextPtr
) gc
;
4952 __GLinterface
*iface
= pContext
->mIface
;
4957 return (*iface
->exports
.dispatchExec
) ((__GLcontext
*) iface
);
4961 xglBeginDispatchOverride (__GLcontext
*gc
)
4963 xglGLContextPtr pContext
= (xglGLContextPtr
) gc
;
4964 __GLinterface
*iface
= pContext
->mIface
;
4967 (*iface
->exports
.beginDispatchOverride
) ((__GLcontext
*) iface
);
4971 xglEndDispatchOverride (__GLcontext
*gc
)
4973 xglGLContextPtr pContext
= (xglGLContextPtr
) gc
;
4974 __GLinterface
*iface
= pContext
->mIface
;
4977 (*iface
->exports
.endDispatchOverride
) ((__GLcontext
*) iface
);
4981 xglLoseCurrentContext (void *closure
)
4983 if (closure
== cctx
)
4987 GlxFlushContextCache ();
4988 GlxSetRenderTables (0);
4992 static __GLinterface
*
4993 xglCreateContext (__GLimports
*imports
,
4994 __GLcontextModes
*modes
,
4995 __GLinterface
*shareGC
)
4997 glitz_drawable_format_t
*format
;
4998 xglGLContextPtr pShareContext
= (xglGLContextPtr
) shareGC
;
4999 xglGLContextPtr pContext
;
5000 __GLinterface
*shareIface
= NULL
;
5001 __GLinterface
*iface
;
5002 __GLXcontext
*glxCtx
= (__GLXcontext
*) imports
->other
;
5004 XGL_SCREEN_PRIV (glxCtx
->pScreen
);
5006 pContext
= xalloc (sizeof (xglGLContextRec
));
5010 format
= glitz_drawable_get_format (pScreenPriv
->drawable
);
5011 pContext
->context
= glitz_context_create (pScreenPriv
->drawable
, format
);
5012 glitz_context_set_user_data (pContext
->context
, pContext
,
5013 xglLoseCurrentContext
);
5015 pContext
->glRenderTable
= __glNativeRenderTable
;
5016 pContext
->needInit
= TRUE
;
5017 pContext
->versionString
= NULL
;
5018 pContext
->errorValue
= GL_NO_ERROR
;
5019 pContext
->shared
= NULL
;
5021 pContext
->groupList
= 0;
5022 pContext
->beginCnt
= 0;
5023 pContext
->nAttribStack
= 0;
5024 pContext
->refcnt
= 1;
5025 pContext
->doubleBuffer
= glxCtx
->modes
->doubleBufferMode
;
5026 pContext
->depthBits
= glxCtx
->modes
->depthBits
;
5027 pContext
->stencilBits
= glxCtx
->modes
->stencilBits
;
5028 pContext
->drawXoff
= 0;
5029 pContext
->drawYoff
= 0;
5030 pContext
->maxTexUnits
= 0;
5032 if (pContext
->doubleBuffer
)
5034 pContext
->attrib
.drawBuffer
= GL_BACK
;
5035 pContext
->attrib
.readBuffer
= GL_BACK
;
5039 pContext
->attrib
.drawBuffer
= GL_FRONT
;
5040 pContext
->attrib
.readBuffer
= GL_FRONT
;
5043 pContext
->attrib
.scissorTest
= GL_FALSE
;
5047 pContext
->texObjects
= NULL
;
5048 pContext
->displayLists
= NULL
;
5050 pContext
->shared
= pShareContext
->shared
;
5051 shareIface
= pShareContext
->mIface
;
5055 pContext
->texObjects
= xglNewHashTable ();
5056 if (!pContext
->texObjects
)
5058 xglFreeContext (pContext
);
5062 pContext
->displayLists
= xglNewHashTable ();
5063 if (!pContext
->displayLists
)
5065 xglFreeContext (pContext
);
5069 pContext
->shared
= pContext
;
5072 pContext
->shared
->refcnt
++;
5074 iface
= (*screenInfoPriv
.createContext
) (imports
, modes
, shareIface
);
5077 xglFreeContext (pContext
);
5081 pContext
->mIface
= iface
;
5082 pContext
->iface
.imports
= *imports
;
5084 pContext
->iface
.exports
.destroyContext
= xglDestroyContext
;
5085 pContext
->iface
.exports
.loseCurrent
= xglLoseCurrent
;
5086 pContext
->iface
.exports
.makeCurrent
= xglMakeCurrent
;
5087 pContext
->iface
.exports
.shareContext
= xglShareContext
;
5088 pContext
->iface
.exports
.copyContext
= xglCopyContext
;
5089 pContext
->iface
.exports
.forceCurrent
= xglForceCurrent
;
5090 pContext
->iface
.exports
.notifyResize
= xglNotifyResize
;
5091 pContext
->iface
.exports
.notifyDestroy
= xglNotifyDestroy
;
5092 pContext
->iface
.exports
.notifySwapBuffers
= xglNotifySwapBuffers
;
5093 pContext
->iface
.exports
.dispatchExec
= xglDispatchExec
;
5094 pContext
->iface
.exports
.beginDispatchOverride
= xglBeginDispatchOverride
;
5095 pContext
->iface
.exports
.endDispatchOverride
= xglEndDispatchOverride
;
5097 return (__GLinterface
*) pContext
;
5101 xglSwapBuffers (__GLXdrawablePrivate
*glxPriv
)
5103 __GLdrawablePrivate
*glPriv
= &glxPriv
->glPriv
;
5104 xglGLBufferPtr pBufferPriv
= glPriv
->private;
5105 DrawablePtr pDrawable
= pBufferPriv
->pDrawable
;
5106 GLboolean status
= GL_TRUE
;
5110 if (glPriv
->modes
->doubleBufferMode
)
5112 glitz_surface_t
*surface
;
5114 GCPtr pGC
= pBufferPriv
->pGC
;
5115 BoxPtr pBox
= REGION_RECTS (pGC
->pCompositeClip
);
5116 int nBox
= REGION_NUM_RECTS (pGC
->pCompositeClip
);
5118 XGL_GET_DRAWABLE (pDrawable
, surface
, xOff
, yOff
);
5120 glitz_drawable_swap_buffer_region (pBufferPriv
->drawable
,
5122 (glitz_box_t
*) pBox
, nBox
);
5124 xglAddBitDamage (pDrawable
, pGC
->pCompositeClip
);
5125 DamageDamageRegion (pDrawable
, pGC
->pCompositeClip
);
5126 REGION_EMPTY (pGC
->pScreen
, &pBufferPriv
->damage
);
5129 else if (pBufferPriv
->private)
5131 glPriv
->private = pBufferPriv
->private;
5132 status
= (*pBufferPriv
->swapBuffers
) (glxPriv
);
5133 glPriv
->private = pBufferPriv
;
5140 xglResizeBuffers (__GLdrawableBuffer
*buffer
,
5145 __GLdrawablePrivate
*glPriv
,
5148 xglGLBufferPtr pBufferPriv
= glPriv
->private;
5149 DrawablePtr pDrawable
= pBufferPriv
->pDrawable
;
5150 GLboolean status
= GL_TRUE
;
5154 if (!xglResizeBuffer (glPriv
, x
, y
, width
, height
))
5157 else if (pBufferPriv
->private)
5159 glPriv
->private = pBufferPriv
->private;
5160 status
= (*pBufferPriv
->resizeBuffers
) (buffer
,
5161 x
, y
, width
, height
,
5164 glPriv
->private = pBufferPriv
;
5171 xglBindBuffers (__GLXdrawablePrivate
*glxPriv
,
5174 __GLdrawablePrivate
*glPriv
= &glxPriv
->glPriv
;
5175 xglGLBufferPtr pBufferPriv
= glPriv
->private;
5179 xglTexUnitPtr pTexUnit
= &cctx
->attrib
.texUnits
[cctx
->activeTexUnit
];
5180 xglTexObjPtr pTexObj
= NULL
;
5181 DrawablePtr pDrawable
;
5183 /* XXX: front left buffer is only supported so far */
5184 if (buffer
!= GLX_FRONT_LEFT_EXT
)
5187 /* Must be a GLXpixmap */
5188 if (!glxPriv
->pGlxPixmap
)
5191 pDrawable
= glxPriv
->pGlxPixmap
->pDraw
;
5193 switch (glxPriv
->texTarget
) {
5194 case GLX_TEXTURE_RECTANGLE_EXT
:
5195 pTexObj
= pTexUnit
->pRect
;
5197 case GLX_TEXTURE_2D_EXT
:
5198 pTexObj
= pTexUnit
->p2D
;
5206 glitz_texture_object_t
*object
;
5208 XGL_SCREEN_PRIV (pDrawable
->pScreen
);
5209 XGL_DRAWABLE_PIXMAP (pDrawable
);
5210 XGL_PIXMAP_PRIV (pPixmap
);
5212 if (pPixmap
== pScreenPriv
->pScreenPixmap
)
5215 object
= glitz_texture_object_create (pPixmapPriv
->surface
);
5220 if (pTexObj
->pPixmap
)
5221 (*pDrawable
->pScreen
->DestroyPixmap
) (pTexObj
->pPixmap
);
5223 if (pTexObj
->object
)
5224 glitz_texture_object_destroy (pTexObj
->object
);
5226 pTexObj
->pPixmap
= pPixmap
;
5227 pTexObj
->object
= object
;
5233 else if (pBufferPriv
->private)
5237 glPriv
->private = pBufferPriv
->private;
5238 status
= (*pBufferPriv
->bindBuffers
) (glxPriv
, buffer
);
5239 glPriv
->private = pBufferPriv
;
5248 xglReleaseBuffers (__GLXdrawablePrivate
*glxPriv
,
5251 __GLdrawablePrivate
*glPriv
= &glxPriv
->glPriv
;
5252 xglGLBufferPtr pBufferPriv
= glPriv
->private;
5256 xglTexObjPtr pTexObj
;
5258 /* XXX: front left buffer is only supported so far */
5259 if (buffer
!= GLX_FRONT_LEFT_EXT
)
5262 /* Must be a GLXpixmap */
5263 if (glxPriv
->pGlxPixmap
)
5265 DrawablePtr pDrawable
= glxPriv
->pGlxPixmap
->pDraw
;
5267 XGL_DRAWABLE_PIXMAP (pDrawable
);
5269 pTexObj
= cctx
->attrib
.texUnits
[cctx
->activeTexUnit
].p2D
;
5270 if (pTexObj
&& pTexObj
->pPixmap
== pPixmap
)
5272 (*pDrawable
->pScreen
->DestroyPixmap
) (pTexObj
->pPixmap
);
5273 pTexObj
->pPixmap
= NULL
;
5274 glitz_texture_object_destroy (pTexObj
->object
);
5275 pTexObj
->object
= NULL
;
5281 pTexObj
= cctx
->attrib
.texUnits
[cctx
->activeTexUnit
].pRect
;
5282 if (pTexObj
&& pTexObj
->pPixmap
== pPixmap
)
5284 (*pDrawable
->pScreen
->DestroyPixmap
) (pTexObj
->pPixmap
);
5285 pTexObj
->pPixmap
= NULL
;
5286 glitz_texture_object_destroy (pTexObj
->object
);
5287 pTexObj
->object
= NULL
;
5294 else if (pBufferPriv
->private)
5298 glPriv
->private = pBufferPriv
->private;
5299 status
= (*pBufferPriv
->releaseBuffers
) (glxPriv
, buffer
);
5300 glPriv
->private = pBufferPriv
;
5308 xglFreeBuffers (__GLdrawablePrivate
*glPriv
)
5310 xglGLBufferPtr pBufferPriv
= glPriv
->private;
5312 glPriv
->private = pBufferPriv
->private;
5314 if (pBufferPriv
->freeBuffers
)
5315 (*pBufferPriv
->freeBuffers
) (glPriv
);
5317 if (pBufferPriv
->pGC
)
5318 FreeGC (pBufferPriv
->pGC
, (GContext
) 0);
5320 if (pBufferPriv
->backSurface
)
5321 glitz_surface_destroy (pBufferPriv
->backSurface
);
5323 if (pBufferPriv
->drawable
)
5324 glitz_drawable_destroy (pBufferPriv
->drawable
);
5326 xfree (pBufferPriv
);
5330 xglCreateBuffer (__GLXdrawablePrivate
*glxPriv
)
5332 __GLdrawablePrivate
*glPriv
= &glxPriv
->glPriv
;
5333 DrawablePtr pDrawable
= glxPriv
->pDraw
;
5334 ScreenPtr pScreen
= pDrawable
->pScreen
;
5335 xglGLBufferPtr pBufferPriv
;
5338 XGL_SCREEN_PRIV (pScreen
);
5339 XGL_DRAWABLE_PIXMAP (pDrawable
);
5341 pBufferPriv
= xalloc (sizeof (xglGLBufferRec
));
5343 FatalError ("xglCreateBuffer: No memory\n");
5345 pBufferPriv
->pScreen
= pScreen
;
5346 pBufferPriv
->pDrawable
= NULL
;
5347 pBufferPriv
->pPixmap
= NULL
;
5348 pBufferPriv
->pGC
= NULL
;
5350 pBufferPriv
->swapBuffers
= NULL
;
5352 pBufferPriv
->bindBuffers
= NULL
;
5353 pBufferPriv
->releaseBuffers
= NULL
;
5355 pBufferPriv
->resizeBuffers
= NULL
;
5356 pBufferPriv
->private = NULL
;
5357 pBufferPriv
->freeBuffers
= NULL
;
5359 pBufferPriv
->drawable
= NULL
;
5360 pBufferPriv
->backSurface
= NULL
;
5362 REGION_INIT (pScreen
, &pBufferPriv
->damage
, NullBox
, 0);
5364 pBufferPriv
->pVisual
= 0;
5366 /* glx acceleration */
5367 if (pScreenPriv
->accel
.glx
.enabled
&&
5368 xglCheckPixmapSize (pPixmap
, &pScreenPriv
->accel
.glx
.size
))
5370 for (v
= pScreenPriv
->pGlxVisual
; v
; v
= v
->next
)
5372 glitz_drawable_format_t
*format
;
5374 if (pScreenPriv
->accel
.glx
.pbuffer
!= v
->pbuffer
)
5377 format
= v
->format
.drawable
;
5381 if (format
->color
.red_size
!= glxPriv
->modes
->redBits
||
5382 format
->color
.green_size
!= glxPriv
->modes
->greenBits
||
5383 format
->color
.blue_size
!= glxPriv
->modes
->blueBits
)
5386 if (format
->color
.alpha_size
< glxPriv
->modes
->alphaBits
||
5387 format
->depth_size
< glxPriv
->modes
->depthBits
||
5388 format
->stencil_size
< glxPriv
->modes
->stencilBits
||
5389 format
->doublebuffer
< glxPriv
->modes
->doubleBufferMode
)
5392 /* this is good enought for pbuffers */
5396 /* we want an exact match for non-pbuffer formats */
5397 if (format
->color
.alpha_size
== glxPriv
->modes
->alphaBits
&&
5398 format
->depth_size
== glxPriv
->modes
->depthBits
&&
5399 format
->stencil_size
== glxPriv
->modes
->stencilBits
&&
5400 format
->doublebuffer
== glxPriv
->modes
->doubleBufferMode
)
5404 pBufferPriv
->pVisual
= v
;
5407 if ((pDrawable
->type
== DRAWABLE_WINDOW
)
5410 && (pBufferPriv
->pVisual
5412 /* this is a root window, can't be redirected */
5413 || (!((WindowPtr
) pDrawable
)->parent
))
5418 pBufferPriv
->pDrawable
= pDrawable
;
5422 (*screenInfoPriv
.createBuffer
) (glxPriv
);
5424 /* Wrap the swap buffers routine */
5425 pBufferPriv
->swapBuffers
= glxPriv
->swapBuffers
;
5427 /* Wrap the render texture routines */
5428 pBufferPriv
->bindBuffers
= glxPriv
->bindBuffers
;
5429 pBufferPriv
->releaseBuffers
= glxPriv
->releaseBuffers
;
5431 /* Wrap the front buffer's resize routine */
5432 pBufferPriv
->resizeBuffers
= glPriv
->frontBuffer
.resize
;
5434 /* Save Xgl's private buffer structure */
5435 pBufferPriv
->freeBuffers
= glPriv
->freePrivate
;
5436 pBufferPriv
->private = glPriv
->private;
5439 glxPriv
->texTarget
= GLX_NO_TEXTURE_EXT
;
5441 /* We enable render texture for all GLXPixmaps right now. Eventually, this
5442 should only be enabled when fbconfig attribute GLX_RENDER_TEXTURE_RGB or
5443 GLX_RENDER_TEXTURE_RGBA is set to TRUE. */
5444 if (pDrawable
->type
!= DRAWABLE_WINDOW
)
5446 XGL_DRAWABLE_PIXMAP (pDrawable
);
5448 if (xglCreatePixmapSurface (pPixmap
))
5450 glitz_texture_object_t
*texture
;
5452 XGL_PIXMAP_PRIV (pPixmap
);
5454 texture
= glitz_texture_object_create (pPixmapPriv
->surface
);
5457 switch (glitz_texture_object_get_target (texture
)) {
5458 case GLITZ_TEXTURE_TARGET_2D
:
5459 glxPriv
->texTarget
= GLX_TEXTURE_2D_EXT
;
5461 case GLITZ_TEXTURE_TARGET_RECT
:
5462 glxPriv
->texTarget
= GLX_TEXTURE_RECTANGLE_EXT
;
5466 glitz_texture_object_destroy (texture
);
5471 glxPriv
->swapBuffers
= xglSwapBuffers
;
5473 glxPriv
->bindBuffers
= xglBindBuffers
;
5474 glxPriv
->releaseBuffers
= xglReleaseBuffers
;
5475 glPriv
->frontBuffer
.resize
= xglResizeBuffers
;
5477 glPriv
->private = (void *) pBufferPriv
;
5478 glPriv
->freePrivate
= xglFreeBuffers
;
5482 xglScreenProbe (int screen
)
5484 ScreenPtr pScreen
= screenInfo
.screens
[screen
];
5485 xglVisualPtr pVisual
;
5489 XGL_SCREEN_PRIV (pScreen
);
5491 status
= (*screenInfoPriv
.screenProbe
) (screen
);
5493 /* Create Xgl GLX visuals */
5494 for (i
= 0; i
< __xglScreenInfoPtr
->numVisuals
; i
++)
5496 pVisual
= xglFindVisualWithId (pScreen
, pScreen
->visuals
[i
].vid
);
5499 glitz_drawable_format_t templ
, *format
, *screenFormat
;
5502 templ
.color
= pVisual
->format
.surface
->color
;
5503 templ
.depth_size
= __xglScreenInfoPtr
->modes
[i
].depthBits
;
5504 templ
.stencil_size
= __xglScreenInfoPtr
->modes
[i
].stencilBits
;
5505 templ
.doublebuffer
= __xglScreenInfoPtr
->modes
[i
].doubleBufferMode
;
5509 GLITZ_FORMAT_FOURCC_MASK
|
5510 GLITZ_FORMAT_RED_SIZE_MASK
|
5511 GLITZ_FORMAT_GREEN_SIZE_MASK
|
5512 GLITZ_FORMAT_BLUE_SIZE_MASK
|
5513 GLITZ_FORMAT_ALPHA_SIZE_MASK
|
5514 GLITZ_FORMAT_DEPTH_SIZE_MASK
|
5515 GLITZ_FORMAT_STENCIL_SIZE_MASK
|
5516 GLITZ_FORMAT_DOUBLEBUFFER_MASK
|
5517 GLITZ_FORMAT_SAMPLES_MASK
;
5519 format
= glitz_find_drawable_format (pScreenPriv
->drawable
,
5523 xglVisualPtr v
, new, *prev
;
5525 new = xalloc (sizeof (xglVisualRec
));
5529 new->vid
= pVisual
->vid
;
5530 new->pPixel
= pVisual
->pPixel
;
5531 new->pbuffer
= FALSE
;
5533 new->format
.surface
= pVisual
->format
.surface
;
5534 new->format
.drawable
= format
;
5536 prev
= &pScreenPriv
->pGlxVisual
;
5544 /* use same drawable format as screen for pbuffers */
5545 screenFormat
= glitz_drawable_get_format (pScreenPriv
->drawable
);
5546 templ
.id
= screenFormat
->id
;
5549 GLITZ_FORMAT_ID_MASK
|
5550 GLITZ_FORMAT_FOURCC_MASK
|
5551 GLITZ_FORMAT_RED_SIZE_MASK
|
5552 GLITZ_FORMAT_GREEN_SIZE_MASK
|
5553 GLITZ_FORMAT_BLUE_SIZE_MASK
|
5554 GLITZ_FORMAT_SAMPLES_MASK
;
5556 format
= glitz_find_pbuffer_format (pScreenPriv
->drawable
,
5560 xglVisualPtr v
, new, *prev
;
5562 new = xalloc (sizeof (xglVisualRec
));
5566 new->vid
= pVisual
->vid
;
5567 new->pPixel
= pVisual
->pPixel
;
5568 new->pbuffer
= TRUE
;
5570 new->format
.surface
= pVisual
->format
.surface
;
5571 new->format
.drawable
= format
;
5573 prev
= &pScreenPriv
->pGlxVisual
;
5583 /* Wrap createBuffer */
5584 if (__xglScreenInfoPtr
->createBuffer
!= xglCreateBuffer
)
5586 screenInfoPriv
.createBuffer
= __xglScreenInfoPtr
->createBuffer
;
5587 __xglScreenInfoPtr
->createBuffer
= xglCreateBuffer
;
5590 /* Wrap createContext */
5591 if (__xglScreenInfoPtr
->createContext
!= xglCreateContext
)
5593 screenInfoPriv
.createContext
= __xglScreenInfoPtr
->createContext
;
5594 __xglScreenInfoPtr
->createContext
= xglCreateContext
;
5601 xglInitVisualConfigs (ScreenPtr pScreen
)
5603 miInitVisualsProcPtr initVisualsProc
= NULL
;
5609 VisualID defaultVis
;
5610 glitz_drawable_format_t
*format
;
5611 xglVisualPtr pVisual
;
5612 __GLXvisualConfig
*pConfig
;
5613 xglGLXVisualConfigPtr pConfigPriv
, *ppConfigPriv
;
5614 XID
*installedCmaps
;
5615 ColormapPtr installedCmap
;
5616 int numInstalledCmaps
;
5620 XGL_SCREEN_PRIV (pScreen
);
5622 if (xglScreenInfo
.depth
!= 16 && xglScreenInfo
.depth
!= 24)
5625 for (pVisual
= xglVisuals
; pVisual
; pVisual
= pVisual
->next
)
5627 if (pVisual
->pPixel
->depth
== xglScreenInfo
.depth
)
5634 bpp
= pVisual
->pPixel
->masks
.bpp
;
5636 format
= glitz_drawable_get_format (pScreenPriv
->drawable
);
5637 if (format
->doublebuffer
)
5640 pConfig
= xcalloc (sizeof (__GLXvisualConfig
), numConfig
);
5644 pConfigPriv
= xcalloc (sizeof (xglGLXVisualConfigRec
), numConfig
);
5651 ppConfigPriv
= xcalloc (sizeof (xglGLXVisualConfigPtr
), numConfig
);
5654 xfree (pConfigPriv
);
5659 installedCmaps
= xalloc (pScreen
->maxInstalledCmaps
* sizeof (XID
));
5660 if (!installedCmaps
)
5662 xfree (ppConfigPriv
);
5663 xfree (pConfigPriv
);
5668 for (i
= 0; i
< numConfig
; i
++)
5670 ppConfigPriv
[i
] = &pConfigPriv
[i
];
5672 pConfig
[i
].vid
= (VisualID
) (-1);
5673 pConfig
[i
].class = -1;
5674 pConfig
[i
].rgba
= TRUE
;
5676 pConfig
[i
].redSize
= format
->color
.red_size
;
5677 pConfig
[i
].greenSize
= format
->color
.green_size
;
5678 pConfig
[i
].blueSize
= format
->color
.blue_size
;
5679 pConfig
[i
].alphaSize
= format
->color
.alpha_size
;
5681 pConfig
[i
].redMask
= pVisual
->pPixel
->masks
.red_mask
;
5682 pConfig
[i
].greenMask
= pVisual
->pPixel
->masks
.green_mask
;
5683 pConfig
[i
].blueMask
= pVisual
->pPixel
->masks
.blue_mask
;
5684 pConfig
[i
].alphaMask
= pVisual
->pPixel
->masks
.alpha_mask
;
5688 pConfig
[i
].doubleBuffer
= FALSE
;
5689 pConfig
[i
].depthSize
= 0;
5690 pConfig
[i
].stencilSize
= 0;
5694 pConfig
[i
].doubleBuffer
= TRUE
;
5695 pConfig
[i
].depthSize
= format
->depth_size
;
5696 pConfig
[i
].stencilSize
= format
->stencil_size
;
5699 pConfig
[i
].stereo
= FALSE
;
5701 if (pScreen
->rootDepth
== 16)
5702 pConfig
[i
].bufferSize
= 16;
5704 pConfig
[i
].bufferSize
= 32;
5706 pConfig
[i
].auxBuffers
= 0;
5707 pConfig
[i
].level
= 0;
5709 pConfig
[i
].visualRating
= GLX_NONE
;
5711 pConfig
[i
].transparentPixel
= GLX_NONE
;
5712 pConfig
[i
].transparentRed
= 0;
5713 pConfig
[i
].transparentGreen
= 0;
5714 pConfig
[i
].transparentBlue
= 0;
5715 pConfig
[i
].transparentAlpha
= 0;
5716 pConfig
[i
].transparentIndex
= 0;
5719 GlxSetVisualConfigs (numConfig
, pConfig
, (void **) ppConfigPriv
);
5721 /* Wrap screenProbe */
5722 if (__xglScreenInfoPtr
->screenProbe
!= xglScreenProbe
)
5724 screenInfoPriv
.screenProbe
= __xglScreenInfoPtr
->screenProbe
;
5725 __xglScreenInfoPtr
->screenProbe
= xglScreenProbe
;
5728 visuals
= pScreen
->visuals
;
5729 nvisuals
= pScreen
->numVisuals
;
5730 depths
= pScreen
->allowedDepths
;
5731 ndepths
= pScreen
->numDepths
;
5732 rootDepth
= pScreen
->rootDepth
;
5733 defaultVis
= pScreen
->rootVisual
;
5735 /* Find installed colormaps */
5736 numInstalledCmaps
= (*pScreen
->ListInstalledColormaps
) (pScreen
,
5739 GlxWrapInitVisuals (&initVisualsProc
);
5740 GlxInitVisuals (&visuals
, &depths
, &nvisuals
, &ndepths
, &rootDepth
,
5741 &defaultVis
, ((unsigned long) 1 << (bpp
- 1)), 8, -1);
5743 /* Fix up any existing installed colormaps. */
5744 for (i
= 0; i
< numInstalledCmaps
; i
++)
5748 installedCmap
= LookupIDByType (installedCmaps
[i
], RT_COLORMAP
);
5752 j
= installedCmap
->pVisual
- pScreen
->visuals
;
5753 installedCmap
->pVisual
= &visuals
[j
];
5756 pScreen
->visuals
= visuals
;
5757 pScreen
->numVisuals
= nvisuals
;
5758 pScreen
->allowedDepths
= depths
;
5759 pScreen
->numDepths
= ndepths
;
5760 pScreen
->rootDepth
= rootDepth
;
5761 pScreen
->rootVisual
= defaultVis
;
5767 xfree (installedCmaps
);
5768 xfree (pConfigPriv
);