1 /* $Id: fakeglx.c,v 1.68 2002/10/05 03:02:34 brianp Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 * This is an emulation of the GLX API which allows Mesa/GLX-based programs
30 * to run on X servers which do not have the real GLX extension.
32 * Thanks to the contributors:
34 * Initial version: Philip Brown (phil@bolthole.com)
35 * Better glXGetConfig() support: Armin Liebchen (liebchen@asylum.cs.utah.edu)
36 * Further visual-handling refinements: Wolfram Gloger
37 * (wmglo@Dent.MED.Uni-Muenchen.DE).
40 * Don't be fooled, stereo isn't supported yet.
45 #include "glxheader.h"
58 /* This indicates the client-side GLX API and GLX encoder version. */
59 #define CLIENT_MAJOR_VERSION 1
60 #define CLIENT_MINOR_VERSION 4 /* but don't have 1.3's pbuffers, etc yet */
62 /* This indicates the server-side GLX decoder version.
63 * GLX 1.4 indicates OpenGL 1.3 support
65 #define SERVER_MAJOR_VERSION 1
66 #define SERVER_MINOR_VERSION 4
68 /* This is appended onto the glXGetClient/ServerString version strings. */
69 #define MESA_GLX_VERSION "Mesa 4.1"
71 /* Who implemented this GLX? */
72 #define VENDOR "Brian Paul"
76 /* Silence compiler warnings */
77 extern void Fake_glXDummyFunc( void );
78 void Fake_glXDummyFunc( void )
88 * Our fake GLX context will contain a "real" GLX context and an XMesa context.
90 * Note that a pointer to a __GLXcontext is a pointer to a fake_glx_context,
93 * We really just need this structure in order to make the libGL functions
94 * glXGetCurrentContext(), glXGetCurrentDrawable() and glXGetCurrentDisplay()
97 struct fake_glx_context
{
98 __GLXcontext glxContext
; /* this MUST be first! */
99 XMesaContext xmesaContext
;
104 /**********************************************************************/
105 /*** GLX Visual Code ***/
106 /**********************************************************************/
111 #define MAX_VISUALS 100
112 static XMesaVisual VisualTable
[MAX_VISUALS
];
113 static int NumVisuals
= 0;
117 * This struct and some code fragments borrowed
118 * from Mark Kilgard's GLUT library.
120 typedef struct _OverlayInfo
{
121 /* Avoid 64-bit portability problems by being careful to use
122 longs due to the way XGetWindowProperty is specified. Note
123 that these parameters are passed as CARD32s over X
125 unsigned long overlay_visual
;
126 long transparent_type
;
133 /* Macro to handle c_class vs class field name in XVisualInfo struct */
134 #if defined(__cplusplus) || defined(c_plusplus)
135 #define CLASS c_class
144 * Test if the given XVisualInfo is usable for Mesa rendering.
146 static GLboolean
is_usable_visual( XVisualInfo
*vinfo
)
148 switch (vinfo
->CLASS
) {
151 /* Any StaticGray/GrayScale visual works in RGB or CI mode */
155 /* Any StaticColor/PseudoColor visual of at least 4 bits */
156 if (vinfo
->depth
>=4) {
164 /* Any depth of TrueColor or DirectColor works in RGB mode */
167 /* This should never happen */
175 * Return the level (overlay, normal, underlay) of a given XVisualInfo.
176 * Input: dpy - the X display
177 * vinfo - the XVisualInfo to test
178 * Return: level of the visual:
180 * >0 = overlay planes
181 * <0 = underlay planes
183 static int level_of_visual( Display
*dpy
, XVisualInfo
*vinfo
)
185 Atom overlayVisualsAtom
;
186 OverlayInfo
*overlay_info
= NULL
;
187 int numOverlaysPerScreen
;
191 unsigned long sizeData
, bytesLeft
;
195 * The SERVER_OVERLAY_VISUALS property on the root window contains
196 * a list of overlay visuals. Get that list now.
198 overlayVisualsAtom
= XInternAtom(dpy
,"SERVER_OVERLAY_VISUALS", True
);
199 if (overlayVisualsAtom
== None
) {
203 status
= XGetWindowProperty(dpy
, RootWindow( dpy
, vinfo
->screen
),
204 overlayVisualsAtom
, 0L, (long) 10000, False
,
205 overlayVisualsAtom
, &actualType
, &actualFormat
,
206 &sizeData
, &bytesLeft
,
207 (unsigned char **) &overlay_info
);
209 if (status
!= Success
|| actualType
!= overlayVisualsAtom
||
210 actualFormat
!= 32 || sizeData
< 4) {
211 /* something went wrong */
212 XFree((void *) overlay_info
);
216 /* search the overlay visual list for the visual ID of interest */
217 numOverlaysPerScreen
= (int) (sizeData
/ 4);
218 for (i
=0;i
<numOverlaysPerScreen
;i
++) {
220 ov
= overlay_info
+ i
;
221 if (ov
->overlay_visual
==vinfo
->visualid
) {
222 /* found the visual */
223 if (/*ov->transparent_type==1 &&*/ ov
->layer
!=0) {
224 int level
= ov
->layer
;
225 XFree((void *) overlay_info
);
229 XFree((void *) overlay_info
);
235 /* The visual ID was not found in the overlay list. */
236 XFree((void *) overlay_info
);
244 * Given an XVisualInfo and RGB, Double, and Depth buffer flags, save the
245 * configuration in our list of GLX visuals.
248 save_glx_visual( Display
*dpy
, XVisualInfo
*vinfo
,
249 GLboolean rgbFlag
, GLboolean alphaFlag
, GLboolean dbFlag
,
250 GLboolean stereoFlag
,
251 GLint depth_size
, GLint stencil_size
,
252 GLint accumRedSize
, GLint accumGreenSize
,
253 GLint accumBlueSize
, GLint accumAlphaSize
,
256 GLboolean ximageFlag
= GL_TRUE
;
259 GLboolean comparePointers
;
262 /* Check if the MESA_BACK_BUFFER env var is set */
263 char *backbuffer
= getenv("MESA_BACK_BUFFER");
265 if (backbuffer
[0]=='p' || backbuffer
[0]=='P') {
266 ximageFlag
= GL_FALSE
;
268 else if (backbuffer
[0]=='x' || backbuffer
[0]=='X') {
269 ximageFlag
= GL_TRUE
;
272 _mesa_warning(NULL
, "Mesa: invalid value for MESA_BACK_BUFFER environment variable, using an XImage.");
277 /* Comparing IDs uses less memory but sometimes fails. */
278 /* XXX revisit this after 3.0 is finished. */
279 if (getenv("MESA_GLX_VISUAL_HACK"))
280 comparePointers
= GL_TRUE
;
282 comparePointers
= GL_FALSE
;
284 /* First check if a matching visual is already in the list */
285 for (i
=0; i
<NumVisuals
; i
++) {
286 XMesaVisual v
= VisualTable
[i
];
287 if (v
->display
== dpy
289 && v
->ximage_flag
== ximageFlag
290 && v
->mesa_visual
.rgbMode
== rgbFlag
291 && v
->mesa_visual
.doubleBufferMode
== dbFlag
292 && v
->mesa_visual
.stereoMode
== stereoFlag
293 && (v
->mesa_visual
.alphaBits
> 0) == alphaFlag
294 && (v
->mesa_visual
.depthBits
>= depth_size
|| depth_size
== 0)
295 && (v
->mesa_visual
.stencilBits
>= stencil_size
|| stencil_size
== 0)
296 && (v
->mesa_visual
.accumRedBits
>= accumRedSize
|| accumRedSize
== 0)
297 && (v
->mesa_visual
.accumGreenBits
>= accumGreenSize
|| accumGreenSize
== 0)
298 && (v
->mesa_visual
.accumBlueBits
>= accumBlueSize
|| accumBlueSize
== 0)
299 && (v
->mesa_visual
.accumAlphaBits
>= accumAlphaSize
|| accumAlphaSize
== 0)) {
300 /* now either compare XVisualInfo pointers or visual IDs */
301 if ((!comparePointers
&& v
->visinfo
->visualid
== vinfo
->visualid
)
302 || (comparePointers
&& v
->vishandle
== vinfo
)) {
308 /* Create a new visual and add it to the list. */
310 if (NumVisuals
>= MAX_VISUALS
) {
311 _mesa_problem(NULL
, "GLX Error: maximum number of visuals exceeded");
315 xmvis
= XMesaCreateVisual( dpy
, vinfo
, rgbFlag
, alphaFlag
, dbFlag
,
316 stereoFlag
, ximageFlag
,
317 depth_size
, stencil_size
,
318 accumRedSize
, accumBlueSize
,
319 accumBlueSize
, accumAlphaSize
, 0, level
,
322 VisualTable
[NumVisuals
] = xmvis
;
331 * Create a GLX visual from a regular XVisualInfo.
332 * This is called when Fake GLX is given an XVisualInfo which wasn't
333 * returned by glXChooseVisual. Since this is the first time we're
334 * considering this visual we'll take a guess at reasonable values
335 * for depth buffer size, stencil size, accum size, etc.
336 * This is the best we can do with a client-side emulation of GLX.
339 create_glx_visual( Display
*dpy
, XVisualInfo
*visinfo
)
343 vislevel
= level_of_visual( dpy
, visinfo
);
345 /* Configure this visual as a CI, single-buffered overlay */
346 return save_glx_visual( dpy
, visinfo
,
348 GL_FALSE
, /* alpha */
349 GL_FALSE
, /* double */
350 GL_FALSE
, /* stereo */
352 0, /* stencil bits */
353 0,0,0,0, /* accum bits */
357 else if (is_usable_visual( visinfo
)) {
358 if (getenv("MESA_GLX_FORCE_CI")) {
359 /* Configure this visual as a COLOR INDEX visual. */
360 return save_glx_visual( dpy
, visinfo
,
362 GL_FALSE
, /* alpha */
363 GL_TRUE
, /* double */
364 GL_FALSE
, /* stereo */
365 DEFAULT_SOFTWARE_DEPTH_BITS
,
366 8 * sizeof(GLstencil
),
367 0 * sizeof(GLaccum
), /* r */
368 0 * sizeof(GLaccum
), /* g */
369 0 * sizeof(GLaccum
), /* b */
370 0 * sizeof(GLaccum
), /* a */
375 /* Configure this visual as RGB, double-buffered, depth-buffered. */
376 /* This is surely wrong for some people's needs but what else */
377 /* can be done? They should use glXChooseVisual(). */
378 return save_glx_visual( dpy
, visinfo
,
380 GL_FALSE
, /* alpha */
381 GL_TRUE
, /* double */
382 GL_FALSE
, /* stereo */
383 DEFAULT_SOFTWARE_DEPTH_BITS
,
384 8 * sizeof(GLstencil
),
385 8 * sizeof(GLaccum
), /* r */
386 8 * sizeof(GLaccum
), /* g */
387 8 * sizeof(GLaccum
), /* b */
388 8 * sizeof(GLaccum
), /* a */
394 _mesa_warning(NULL
, "Mesa: error in glXCreateContext: bad visual\n");
402 * Find the GLX visual associated with an XVisualInfo.
405 find_glx_visual( Display
*dpy
, XVisualInfo
*vinfo
)
409 /* First try to match pointers */
410 for (i
=0;i
<NumVisuals
;i
++) {
411 if (VisualTable
[i
]->display
==dpy
&& VisualTable
[i
]->vishandle
==vinfo
) {
412 return VisualTable
[i
];
415 /* try to match visual id */
416 for (i
=0;i
<NumVisuals
;i
++) {
417 if (VisualTable
[i
]->display
==dpy
418 && VisualTable
[i
]->visinfo
->visualid
== vinfo
->visualid
) {
419 return VisualTable
[i
];
428 * Return the transparent pixel value for a GLX visual.
429 * Input: glxvis - the glx_visual
430 * Return: a pixel value or -1 if no transparent pixel
432 static int transparent_pixel( XMesaVisual glxvis
)
434 Display
*dpy
= glxvis
->display
;
435 XVisualInfo
*vinfo
= glxvis
->visinfo
;
436 Atom overlayVisualsAtom
;
437 OverlayInfo
*overlay_info
= NULL
;
438 int numOverlaysPerScreen
;
442 unsigned long sizeData
, bytesLeft
;
446 * The SERVER_OVERLAY_VISUALS property on the root window contains
447 * a list of overlay visuals. Get that list now.
449 overlayVisualsAtom
= XInternAtom(dpy
,"SERVER_OVERLAY_VISUALS", True
);
450 if (overlayVisualsAtom
== None
) {
454 status
= XGetWindowProperty(dpy
, RootWindow( dpy
, vinfo
->screen
),
455 overlayVisualsAtom
, 0L, (long) 10000, False
,
456 overlayVisualsAtom
, &actualType
, &actualFormat
,
457 &sizeData
, &bytesLeft
,
458 (unsigned char **) &overlay_info
);
460 if (status
!= Success
|| actualType
!= overlayVisualsAtom
||
461 actualFormat
!= 32 || sizeData
< 4) {
462 /* something went wrong */
463 XFree((void *) overlay_info
);
467 /* search the overlay visual list for the visual ID of interest */
468 numOverlaysPerScreen
= (int) (sizeData
/ 4);
469 for (i
=0;i
<numOverlaysPerScreen
;i
++) {
471 ov
= overlay_info
+ i
;
472 if (ov
->overlay_visual
==vinfo
->visualid
) {
474 if (ov
->transparent_type
==0) {
475 /* type 0 indicates no transparency */
476 XFree((void *) overlay_info
);
480 /* ov->value is the transparent pixel */
481 XFree((void *) overlay_info
);
487 /* The visual ID was not found in the overlay list. */
488 XFree((void *) overlay_info
);
495 * Try to get an X visual which matches the given arguments.
497 static XVisualInfo
*get_visual( Display
*dpy
, int scr
,
498 unsigned int depth
, int xclass
)
500 XVisualInfo temp
, *vis
;
503 unsigned int default_depth
;
506 mask
= VisualScreenMask
| VisualDepthMask
| VisualClassMask
;
511 default_depth
= DefaultDepth(dpy
,scr
);
512 default_class
= DefaultVisual(dpy
,scr
)->CLASS
;
514 if (depth
==default_depth
&& xclass
==default_class
) {
515 /* try to get root window's visual */
516 temp
.visualid
= DefaultVisual(dpy
,scr
)->visualid
;
517 mask
|= VisualIDMask
;
520 vis
= XGetVisualInfo( dpy
, mask
, &temp
, &n
);
522 /* In case bits/pixel > 24, make sure color channels are still <=8 bits.
523 * An SGI Infinite Reality system, for example, can have 30bpp pixels:
524 * 10 bits per color channel. Mesa's limited to a max of 8 bits/channel.
526 if (vis
&& depth
> 24 && (xclass
==TrueColor
|| xclass
==DirectColor
)) {
527 if (_mesa_bitcount((GLuint
) vis
->red_mask
) <= 8 &&
528 _mesa_bitcount((GLuint
) vis
->green_mask
) <= 8 &&
529 _mesa_bitcount((GLuint
) vis
->blue_mask
) <= 8) {
544 * Retrieve the value of the given environment variable and find
545 * the X visual which matches it.
546 * Input: dpy - the display
547 * screen - the screen number
548 * varname - the name of the environment variable
549 * Return: an XVisualInfo pointer to NULL if error.
551 static XVisualInfo
*get_env_visual(Display
*dpy
, int scr
, const char *varname
)
553 char value
[100], type
[100];
554 int depth
, xclass
= -1;
557 if (!getenv( varname
)) {
561 strncpy( value
, getenv(varname
), 100 );
564 sscanf( value
, "%s %d", type
, &depth
);
566 if (strcmp(type
,"TrueColor")==0) xclass
= TrueColor
;
567 else if (strcmp(type
,"DirectColor")==0) xclass
= DirectColor
;
568 else if (strcmp(type
,"PseudoColor")==0) xclass
= PseudoColor
;
569 else if (strcmp(type
,"StaticColor")==0) xclass
= StaticColor
;
570 else if (strcmp(type
,"GrayScale")==0) xclass
= GrayScale
;
571 else if (strcmp(type
,"StaticGray")==0) xclass
= StaticGray
;
573 if (xclass
>-1 && depth
>0) {
574 vis
= get_visual( dpy
, scr
, depth
, xclass
);
582 sprintf(s
, "Mesa: GLX unable to find visual class=%s, depth=%d.\n",
584 _mesa_warning(NULL
, s
);
593 * Select an X visual which satisfies the RGBA/CI flag and minimum depth.
594 * Input: dpy, screen - X display and screen number
595 * rgba - GL_TRUE = RGBA mode, GL_FALSE = CI mode
596 * min_depth - minimum visual depth
597 * preferred_class - preferred GLX visual class or DONT_CARE
598 * Return: pointer to an XVisualInfo or NULL.
600 static XVisualInfo
*choose_x_visual( Display
*dpy
, int screen
,
601 GLboolean rgba
, int min_depth
,
602 int preferred_class
)
605 int xclass
, visclass
= 0;
609 Atom hp_cr_maps
= XInternAtom(dpy
, "_HP_RGB_SMOOTH_MAP_LIST", True
);
610 /* First see if the MESA_RGB_VISUAL env var is defined */
611 vis
= get_env_visual( dpy
, screen
, "MESA_RGB_VISUAL" );
615 /* Otherwise, search for a suitable visual */
616 if (preferred_class
==DONT_CARE
) {
617 for (xclass
=0;xclass
<6;xclass
++) {
619 case 0: visclass
= TrueColor
; break;
620 case 1: visclass
= DirectColor
; break;
621 case 2: visclass
= PseudoColor
; break;
622 case 3: visclass
= StaticColor
; break;
623 case 4: visclass
= GrayScale
; break;
624 case 5: visclass
= StaticGray
; break;
627 /* start with shallowest */
628 for (depth
=0;depth
<=32;depth
++) {
629 if (visclass
==TrueColor
&& depth
==8 && !hp_cr_maps
) {
630 /* Special case: try to get 8-bit PseudoColor before */
631 /* 8-bit TrueColor */
632 vis
= get_visual( dpy
, screen
, 8, PseudoColor
);
637 vis
= get_visual( dpy
, screen
, depth
, visclass
);
644 /* start with deepest */
645 for (depth
=32;depth
>=min_depth
;depth
--) {
646 if (visclass
==TrueColor
&& depth
==8 && !hp_cr_maps
) {
647 /* Special case: try to get 8-bit PseudoColor before */
648 /* 8-bit TrueColor */
649 vis
= get_visual( dpy
, screen
, 8, PseudoColor
);
654 vis
= get_visual( dpy
, screen
, depth
, visclass
);
663 /* search for a specific visual class */
664 switch (preferred_class
) {
665 case GLX_TRUE_COLOR_EXT
: visclass
= TrueColor
; break;
666 case GLX_DIRECT_COLOR_EXT
: visclass
= DirectColor
; break;
667 case GLX_PSEUDO_COLOR_EXT
: visclass
= PseudoColor
; break;
668 case GLX_STATIC_COLOR_EXT
: visclass
= StaticColor
; break;
669 case GLX_GRAY_SCALE_EXT
: visclass
= GrayScale
; break;
670 case GLX_STATIC_GRAY_EXT
: visclass
= StaticGray
; break;
671 default: return NULL
;
674 /* start with shallowest */
675 for (depth
=0;depth
<=32;depth
++) {
676 vis
= get_visual( dpy
, screen
, depth
, visclass
);
683 /* start with deepest */
684 for (depth
=32;depth
>=min_depth
;depth
--) {
685 vis
= get_visual( dpy
, screen
, depth
, visclass
);
694 /* First see if the MESA_CI_VISUAL env var is defined */
695 vis
= get_env_visual( dpy
, screen
, "MESA_CI_VISUAL" );
699 /* Otherwise, search for a suitable visual, starting with shallowest */
700 if (preferred_class
==DONT_CARE
) {
701 for (xclass
=0;xclass
<4;xclass
++) {
703 case 0: visclass
= PseudoColor
; break;
704 case 1: visclass
= StaticColor
; break;
705 case 2: visclass
= GrayScale
; break;
706 case 3: visclass
= StaticGray
; break;
708 /* try 8-bit up through 16-bit */
709 for (depth
=8;depth
<=16;depth
++) {
710 vis
= get_visual( dpy
, screen
, depth
, visclass
);
715 /* try min_depth up to 8-bit */
716 for (depth
=min_depth
;depth
<8;depth
++) {
717 vis
= get_visual( dpy
, screen
, depth
, visclass
);
725 /* search for a specific visual class */
726 switch (preferred_class
) {
727 case GLX_TRUE_COLOR_EXT
: visclass
= TrueColor
; break;
728 case GLX_DIRECT_COLOR_EXT
: visclass
= DirectColor
; break;
729 case GLX_PSEUDO_COLOR_EXT
: visclass
= PseudoColor
; break;
730 case GLX_STATIC_COLOR_EXT
: visclass
= StaticColor
; break;
731 case GLX_GRAY_SCALE_EXT
: visclass
= GrayScale
; break;
732 case GLX_STATIC_GRAY_EXT
: visclass
= StaticGray
; break;
733 default: return NULL
;
735 /* try 8-bit up through 16-bit */
736 for (depth
=8;depth
<=16;depth
++) {
737 vis
= get_visual( dpy
, screen
, depth
, visclass
);
742 /* try min_depth up to 8-bit */
743 for (depth
=min_depth
;depth
<8;depth
++) {
744 vis
= get_visual( dpy
, screen
, depth
, visclass
);
752 /* didn't find a visual */
759 * Find the deepest X over/underlay visual of at least min_depth.
760 * Input: dpy, screen - X display and screen number
761 * level - the over/underlay level
762 * trans_type - transparent pixel type: GLX_NONE_EXT,
763 * GLX_TRANSPARENT_RGB_EXT, GLX_TRANSPARENT_INDEX_EXT,
765 * trans_value - transparent pixel value or DONT_CARE
766 * min_depth - minimum visual depth
767 * preferred_class - preferred GLX visual class or DONT_CARE
768 * Return: pointer to an XVisualInfo or NULL.
770 static XVisualInfo
*choose_x_overlay_visual( Display
*dpy
, int scr
,
772 int level
, int trans_type
,
775 int preferred_class
)
777 Atom overlayVisualsAtom
;
778 OverlayInfo
*overlay_info
;
779 int numOverlaysPerScreen
;
783 unsigned long sizeData
, bytesLeft
;
785 XVisualInfo
*deepvis
;
788 /*DEBUG int tt, tv; */
790 switch (preferred_class
) {
791 case GLX_TRUE_COLOR_EXT
: preferred_class
= TrueColor
; break;
792 case GLX_DIRECT_COLOR_EXT
: preferred_class
= DirectColor
; break;
793 case GLX_PSEUDO_COLOR_EXT
: preferred_class
= PseudoColor
; break;
794 case GLX_STATIC_COLOR_EXT
: preferred_class
= StaticColor
; break;
795 case GLX_GRAY_SCALE_EXT
: preferred_class
= GrayScale
; break;
796 case GLX_STATIC_GRAY_EXT
: preferred_class
= StaticGray
; break;
797 default: preferred_class
= DONT_CARE
;
801 * The SERVER_OVERLAY_VISUALS property on the root window contains
802 * a list of overlay visuals. Get that list now.
804 overlayVisualsAtom
= XInternAtom(dpy
,"SERVER_OVERLAY_VISUALS", True
);
805 if (overlayVisualsAtom
== (Atom
) None
) {
809 status
= XGetWindowProperty(dpy
, RootWindow( dpy
, scr
),
810 overlayVisualsAtom
, 0L, (long) 10000, False
,
811 overlayVisualsAtom
, &actualType
, &actualFormat
,
812 &sizeData
, &bytesLeft
,
813 (unsigned char **) &overlay_info
);
815 if (status
!= Success
|| actualType
!= overlayVisualsAtom
||
816 actualFormat
!= 32 || sizeData
< 4) {
817 /* something went wrong */
821 /* Search for the deepest overlay which satisifies all criteria. */
825 numOverlaysPerScreen
= (int) (sizeData
/ 4);
826 for (i
=0;i
<numOverlaysPerScreen
;i
++) {
827 XVisualInfo
*vislist
, vistemplate
;
830 ov
= overlay_info
+ i
;
832 if (ov
->layer
!=level
) {
833 /* failed overlay level criteria */
836 if (!(trans_type
==DONT_CARE
837 || (trans_type
==GLX_TRANSPARENT_INDEX_EXT
838 && ov
->transparent_type
>0)
839 || (trans_type
==GLX_NONE_EXT
&& ov
->transparent_type
==0))) {
840 /* failed transparent pixel type criteria */
843 if (trans_value
!=DONT_CARE
&& trans_value
!=ov
->value
) {
844 /* failed transparent pixel value criteria */
848 /* get XVisualInfo and check the depth */
849 vistemplate
.visualid
= ov
->overlay_visual
;
850 vistemplate
.screen
= scr
;
851 vislist
= XGetVisualInfo( dpy
, VisualIDMask
| VisualScreenMask
,
852 &vistemplate
, &count
);
855 /* something went wrong */
858 if (preferred_class
!=DONT_CARE
&& preferred_class
!=vislist
->CLASS
) {
859 /* wrong visual class */
863 /* if RGB was requested, make sure we have True/DirectColor */
864 if (rgbFlag
&& vislist
->CLASS
!= TrueColor
865 && vislist
->CLASS
!= DirectColor
)
868 /* if CI was requested, make sure we have a color indexed visual */
870 && (vislist
->CLASS
== TrueColor
|| vislist
->CLASS
== DirectColor
))
873 if (deepvis
==NULL
|| vislist
->depth
> deepest
) {
874 /* YES! found a satisfactory visual */
878 deepest
= vislist
->depth
;
880 /* DEBUG tt = ov->transparent_type;*/
881 /* DEBUG tv = ov->value; */
887 printf("chose 0x%x: layer=%d depth=%d trans_type=%d trans_value=%d\n",
888 deepvis->visualid, level, deepvis->depth, tt, tv );
895 /**********************************************************************/
896 /*** Begin Fake GLX API Functions ***/
897 /**********************************************************************/
900 static XMesaVisual
choose_visual( Display
*dpy
, int screen
, const int *list
)
902 const int *parselist
;
905 int min_red
=0, min_green
=0, min_blue
=0;
906 GLboolean rgb_flag
= GL_FALSE
;
907 GLboolean alpha_flag
= GL_FALSE
;
908 GLboolean double_flag
= GL_FALSE
;
909 GLboolean stereo_flag
= GL_FALSE
;
910 GLint depth_size
= 0;
911 GLint stencil_size
= 0;
912 GLint accumRedSize
= 0;
913 GLint accumGreenSize
= 0;
914 GLint accumBlueSize
= 0;
915 GLint accumAlphaSize
= 0;
917 int visual_type
= DONT_CARE
;
918 int trans_type
= DONT_CARE
;
919 int trans_value
= DONT_CARE
;
920 GLint caveat
= DONT_CARE
;
921 XMesaVisual xmvis
= NULL
;
927 switch (*parselist
) {
932 case GLX_BUFFER_SIZE
:
934 min_ci
= *parselist
++;
938 level
= *parselist
++;
944 case GLX_DOUBLEBUFFER
:
945 double_flag
= GL_TRUE
;
949 stereo_flag
= GL_TRUE
;
951 case GLX_AUX_BUFFERS
:
958 min_red
= *parselist
++;
962 min_green
= *parselist
++;
966 min_blue
= *parselist
++;
971 GLint size
= *parselist
++;
972 alpha_flag
= size
>0 ? 1 : 0;
977 depth_size
= *parselist
++;
979 case GLX_STENCIL_SIZE
:
981 stencil_size
= *parselist
++;
983 case GLX_ACCUM_RED_SIZE
:
986 GLint size
= *parselist
++;
987 accumRedSize
= MAX2( accumRedSize
, size
);
990 case GLX_ACCUM_GREEN_SIZE
:
993 GLint size
= *parselist
++;
994 accumGreenSize
= MAX2( accumGreenSize
, size
);
997 case GLX_ACCUM_BLUE_SIZE
:
1000 GLint size
= *parselist
++;
1001 accumBlueSize
= MAX2( accumBlueSize
, size
);
1004 case GLX_ACCUM_ALPHA_SIZE
:
1007 GLint size
= *parselist
++;
1008 accumAlphaSize
= MAX2( accumAlphaSize
, size
);
1013 * GLX_EXT_visual_info extension
1015 case GLX_X_VISUAL_TYPE_EXT
:
1017 visual_type
= *parselist
++;
1019 case GLX_TRANSPARENT_TYPE_EXT
:
1021 trans_type
= *parselist
++;
1023 case GLX_TRANSPARENT_INDEX_VALUE_EXT
:
1025 trans_value
= *parselist
++;
1027 case GLX_TRANSPARENT_RED_VALUE_EXT
:
1028 case GLX_TRANSPARENT_GREEN_VALUE_EXT
:
1029 case GLX_TRANSPARENT_BLUE_VALUE_EXT
:
1030 case GLX_TRANSPARENT_ALPHA_VALUE_EXT
:
1037 * GLX_EXT_visual_info extension
1039 case GLX_VISUAL_CAVEAT_EXT
:
1041 caveat
= *parselist
++; /* ignored for now */
1047 case GLX_RENDER_TYPE
:
1049 if (*parselist
== GLX_RGBA_BIT
) {
1052 else if (*parselist
== GLX_COLOR_INDEX_BIT
) {
1053 rgb_flag
= GL_FALSE
;
1055 else if (*parselist
== 0) {
1060 case GLX_DRAWABLE_TYPE
:
1062 if (*parselist
& ~(GLX_WINDOW_BIT
| GLX_PIXMAP_BIT
| GLX_PBUFFER_BIT
)) {
1063 return NULL
; /* bad bit */
1072 /* undefined attribute */
1073 printf("unexpected attrib 0x%x\n", *parselist
);
1079 * Since we're only simulating the GLX extension this function will never
1080 * find any real GL visuals. Instead, all we can do is try to find an RGB
1081 * or CI visual of appropriate depth. Other requested attributes such as
1082 * double buffering, depth buffer, etc. will be associated with the X
1083 * visual and stored in the VisualTable[].
1086 /* normal color planes */
1088 /* Get an RGB visual */
1089 int min_rgb
= min_red
+ min_green
+ min_blue
;
1090 if (min_rgb
>1 && min_rgb
<8) {
1091 /* a special case to be sure we can get a monochrome visual */
1094 vis
= choose_x_visual( dpy
, screen
, rgb_flag
, min_rgb
, visual_type
);
1097 /* Get a color index visual */
1098 vis
= choose_x_visual( dpy
, screen
, rgb_flag
, min_ci
, visual_type
);
1099 accumRedSize
= accumGreenSize
= accumBlueSize
= accumAlphaSize
= 0;
1103 /* over/underlay planes */
1106 int min_rgb
= min_red
+ min_green
+ min_blue
;
1107 if (min_rgb
>1 && min_rgb
<8) {
1108 /* a special case to be sure we can get a monochrome visual */
1111 vis
= choose_x_overlay_visual( dpy
, screen
, rgb_flag
, level
,
1112 trans_type
, trans_value
, min_rgb
, visual_type
);
1115 /* color index overlay */
1116 vis
= choose_x_overlay_visual( dpy
, screen
, rgb_flag
, level
,
1117 trans_type
, trans_value
, min_ci
, visual_type
);
1122 /* Note: we're not exactly obeying the glXChooseVisual rules here.
1123 * When GLX_DEPTH_SIZE = 1 is specified we're supposed to choose the
1124 * largest depth buffer size, which is 32bits/value. Instead, we
1125 * return 16 to maintain performance with earlier versions of Mesa.
1127 if (depth_size
> 24)
1128 depth_size
= 31; /* 32 causes int overflow problems */
1129 else if (depth_size
> 16)
1131 else if (depth_size
> 0)
1132 depth_size
= DEFAULT_SOFTWARE_DEPTH_BITS
; /*16*/
1134 /* we only support one size of stencil and accum buffers. */
1135 if (stencil_size
> 0)
1136 stencil_size
= STENCIL_BITS
;
1137 if (accumRedSize
> 0 || accumGreenSize
> 0 || accumBlueSize
> 0 ||
1138 accumAlphaSize
> 0) {
1139 accumRedSize
= ACCUM_BITS
;
1140 accumGreenSize
= ACCUM_BITS
;
1141 accumBlueSize
= ACCUM_BITS
;
1142 accumAlphaSize
= alpha_flag
? ACCUM_BITS
: 0;
1145 xmvis
= save_glx_visual( dpy
, vis
, rgb_flag
, alpha_flag
, double_flag
,
1146 stereo_flag
, depth_size
, stencil_size
,
1147 accumRedSize
, accumGreenSize
,
1148 accumBlueSize
, accumAlphaSize
, level
);
1155 static XVisualInfo
*
1156 Fake_glXChooseVisual( Display
*dpy
, int screen
, int *list
)
1158 XMesaVisual xmvis
= choose_visual(dpy
, screen
, list
);
1160 return xmvis
->vishandle
;
1167 Fake_glXCreateContext( Display
*dpy
, XVisualInfo
*visinfo
,
1168 GLXContext share_list
, Bool direct
)
1171 struct fake_glx_context
*glxCtx
;
1172 struct fake_glx_context
*shareCtx
= (struct fake_glx_context
*) share_list
;
1174 if (!dpy
|| !visinfo
)
1177 glxCtx
= CALLOC_STRUCT(fake_glx_context
);
1181 /* deallocate unused windows/buffers */
1182 XMesaGarbageCollect();
1184 glxvis
= find_glx_visual( dpy
, visinfo
);
1186 /* This visual wasn't found with glXChooseVisual() */
1187 glxvis
= create_glx_visual( dpy
, visinfo
);
1189 /* unusable visual */
1195 glxCtx
->xmesaContext
= XMesaCreateContext(glxvis
,
1196 shareCtx
? shareCtx
->xmesaContext
: NULL
);
1197 if (!glxCtx
->xmesaContext
) {
1202 glxCtx
->xmesaContext
->direct
= GL_FALSE
;
1203 glxCtx
->glxContext
.isDirect
= GL_FALSE
;
1204 glxCtx
->glxContext
.currentDpy
= dpy
;
1205 glxCtx
->glxContext
.xid
= (XID
) glxCtx
; /* self pointer */
1207 assert((void *) glxCtx
== (void *) &(glxCtx
->glxContext
));
1209 return (GLXContext
) glxCtx
;
1213 /* XXX these may have to be removed due to thread-safety issues. */
1214 static GLXContext MakeCurrent_PrevContext
= 0;
1215 static GLXDrawable MakeCurrent_PrevDrawable
= 0;
1216 static GLXDrawable MakeCurrent_PrevReadable
= 0;
1217 static XMesaBuffer MakeCurrent_PrevDrawBuffer
= 0;
1218 static XMesaBuffer MakeCurrent_PrevReadBuffer
= 0;
1221 /* GLX 1.3 and later */
1223 Fake_glXMakeContextCurrent( Display
*dpy
, GLXDrawable draw
,
1224 GLXDrawable read
, GLXContext ctx
)
1226 struct fake_glx_context
*glxCtx
= (struct fake_glx_context
*) ctx
;
1228 if (ctx
&& draw
&& read
) {
1229 XMesaBuffer drawBuffer
, readBuffer
;
1230 XMesaContext xmctx
= glxCtx
->xmesaContext
;
1232 /* Find the XMesaBuffer which corresponds to the GLXDrawable 'draw' */
1233 if (ctx
== MakeCurrent_PrevContext
1234 && draw
== MakeCurrent_PrevDrawable
) {
1235 drawBuffer
= MakeCurrent_PrevDrawBuffer
;
1238 drawBuffer
= XMesaFindBuffer( dpy
, draw
);
1241 /* drawable must be a new window! */
1242 drawBuffer
= XMesaCreateWindowBuffer2( xmctx
->xm_visual
, draw
, xmctx
);
1244 /* Out of memory, or context/drawable depth mismatch */
1249 /* Find the XMesaBuffer which corresponds to the GLXDrawable 'read' */
1250 if (ctx
== MakeCurrent_PrevContext
1251 && read
== MakeCurrent_PrevReadable
) {
1252 readBuffer
= MakeCurrent_PrevReadBuffer
;
1255 readBuffer
= XMesaFindBuffer( dpy
, read
);
1258 /* drawable must be a new window! */
1259 readBuffer
= XMesaCreateWindowBuffer2(glxCtx
->xmesaContext
->xm_visual
,
1262 /* Out of memory, or context/drawable depth mismatch */
1267 MakeCurrent_PrevContext
= ctx
;
1268 MakeCurrent_PrevDrawable
= draw
;
1269 MakeCurrent_PrevReadable
= read
;
1270 MakeCurrent_PrevDrawBuffer
= drawBuffer
;
1271 MakeCurrent_PrevReadBuffer
= readBuffer
;
1273 /* Now make current! */
1274 if (XMesaMakeCurrent2(xmctx
, drawBuffer
, readBuffer
)) {
1275 ((__GLXcontext
*) ctx
)->currentDpy
= dpy
;
1276 ((__GLXcontext
*) ctx
)->currentDrawable
= draw
;
1277 #ifndef GLX_BUILT_IN_XMESA
1278 ((__GLXcontext
*) ctx
)->currentReadable
= read
;
1280 __glXSetCurrentContext(ctx
);
1288 else if (!ctx
&& !draw
&& !read
) {
1289 /* release current context w/out assigning new one. */
1290 XMesaMakeCurrent( NULL
, NULL
);
1291 MakeCurrent_PrevContext
= 0;
1292 MakeCurrent_PrevDrawable
= 0;
1293 MakeCurrent_PrevReadable
= 0;
1294 MakeCurrent_PrevDrawBuffer
= 0;
1295 MakeCurrent_PrevReadBuffer
= 0;
1296 #ifdef GLX_BUILT_IN_XMESA
1297 /* XXX bind dummy context with __glXSetCurrentContext(ctx); */
1302 /* The args must either all be non-zero or all zero.
1312 Fake_glXMakeCurrent( Display
*dpy
, GLXDrawable drawable
, GLXContext ctx
)
1314 return Fake_glXMakeContextCurrent( dpy
, drawable
, drawable
, ctx
);
1320 Fake_glXCreateGLXPixmap( Display
*dpy
, XVisualInfo
*visinfo
, Pixmap pixmap
)
1325 v
= find_glx_visual( dpy
, visinfo
);
1327 v
= create_glx_visual( dpy
, visinfo
);
1329 /* unusable visual */
1334 b
= XMesaCreatePixmapBuffer( v
, pixmap
, 0 );
1338 return b
->frontbuffer
;
1342 /*** GLX_MESA_pixmap_colormap ***/
1345 Fake_glXCreateGLXPixmapMESA( Display
*dpy
, XVisualInfo
*visinfo
,
1346 Pixmap pixmap
, Colormap cmap
)
1351 v
= find_glx_visual( dpy
, visinfo
);
1353 v
= create_glx_visual( dpy
, visinfo
);
1355 /* unusable visual */
1360 b
= XMesaCreatePixmapBuffer( v
, pixmap
, cmap
);
1364 return b
->frontbuffer
;
1369 Fake_glXDestroyGLXPixmap( Display
*dpy
, GLXPixmap pixmap
)
1371 XMesaBuffer b
= XMesaFindBuffer(dpy
, pixmap
);
1373 XMesaDestroyBuffer(b
);
1375 else if (getenv("MESA_DEBUG")) {
1376 _mesa_warning(NULL
, "Mesa: glXDestroyGLXPixmap: invalid pixmap\n");
1383 Fake_glXCopyContext( Display
*dpy
, GLXContext src
, GLXContext dst
,
1384 unsigned long mask
)
1386 struct fake_glx_context
*fakeSrc
= (struct fake_glx_context
*) src
;
1387 struct fake_glx_context
*fakeDst
= (struct fake_glx_context
*) dst
;
1388 XMesaContext xm_src
= fakeSrc
->xmesaContext
;
1389 XMesaContext xm_dst
= fakeDst
->xmesaContext
;
1391 _mesa_copy_context( xm_src
->gl_ctx
, xm_dst
->gl_ctx
, (GLuint
) mask
);
1397 Fake_glXQueryExtension( Display
*dpy
, int *errorb
, int *event
)
1399 /* Mesa's GLX isn't really an X extension but we try to act like one. */
1407 extern void _kw_ungrab_all( Display
*dpy
);
1408 void _kw_ungrab_all( Display
*dpy
)
1410 XUngrabPointer( dpy
, CurrentTime
);
1411 XUngrabKeyboard( dpy
, CurrentTime
);
1416 Fake_glXDestroyContext( Display
*dpy
, GLXContext ctx
)
1418 struct fake_glx_context
*glxCtx
= (struct fake_glx_context
*) ctx
;
1420 MakeCurrent_PrevContext
= 0;
1421 MakeCurrent_PrevDrawable
= 0;
1422 MakeCurrent_PrevReadable
= 0;
1423 MakeCurrent_PrevDrawBuffer
= 0;
1424 MakeCurrent_PrevReadBuffer
= 0;
1425 XMesaDestroyContext( glxCtx
->xmesaContext
);
1426 XMesaGarbageCollect();
1432 Fake_glXIsDirect( Display
*dpy
, GLXContext ctx
)
1434 struct fake_glx_context
*glxCtx
= (struct fake_glx_context
*) ctx
;
1436 return glxCtx
->xmesaContext
->direct
;
1442 Fake_glXSwapBuffers( Display
*dpy
, GLXDrawable drawable
)
1444 XMesaBuffer buffer
= XMesaFindBuffer( dpy
, drawable
);
1447 XMesaSwapBuffers(buffer
);
1449 else if (getenv("MESA_DEBUG")) {
1450 _mesa_warning(NULL
, "Mesa: glXSwapBuffers: invalid drawable\n");
1456 /*** GLX_MESA_copy_sub_buffer ***/
1459 Fake_glXCopySubBufferMESA( Display
*dpy
, GLXDrawable drawable
,
1460 int x
, int y
, int width
, int height
)
1462 XMesaBuffer buffer
= XMesaFindBuffer( dpy
, drawable
);
1464 XMesaCopySubBuffer(buffer
, x
, y
, width
, height
);
1466 else if (getenv("MESA_DEBUG")) {
1467 _mesa_warning(NULL
, "Mesa: glXCopySubBufferMESA: invalid drawable\n");
1474 Fake_glXQueryVersion( Display
*dpy
, int *maj
, int *min
)
1477 /* Return GLX version, not Mesa version */
1478 assert(CLIENT_MAJOR_VERSION
== SERVER_MAJOR_VERSION
);
1479 *maj
= CLIENT_MAJOR_VERSION
;
1480 *min
= MIN2( CLIENT_MINOR_VERSION
, SERVER_MINOR_VERSION
);
1487 * Query the GLX attributes of the given XVisualInfo.
1490 get_config( XMesaVisual glxvis
, int attrib
, int *value
, GLboolean fbconfig
)
1495 *value
= (int) True
;
1497 case GLX_BUFFER_SIZE
:
1498 *value
= glxvis
->visinfo
->depth
;
1501 *value
= glxvis
->level
;
1504 if (glxvis
->mesa_visual
.rgbMode
) {
1511 case GLX_DOUBLEBUFFER
:
1512 *value
= (int) glxvis
->mesa_visual
.doubleBufferMode
;
1515 *value
= (int) glxvis
->mesa_visual
.stereoMode
;
1517 case GLX_AUX_BUFFERS
:
1518 *value
= (int) False
;
1521 *value
= glxvis
->mesa_visual
.redBits
;
1523 case GLX_GREEN_SIZE
:
1524 *value
= glxvis
->mesa_visual
.greenBits
;
1527 *value
= glxvis
->mesa_visual
.blueBits
;
1529 case GLX_ALPHA_SIZE
:
1530 *value
= glxvis
->mesa_visual
.alphaBits
;
1532 case GLX_DEPTH_SIZE
:
1533 *value
= glxvis
->mesa_visual
.depthBits
;
1535 case GLX_STENCIL_SIZE
:
1536 *value
= glxvis
->mesa_visual
.stencilBits
;
1538 case GLX_ACCUM_RED_SIZE
:
1539 *value
= glxvis
->mesa_visual
.accumRedBits
;
1541 case GLX_ACCUM_GREEN_SIZE
:
1542 *value
= glxvis
->mesa_visual
.accumGreenBits
;
1544 case GLX_ACCUM_BLUE_SIZE
:
1545 *value
= glxvis
->mesa_visual
.accumBlueBits
;
1547 case GLX_ACCUM_ALPHA_SIZE
:
1548 *value
= glxvis
->mesa_visual
.accumAlphaBits
;
1552 * GLX_EXT_visual_info extension
1554 case GLX_X_VISUAL_TYPE_EXT
:
1555 switch (glxvis
->visinfo
->CLASS
) {
1556 case StaticGray
: *value
= GLX_STATIC_GRAY_EXT
; return 0;
1557 case GrayScale
: *value
= GLX_GRAY_SCALE_EXT
; return 0;
1558 case StaticColor
: *value
= GLX_STATIC_GRAY_EXT
; return 0;
1559 case PseudoColor
: *value
= GLX_PSEUDO_COLOR_EXT
; return 0;
1560 case TrueColor
: *value
= GLX_TRUE_COLOR_EXT
; return 0;
1561 case DirectColor
: *value
= GLX_DIRECT_COLOR_EXT
; return 0;
1564 case GLX_TRANSPARENT_TYPE_EXT
:
1565 if (glxvis
->level
==0) {
1567 *value
= GLX_NONE_EXT
;
1569 else if (glxvis
->level
>0) {
1571 if (glxvis
->mesa_visual
.rgbMode
) {
1572 *value
= GLX_TRANSPARENT_RGB_EXT
;
1575 *value
= GLX_TRANSPARENT_INDEX_EXT
;
1578 else if (glxvis
->level
<0) {
1580 *value
= GLX_NONE_EXT
;
1583 case GLX_TRANSPARENT_INDEX_VALUE_EXT
:
1585 int pixel
= transparent_pixel( glxvis
);
1589 /* else undefined */
1592 case GLX_TRANSPARENT_RED_VALUE_EXT
:
1595 case GLX_TRANSPARENT_GREEN_VALUE_EXT
:
1598 case GLX_TRANSPARENT_BLUE_VALUE_EXT
:
1601 case GLX_TRANSPARENT_ALPHA_VALUE_EXT
:
1606 * GLX_EXT_visual_info extension
1608 case GLX_VISUAL_CAVEAT_EXT
:
1609 /* test for zero, just in case */
1610 if (glxvis
->VisualCaveat
> 0)
1611 *value
= glxvis
->VisualCaveat
;
1613 *value
= GLX_NONE_EXT
;
1617 * GLX_EXT_multisample
1619 case GLX_SAMPLE_BUFFERS_SGIS
:
1622 case GLX_SAMPLES_SGIS
:
1629 case GLX_SCREEN_EXT
:
1631 return GLX_BAD_ATTRIBUTE
;
1632 *value
= glxvis
->visinfo
->screen
;
1634 case GLX_DRAWABLE_TYPE
: /*SGIX too */
1636 return GLX_BAD_ATTRIBUTE
;
1637 *value
= GLX_WINDOW_BIT
| GLX_PIXMAP_BIT
| GLX_PBUFFER_BIT
;
1639 case GLX_RENDER_TYPE_SGIX
:
1641 return GLX_BAD_ATTRIBUTE
;
1642 if (glxvis
->mesa_visual
.rgbMode
)
1643 *value
= GLX_RGBA_BIT
;
1645 *value
= GLX_COLOR_INDEX_BIT
;
1647 case GLX_X_RENDERABLE_SGIX
:
1649 return GLX_BAD_ATTRIBUTE
;
1650 *value
= True
; /* XXX really? */
1652 case GLX_FBCONFIG_ID_SGIX
:
1654 return GLX_BAD_ATTRIBUTE
;
1655 *value
= glxvis
->vishandle
->visualid
;
1657 case GLX_MAX_PBUFFER_WIDTH
:
1659 return GLX_BAD_ATTRIBUTE
;
1660 /* XXX or MAX_WIDTH? */
1661 *value
= DisplayWidth(glxvis
->display
, glxvis
->vishandle
->screen
);
1663 case GLX_MAX_PBUFFER_HEIGHT
:
1665 return GLX_BAD_ATTRIBUTE
;
1666 *value
= DisplayHeight(glxvis
->display
, glxvis
->vishandle
->screen
);
1668 case GLX_MAX_PBUFFER_PIXELS
:
1670 return GLX_BAD_ATTRIBUTE
;
1671 *value
= DisplayWidth(glxvis
->display
, glxvis
->vishandle
->screen
) *
1672 DisplayHeight(glxvis
->display
, glxvis
->vishandle
->screen
);
1676 return GLX_BAD_ATTRIBUTE
;
1677 *value
= glxvis
->vishandle
->visualid
;
1681 return GLX_BAD_ATTRIBUTE
;
1688 Fake_glXGetConfig( Display
*dpy
, XVisualInfo
*visinfo
,
1689 int attrib
, int *value
)
1693 glxvis
= find_glx_visual( dpy
, visinfo
);
1695 /* this visual wasn't obtained with glXChooseVisual */
1696 glxvis
= create_glx_visual( dpy
, visinfo
);
1698 /* this visual can't be used for GL rendering */
1699 if (attrib
==GLX_USE_GL
) {
1700 *value
= (int) False
;
1704 return GLX_BAD_VISUAL
;
1709 return get_config(glxvis
, attrib
, value
, GL_FALSE
);
1714 Fake_glXWaitGL( void )
1716 XMesaContext xmesa
= XMesaGetCurrentContext();
1717 XMesaFlush( xmesa
);
1723 Fake_glXWaitX( void )
1725 XMesaContext xmesa
= XMesaGetCurrentContext();
1726 XMesaFlush( xmesa
);
1731 * Return the extensions string, which is 3Dfx-dependant.
1733 static const char *get_extensions( void )
1736 const char *fx
= getenv("MESA_GLX_FX");
1737 if (fx
&& fx
[0] != 'd') {
1738 return "GLX_MESA_pixmap_colormap GLX_EXT_visual_info GLX_EXT_visual_rating GLX_MESA_release_buffers GLX_MESA_copy_sub_buffer GLX_SGI_video_sync GLX_SGIX_fbconfig GLX_SGIX_pbuffer GLX_MESA_set_3dfx_mode GLX_ARB_get_proc_address";
1741 return "GLX_MESA_pixmap_colormap GLX_EXT_visual_info GLX_EXT_visual_rating GLX_MESA_release_buffers GLX_MESA_copy_sub_buffer GLX_SGI_video_sync GLX_SGIX_fbconfig GLX_SGIX_pbuffer GLX_ARB_get_proc_address";
1746 /* GLX 1.1 and later */
1748 Fake_glXQueryExtensionsString( Display
*dpy
, int screen
)
1752 return get_extensions();
1757 /* GLX 1.1 and later */
1759 Fake_glXQueryServerString( Display
*dpy
, int screen
, int name
)
1761 static char version
[1000];
1762 sprintf(version
, "%d.%d %s", SERVER_MAJOR_VERSION
, SERVER_MINOR_VERSION
,
1769 case GLX_EXTENSIONS
:
1770 return get_extensions();
1782 /* GLX 1.1 and later */
1784 Fake_glXGetClientString( Display
*dpy
, int name
)
1786 static char version
[1000];
1787 sprintf(version
, "%d.%d %s", CLIENT_MAJOR_VERSION
, CLIENT_MINOR_VERSION
,
1793 case GLX_EXTENSIONS
:
1794 return get_extensions();
1812 static GLXFBConfig
*
1813 Fake_glXChooseFBConfig( Display
*dpy
, int screen
,
1814 const int *attribList
, int *nitems
)
1816 XMesaVisual xmvis
= choose_visual(dpy
, screen
, attribList
);
1818 GLXFBConfig
*config
= malloc(sizeof(XMesaVisual
));
1824 config
[0] = (GLXFBConfig
) xmvis
;
1825 return (GLXFBConfig
*) config
;
1836 Fake_glXGetFBConfigAttrib( Display
*dpy
, GLXFBConfig config
,
1837 int attribute
, int *value
)
1839 XMesaVisual v
= (XMesaVisual
) config
;
1843 if (!dpy
|| !config
|| !value
)
1846 return get_config(v
, attribute
, value
, GL_TRUE
);
1851 static GLXFBConfig
*
1852 Fake_glXGetFBConfigs( Display
*dpy
, int screen
, int *nelements
)
1854 XVisualInfo
*visuals
, visTemplate
;
1855 const long visMask
= VisualScreenMask
;
1858 /* Get list of all X visuals */
1859 visTemplate
.screen
= screen
;
1860 visuals
= XGetVisualInfo(dpy
, visMask
, &visTemplate
, nelements
);
1861 if (*nelements
> 0) {
1862 XMesaVisual
*results
;
1863 results
= malloc(*nelements
* sizeof(XMesaVisual
));
1868 for (i
= 0; i
< *nelements
; i
++) {
1869 results
[i
] = create_glx_visual(dpy
, visuals
+ i
);
1871 return (GLXFBConfig
*) results
;
1878 static XVisualInfo
*
1879 Fake_glXGetVisualFromFBConfig( Display
*dpy
, GLXFBConfig config
)
1881 if (dpy
&& config
) {
1882 XMesaVisual v
= (XMesaVisual
) config
;
1883 return v
->vishandle
;
1893 Fake_glXCreateWindow( Display
*dpy
, GLXFBConfig config
, Window win
,
1894 const int *attribList
)
1899 (void) attribList
; /* Ignored in GLX 1.3 */
1901 return win
; /* A hack for now */
1906 Fake_glXDestroyWindow( Display
*dpy
, GLXWindow window
)
1908 XMesaBuffer b
= XMesaFindBuffer(dpy
, (XMesaDrawable
) window
);
1910 XMesaDestroyBuffer(b
);
1911 /* don't destroy X window */
1917 Fake_glXCreatePixmap( Display
*dpy
, GLXFBConfig config
, Pixmap pixmap
,
1918 const int *attribList
)
1920 XMesaVisual v
= (XMesaVisual
) config
;
1921 XVisualInfo
*visinfo
;
1927 (void) attribList
; /* Ignored in GLX 1.3 */
1929 if (!dpy
|| !config
|| !pixmap
)
1932 visinfo
= v
->vishandle
;
1934 v
= find_glx_visual( dpy
, visinfo
);
1936 v
= create_glx_visual( dpy
, visinfo
);
1938 /* unusable visual */
1943 b
= XMesaCreatePixmapBuffer( v
, pixmap
, 0 );
1953 Fake_glXDestroyPixmap( Display
*dpy
, GLXPixmap pixmap
)
1955 XMesaBuffer b
= XMesaFindBuffer(dpy
, (XMesaDrawable
)pixmap
);
1957 XMesaDestroyBuffer(b
);
1958 /* don't destroy X pixmap */
1964 Fake_glXCreatePbuffer( Display
*dpy
, GLXFBConfig config
,
1965 const int *attribList
)
1967 XMesaVisual xmvis
= (XMesaVisual
) config
;
1970 int width
= 0, height
= 0;
1971 GLboolean useLargest
= GL_FALSE
, preserveContents
= GL_FALSE
;
1975 for (attrib
= attribList
; *attrib
; attrib
++) {
1977 case GLX_PBUFFER_WIDTH
:
1981 case GLX_PBUFFER_HEIGHT
:
1985 case GLX_PRESERVED_CONTENTS
:
1987 preserveContents
= *attrib
; /* ignored */
1989 case GLX_LARGEST_PBUFFER
:
1991 useLargest
= *attrib
; /* ignored */
1998 if (width
== 0 || height
== 0)
2001 xmbuf
= XMesaCreatePBuffer( xmvis
, 0, width
, height
);
2002 return (GLXPbuffer
) xmbuf
;
2008 Fake_glXDestroyPbuffer( Display
*dpy
, GLXPbuffer pbuf
)
2017 Fake_glXQueryDrawable( Display
*dpy
, GLXDrawable draw
, int attribute
,
2018 unsigned int *value
)
2023 switch (attribute
) {
2026 case GLX_PRESERVED_CONTENTS
:
2027 case GLX_LARGEST_PBUFFER
:
2028 case GLX_FBCONFIG_ID
:
2032 return; /* GLX_BAD_ATTRIBUTE? */
2038 Fake_glXCreateNewContext( Display
*dpy
, GLXFBConfig config
,
2039 int renderType
, GLXContext shareList
, Bool direct
)
2041 XMesaVisual v
= (XMesaVisual
) config
;
2043 if (!dpy
|| !config
||
2044 (renderType
!= GLX_RGBA_TYPE
&& renderType
!= GLX_COLOR_INDEX_TYPE
))
2047 return Fake_glXCreateContext(dpy
, v
->vishandle
, shareList
, direct
);
2053 Fake_glXQueryContext( Display
*dpy
, GLXContext ctx
, int attribute
, int *value
)
2058 switch (attribute
) {
2059 case GLX_FBCONFIG_ID
:
2060 case GLX_RENDER_TYPE
:
2065 return GLX_BAD_ATTRIBUTE
;
2072 Fake_glXSelectEvent( Display
*dpy
, GLXDrawable drawable
, unsigned long mask
)
2082 Fake_glXGetSelectedEvent( Display
*dpy
, GLXDrawable drawable
,
2083 unsigned long *mask
)
2092 /*** GLX_SGI_swap_control ***/
2095 Fake_glXSwapIntervalSGI(int interval
)
2103 /*** GLX_SGI_video_sync ***/
2106 Fake_glXGetVideoSyncSGI(unsigned int *count
)
2113 Fake_glXWaitVideoSyncSGI(int divisor
, int remainder
, unsigned int *count
)
2123 /*** GLX_SGI_make_current_read ***/
2126 Fake_glXMakeCurrentReadSGI(Display
*dpy
, GLXDrawable draw
, GLXDrawable read
, GLXContext ctx
)
2128 return Fake_glXMakeContextCurrent( dpy
, draw
, read
, ctx
);
2133 Fake_glXGetCurrentReadDrawableSGI(void)
2140 /*** GLX_SGIX_video_source ***/
2143 static GLXVideoSourceSGIX
2144 Fake_glXCreateGLXVideoSourceSGIX(Display
*dpy
, int screen
, VLServer server
, VLPath path
, int nodeClass
, VLNode drainNode
)
2156 Fake_glXDestroyGLXVideoSourceSGIX(Display
*dpy
, GLXVideoSourceSGIX src
)
2165 /*** GLX_EXT_import_context ***/
2168 Fake_glXFreeContextEXT(Display
*dpy
, GLXContext context
)
2175 Fake_glXGetContextIDEXT(const GLXContext context
)
2182 Fake_glXImportContextEXT(Display
*dpy
, GLXContextID contextID
)
2190 Fake_glXQueryContextInfoEXT(Display
*dpy
, GLXContext context
, int attribute
, int *value
)
2201 /*** GLX_SGIX_fbconfig ***/
2204 Fake_glXGetFBConfigAttribSGIX(Display
*dpy
, GLXFBConfigSGIX config
, int attribute
, int *value
)
2206 return Fake_glXGetFBConfigAttrib(dpy
, config
, attribute
, value
);
2209 static GLXFBConfigSGIX
*
2210 Fake_glXChooseFBConfigSGIX(Display
*dpy
, int screen
, int *attrib_list
, int *nelements
)
2212 return (GLXFBConfig
*) Fake_glXChooseFBConfig(dpy
, screen
, attrib_list
, nelements
);
2216 Fake_glXCreateGLXPixmapWithConfigSGIX(Display
*dpy
, GLXFBConfigSGIX config
, Pixmap pixmap
)
2225 Fake_glXCreateContextWithConfigSGIX(Display
*dpy
, GLXFBConfigSGIX config
, int render_type
, GLXContext share_list
, Bool direct
)
2235 static XVisualInfo
*
2236 Fake_glXGetVisualFromFBConfigSGIX(Display
*dpy
, GLXFBConfigSGIX config
)
2238 return Fake_glXGetVisualFromFBConfig(dpy
, config
);
2241 static GLXFBConfigSGIX
2242 Fake_glXGetFBConfigFromVisualSGIX(Display
*dpy
, XVisualInfo
*vis
)
2251 /*** GLX_SGIX_pbuffer ***/
2253 static GLXPbufferSGIX
2254 Fake_glXCreateGLXPbufferSGIX(Display
*dpy
, GLXFBConfigSGIX config
,
2255 unsigned int width
, unsigned int height
,
2258 XMesaVisual xmvis
= (XMesaVisual
) config
;
2261 GLboolean useLargest
= GL_FALSE
, preserveContents
= GL_FALSE
;
2265 for (attrib
= attribList
; *attrib
; attrib
++) {
2267 case GLX_PRESERVED_CONTENTS_SGIX
:
2269 preserveContents
= *attrib
; /* ignored */
2271 case GLX_LARGEST_PBUFFER_SGIX
:
2273 useLargest
= *attrib
; /* ignored */
2280 xmbuf
= XMesaCreatePBuffer( xmvis
, 0, width
, height
);
2281 return (GLXPbuffer
) xmbuf
;
2285 Fake_glXDestroyGLXPbufferSGIX(Display
*dpy
, GLXPbufferSGIX pbuf
)
2292 Fake_glXQueryGLXPbufferSGIX(Display
*dpy
, GLXPbufferSGIX pbuf
, int attribute
, unsigned int *value
)
2302 Fake_glXSelectEventSGIX(Display
*dpy
, GLXDrawable drawable
, unsigned long mask
)
2310 Fake_glXGetSelectedEventSGIX(Display
*dpy
, GLXDrawable drawable
, unsigned long *mask
)
2319 /*** GLX_SGI_cushion ***/
2322 Fake_glXCushionSGI(Display
*dpy
, Window win
, float cushion
)
2331 /*** GLX_SGIX_video_resize ***/
2334 Fake_glXBindChannelToWindowSGIX(Display
*dpy
, int screen
, int channel
, Window window
)
2344 Fake_glXChannelRectSGIX(Display
*dpy
, int screen
, int channel
, int x
, int y
, int w
, int h
)
2357 Fake_glXQueryChannelRectSGIX(Display
*dpy
, int screen
, int channel
, int *x
, int *y
, int *w
, int *h
)
2370 Fake_glXQueryChannelDeltasSGIX(Display
*dpy
, int screen
, int channel
, int *dx
, int *dy
, int *dw
, int *dh
)
2383 Fake_glXChannelRectSyncSGIX(Display
*dpy
, int screen
, int channel
, GLenum synctype
)
2394 /*** GLX_SGIX_dmbuffer **/
2396 #if defined(_DM_BUFFER_H_)
2398 Fake_glXAssociateDMPbufferSGIX(Display
*dpy
, GLXPbufferSGIX pbuffer
, DMparams
*params
, DMbuffer dmbuffer
)
2409 /*** GLX_SGIX_swap_group ***/
2412 Fake_glXJoinSwapGroupSGIX(Display
*dpy
, GLXDrawable drawable
, GLXDrawable member
)
2421 /*** GLX_SGIX_swap_barrier ***/
2424 Fake_glXBindSwapBarrierSGIX(Display
*dpy
, GLXDrawable drawable
, int barrier
)
2432 Fake_glXQueryMaxSwapBarriersSGIX(Display
*dpy
, int screen
, int *max
)
2442 /*** GLX_SUN_get_transparent_index ***/
2445 Fake_glXGetTransparentIndexSUN(Display
*dpy
, Window overlay
, Window underlay
, long *pTransparent
)
2450 (void) pTransparent
;
2456 /*** GLX_MESA_release_buffers ***/
2459 * Release the depth, stencil, accum buffers attached to a GLXDrawable
2460 * (a window or pixmap) prior to destroying the GLXDrawable.
2463 Fake_glXReleaseBuffersMESA( Display
*dpy
, GLXDrawable d
)
2465 XMesaBuffer b
= XMesaFindBuffer(dpy
, d
);
2467 XMesaDestroyBuffer(b
);
2475 /*** GLX_MESA_set_3dfx_mode ***/
2478 Fake_glXSet3DfxModeMESA( int mode
)
2480 return XMesaSetFXmode( mode
);
2485 /*** AGP memory allocation ***/
2487 Fake_glXAllocateMemoryNV( GLsizei size
,
2488 GLfloat readFrequency
,
2489 GLfloat writeFrequency
,
2493 (void) readFrequency
;
2494 (void) writeFrequency
;
2501 Fake_glXFreeMemoryNV( GLvoid
*pointer
)
2508 extern struct _glxapi_table
*_mesa_GetGLXDispatchTable(void);
2509 struct _glxapi_table
*_mesa_GetGLXDispatchTable(void)
2511 static struct _glxapi_table glx
;
2513 /* be sure our dispatch table size <= libGL's table */
2515 GLuint size
= sizeof(struct _glxapi_table
) / sizeof(void *);
2517 assert(_glxapi_get_dispatch_table_size() >= size
);
2520 /* initialize the whole table to no-ops */
2521 _glxapi_set_no_op_table(&glx
);
2523 /* now initialize the table with the functions I implement */
2524 glx
.ChooseVisual
= Fake_glXChooseVisual
;
2525 glx
.CopyContext
= Fake_glXCopyContext
;
2526 glx
.CreateContext
= Fake_glXCreateContext
;
2527 glx
.CreateGLXPixmap
= Fake_glXCreateGLXPixmap
;
2528 glx
.DestroyContext
= Fake_glXDestroyContext
;
2529 glx
.DestroyGLXPixmap
= Fake_glXDestroyGLXPixmap
;
2530 glx
.GetConfig
= Fake_glXGetConfig
;
2531 /*glx.GetCurrentContext = Fake_glXGetCurrentContext;*/
2532 /*glx.GetCurrentDrawable = Fake_glXGetCurrentDrawable;*/
2533 glx
.IsDirect
= Fake_glXIsDirect
;
2534 glx
.MakeCurrent
= Fake_glXMakeCurrent
;
2535 glx
.QueryExtension
= Fake_glXQueryExtension
;
2536 glx
.QueryVersion
= Fake_glXQueryVersion
;
2537 glx
.SwapBuffers
= Fake_glXSwapBuffers
;
2538 glx
.UseXFont
= Fake_glXUseXFont
;
2539 glx
.WaitGL
= Fake_glXWaitGL
;
2540 glx
.WaitX
= Fake_glXWaitX
;
2542 /*** GLX_VERSION_1_1 ***/
2543 glx
.GetClientString
= Fake_glXGetClientString
;
2544 glx
.QueryExtensionsString
= Fake_glXQueryExtensionsString
;
2545 glx
.QueryServerString
= Fake_glXQueryServerString
;
2547 /*** GLX_VERSION_1_2 ***/
2548 /*glx.GetCurrentDisplay = Fake_glXGetCurrentDisplay;*/
2550 /*** GLX_VERSION_1_3 ***/
2551 glx
.ChooseFBConfig
= Fake_glXChooseFBConfig
;
2552 glx
.CreateNewContext
= Fake_glXCreateNewContext
;
2553 glx
.CreatePbuffer
= Fake_glXCreatePbuffer
;
2554 glx
.CreatePixmap
= Fake_glXCreatePixmap
;
2555 glx
.CreateWindow
= Fake_glXCreateWindow
;
2556 glx
.DestroyPbuffer
= Fake_glXDestroyPbuffer
;
2557 glx
.DestroyPixmap
= Fake_glXDestroyPixmap
;
2558 glx
.DestroyWindow
= Fake_glXDestroyWindow
;
2559 /*glx.GetCurrentReadDrawable = Fake_glXGetCurrentReadDrawable;*/
2560 glx
.GetFBConfigAttrib
= Fake_glXGetFBConfigAttrib
;
2561 glx
.GetFBConfigs
= Fake_glXGetFBConfigs
;
2562 glx
.GetSelectedEvent
= Fake_glXGetSelectedEvent
;
2563 glx
.GetVisualFromFBConfig
= Fake_glXGetVisualFromFBConfig
;
2564 glx
.MakeContextCurrent
= Fake_glXMakeContextCurrent
;
2565 glx
.QueryContext
= Fake_glXQueryContext
;
2566 glx
.QueryDrawable
= Fake_glXQueryDrawable
;
2567 glx
.SelectEvent
= Fake_glXSelectEvent
;
2569 /*** GLX_SGI_swap_control ***/
2570 glx
.SwapIntervalSGI
= Fake_glXSwapIntervalSGI
;
2572 /*** GLX_SGI_video_sync ***/
2573 glx
.GetVideoSyncSGI
= Fake_glXGetVideoSyncSGI
;
2574 glx
.WaitVideoSyncSGI
= Fake_glXWaitVideoSyncSGI
;
2576 /*** GLX_SGI_make_current_read ***/
2577 glx
.MakeCurrentReadSGI
= Fake_glXMakeCurrentReadSGI
;
2578 /*glx.GetCurrentReadDrawableSGI = Fake_glXGetCurrentReadDrawableSGI;*/
2580 /*** GLX_SGIX_video_source ***/
2582 glx
.CreateGLXVideoSourceSGIX
= Fake_glXCreateGLXVideoSourceSGIX
;
2583 glx
.DestroyGLXVideoSourceSGIX
= Fake_glXDestroyGLXVideoSourceSGIX
;
2586 /*** GLX_EXT_import_context ***/
2587 glx
.FreeContextEXT
= Fake_glXFreeContextEXT
;
2588 glx
.GetContextIDEXT
= Fake_glXGetContextIDEXT
;
2589 /*glx.GetCurrentDisplayEXT = Fake_glXGetCurrentDisplayEXT;*/
2590 glx
.ImportContextEXT
= Fake_glXImportContextEXT
;
2591 glx
.QueryContextInfoEXT
= Fake_glXQueryContextInfoEXT
;
2593 /*** GLX_SGIX_fbconfig ***/
2594 glx
.GetFBConfigAttribSGIX
= Fake_glXGetFBConfigAttribSGIX
;
2595 glx
.ChooseFBConfigSGIX
= Fake_glXChooseFBConfigSGIX
;
2596 glx
.CreateGLXPixmapWithConfigSGIX
= Fake_glXCreateGLXPixmapWithConfigSGIX
;
2597 glx
.CreateContextWithConfigSGIX
= Fake_glXCreateContextWithConfigSGIX
;
2598 glx
.GetVisualFromFBConfigSGIX
= Fake_glXGetVisualFromFBConfigSGIX
;
2599 glx
.GetFBConfigFromVisualSGIX
= Fake_glXGetFBConfigFromVisualSGIX
;
2601 /*** GLX_SGIX_pbuffer ***/
2602 glx
.CreateGLXPbufferSGIX
= Fake_glXCreateGLXPbufferSGIX
;
2603 glx
.DestroyGLXPbufferSGIX
= Fake_glXDestroyGLXPbufferSGIX
;
2604 glx
.QueryGLXPbufferSGIX
= Fake_glXQueryGLXPbufferSGIX
;
2605 glx
.SelectEventSGIX
= Fake_glXSelectEventSGIX
;
2606 glx
.GetSelectedEventSGIX
= Fake_glXGetSelectedEventSGIX
;
2608 /*** GLX_SGI_cushion ***/
2609 glx
.CushionSGI
= Fake_glXCushionSGI
;
2611 /*** GLX_SGIX_video_resize ***/
2612 glx
.BindChannelToWindowSGIX
= Fake_glXBindChannelToWindowSGIX
;
2613 glx
.ChannelRectSGIX
= Fake_glXChannelRectSGIX
;
2614 glx
.QueryChannelRectSGIX
= Fake_glXQueryChannelRectSGIX
;
2615 glx
.QueryChannelDeltasSGIX
= Fake_glXQueryChannelDeltasSGIX
;
2616 glx
.ChannelRectSyncSGIX
= Fake_glXChannelRectSyncSGIX
;
2618 /*** GLX_SGIX_dmbuffer **/
2619 #if defined(_DM_BUFFER_H_)
2620 glx
.AssociateDMPbufferSGIX
= NULL
;
2623 /*** GLX_SGIX_swap_group ***/
2624 glx
.JoinSwapGroupSGIX
= Fake_glXJoinSwapGroupSGIX
;
2626 /*** GLX_SGIX_swap_barrier ***/
2627 glx
.BindSwapBarrierSGIX
= Fake_glXBindSwapBarrierSGIX
;
2628 glx
.QueryMaxSwapBarriersSGIX
= Fake_glXQueryMaxSwapBarriersSGIX
;
2630 /*** GLX_SUN_get_transparent_index ***/
2631 glx
.GetTransparentIndexSUN
= Fake_glXGetTransparentIndexSUN
;
2633 /*** GLX_MESA_copy_sub_buffer ***/
2634 glx
.CopySubBufferMESA
= Fake_glXCopySubBufferMESA
;
2636 /*** GLX_MESA_release_buffers ***/
2637 glx
.ReleaseBuffersMESA
= Fake_glXReleaseBuffersMESA
;
2639 /*** GLX_MESA_pixmap_colormap ***/
2640 glx
.CreateGLXPixmapMESA
= Fake_glXCreateGLXPixmapMESA
;
2642 /*** GLX_MESA_set_3dfx_mode ***/
2643 glx
.Set3DfxModeMESA
= Fake_glXSet3DfxModeMESA
;
2645 /*** GLX AGP memory allocation ***/
2646 glx
.AllocateMemoryNV
= Fake_glXAllocateMemoryNV
;
2647 glx
.FreeMemoryNV
= Fake_glXFreeMemoryNV
;