2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 * This is an emulation of the GLX API which allows Mesa/GLX-based programs
28 * to run on X servers which do not have the real GLX extension.
30 * Thanks to the contributors:
32 * Initial version: Philip Brown (phil@bolthole.com)
33 * Better glXGetConfig() support: Armin Liebchen (liebchen@asylum.cs.utah.edu)
34 * Further visual-handling refinements: Wolfram Gloger
35 * (wmglo@Dent.MED.Uni-Muenchen.DE).
38 * Don't be fooled, stereo isn't supported yet.
51 #include "state_tracker/st_context.h"
52 #include "state_tracker/st_public.h"
55 /* This indicates the client-side GLX API and GLX encoder version. */
56 #define CLIENT_MAJOR_VERSION 1
57 #define CLIENT_MINOR_VERSION 4 /* but don't have 1.3's pbuffers, etc yet */
59 /* This indicates the server-side GLX decoder version.
60 * GLX 1.4 indicates OpenGL 1.3 support
62 #define SERVER_MAJOR_VERSION 1
63 #define SERVER_MINOR_VERSION 4
65 /* This is appended onto the glXGetClient/ServerString version strings. */
66 #define MESA_GLX_VERSION "Mesa " MESA_VERSION_STRING
68 /* Who implemented this GLX? */
69 #define VENDOR "Brian Paul"
72 "GLX_MESA_copy_sub_buffer " \
73 "GLX_MESA_pixmap_colormap " \
74 "GLX_MESA_release_buffers " \
75 "GLX_ARB_get_proc_address " \
76 "GLX_EXT_texture_from_pixmap " \
77 "GLX_EXT_visual_info " \
78 "GLX_EXT_visual_rating " \
79 /*"GLX_SGI_video_sync "*/ \
80 "GLX_SGIX_fbconfig " \
84 * Our fake GLX context will contain a "real" GLX context and an XMesa context.
86 * Note that a pointer to a __GLXcontext is a pointer to a fake_glx_context,
89 * We really just need this structure in order to make the libGL functions
90 * glXGetCurrentContext(), glXGetCurrentDrawable() and glXGetCurrentDisplay()
93 struct fake_glx_context
{
94 __GLXcontext glxContext
; /* this MUST be first! */
95 XMesaContext xmesaContext
;
100 #define DEFAULT_DIRECT GL_TRUE
103 /**********************************************************************/
104 /*** GLX Visual Code ***/
105 /**********************************************************************/
110 static XMesaVisual
*VisualTable
= NULL
;
111 static int NumVisuals
= 0;
115 /* Macro to handle c_class vs class field name in XVisualInfo struct */
116 #if defined(__cplusplus) || defined(c_plusplus)
117 #define CLASS c_class
125 * Test if the given XVisualInfo is usable for Mesa rendering.
128 is_usable_visual( XVisualInfo
*vinfo
)
130 switch (vinfo
->CLASS
) {
133 /* Any StaticGray/GrayScale visual works in RGB or CI mode */
137 /* Any StaticColor/PseudoColor visual of at least 4 bits */
138 if (vinfo
->depth
>=4) {
146 /* Any depth of TrueColor or DirectColor works in RGB mode */
149 /* This should never happen */
156 * Given an XVisualInfo and RGB, Double, and Depth buffer flags, save the
157 * configuration in our list of GLX visuals.
160 save_glx_visual( Display
*dpy
, XVisualInfo
*vinfo
,
161 GLboolean rgbFlag
, GLboolean alphaFlag
, GLboolean dbFlag
,
162 GLboolean stereoFlag
,
163 GLint depth_size
, GLint stencil_size
,
164 GLint accumRedSize
, GLint accumGreenSize
,
165 GLint accumBlueSize
, GLint accumAlphaSize
,
166 GLint level
, GLint numAuxBuffers
)
168 GLboolean ximageFlag
= GL_TRUE
;
171 GLboolean comparePointers
;
174 /* Check if the MESA_BACK_BUFFER env var is set */
175 char *backbuffer
= _mesa_getenv("MESA_BACK_BUFFER");
177 if (backbuffer
[0]=='p' || backbuffer
[0]=='P') {
178 ximageFlag
= GL_FALSE
;
180 else if (backbuffer
[0]=='x' || backbuffer
[0]=='X') {
181 ximageFlag
= GL_TRUE
;
184 _mesa_warning(NULL
, "Mesa: invalid value for MESA_BACK_BUFFER environment variable, using an XImage.");
190 /* stereo not supported */
194 if (stencil_size
> 0 && depth_size
> 0)
197 /* Comparing IDs uses less memory but sometimes fails. */
198 /* XXX revisit this after 3.0 is finished. */
199 if (_mesa_getenv("MESA_GLX_VISUAL_HACK"))
200 comparePointers
= GL_TRUE
;
202 comparePointers
= GL_FALSE
;
204 /* Force the visual to have an alpha channel */
205 if (rgbFlag
&& _mesa_getenv("MESA_GLX_FORCE_ALPHA"))
208 /* First check if a matching visual is already in the list */
209 for (i
=0; i
<NumVisuals
; i
++) {
210 XMesaVisual v
= VisualTable
[i
];
211 if (v
->display
== dpy
212 && v
->mesa_visual
.level
== level
213 && v
->mesa_visual
.numAuxBuffers
== numAuxBuffers
214 && v
->ximage_flag
== ximageFlag
215 && v
->mesa_visual
.rgbMode
== rgbFlag
216 && v
->mesa_visual
.doubleBufferMode
== dbFlag
217 && v
->mesa_visual
.stereoMode
== stereoFlag
218 && (v
->mesa_visual
.alphaBits
> 0) == alphaFlag
219 && (v
->mesa_visual
.depthBits
>= depth_size
|| depth_size
== 0)
220 && (v
->mesa_visual
.stencilBits
>= stencil_size
|| stencil_size
== 0)
221 && (v
->mesa_visual
.accumRedBits
>= accumRedSize
|| accumRedSize
== 0)
222 && (v
->mesa_visual
.accumGreenBits
>= accumGreenSize
|| accumGreenSize
== 0)
223 && (v
->mesa_visual
.accumBlueBits
>= accumBlueSize
|| accumBlueSize
== 0)
224 && (v
->mesa_visual
.accumAlphaBits
>= accumAlphaSize
|| accumAlphaSize
== 0)) {
225 /* now either compare XVisualInfo pointers or visual IDs */
226 if ((!comparePointers
&& v
->visinfo
->visualid
== vinfo
->visualid
)
227 || (comparePointers
&& v
->vishandle
== vinfo
)) {
233 /* Create a new visual and add it to the list. */
235 xmvis
= XMesaCreateVisual( dpy
, vinfo
, rgbFlag
, alphaFlag
, dbFlag
,
236 stereoFlag
, ximageFlag
,
237 depth_size
, stencil_size
,
238 accumRedSize
, accumBlueSize
,
239 accumBlueSize
, accumAlphaSize
, 0, level
,
242 /* Save a copy of the pointer now so we can find this visual again
243 * if we need to search for it in find_glx_visual().
245 xmvis
->vishandle
= vinfo
;
246 /* Allocate more space for additional visual */
247 VisualTable
= (XMesaVisual
*) _mesa_realloc( VisualTable
,
248 sizeof(XMesaVisual
) * NumVisuals
,
249 sizeof(XMesaVisual
) * (NumVisuals
+ 1));
250 /* add xmvis to the list */
251 VisualTable
[NumVisuals
] = xmvis
;
253 /* XXX minor hack, because XMesaCreateVisual doesn't support an
254 * aux buffers parameter.
256 xmvis
->mesa_visual
.numAuxBuffers
= numAuxBuffers
;
263 * Return the default number of bits for the Z buffer.
264 * If defined, use the MESA_GLX_DEPTH_BITS env var value.
265 * Otherwise, use the DEFAULT_SOFTWARE_DEPTH_BITS constant.
266 * XXX probably do the same thing for stencil, accum, etc.
269 default_depth_bits(void)
272 const char *zEnv
= _mesa_getenv("MESA_GLX_DEPTH_BITS");
274 zBits
= _mesa_atoi(zEnv
);
276 zBits
= DEFAULT_SOFTWARE_DEPTH_BITS
;
281 default_alpha_bits(void)
284 const char *aEnv
= _mesa_getenv("MESA_GLX_ALPHA_BITS");
286 aBits
= _mesa_atoi(aEnv
);
293 default_accum_bits(void)
301 * Create a GLX visual from a regular XVisualInfo.
302 * This is called when Fake GLX is given an XVisualInfo which wasn't
303 * returned by glXChooseVisual. Since this is the first time we're
304 * considering this visual we'll take a guess at reasonable values
305 * for depth buffer size, stencil size, accum size, etc.
306 * This is the best we can do with a client-side emulation of GLX.
309 create_glx_visual( Display
*dpy
, XVisualInfo
*visinfo
)
311 GLint zBits
= default_depth_bits();
312 GLint accBits
= default_accum_bits();
313 GLboolean alphaFlag
= default_alpha_bits() > 0;
315 if (is_usable_visual( visinfo
)) {
316 /* Configure this visual as RGB, double-buffered, depth-buffered. */
317 /* This is surely wrong for some people's needs but what else */
318 /* can be done? They should use glXChooseVisual(). */
319 return save_glx_visual( dpy
, visinfo
,
321 alphaFlag
, /* alpha */
322 GL_TRUE
, /* double */
323 GL_FALSE
, /* stereo */
335 _mesa_warning(NULL
, "Mesa: error in glXCreateContext: bad visual\n");
343 * Find the GLX visual associated with an XVisualInfo.
346 find_glx_visual( Display
*dpy
, XVisualInfo
*vinfo
)
350 /* try to match visual id */
351 for (i
=0;i
<NumVisuals
;i
++) {
352 if (VisualTable
[i
]->display
==dpy
353 && VisualTable
[i
]->visinfo
->visualid
== vinfo
->visualid
) {
354 return VisualTable
[i
];
358 /* if that fails, try to match pointers */
359 for (i
=0;i
<NumVisuals
;i
++) {
360 if (VisualTable
[i
]->display
==dpy
&& VisualTable
[i
]->vishandle
==vinfo
) {
361 return VisualTable
[i
];
374 * Try to get an X visual which matches the given arguments.
377 get_visual( Display
*dpy
, int scr
, unsigned int depth
, int xclass
)
379 XVisualInfo temp
, *vis
;
382 unsigned int default_depth
;
385 mask
= VisualScreenMask
| VisualDepthMask
| VisualClassMask
;
390 default_depth
= DefaultDepth(dpy
,scr
);
391 default_class
= DefaultVisual(dpy
,scr
)->CLASS
;
393 if (depth
==default_depth
&& xclass
==default_class
) {
394 /* try to get root window's visual */
395 temp
.visualid
= DefaultVisual(dpy
,scr
)->visualid
;
396 mask
|= VisualIDMask
;
399 vis
= XGetVisualInfo( dpy
, mask
, &temp
, &n
);
401 /* In case bits/pixel > 24, make sure color channels are still <=8 bits.
402 * An SGI Infinite Reality system, for example, can have 30bpp pixels:
403 * 10 bits per color channel. Mesa's limited to a max of 8 bits/channel.
405 if (vis
&& depth
> 24 && (xclass
==TrueColor
|| xclass
==DirectColor
)) {
406 if (_mesa_bitcount((GLuint
) vis
->red_mask
) <= 8 &&
407 _mesa_bitcount((GLuint
) vis
->green_mask
) <= 8 &&
408 _mesa_bitcount((GLuint
) vis
->blue_mask
) <= 8) {
423 * Retrieve the value of the given environment variable and find
424 * the X visual which matches it.
425 * Input: dpy - the display
426 * screen - the screen number
427 * varname - the name of the environment variable
428 * Return: an XVisualInfo pointer to NULL if error.
431 get_env_visual(Display
*dpy
, int scr
, const char *varname
)
433 char value
[100], type
[100];
434 int depth
, xclass
= -1;
437 if (!_mesa_getenv( varname
)) {
441 _mesa_strncpy( value
, _mesa_getenv(varname
), 100 );
444 sscanf( value
, "%s %d", type
, &depth
);
446 if (_mesa_strcmp(type
,"TrueColor")==0) xclass
= TrueColor
;
447 else if (_mesa_strcmp(type
,"DirectColor")==0) xclass
= DirectColor
;
448 else if (_mesa_strcmp(type
,"PseudoColor")==0) xclass
= PseudoColor
;
449 else if (_mesa_strcmp(type
,"StaticColor")==0) xclass
= StaticColor
;
450 else if (_mesa_strcmp(type
,"GrayScale")==0) xclass
= GrayScale
;
451 else if (_mesa_strcmp(type
,"StaticGray")==0) xclass
= StaticGray
;
453 if (xclass
>-1 && depth
>0) {
454 vis
= get_visual( dpy
, scr
, depth
, xclass
);
460 _mesa_warning(NULL
, "GLX unable to find visual class=%s, depth=%d.",
469 * Select an X visual which satisfies the RGBA flag and minimum depth.
471 * screen - X display and screen number
472 * min_depth - minimum visual depth
473 * preferred_class - preferred GLX visual class or DONT_CARE
474 * Return: pointer to an XVisualInfo or NULL.
477 choose_x_visual( Display
*dpy
, int screen
, int min_depth
,
478 int preferred_class
)
481 int xclass
, visclass
= 0;
484 /* First see if the MESA_RGB_VISUAL env var is defined */
485 vis
= get_env_visual( dpy
, screen
, "MESA_RGB_VISUAL" );
489 /* Otherwise, search for a suitable visual */
490 if (preferred_class
==DONT_CARE
) {
491 for (xclass
=0;xclass
<6;xclass
++) {
493 case 0: visclass
= TrueColor
; break;
494 case 1: visclass
= DirectColor
; break;
495 case 2: visclass
= PseudoColor
; break;
496 case 3: visclass
= StaticColor
; break;
497 case 4: visclass
= GrayScale
; break;
498 case 5: visclass
= StaticGray
; break;
501 /* start with shallowest */
502 for (depth
=0;depth
<=32;depth
++) {
503 if (visclass
==TrueColor
&& depth
==8) {
504 /* Special case: try to get 8-bit PseudoColor before */
505 /* 8-bit TrueColor */
506 vis
= get_visual( dpy
, screen
, 8, PseudoColor
);
511 vis
= get_visual( dpy
, screen
, depth
, visclass
);
518 /* start with deepest */
519 for (depth
=32;depth
>=min_depth
;depth
--) {
520 if (visclass
==TrueColor
&& depth
==8) {
521 /* Special case: try to get 8-bit PseudoColor before */
522 /* 8-bit TrueColor */
523 vis
= get_visual( dpy
, screen
, 8, PseudoColor
);
528 vis
= get_visual( dpy
, screen
, depth
, visclass
);
537 /* search for a specific visual class */
538 switch (preferred_class
) {
539 case GLX_TRUE_COLOR_EXT
: visclass
= TrueColor
; break;
540 case GLX_DIRECT_COLOR_EXT
: visclass
= DirectColor
; break;
541 case GLX_PSEUDO_COLOR_EXT
: visclass
= PseudoColor
; break;
542 case GLX_STATIC_COLOR_EXT
: visclass
= StaticColor
; break;
543 case GLX_GRAY_SCALE_EXT
: visclass
= GrayScale
; break;
544 case GLX_STATIC_GRAY_EXT
: visclass
= StaticGray
; break;
545 default: return NULL
;
548 /* start with shallowest */
549 for (depth
=0;depth
<=32;depth
++) {
550 vis
= get_visual( dpy
, screen
, depth
, visclass
);
557 /* start with deepest */
558 for (depth
=32;depth
>=min_depth
;depth
--) {
559 vis
= get_visual( dpy
, screen
, depth
, visclass
);
567 /* didn't find a visual */
574 /**********************************************************************/
575 /*** Display-related functions ***/
576 /**********************************************************************/
580 * Free all XMesaVisuals which are associated with the given display.
583 destroy_visuals_on_display(Display
*dpy
)
586 for (i
= 0; i
< NumVisuals
; i
++) {
587 if (VisualTable
[i
]->display
== dpy
) {
588 /* remove this visual */
590 free(VisualTable
[i
]);
591 for (j
= i
; j
< NumVisuals
- 1; j
++)
592 VisualTable
[j
] = VisualTable
[j
+ 1];
600 * Called from XCloseDisplay() to let us free our display-related data.
603 close_display_callback(Display
*dpy
, XExtCodes
*codes
)
605 destroy_visuals_on_display(dpy
);
606 xmesa_destroy_buffers_on_display(dpy
);
612 * Look for the named extension on given display and return a pointer
613 * to the _XExtension data, or NULL if extension not found.
616 lookup_extension(Display
*dpy
, const char *extName
)
619 for (ext
= dpy
->ext_procs
; ext
; ext
= ext
->next
) {
620 if (ext
->name
&& strcmp(ext
->name
, extName
) == 0) {
629 * Whenever we're given a new Display pointer, call this function to
630 * register our close_display_callback function.
633 register_with_display(Display
*dpy
)
635 const char *extName
= "MesaGLX";
638 ext
= lookup_extension(dpy
, extName
);
640 XExtCodes
*c
= XAddExtension(dpy
);
641 ext
= dpy
->ext_procs
; /* new extension is at head of list */
642 assert(c
->extension
== ext
->codes
.extension
);
643 ext
->name
= _mesa_strdup(extName
);
644 ext
->close_display
= close_display_callback
;
649 /**********************************************************************/
650 /*** Begin Fake GLX API Functions ***/
651 /**********************************************************************/
655 * Helper used by glXChooseVisual and glXChooseFBConfig.
656 * The fbConfig parameter must be GL_FALSE for the former and GL_TRUE for
658 * In either case, the attribute list is terminated with the value 'None'.
661 choose_visual( Display
*dpy
, int screen
, const int *list
, GLboolean fbConfig
)
663 const GLboolean rgbModeDefault
= fbConfig
;
664 const int *parselist
;
667 int min_red
=0, min_green
=0, min_blue
=0;
668 GLboolean rgb_flag
= rgbModeDefault
;
669 GLboolean alpha_flag
= GL_FALSE
;
670 GLboolean double_flag
= GL_FALSE
;
671 GLboolean stereo_flag
= GL_FALSE
;
672 GLint depth_size
= 0;
673 GLint stencil_size
= 0;
674 GLint accumRedSize
= 0;
675 GLint accumGreenSize
= 0;
676 GLint accumBlueSize
= 0;
677 GLint accumAlphaSize
= 0;
679 int visual_type
= DONT_CARE
;
680 int trans_type
= DONT_CARE
;
681 int trans_value
= DONT_CARE
;
682 GLint caveat
= DONT_CARE
;
683 XMesaVisual xmvis
= NULL
;
684 int desiredVisualID
= -1;
691 switch (*parselist
) {
702 case GLX_BUFFER_SIZE
:
704 min_ci
= *parselist
++;
708 level
= *parselist
++;
720 case GLX_DOUBLEBUFFER
:
723 double_flag
= *parselist
++;
726 double_flag
= GL_TRUE
;
732 stereo_flag
= *parselist
++;
735 stereo_flag
= GL_TRUE
;
738 case GLX_AUX_BUFFERS
:
740 numAux
= *parselist
++;
741 if (numAux
> MAX_AUX_BUFFERS
)
746 min_red
= *parselist
++;
750 min_green
= *parselist
++;
754 min_blue
= *parselist
++;
759 GLint size
= *parselist
++;
760 alpha_flag
= size
? GL_TRUE
: GL_FALSE
;
765 depth_size
= *parselist
++;
767 case GLX_STENCIL_SIZE
:
769 stencil_size
= *parselist
++;
771 case GLX_ACCUM_RED_SIZE
:
774 GLint size
= *parselist
++;
775 accumRedSize
= MAX2( accumRedSize
, size
);
778 case GLX_ACCUM_GREEN_SIZE
:
781 GLint size
= *parselist
++;
782 accumGreenSize
= MAX2( accumGreenSize
, size
);
785 case GLX_ACCUM_BLUE_SIZE
:
788 GLint size
= *parselist
++;
789 accumBlueSize
= MAX2( accumBlueSize
, size
);
792 case GLX_ACCUM_ALPHA_SIZE
:
795 GLint size
= *parselist
++;
796 accumAlphaSize
= MAX2( accumAlphaSize
, size
);
801 * GLX_EXT_visual_info extension
803 case GLX_X_VISUAL_TYPE_EXT
:
805 visual_type
= *parselist
++;
807 case GLX_TRANSPARENT_TYPE_EXT
:
809 trans_type
= *parselist
++;
811 case GLX_TRANSPARENT_INDEX_VALUE_EXT
:
813 trans_value
= *parselist
++;
815 case GLX_TRANSPARENT_RED_VALUE_EXT
:
816 case GLX_TRANSPARENT_GREEN_VALUE_EXT
:
817 case GLX_TRANSPARENT_BLUE_VALUE_EXT
:
818 case GLX_TRANSPARENT_ALPHA_VALUE_EXT
:
825 * GLX_EXT_visual_info extension
827 case GLX_VISUAL_CAVEAT_EXT
:
829 caveat
= *parselist
++; /* ignored for now */
833 * GLX_ARB_multisample
835 case GLX_SAMPLE_BUFFERS_ARB
:
836 /* ms not supported */
838 case GLX_SAMPLES_ARB
:
839 /* ms not supported */
845 case GLX_RENDER_TYPE
:
849 if (*parselist
== GLX_RGBA_BIT
) {
852 else if (*parselist
== GLX_COLOR_INDEX_BIT
) {
855 else if (*parselist
== 0) {
860 case GLX_DRAWABLE_TYPE
:
864 if (*parselist
& ~(GLX_WINDOW_BIT
| GLX_PIXMAP_BIT
| GLX_PBUFFER_BIT
)) {
865 return NULL
; /* bad bit */
869 case GLX_FBCONFIG_ID
:
873 desiredVisualID
= *parselist
++;
875 case GLX_X_RENDERABLE
:
882 #ifdef GLX_EXT_texture_from_pixmap
883 case GLX_BIND_TO_TEXTURE_RGB_EXT
:
884 parselist
++; /*skip*/
886 case GLX_BIND_TO_TEXTURE_RGBA_EXT
:
887 parselist
++; /*skip*/
889 case GLX_BIND_TO_MIPMAP_TEXTURE_EXT
:
890 parselist
++; /*skip*/
892 case GLX_BIND_TO_TEXTURE_TARGETS_EXT
:
894 if (*parselist
& ~(GLX_TEXTURE_1D_BIT_EXT
|
895 GLX_TEXTURE_2D_BIT_EXT
|
896 GLX_TEXTURE_RECTANGLE_BIT_EXT
)) {
901 case GLX_Y_INVERTED_EXT
:
902 parselist
++; /*skip*/
911 /* undefined attribute */
912 _mesa_warning(NULL
, "unexpected attrib 0x%x in choose_visual()",
922 * Since we're only simulating the GLX extension this function will never
923 * find any real GL visuals. Instead, all we can do is try to find an RGB
924 * or CI visual of appropriate depth. Other requested attributes such as
925 * double buffering, depth buffer, etc. will be associated with the X
926 * visual and stored in the VisualTable[].
928 if (desiredVisualID
!= -1) {
929 /* try to get a specific visual, by visualID */
932 temp
.visualid
= desiredVisualID
;
933 temp
.screen
= screen
;
934 vis
= XGetVisualInfo(dpy
, VisualIDMask
| VisualScreenMask
, &temp
, &n
);
936 /* give the visual some useful GLX attributes */
937 double_flag
= GL_TRUE
;
939 depth_size
= default_depth_bits();
940 stencil_size
= STENCIL_BITS
;
945 /* normal color planes */
946 /* Get an RGB visual */
947 int min_rgb
= min_red
+ min_green
+ min_blue
;
948 if (min_rgb
>1 && min_rgb
<8) {
949 /* a special case to be sure we can get a monochrome visual */
952 vis
= choose_x_visual( dpy
, screen
, min_rgb
, visual_type
);
955 _mesa_warning(NULL
, "overlay not supported");
960 /* Note: we're not exactly obeying the glXChooseVisual rules here.
961 * When GLX_DEPTH_SIZE = 1 is specified we're supposed to choose the
962 * largest depth buffer size, which is 32bits/value. Instead, we
963 * return 16 to maintain performance with earlier versions of Mesa.
965 if (stencil_size
> 0)
966 depth_size
= 24; /* if Z and stencil, always use 24+8 format */
967 else if (depth_size
> 24)
969 else if (depth_size
> 16)
971 else if (depth_size
> 0) {
972 depth_size
= default_depth_bits();
976 alpha_flag
= default_alpha_bits() > 0;
979 /* we only support one size of stencil and accum buffers. */
980 if (stencil_size
> 0)
981 stencil_size
= STENCIL_BITS
;
983 if (accumRedSize
> 0 ||
984 accumGreenSize
> 0 ||
986 accumAlphaSize
> 0) {
990 accumBlueSize
= default_accum_bits();
992 accumAlphaSize
= alpha_flag
? accumRedSize
: 0;
995 xmvis
= save_glx_visual( dpy
, vis
, rgb_flag
, alpha_flag
, double_flag
,
996 stereo_flag
, depth_size
, stencil_size
,
997 accumRedSize
, accumGreenSize
,
998 accumBlueSize
, accumAlphaSize
, level
, numAux
);
1005 static XVisualInfo
*
1006 Fake_glXChooseVisual( Display
*dpy
, int screen
, int *list
)
1010 /* register ourselves as an extension on this display */
1011 register_with_display(dpy
);
1013 xmvis
= choose_visual(dpy
, screen
, list
, GL_FALSE
);
1015 /* create a new vishandle - the cached one may be stale */
1016 xmvis
->vishandle
= (XVisualInfo
*) _mesa_malloc(sizeof(XVisualInfo
));
1017 if (xmvis
->vishandle
) {
1018 _mesa_memcpy(xmvis
->vishandle
, xmvis
->visinfo
, sizeof(XVisualInfo
));
1020 return xmvis
->vishandle
;
1028 Fake_glXCreateContext( Display
*dpy
, XVisualInfo
*visinfo
,
1029 GLXContext share_list
, Bool direct
)
1032 struct fake_glx_context
*glxCtx
;
1033 struct fake_glx_context
*shareCtx
= (struct fake_glx_context
*) share_list
;
1035 if (!dpy
|| !visinfo
)
1038 glxCtx
= CALLOC_STRUCT(fake_glx_context
);
1042 /* deallocate unused windows/buffers */
1044 XMesaGarbageCollect();
1047 xmvis
= find_glx_visual( dpy
, visinfo
);
1049 /* This visual wasn't found with glXChooseVisual() */
1050 xmvis
= create_glx_visual( dpy
, visinfo
);
1052 /* unusable visual */
1058 glxCtx
->xmesaContext
= XMesaCreateContext(xmvis
,
1059 shareCtx
? shareCtx
->xmesaContext
: NULL
);
1060 if (!glxCtx
->xmesaContext
) {
1065 glxCtx
->glxContext
.isDirect
= DEFAULT_DIRECT
;
1066 glxCtx
->glxContext
.currentDpy
= dpy
;
1067 glxCtx
->glxContext
.xid
= (XID
) glxCtx
; /* self pointer */
1069 assert((void *) glxCtx
== (void *) &(glxCtx
->glxContext
));
1071 return (GLXContext
) glxCtx
;
1075 /* XXX these may have to be removed due to thread-safety issues. */
1076 static GLXContext MakeCurrent_PrevContext
= 0;
1077 static GLXDrawable MakeCurrent_PrevDrawable
= 0;
1078 static GLXDrawable MakeCurrent_PrevReadable
= 0;
1079 static XMesaBuffer MakeCurrent_PrevDrawBuffer
= 0;
1080 static XMesaBuffer MakeCurrent_PrevReadBuffer
= 0;
1083 /* GLX 1.3 and later */
1085 Fake_glXMakeContextCurrent( Display
*dpy
, GLXDrawable draw
,
1086 GLXDrawable read
, GLXContext ctx
)
1088 struct fake_glx_context
*glxCtx
= (struct fake_glx_context
*) ctx
;
1089 static boolean firsttime
= 1, no_rast
= 0;
1092 no_rast
= getenv("SP_NO_RAST") != NULL
;
1097 if (ctx
&& draw
&& read
) {
1098 XMesaBuffer drawBuffer
, readBuffer
;
1099 XMesaContext xmctx
= glxCtx
->xmesaContext
;
1101 /* Find the XMesaBuffer which corresponds to the GLXDrawable 'draw' */
1102 if (ctx
== MakeCurrent_PrevContext
1103 && draw
== MakeCurrent_PrevDrawable
) {
1104 drawBuffer
= MakeCurrent_PrevDrawBuffer
;
1107 drawBuffer
= XMesaFindBuffer( dpy
, draw
);
1110 /* drawable must be a new window! */
1111 drawBuffer
= XMesaCreateWindowBuffer( xmctx
->xm_visual
, draw
);
1113 /* Out of memory, or context/drawable depth mismatch */
1118 /* Find the XMesaBuffer which corresponds to the GLXDrawable 'read' */
1119 if (ctx
== MakeCurrent_PrevContext
1120 && read
== MakeCurrent_PrevReadable
) {
1121 readBuffer
= MakeCurrent_PrevReadBuffer
;
1124 readBuffer
= XMesaFindBuffer( dpy
, read
);
1127 /* drawable must be a new window! */
1128 readBuffer
= XMesaCreateWindowBuffer( xmctx
->xm_visual
, read
);
1130 /* Out of memory, or context/drawable depth mismatch */
1136 MakeCurrent_PrevContext
== ctx
&&
1137 MakeCurrent_PrevDrawable
== draw
&&
1138 MakeCurrent_PrevReadable
== read
&&
1139 MakeCurrent_PrevDrawBuffer
== drawBuffer
&&
1140 MakeCurrent_PrevReadBuffer
== readBuffer
)
1143 MakeCurrent_PrevContext
= ctx
;
1144 MakeCurrent_PrevDrawable
= draw
;
1145 MakeCurrent_PrevReadable
= read
;
1146 MakeCurrent_PrevDrawBuffer
= drawBuffer
;
1147 MakeCurrent_PrevReadBuffer
= readBuffer
;
1149 /* Now make current! */
1150 if (XMesaMakeCurrent2(xmctx
, drawBuffer
, readBuffer
)) {
1151 ((__GLXcontext
*) ctx
)->currentDpy
= dpy
;
1152 ((__GLXcontext
*) ctx
)->currentDrawable
= draw
;
1153 ((__GLXcontext
*) ctx
)->currentReadable
= read
;
1160 else if (!ctx
&& !draw
&& !read
) {
1161 /* release current context w/out assigning new one. */
1162 XMesaMakeCurrent2( NULL
, NULL
, NULL
);
1163 MakeCurrent_PrevContext
= 0;
1164 MakeCurrent_PrevDrawable
= 0;
1165 MakeCurrent_PrevReadable
= 0;
1166 MakeCurrent_PrevDrawBuffer
= 0;
1167 MakeCurrent_PrevReadBuffer
= 0;
1171 /* The args must either all be non-zero or all zero.
1180 Fake_glXMakeCurrent( Display
*dpy
, GLXDrawable drawable
, GLXContext ctx
)
1182 return Fake_glXMakeContextCurrent( dpy
, drawable
, drawable
, ctx
);
1187 Fake_glXCreateGLXPixmap( Display
*dpy
, XVisualInfo
*visinfo
, Pixmap pixmap
)
1192 v
= find_glx_visual( dpy
, visinfo
);
1194 v
= create_glx_visual( dpy
, visinfo
);
1196 /* unusable visual */
1201 b
= XMesaCreatePixmapBuffer( v
, pixmap
, 0 );
1209 /*** GLX_MESA_pixmap_colormap ***/
1212 Fake_glXCreateGLXPixmapMESA( Display
*dpy
, XVisualInfo
*visinfo
,
1213 Pixmap pixmap
, Colormap cmap
)
1218 v
= find_glx_visual( dpy
, visinfo
);
1220 v
= create_glx_visual( dpy
, visinfo
);
1222 /* unusable visual */
1227 b
= XMesaCreatePixmapBuffer( v
, pixmap
, cmap
);
1236 Fake_glXDestroyGLXPixmap( Display
*dpy
, GLXPixmap pixmap
)
1238 XMesaBuffer b
= XMesaFindBuffer(dpy
, pixmap
);
1240 XMesaDestroyBuffer(b
);
1242 else if (_mesa_getenv("MESA_DEBUG")) {
1243 _mesa_warning(NULL
, "Mesa: glXDestroyGLXPixmap: invalid pixmap\n");
1249 Fake_glXCopyContext( Display
*dpy
, GLXContext src
, GLXContext dst
,
1250 unsigned long mask
)
1252 struct fake_glx_context
*fakeSrc
= (struct fake_glx_context
*) src
;
1253 struct fake_glx_context
*fakeDst
= (struct fake_glx_context
*) dst
;
1254 XMesaContext xm_src
= fakeSrc
->xmesaContext
;
1255 XMesaContext xm_dst
= fakeDst
->xmesaContext
;
1257 if (MakeCurrent_PrevContext
== src
) {
1260 st_copy_context_state( xm_src
->st
, xm_dst
->st
, (GLuint
) mask
);
1265 Fake_glXQueryExtension( Display
*dpy
, int *errorb
, int *event
)
1267 /* Mesa's GLX isn't really an X extension but we try to act like one. */
1275 extern void _kw_ungrab_all( Display
*dpy
);
1276 void _kw_ungrab_all( Display
*dpy
)
1278 XUngrabPointer( dpy
, CurrentTime
);
1279 XUngrabKeyboard( dpy
, CurrentTime
);
1284 Fake_glXDestroyContext( Display
*dpy
, GLXContext ctx
)
1286 struct fake_glx_context
*glxCtx
= (struct fake_glx_context
*) ctx
;
1288 MakeCurrent_PrevContext
= 0;
1289 MakeCurrent_PrevDrawable
= 0;
1290 MakeCurrent_PrevReadable
= 0;
1291 MakeCurrent_PrevDrawBuffer
= 0;
1292 MakeCurrent_PrevReadBuffer
= 0;
1293 XMesaDestroyContext( glxCtx
->xmesaContext
);
1294 XMesaGarbageCollect();
1300 Fake_glXIsDirect( Display
*dpy
, GLXContext ctx
)
1302 struct fake_glx_context
*glxCtx
= (struct fake_glx_context
*) ctx
;
1304 return glxCtx
->glxContext
.isDirect
;
1310 Fake_glXSwapBuffers( Display
*dpy
, GLXDrawable drawable
)
1312 XMesaBuffer buffer
= XMesaFindBuffer( dpy
, drawable
);
1313 static boolean firsttime
= 1, no_rast
= 0;
1316 no_rast
= getenv("SP_NO_RAST") != NULL
;
1324 XMesaSwapBuffers(buffer
);
1326 else if (_mesa_getenv("MESA_DEBUG")) {
1327 _mesa_warning(NULL
, "glXSwapBuffers: invalid drawable 0x%x\n",
1334 /*** GLX_MESA_copy_sub_buffer ***/
1337 Fake_glXCopySubBufferMESA( Display
*dpy
, GLXDrawable drawable
,
1338 int x
, int y
, int width
, int height
)
1340 XMesaBuffer buffer
= XMesaFindBuffer( dpy
, drawable
);
1342 XMesaCopySubBuffer(buffer
, x
, y
, width
, height
);
1344 else if (_mesa_getenv("MESA_DEBUG")) {
1345 _mesa_warning(NULL
, "Mesa: glXCopySubBufferMESA: invalid drawable\n");
1351 Fake_glXQueryVersion( Display
*dpy
, int *maj
, int *min
)
1354 /* Return GLX version, not Mesa version */
1355 assert(CLIENT_MAJOR_VERSION
== SERVER_MAJOR_VERSION
);
1356 *maj
= CLIENT_MAJOR_VERSION
;
1357 *min
= MIN2( CLIENT_MINOR_VERSION
, SERVER_MINOR_VERSION
);
1363 * Query the GLX attributes of the given XVisualInfo.
1366 get_config( XMesaVisual xmvis
, int attrib
, int *value
, GLboolean fbconfig
)
1372 return GLX_BAD_ATTRIBUTE
;
1373 *value
= (int) True
;
1375 case GLX_BUFFER_SIZE
:
1376 *value
= xmvis
->visinfo
->depth
;
1379 *value
= xmvis
->mesa_visual
.level
;
1383 return GLX_BAD_ATTRIBUTE
;
1384 if (xmvis
->mesa_visual
.rgbMode
) {
1391 case GLX_DOUBLEBUFFER
:
1392 *value
= (int) xmvis
->mesa_visual
.doubleBufferMode
;
1395 *value
= (int) xmvis
->mesa_visual
.stereoMode
;
1397 case GLX_AUX_BUFFERS
:
1398 *value
= xmvis
->mesa_visual
.numAuxBuffers
;
1401 *value
= xmvis
->mesa_visual
.redBits
;
1403 case GLX_GREEN_SIZE
:
1404 *value
= xmvis
->mesa_visual
.greenBits
;
1407 *value
= xmvis
->mesa_visual
.blueBits
;
1409 case GLX_ALPHA_SIZE
:
1410 *value
= xmvis
->mesa_visual
.alphaBits
;
1412 case GLX_DEPTH_SIZE
:
1413 *value
= xmvis
->mesa_visual
.depthBits
;
1415 case GLX_STENCIL_SIZE
:
1416 *value
= xmvis
->mesa_visual
.stencilBits
;
1418 case GLX_ACCUM_RED_SIZE
:
1419 *value
= xmvis
->mesa_visual
.accumRedBits
;
1421 case GLX_ACCUM_GREEN_SIZE
:
1422 *value
= xmvis
->mesa_visual
.accumGreenBits
;
1424 case GLX_ACCUM_BLUE_SIZE
:
1425 *value
= xmvis
->mesa_visual
.accumBlueBits
;
1427 case GLX_ACCUM_ALPHA_SIZE
:
1428 *value
= xmvis
->mesa_visual
.accumAlphaBits
;
1432 * GLX_EXT_visual_info extension
1434 case GLX_X_VISUAL_TYPE_EXT
:
1435 switch (xmvis
->visinfo
->CLASS
) {
1436 case StaticGray
: *value
= GLX_STATIC_GRAY_EXT
; return 0;
1437 case GrayScale
: *value
= GLX_GRAY_SCALE_EXT
; return 0;
1438 case StaticColor
: *value
= GLX_STATIC_GRAY_EXT
; return 0;
1439 case PseudoColor
: *value
= GLX_PSEUDO_COLOR_EXT
; return 0;
1440 case TrueColor
: *value
= GLX_TRUE_COLOR_EXT
; return 0;
1441 case DirectColor
: *value
= GLX_DIRECT_COLOR_EXT
; return 0;
1444 case GLX_TRANSPARENT_TYPE_EXT
:
1446 *value
= GLX_NONE_EXT
;
1448 case GLX_TRANSPARENT_INDEX_VALUE_EXT
:
1451 case GLX_TRANSPARENT_RED_VALUE_EXT
:
1454 case GLX_TRANSPARENT_GREEN_VALUE_EXT
:
1457 case GLX_TRANSPARENT_BLUE_VALUE_EXT
:
1460 case GLX_TRANSPARENT_ALPHA_VALUE_EXT
:
1465 * GLX_EXT_visual_info extension
1467 case GLX_VISUAL_CAVEAT_EXT
:
1468 /* test for zero, just in case */
1469 if (xmvis
->mesa_visual
.visualRating
> 0)
1470 *value
= xmvis
->mesa_visual
.visualRating
;
1472 *value
= GLX_NONE_EXT
;
1476 * GLX_ARB_multisample
1478 case GLX_SAMPLE_BUFFERS_ARB
:
1481 case GLX_SAMPLES_ARB
:
1488 case GLX_SCREEN_EXT
:
1490 return GLX_BAD_ATTRIBUTE
;
1491 *value
= xmvis
->visinfo
->screen
;
1493 case GLX_DRAWABLE_TYPE
: /*SGIX too */
1495 return GLX_BAD_ATTRIBUTE
;
1496 *value
= GLX_WINDOW_BIT
| GLX_PIXMAP_BIT
| GLX_PBUFFER_BIT
;
1498 case GLX_RENDER_TYPE_SGIX
:
1500 return GLX_BAD_ATTRIBUTE
;
1501 if (xmvis
->mesa_visual
.rgbMode
)
1502 *value
= GLX_RGBA_BIT
;
1504 *value
= GLX_COLOR_INDEX_BIT
;
1506 case GLX_X_RENDERABLE_SGIX
:
1508 return GLX_BAD_ATTRIBUTE
;
1509 *value
= True
; /* XXX really? */
1511 case GLX_FBCONFIG_ID_SGIX
:
1513 return GLX_BAD_ATTRIBUTE
;
1514 *value
= xmvis
->visinfo
->visualid
;
1516 case GLX_MAX_PBUFFER_WIDTH
:
1518 return GLX_BAD_ATTRIBUTE
;
1519 /* XXX or MAX_WIDTH? */
1520 *value
= DisplayWidth(xmvis
->display
, xmvis
->visinfo
->screen
);
1522 case GLX_MAX_PBUFFER_HEIGHT
:
1524 return GLX_BAD_ATTRIBUTE
;
1525 *value
= DisplayHeight(xmvis
->display
, xmvis
->visinfo
->screen
);
1527 case GLX_MAX_PBUFFER_PIXELS
:
1529 return GLX_BAD_ATTRIBUTE
;
1530 *value
= DisplayWidth(xmvis
->display
, xmvis
->visinfo
->screen
) *
1531 DisplayHeight(xmvis
->display
, xmvis
->visinfo
->screen
);
1535 return GLX_BAD_ATTRIBUTE
;
1536 *value
= xmvis
->visinfo
->visualid
;
1539 #ifdef GLX_EXT_texture_from_pixmap
1540 case GLX_BIND_TO_TEXTURE_RGB_EXT
:
1541 *value
= True
; /*XXX*/
1543 case GLX_BIND_TO_TEXTURE_RGBA_EXT
:
1545 *value
= xmvis
->mesa_visual
.alphaBits
> 0 ? True
: False
;
1547 case GLX_BIND_TO_MIPMAP_TEXTURE_EXT
:
1548 *value
= True
; /*XXX*/
1550 case GLX_BIND_TO_TEXTURE_TARGETS_EXT
:
1551 *value
= (GLX_TEXTURE_1D_BIT_EXT
|
1552 GLX_TEXTURE_2D_BIT_EXT
|
1553 GLX_TEXTURE_RECTANGLE_BIT_EXT
); /*XXX*/
1555 case GLX_Y_INVERTED_EXT
:
1556 *value
= True
; /*XXX*/
1561 return GLX_BAD_ATTRIBUTE
;
1568 Fake_glXGetConfig( Display
*dpy
, XVisualInfo
*visinfo
,
1569 int attrib
, int *value
)
1573 if (!dpy
|| !visinfo
)
1574 return GLX_BAD_ATTRIBUTE
;
1576 xmvis
= find_glx_visual( dpy
, visinfo
);
1578 /* this visual wasn't obtained with glXChooseVisual */
1579 xmvis
= create_glx_visual( dpy
, visinfo
);
1581 /* this visual can't be used for GL rendering */
1582 if (attrib
==GLX_USE_GL
) {
1583 *value
= (int) False
;
1587 return GLX_BAD_VISUAL
;
1592 k
= get_config(xmvis
, attrib
, value
, GL_FALSE
);
1598 Fake_glXWaitGL( void )
1600 XMesaContext xmesa
= XMesaGetCurrentContext();
1601 XMesaFlush( xmesa
);
1607 Fake_glXWaitX( void )
1609 XMesaContext xmesa
= XMesaGetCurrentContext();
1610 XMesaFlush( xmesa
);
1615 get_extensions( void )
1622 /* GLX 1.1 and later */
1624 Fake_glXQueryExtensionsString( Display
*dpy
, int screen
)
1628 return get_extensions();
1633 /* GLX 1.1 and later */
1635 Fake_glXQueryServerString( Display
*dpy
, int screen
, int name
)
1637 static char version
[1000];
1638 _mesa_sprintf(version
, "%d.%d %s",
1639 SERVER_MAJOR_VERSION
, SERVER_MINOR_VERSION
, MESA_GLX_VERSION
);
1645 case GLX_EXTENSIONS
:
1646 return get_extensions();
1658 /* GLX 1.1 and later */
1660 Fake_glXGetClientString( Display
*dpy
, int name
)
1662 static char version
[1000];
1663 _mesa_sprintf(version
, "%d.%d %s", CLIENT_MAJOR_VERSION
,
1664 CLIENT_MINOR_VERSION
, MESA_GLX_VERSION
);
1669 case GLX_EXTENSIONS
:
1670 return get_extensions();
1688 Fake_glXGetFBConfigAttrib( Display
*dpy
, GLXFBConfig config
,
1689 int attribute
, int *value
)
1691 XMesaVisual v
= (XMesaVisual
) config
;
1695 if (!dpy
|| !config
|| !value
)
1698 return get_config(v
, attribute
, value
, GL_TRUE
);
1702 static GLXFBConfig
*
1703 Fake_glXGetFBConfigs( Display
*dpy
, int screen
, int *nelements
)
1705 XVisualInfo
*visuals
, visTemplate
;
1706 const long visMask
= VisualScreenMask
;
1709 /* Get list of all X visuals */
1710 visTemplate
.screen
= screen
;
1711 visuals
= XGetVisualInfo(dpy
, visMask
, &visTemplate
, nelements
);
1712 if (*nelements
> 0) {
1713 XMesaVisual
*results
;
1714 results
= (XMesaVisual
*) _mesa_malloc(*nelements
* sizeof(XMesaVisual
));
1719 for (i
= 0; i
< *nelements
; i
++) {
1720 results
[i
] = create_glx_visual(dpy
, visuals
+ i
);
1722 return (GLXFBConfig
*) results
;
1728 static GLXFBConfig
*
1729 Fake_glXChooseFBConfig( Display
*dpy
, int screen
,
1730 const int *attribList
, int *nitems
)
1734 if (!attribList
|| !attribList
[0]) {
1735 /* return list of all configs (per GLX_SGIX_fbconfig spec) */
1736 return Fake_glXGetFBConfigs(dpy
, screen
, nitems
);
1739 xmvis
= choose_visual(dpy
, screen
, attribList
, GL_TRUE
);
1741 GLXFBConfig
*config
= (GLXFBConfig
*) _mesa_malloc(sizeof(XMesaVisual
));
1747 config
[0] = (GLXFBConfig
) xmvis
;
1748 return (GLXFBConfig
*) config
;
1757 static XVisualInfo
*
1758 Fake_glXGetVisualFromFBConfig( Display
*dpy
, GLXFBConfig config
)
1760 if (dpy
&& config
) {
1761 XMesaVisual xmvis
= (XMesaVisual
) config
;
1763 return xmvis
->vishandle
;
1765 /* create a new vishandle - the cached one may be stale */
1766 xmvis
->vishandle
= (XVisualInfo
*) _mesa_malloc(sizeof(XVisualInfo
));
1767 if (xmvis
->vishandle
) {
1768 _mesa_memcpy(xmvis
->vishandle
, xmvis
->visinfo
, sizeof(XVisualInfo
));
1770 return xmvis
->vishandle
;
1780 Fake_glXCreateWindow( Display
*dpy
, GLXFBConfig config
, Window win
,
1781 const int *attribList
)
1783 XMesaVisual xmvis
= (XMesaVisual
) config
;
1788 xmbuf
= XMesaCreateWindowBuffer(xmvis
, win
);
1793 (void) attribList
; /* Ignored in GLX 1.3 */
1795 return win
; /* A hack for now */
1800 Fake_glXDestroyWindow( Display
*dpy
, GLXWindow window
)
1802 XMesaBuffer b
= XMesaFindBuffer(dpy
, (Drawable
) window
);
1804 XMesaDestroyBuffer(b
);
1805 /* don't destroy X window */
1811 Fake_glXCreatePixmap( Display
*dpy
, GLXFBConfig config
, Pixmap pixmap
,
1812 const int *attribList
)
1814 XMesaVisual v
= (XMesaVisual
) config
;
1817 int target
= 0, format
= 0, mipmap
= 0;
1820 if (!dpy
|| !config
|| !pixmap
)
1823 for (attr
= attribList
; *attr
; attr
++) {
1825 case GLX_TEXTURE_FORMAT_EXT
:
1828 case GLX_TEXTURE_FORMAT_NONE_EXT
:
1829 case GLX_TEXTURE_FORMAT_RGB_EXT
:
1830 case GLX_TEXTURE_FORMAT_RGBA_EXT
:
1838 case GLX_TEXTURE_TARGET_EXT
:
1841 case GLX_TEXTURE_1D_EXT
:
1842 case GLX_TEXTURE_2D_EXT
:
1843 case GLX_TEXTURE_RECTANGLE_EXT
:
1851 case GLX_MIPMAP_TEXTURE_EXT
:
1862 if (format
== GLX_TEXTURE_FORMAT_RGB_EXT
) {
1863 if (get_config(v
, GLX_BIND_TO_TEXTURE_RGB_EXT
,
1864 &value
, GL_TRUE
) != Success
1866 return 0; /* error! */
1869 else if (format
== GLX_TEXTURE_FORMAT_RGBA_EXT
) {
1870 if (get_config(v
, GLX_BIND_TO_TEXTURE_RGBA_EXT
,
1871 &value
, GL_TRUE
) != Success
1873 return 0; /* error! */
1877 if (get_config(v
, GLX_BIND_TO_MIPMAP_TEXTURE_EXT
,
1878 &value
, GL_TRUE
) != Success
1880 return 0; /* error! */
1883 if (target
== GLX_TEXTURE_1D_EXT
) {
1884 if (get_config(v
, GLX_BIND_TO_TEXTURE_TARGETS_EXT
,
1885 &value
, GL_TRUE
) != Success
1886 || (value
& GLX_TEXTURE_1D_BIT_EXT
) == 0) {
1887 return 0; /* error! */
1890 else if (target
== GLX_TEXTURE_2D_EXT
) {
1891 if (get_config(v
, GLX_BIND_TO_TEXTURE_TARGETS_EXT
,
1892 &value
, GL_TRUE
) != Success
1893 || (value
& GLX_TEXTURE_2D_BIT_EXT
) == 0) {
1894 return 0; /* error! */
1897 if (target
== GLX_TEXTURE_RECTANGLE_EXT
) {
1898 if (get_config(v
, GLX_BIND_TO_TEXTURE_TARGETS_EXT
,
1899 &value
, GL_TRUE
) != Success
1900 || (value
& GLX_TEXTURE_RECTANGLE_BIT_EXT
) == 0) {
1901 return 0; /* error! */
1905 if (format
|| target
|| mipmap
) {
1906 /* texture from pixmap */
1907 b
= XMesaCreatePixmapTextureBuffer(v
, pixmap
, 0, format
, target
, mipmap
);
1910 b
= XMesaCreatePixmapBuffer( v
, pixmap
, 0 );
1921 Fake_glXDestroyPixmap( Display
*dpy
, GLXPixmap pixmap
)
1923 XMesaBuffer b
= XMesaFindBuffer(dpy
, (Drawable
)pixmap
);
1925 XMesaDestroyBuffer(b
);
1926 /* don't destroy X pixmap */
1931 Fake_glXCreatePbuffer( Display
*dpy
, GLXFBConfig config
,
1932 const int *attribList
)
1934 XMesaVisual xmvis
= (XMesaVisual
) config
;
1937 int width
= 0, height
= 0;
1938 GLboolean useLargest
= GL_FALSE
, preserveContents
= GL_FALSE
;
1942 for (attrib
= attribList
; *attrib
; attrib
++) {
1944 case GLX_PBUFFER_WIDTH
:
1948 case GLX_PBUFFER_HEIGHT
:
1952 case GLX_PRESERVED_CONTENTS
:
1954 preserveContents
= *attrib
; /* ignored */
1956 case GLX_LARGEST_PBUFFER
:
1958 useLargest
= *attrib
; /* ignored */
1965 /* not used at this time */
1967 (void) preserveContents
;
1969 if (width
== 0 || height
== 0)
1972 xmbuf
= XMesaCreatePBuffer( xmvis
, 0, width
, height
);
1973 /* A GLXPbuffer handle must be an X Drawable because that's what
1974 * glXMakeCurrent takes.
1977 return (GLXPbuffer
) xmbuf
->drawable
;
1984 Fake_glXDestroyPbuffer( Display
*dpy
, GLXPbuffer pbuf
)
1986 XMesaBuffer b
= XMesaFindBuffer(dpy
, pbuf
);
1988 XMesaDestroyBuffer(b
);
1994 Fake_glXQueryDrawable( Display
*dpy
, GLXDrawable draw
, int attribute
,
1995 unsigned int *value
)
1997 XMesaBuffer xmbuf
= XMesaFindBuffer(dpy
, draw
);
2001 switch (attribute
) {
2003 *value
= xmesa_buffer_width(xmbuf
);
2006 *value
= xmesa_buffer_width(xmbuf
);
2008 case GLX_PRESERVED_CONTENTS
:
2011 case GLX_LARGEST_PBUFFER
:
2012 *value
= xmesa_buffer_width(xmbuf
) * xmesa_buffer_height(xmbuf
);
2014 case GLX_FBCONFIG_ID
:
2015 *value
= xmbuf
->xm_visual
->visinfo
->visualid
;
2017 #ifdef GLX_EXT_texture_from_pixmap
2018 case GLX_TEXTURE_FORMAT_EXT
:
2019 *value
= xmbuf
->TextureFormat
;
2021 case GLX_TEXTURE_TARGET_EXT
:
2022 *value
= xmbuf
->TextureTarget
;
2024 case GLX_MIPMAP_TEXTURE_EXT
:
2025 *value
= xmbuf
->TextureMipmap
;
2030 return; /* raise BadValue error */
2036 Fake_glXCreateNewContext( Display
*dpy
, GLXFBConfig config
,
2037 int renderType
, GLXContext shareList
, Bool direct
)
2039 struct fake_glx_context
*glxCtx
;
2040 struct fake_glx_context
*shareCtx
= (struct fake_glx_context
*) shareList
;
2041 XMesaVisual xmvis
= (XMesaVisual
) config
;
2043 if (!dpy
|| !config
||
2044 (renderType
!= GLX_RGBA_TYPE
&& renderType
!= GLX_COLOR_INDEX_TYPE
))
2047 glxCtx
= CALLOC_STRUCT(fake_glx_context
);
2051 /* deallocate unused windows/buffers */
2052 XMesaGarbageCollect();
2054 glxCtx
->xmesaContext
= XMesaCreateContext(xmvis
,
2055 shareCtx
? shareCtx
->xmesaContext
: NULL
);
2056 if (!glxCtx
->xmesaContext
) {
2061 glxCtx
->glxContext
.isDirect
= DEFAULT_DIRECT
;
2062 glxCtx
->glxContext
.currentDpy
= dpy
;
2063 glxCtx
->glxContext
.xid
= (XID
) glxCtx
; /* self pointer */
2065 assert((void *) glxCtx
== (void *) &(glxCtx
->glxContext
));
2067 return (GLXContext
) glxCtx
;
2072 Fake_glXQueryContext( Display
*dpy
, GLXContext ctx
, int attribute
, int *value
)
2074 struct fake_glx_context
*glxCtx
= (struct fake_glx_context
*) ctx
;
2075 XMesaContext xmctx
= glxCtx
->xmesaContext
;
2080 switch (attribute
) {
2081 case GLX_FBCONFIG_ID
:
2082 *value
= xmctx
->xm_visual
->visinfo
->visualid
;
2084 case GLX_RENDER_TYPE
:
2085 if (xmctx
->xm_visual
->mesa_visual
.rgbMode
)
2086 *value
= GLX_RGBA_BIT
;
2088 *value
= GLX_COLOR_INDEX_BIT
;
2094 return GLX_BAD_ATTRIBUTE
;
2101 Fake_glXSelectEvent( Display
*dpy
, GLXDrawable drawable
, unsigned long mask
)
2103 XMesaBuffer xmbuf
= XMesaFindBuffer(dpy
, drawable
);
2105 xmbuf
->selectedEvents
= mask
;
2110 Fake_glXGetSelectedEvent( Display
*dpy
, GLXDrawable drawable
,
2111 unsigned long *mask
)
2113 XMesaBuffer xmbuf
= XMesaFindBuffer(dpy
, drawable
);
2115 *mask
= xmbuf
->selectedEvents
;
2122 /*** GLX_SGI_swap_control ***/
2125 Fake_glXSwapIntervalSGI(int interval
)
2133 /*** GLX_SGI_video_sync ***/
2135 static unsigned int FrameCounter
= 0;
2138 Fake_glXGetVideoSyncSGI(unsigned int *count
)
2140 /* this is a bogus implementation */
2141 *count
= FrameCounter
++;
2146 Fake_glXWaitVideoSyncSGI(int divisor
, int remainder
, unsigned int *count
)
2148 if (divisor
<= 0 || remainder
< 0)
2149 return GLX_BAD_VALUE
;
2150 /* this is a bogus implementation */
2152 while (FrameCounter
% divisor
!= remainder
)
2154 *count
= FrameCounter
;
2160 /*** GLX_SGI_make_current_read ***/
2163 Fake_glXMakeCurrentReadSGI(Display
*dpy
, GLXDrawable draw
, GLXDrawable read
, GLXContext ctx
)
2165 return Fake_glXMakeContextCurrent( dpy
, draw
, read
, ctx
);
2170 Fake_glXGetCurrentReadDrawableSGI(void)
2177 /*** GLX_SGIX_video_source ***/
2180 static GLXVideoSourceSGIX
2181 Fake_glXCreateGLXVideoSourceSGIX(Display
*dpy
, int screen
, VLServer server
, VLPath path
, int nodeClass
, VLNode drainNode
)
2193 Fake_glXDestroyGLXVideoSourceSGIX(Display
*dpy
, GLXVideoSourceSGIX src
)
2202 /*** GLX_EXT_import_context ***/
2205 Fake_glXFreeContextEXT(Display
*dpy
, GLXContext context
)
2212 Fake_glXGetContextIDEXT(const GLXContext context
)
2219 Fake_glXImportContextEXT(Display
*dpy
, GLXContextID contextID
)
2227 Fake_glXQueryContextInfoEXT(Display
*dpy
, GLXContext context
, int attribute
, int *value
)
2238 /*** GLX_SGIX_fbconfig ***/
2241 Fake_glXGetFBConfigAttribSGIX(Display
*dpy
, GLXFBConfigSGIX config
, int attribute
, int *value
)
2243 return Fake_glXGetFBConfigAttrib(dpy
, config
, attribute
, value
);
2246 static GLXFBConfigSGIX
*
2247 Fake_glXChooseFBConfigSGIX(Display
*dpy
, int screen
, int *attrib_list
, int *nelements
)
2249 return (GLXFBConfig
*) Fake_glXChooseFBConfig(dpy
, screen
, attrib_list
, nelements
);
2254 Fake_glXCreateGLXPixmapWithConfigSGIX(Display
*dpy
, GLXFBConfigSGIX config
, Pixmap pixmap
)
2256 XMesaVisual xmvis
= (XMesaVisual
) config
;
2257 XMesaBuffer xmbuf
= XMesaCreatePixmapBuffer(xmvis
, pixmap
, 0);
2258 return xmbuf
->drawable
; /* need to return an X ID */
2263 Fake_glXCreateContextWithConfigSGIX(Display
*dpy
, GLXFBConfigSGIX config
, int render_type
, GLXContext share_list
, Bool direct
)
2265 XMesaVisual xmvis
= (XMesaVisual
) config
;
2266 struct fake_glx_context
*glxCtx
;
2267 struct fake_glx_context
*shareCtx
= (struct fake_glx_context
*) share_list
;
2269 glxCtx
= CALLOC_STRUCT(fake_glx_context
);
2273 /* deallocate unused windows/buffers */
2274 XMesaGarbageCollect();
2276 glxCtx
->xmesaContext
= XMesaCreateContext(xmvis
,
2277 shareCtx
? shareCtx
->xmesaContext
: NULL
);
2278 if (!glxCtx
->xmesaContext
) {
2283 glxCtx
->glxContext
.isDirect
= DEFAULT_DIRECT
;
2284 glxCtx
->glxContext
.currentDpy
= dpy
;
2285 glxCtx
->glxContext
.xid
= (XID
) glxCtx
; /* self pointer */
2287 assert((void *) glxCtx
== (void *) &(glxCtx
->glxContext
));
2289 return (GLXContext
) glxCtx
;
2293 static XVisualInfo
*
2294 Fake_glXGetVisualFromFBConfigSGIX(Display
*dpy
, GLXFBConfigSGIX config
)
2296 return Fake_glXGetVisualFromFBConfig(dpy
, config
);
2300 static GLXFBConfigSGIX
2301 Fake_glXGetFBConfigFromVisualSGIX(Display
*dpy
, XVisualInfo
*vis
)
2303 XMesaVisual xmvis
= find_glx_visual(dpy
, vis
);
2305 /* This visual wasn't found with glXChooseVisual() */
2306 xmvis
= create_glx_visual(dpy
, vis
);
2309 return (GLXFBConfigSGIX
) xmvis
;
2314 /*** GLX_SGIX_pbuffer ***/
2316 static GLXPbufferSGIX
2317 Fake_glXCreateGLXPbufferSGIX(Display
*dpy
, GLXFBConfigSGIX config
,
2318 unsigned int width
, unsigned int height
,
2321 XMesaVisual xmvis
= (XMesaVisual
) config
;
2324 GLboolean useLargest
= GL_FALSE
, preserveContents
= GL_FALSE
;
2328 for (attrib
= attribList
; attrib
&& *attrib
; attrib
++) {
2330 case GLX_PRESERVED_CONTENTS_SGIX
:
2332 preserveContents
= *attrib
; /* ignored */
2334 case GLX_LARGEST_PBUFFER_SGIX
:
2336 useLargest
= *attrib
; /* ignored */
2343 /* not used at this time */
2345 (void) preserveContents
;
2347 xmbuf
= XMesaCreatePBuffer( xmvis
, 0, width
, height
);
2348 /* A GLXPbuffer handle must be an X Drawable because that's what
2349 * glXMakeCurrent takes.
2351 return (GLXPbuffer
) xmbuf
->drawable
;
2356 Fake_glXDestroyGLXPbufferSGIX(Display
*dpy
, GLXPbufferSGIX pbuf
)
2358 XMesaBuffer xmbuf
= XMesaFindBuffer(dpy
, pbuf
);
2360 XMesaDestroyBuffer(xmbuf
);
2366 Fake_glXQueryGLXPbufferSGIX(Display
*dpy
, GLXPbufferSGIX pbuf
, int attribute
, unsigned int *value
)
2368 const XMesaBuffer xmbuf
= XMesaFindBuffer(dpy
, pbuf
);
2371 /* Generate GLXBadPbufferSGIX for bad pbuffer */
2375 switch (attribute
) {
2376 case GLX_PRESERVED_CONTENTS_SGIX
:
2379 case GLX_LARGEST_PBUFFER_SGIX
:
2380 *value
= xmesa_buffer_width(xmbuf
) * xmesa_buffer_height(xmbuf
);
2382 case GLX_WIDTH_SGIX
:
2383 *value
= xmesa_buffer_width(xmbuf
);
2385 case GLX_HEIGHT_SGIX
:
2386 *value
= xmesa_buffer_height(xmbuf
);
2388 case GLX_EVENT_MASK_SGIX
:
2389 *value
= 0; /* XXX might be wrong */
2399 Fake_glXSelectEventSGIX(Display
*dpy
, GLXDrawable drawable
, unsigned long mask
)
2401 XMesaBuffer xmbuf
= XMesaFindBuffer(dpy
, drawable
);
2403 /* Note: we'll never generate clobber events */
2404 xmbuf
->selectedEvents
= mask
;
2410 Fake_glXGetSelectedEventSGIX(Display
*dpy
, GLXDrawable drawable
, unsigned long *mask
)
2412 XMesaBuffer xmbuf
= XMesaFindBuffer(dpy
, drawable
);
2414 *mask
= xmbuf
->selectedEvents
;
2423 /*** GLX_SGI_cushion ***/
2426 Fake_glXCushionSGI(Display
*dpy
, Window win
, float cushion
)
2435 /*** GLX_SGIX_video_resize ***/
2438 Fake_glXBindChannelToWindowSGIX(Display
*dpy
, int screen
, int channel
, Window window
)
2448 Fake_glXChannelRectSGIX(Display
*dpy
, int screen
, int channel
, int x
, int y
, int w
, int h
)
2461 Fake_glXQueryChannelRectSGIX(Display
*dpy
, int screen
, int channel
, int *x
, int *y
, int *w
, int *h
)
2474 Fake_glXQueryChannelDeltasSGIX(Display
*dpy
, int screen
, int channel
, int *dx
, int *dy
, int *dw
, int *dh
)
2487 Fake_glXChannelRectSyncSGIX(Display
*dpy
, int screen
, int channel
, GLenum synctype
)
2498 /*** GLX_SGIX_dmbuffer **/
2500 #if defined(_DM_BUFFER_H_)
2502 Fake_glXAssociateDMPbufferSGIX(Display
*dpy
, GLXPbufferSGIX pbuffer
, DMparams
*params
, DMbuffer dmbuffer
)
2513 /*** GLX_SGIX_swap_group ***/
2516 Fake_glXJoinSwapGroupSGIX(Display
*dpy
, GLXDrawable drawable
, GLXDrawable member
)
2525 /*** GLX_SGIX_swap_barrier ***/
2528 Fake_glXBindSwapBarrierSGIX(Display
*dpy
, GLXDrawable drawable
, int barrier
)
2536 Fake_glXQueryMaxSwapBarriersSGIX(Display
*dpy
, int screen
, int *max
)
2546 /*** GLX_SUN_get_transparent_index ***/
2549 Fake_glXGetTransparentIndexSUN(Display
*dpy
, Window overlay
, Window underlay
, long *pTransparent
)
2554 (void) pTransparent
;
2560 /*** GLX_MESA_release_buffers ***/
2563 * Release the depth, stencil, accum buffers attached to a GLXDrawable
2564 * (a window or pixmap) prior to destroying the GLXDrawable.
2567 Fake_glXReleaseBuffersMESA( Display
*dpy
, GLXDrawable d
)
2569 XMesaBuffer b
= XMesaFindBuffer(dpy
, d
);
2571 XMesaDestroyBuffer(b
);
2577 /*** GLX_EXT_texture_from_pixmap ***/
2580 Fake_glXBindTexImageEXT(Display
*dpy
, GLXDrawable drawable
, int buffer
,
2581 const int *attrib_list
)
2583 XMesaBuffer b
= XMesaFindBuffer(dpy
, drawable
);
2585 XMesaBindTexImage(dpy
, b
, buffer
, attrib_list
);
2589 Fake_glXReleaseTexImageEXT(Display
*dpy
, GLXDrawable drawable
, int buffer
)
2591 XMesaBuffer b
= XMesaFindBuffer(dpy
, drawable
);
2593 XMesaReleaseTexImage(dpy
, b
, buffer
);
2599 * Create a new GLX API dispatch table with its function pointers
2600 * initialized to point to Mesa's "fake" GLX API functions.
2602 * Note: there used to be a similar function
2603 * (_real_GetGLXDispatchTable) that returns a new dispatch table with
2604 * all pointers initalized to point to "real" GLX functions (which
2605 * understand GLX wire protocol, etc).
2607 struct _glxapi_table
*
2608 _mesa_GetGLXDispatchTable(void)
2610 static struct _glxapi_table glx
;
2612 /* be sure our dispatch table size <= libGL's table */
2614 GLuint size
= sizeof(struct _glxapi_table
) / sizeof(void *);
2616 assert(_glxapi_get_dispatch_table_size() >= size
);
2619 /* initialize the whole table to no-ops */
2620 _glxapi_set_no_op_table(&glx
);
2622 /* now initialize the table with the functions I implement */
2623 glx
.ChooseVisual
= Fake_glXChooseVisual
;
2624 glx
.CopyContext
= Fake_glXCopyContext
;
2625 glx
.CreateContext
= Fake_glXCreateContext
;
2626 glx
.CreateGLXPixmap
= Fake_glXCreateGLXPixmap
;
2627 glx
.DestroyContext
= Fake_glXDestroyContext
;
2628 glx
.DestroyGLXPixmap
= Fake_glXDestroyGLXPixmap
;
2629 glx
.GetConfig
= Fake_glXGetConfig
;
2630 /*glx.GetCurrentContext = Fake_glXGetCurrentContext;*/
2631 /*glx.GetCurrentDrawable = Fake_glXGetCurrentDrawable;*/
2632 glx
.IsDirect
= Fake_glXIsDirect
;
2633 glx
.MakeCurrent
= Fake_glXMakeCurrent
;
2634 glx
.QueryExtension
= Fake_glXQueryExtension
;
2635 glx
.QueryVersion
= Fake_glXQueryVersion
;
2636 glx
.SwapBuffers
= Fake_glXSwapBuffers
;
2637 glx
.UseXFont
= Fake_glXUseXFont
;
2638 glx
.WaitGL
= Fake_glXWaitGL
;
2639 glx
.WaitX
= Fake_glXWaitX
;
2641 /*** GLX_VERSION_1_1 ***/
2642 glx
.GetClientString
= Fake_glXGetClientString
;
2643 glx
.QueryExtensionsString
= Fake_glXQueryExtensionsString
;
2644 glx
.QueryServerString
= Fake_glXQueryServerString
;
2646 /*** GLX_VERSION_1_2 ***/
2647 /*glx.GetCurrentDisplay = Fake_glXGetCurrentDisplay;*/
2649 /*** GLX_VERSION_1_3 ***/
2650 glx
.ChooseFBConfig
= Fake_glXChooseFBConfig
;
2651 glx
.CreateNewContext
= Fake_glXCreateNewContext
;
2652 glx
.CreatePbuffer
= Fake_glXCreatePbuffer
;
2653 glx
.CreatePixmap
= Fake_glXCreatePixmap
;
2654 glx
.CreateWindow
= Fake_glXCreateWindow
;
2655 glx
.DestroyPbuffer
= Fake_glXDestroyPbuffer
;
2656 glx
.DestroyPixmap
= Fake_glXDestroyPixmap
;
2657 glx
.DestroyWindow
= Fake_glXDestroyWindow
;
2658 /*glx.GetCurrentReadDrawable = Fake_glXGetCurrentReadDrawable;*/
2659 glx
.GetFBConfigAttrib
= Fake_glXGetFBConfigAttrib
;
2660 glx
.GetFBConfigs
= Fake_glXGetFBConfigs
;
2661 glx
.GetSelectedEvent
= Fake_glXGetSelectedEvent
;
2662 glx
.GetVisualFromFBConfig
= Fake_glXGetVisualFromFBConfig
;
2663 glx
.MakeContextCurrent
= Fake_glXMakeContextCurrent
;
2664 glx
.QueryContext
= Fake_glXQueryContext
;
2665 glx
.QueryDrawable
= Fake_glXQueryDrawable
;
2666 glx
.SelectEvent
= Fake_glXSelectEvent
;
2668 /*** GLX_SGI_swap_control ***/
2669 glx
.SwapIntervalSGI
= Fake_glXSwapIntervalSGI
;
2671 /*** GLX_SGI_video_sync ***/
2672 glx
.GetVideoSyncSGI
= Fake_glXGetVideoSyncSGI
;
2673 glx
.WaitVideoSyncSGI
= Fake_glXWaitVideoSyncSGI
;
2675 /*** GLX_SGI_make_current_read ***/
2676 glx
.MakeCurrentReadSGI
= Fake_glXMakeCurrentReadSGI
;
2677 /*glx.GetCurrentReadDrawableSGI = Fake_glXGetCurrentReadDrawableSGI;*/
2679 /*** GLX_SGIX_video_source ***/
2681 glx
.CreateGLXVideoSourceSGIX
= Fake_glXCreateGLXVideoSourceSGIX
;
2682 glx
.DestroyGLXVideoSourceSGIX
= Fake_glXDestroyGLXVideoSourceSGIX
;
2685 /*** GLX_EXT_import_context ***/
2686 glx
.FreeContextEXT
= Fake_glXFreeContextEXT
;
2687 glx
.GetContextIDEXT
= Fake_glXGetContextIDEXT
;
2688 /*glx.GetCurrentDisplayEXT = Fake_glXGetCurrentDisplayEXT;*/
2689 glx
.ImportContextEXT
= Fake_glXImportContextEXT
;
2690 glx
.QueryContextInfoEXT
= Fake_glXQueryContextInfoEXT
;
2692 /*** GLX_SGIX_fbconfig ***/
2693 glx
.GetFBConfigAttribSGIX
= Fake_glXGetFBConfigAttribSGIX
;
2694 glx
.ChooseFBConfigSGIX
= Fake_glXChooseFBConfigSGIX
;
2695 glx
.CreateGLXPixmapWithConfigSGIX
= Fake_glXCreateGLXPixmapWithConfigSGIX
;
2696 glx
.CreateContextWithConfigSGIX
= Fake_glXCreateContextWithConfigSGIX
;
2697 glx
.GetVisualFromFBConfigSGIX
= Fake_glXGetVisualFromFBConfigSGIX
;
2698 glx
.GetFBConfigFromVisualSGIX
= Fake_glXGetFBConfigFromVisualSGIX
;
2700 /*** GLX_SGIX_pbuffer ***/
2701 glx
.CreateGLXPbufferSGIX
= Fake_glXCreateGLXPbufferSGIX
;
2702 glx
.DestroyGLXPbufferSGIX
= Fake_glXDestroyGLXPbufferSGIX
;
2703 glx
.QueryGLXPbufferSGIX
= Fake_glXQueryGLXPbufferSGIX
;
2704 glx
.SelectEventSGIX
= Fake_glXSelectEventSGIX
;
2705 glx
.GetSelectedEventSGIX
= Fake_glXGetSelectedEventSGIX
;
2707 /*** GLX_SGI_cushion ***/
2708 glx
.CushionSGI
= Fake_glXCushionSGI
;
2710 /*** GLX_SGIX_video_resize ***/
2711 glx
.BindChannelToWindowSGIX
= Fake_glXBindChannelToWindowSGIX
;
2712 glx
.ChannelRectSGIX
= Fake_glXChannelRectSGIX
;
2713 glx
.QueryChannelRectSGIX
= Fake_glXQueryChannelRectSGIX
;
2714 glx
.QueryChannelDeltasSGIX
= Fake_glXQueryChannelDeltasSGIX
;
2715 glx
.ChannelRectSyncSGIX
= Fake_glXChannelRectSyncSGIX
;
2717 /*** GLX_SGIX_dmbuffer **/
2718 #if defined(_DM_BUFFER_H_)
2719 glx
.AssociateDMPbufferSGIX
= NULL
;
2722 /*** GLX_SGIX_swap_group ***/
2723 glx
.JoinSwapGroupSGIX
= Fake_glXJoinSwapGroupSGIX
;
2725 /*** GLX_SGIX_swap_barrier ***/
2726 glx
.BindSwapBarrierSGIX
= Fake_glXBindSwapBarrierSGIX
;
2727 glx
.QueryMaxSwapBarriersSGIX
= Fake_glXQueryMaxSwapBarriersSGIX
;
2729 /*** GLX_SUN_get_transparent_index ***/
2730 glx
.GetTransparentIndexSUN
= Fake_glXGetTransparentIndexSUN
;
2732 /*** GLX_MESA_copy_sub_buffer ***/
2733 glx
.CopySubBufferMESA
= Fake_glXCopySubBufferMESA
;
2735 /*** GLX_MESA_release_buffers ***/
2736 glx
.ReleaseBuffersMESA
= Fake_glXReleaseBuffersMESA
;
2738 /*** GLX_MESA_pixmap_colormap ***/
2739 glx
.CreateGLXPixmapMESA
= Fake_glXCreateGLXPixmapMESA
;
2741 /*** GLX_EXT_texture_from_pixmap ***/
2742 glx
.BindTexImageEXT
= Fake_glXBindTexImageEXT
;
2743 glx
.ReleaseTexImageEXT
= Fake_glXReleaseTexImageEXT
;