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 /**********************************************************************/
101 /*** GLX Visual Code ***/
102 /**********************************************************************/
107 static XMesaVisual
*VisualTable
= NULL
;
108 static int NumVisuals
= 0;
112 /* Macro to handle c_class vs class field name in XVisualInfo struct */
113 #if defined(__cplusplus) || defined(c_plusplus)
114 #define CLASS c_class
122 * Test if the given XVisualInfo is usable for Mesa rendering.
125 is_usable_visual( XVisualInfo
*vinfo
)
127 switch (vinfo
->CLASS
) {
130 /* Any StaticGray/GrayScale visual works in RGB or CI mode */
134 /* Any StaticColor/PseudoColor visual of at least 4 bits */
135 if (vinfo
->depth
>=4) {
143 /* Any depth of TrueColor or DirectColor works in RGB mode */
146 /* This should never happen */
153 * Given an XVisualInfo and RGB, Double, and Depth buffer flags, save the
154 * configuration in our list of GLX visuals.
157 save_glx_visual( Display
*dpy
, XVisualInfo
*vinfo
,
158 GLboolean rgbFlag
, GLboolean alphaFlag
, GLboolean dbFlag
,
159 GLboolean stereoFlag
,
160 GLint depth_size
, GLint stencil_size
,
161 GLint accumRedSize
, GLint accumGreenSize
,
162 GLint accumBlueSize
, GLint accumAlphaSize
,
163 GLint level
, GLint numAuxBuffers
)
165 GLboolean ximageFlag
= GL_TRUE
;
168 GLboolean comparePointers
;
171 /* Check if the MESA_BACK_BUFFER env var is set */
172 char *backbuffer
= _mesa_getenv("MESA_BACK_BUFFER");
174 if (backbuffer
[0]=='p' || backbuffer
[0]=='P') {
175 ximageFlag
= GL_FALSE
;
177 else if (backbuffer
[0]=='x' || backbuffer
[0]=='X') {
178 ximageFlag
= GL_TRUE
;
181 _mesa_warning(NULL
, "Mesa: invalid value for MESA_BACK_BUFFER environment variable, using an XImage.");
187 /* stereo not supported */
191 if (stencil_size
> 0 && depth_size
> 0)
194 /* Comparing IDs uses less memory but sometimes fails. */
195 /* XXX revisit this after 3.0 is finished. */
196 if (_mesa_getenv("MESA_GLX_VISUAL_HACK"))
197 comparePointers
= GL_TRUE
;
199 comparePointers
= GL_FALSE
;
201 /* Force the visual to have an alpha channel */
202 if (rgbFlag
&& _mesa_getenv("MESA_GLX_FORCE_ALPHA"))
205 /* First check if a matching visual is already in the list */
206 for (i
=0; i
<NumVisuals
; i
++) {
207 XMesaVisual v
= VisualTable
[i
];
208 if (v
->display
== dpy
209 && v
->mesa_visual
.level
== level
210 && v
->mesa_visual
.numAuxBuffers
== numAuxBuffers
211 && v
->ximage_flag
== ximageFlag
212 && v
->mesa_visual
.rgbMode
== rgbFlag
213 && v
->mesa_visual
.doubleBufferMode
== dbFlag
214 && v
->mesa_visual
.stereoMode
== stereoFlag
215 && (v
->mesa_visual
.alphaBits
> 0) == alphaFlag
216 && (v
->mesa_visual
.depthBits
>= depth_size
|| depth_size
== 0)
217 && (v
->mesa_visual
.stencilBits
>= stencil_size
|| stencil_size
== 0)
218 && (v
->mesa_visual
.accumRedBits
>= accumRedSize
|| accumRedSize
== 0)
219 && (v
->mesa_visual
.accumGreenBits
>= accumGreenSize
|| accumGreenSize
== 0)
220 && (v
->mesa_visual
.accumBlueBits
>= accumBlueSize
|| accumBlueSize
== 0)
221 && (v
->mesa_visual
.accumAlphaBits
>= accumAlphaSize
|| accumAlphaSize
== 0)) {
222 /* now either compare XVisualInfo pointers or visual IDs */
223 if ((!comparePointers
&& v
->visinfo
->visualid
== vinfo
->visualid
)
224 || (comparePointers
&& v
->vishandle
== vinfo
)) {
230 /* Create a new visual and add it to the list. */
232 xmvis
= XMesaCreateVisual( dpy
, vinfo
, rgbFlag
, alphaFlag
, dbFlag
,
233 stereoFlag
, ximageFlag
,
234 depth_size
, stencil_size
,
235 accumRedSize
, accumBlueSize
,
236 accumBlueSize
, accumAlphaSize
, 0, level
,
239 /* Save a copy of the pointer now so we can find this visual again
240 * if we need to search for it in find_glx_visual().
242 xmvis
->vishandle
= vinfo
;
243 /* Allocate more space for additional visual */
244 VisualTable
= (XMesaVisual
*) _mesa_realloc( VisualTable
,
245 sizeof(XMesaVisual
) * NumVisuals
,
246 sizeof(XMesaVisual
) * (NumVisuals
+ 1));
247 /* add xmvis to the list */
248 VisualTable
[NumVisuals
] = xmvis
;
250 /* XXX minor hack, because XMesaCreateVisual doesn't support an
251 * aux buffers parameter.
253 xmvis
->mesa_visual
.numAuxBuffers
= numAuxBuffers
;
260 * Return the default number of bits for the Z buffer.
261 * If defined, use the MESA_GLX_DEPTH_BITS env var value.
262 * Otherwise, use the DEFAULT_SOFTWARE_DEPTH_BITS constant.
263 * XXX probably do the same thing for stencil, accum, etc.
266 default_depth_bits(void)
269 const char *zEnv
= _mesa_getenv("MESA_GLX_DEPTH_BITS");
271 zBits
= _mesa_atoi(zEnv
);
273 zBits
= DEFAULT_SOFTWARE_DEPTH_BITS
;
278 default_alpha_bits(void)
281 const char *aEnv
= _mesa_getenv("MESA_GLX_ALPHA_BITS");
283 aBits
= _mesa_atoi(aEnv
);
290 default_accum_bits(void)
298 * Create a GLX visual from a regular XVisualInfo.
299 * This is called when Fake GLX is given an XVisualInfo which wasn't
300 * returned by glXChooseVisual. Since this is the first time we're
301 * considering this visual we'll take a guess at reasonable values
302 * for depth buffer size, stencil size, accum size, etc.
303 * This is the best we can do with a client-side emulation of GLX.
306 create_glx_visual( Display
*dpy
, XVisualInfo
*visinfo
)
308 GLint zBits
= default_depth_bits();
309 GLint accBits
= default_accum_bits();
310 GLboolean alphaFlag
= default_alpha_bits() > 0;
312 if (is_usable_visual( visinfo
)) {
313 /* Configure this visual as RGB, double-buffered, depth-buffered. */
314 /* This is surely wrong for some people's needs but what else */
315 /* can be done? They should use glXChooseVisual(). */
316 return save_glx_visual( dpy
, visinfo
,
318 alphaFlag
, /* alpha */
319 GL_TRUE
, /* double */
320 GL_FALSE
, /* stereo */
332 _mesa_warning(NULL
, "Mesa: error in glXCreateContext: bad visual\n");
340 * Find the GLX visual associated with an XVisualInfo.
343 find_glx_visual( Display
*dpy
, XVisualInfo
*vinfo
)
347 /* try to match visual id */
348 for (i
=0;i
<NumVisuals
;i
++) {
349 if (VisualTable
[i
]->display
==dpy
350 && VisualTable
[i
]->visinfo
->visualid
== vinfo
->visualid
) {
351 return VisualTable
[i
];
355 /* if that fails, try to match pointers */
356 for (i
=0;i
<NumVisuals
;i
++) {
357 if (VisualTable
[i
]->display
==dpy
&& VisualTable
[i
]->vishandle
==vinfo
) {
358 return VisualTable
[i
];
371 * Try to get an X visual which matches the given arguments.
374 get_visual( Display
*dpy
, int scr
, unsigned int depth
, int xclass
)
376 XVisualInfo temp
, *vis
;
379 unsigned int default_depth
;
382 mask
= VisualScreenMask
| VisualDepthMask
| VisualClassMask
;
387 default_depth
= DefaultDepth(dpy
,scr
);
388 default_class
= DefaultVisual(dpy
,scr
)->CLASS
;
390 if (depth
==default_depth
&& xclass
==default_class
) {
391 /* try to get root window's visual */
392 temp
.visualid
= DefaultVisual(dpy
,scr
)->visualid
;
393 mask
|= VisualIDMask
;
396 vis
= XGetVisualInfo( dpy
, mask
, &temp
, &n
);
398 /* In case bits/pixel > 24, make sure color channels are still <=8 bits.
399 * An SGI Infinite Reality system, for example, can have 30bpp pixels:
400 * 10 bits per color channel. Mesa's limited to a max of 8 bits/channel.
402 if (vis
&& depth
> 24 && (xclass
==TrueColor
|| xclass
==DirectColor
)) {
403 if (_mesa_bitcount((GLuint
) vis
->red_mask
) <= 8 &&
404 _mesa_bitcount((GLuint
) vis
->green_mask
) <= 8 &&
405 _mesa_bitcount((GLuint
) vis
->blue_mask
) <= 8) {
420 * Retrieve the value of the given environment variable and find
421 * the X visual which matches it.
422 * Input: dpy - the display
423 * screen - the screen number
424 * varname - the name of the environment variable
425 * Return: an XVisualInfo pointer to NULL if error.
428 get_env_visual(Display
*dpy
, int scr
, const char *varname
)
430 char value
[100], type
[100];
431 int depth
, xclass
= -1;
434 if (!_mesa_getenv( varname
)) {
438 _mesa_strncpy( value
, _mesa_getenv(varname
), 100 );
441 sscanf( value
, "%s %d", type
, &depth
);
443 if (_mesa_strcmp(type
,"TrueColor")==0) xclass
= TrueColor
;
444 else if (_mesa_strcmp(type
,"DirectColor")==0) xclass
= DirectColor
;
445 else if (_mesa_strcmp(type
,"PseudoColor")==0) xclass
= PseudoColor
;
446 else if (_mesa_strcmp(type
,"StaticColor")==0) xclass
= StaticColor
;
447 else if (_mesa_strcmp(type
,"GrayScale")==0) xclass
= GrayScale
;
448 else if (_mesa_strcmp(type
,"StaticGray")==0) xclass
= StaticGray
;
450 if (xclass
>-1 && depth
>0) {
451 vis
= get_visual( dpy
, scr
, depth
, xclass
);
457 _mesa_warning(NULL
, "GLX unable to find visual class=%s, depth=%d.",
466 * Select an X visual which satisfies the RGBA flag and minimum depth.
468 * screen - X display and screen number
469 * min_depth - minimum visual depth
470 * preferred_class - preferred GLX visual class or DONT_CARE
471 * Return: pointer to an XVisualInfo or NULL.
474 choose_x_visual( Display
*dpy
, int screen
, int min_depth
,
475 int preferred_class
)
478 int xclass
, visclass
= 0;
481 /* First see if the MESA_RGB_VISUAL env var is defined */
482 vis
= get_env_visual( dpy
, screen
, "MESA_RGB_VISUAL" );
486 /* Otherwise, search for a suitable visual */
487 if (preferred_class
==DONT_CARE
) {
488 for (xclass
=0;xclass
<6;xclass
++) {
490 case 0: visclass
= TrueColor
; break;
491 case 1: visclass
= DirectColor
; break;
492 case 2: visclass
= PseudoColor
; break;
493 case 3: visclass
= StaticColor
; break;
494 case 4: visclass
= GrayScale
; break;
495 case 5: visclass
= StaticGray
; break;
498 /* start with shallowest */
499 for (depth
=0;depth
<=32;depth
++) {
500 if (visclass
==TrueColor
&& depth
==8) {
501 /* Special case: try to get 8-bit PseudoColor before */
502 /* 8-bit TrueColor */
503 vis
= get_visual( dpy
, screen
, 8, PseudoColor
);
508 vis
= get_visual( dpy
, screen
, depth
, visclass
);
515 /* start with deepest */
516 for (depth
=32;depth
>=min_depth
;depth
--) {
517 if (visclass
==TrueColor
&& depth
==8) {
518 /* Special case: try to get 8-bit PseudoColor before */
519 /* 8-bit TrueColor */
520 vis
= get_visual( dpy
, screen
, 8, PseudoColor
);
525 vis
= get_visual( dpy
, screen
, depth
, visclass
);
534 /* search for a specific visual class */
535 switch (preferred_class
) {
536 case GLX_TRUE_COLOR_EXT
: visclass
= TrueColor
; break;
537 case GLX_DIRECT_COLOR_EXT
: visclass
= DirectColor
; break;
538 case GLX_PSEUDO_COLOR_EXT
: visclass
= PseudoColor
; break;
539 case GLX_STATIC_COLOR_EXT
: visclass
= StaticColor
; break;
540 case GLX_GRAY_SCALE_EXT
: visclass
= GrayScale
; break;
541 case GLX_STATIC_GRAY_EXT
: visclass
= StaticGray
; break;
542 default: return NULL
;
545 /* start with shallowest */
546 for (depth
=0;depth
<=32;depth
++) {
547 vis
= get_visual( dpy
, screen
, depth
, visclass
);
554 /* start with deepest */
555 for (depth
=32;depth
>=min_depth
;depth
--) {
556 vis
= get_visual( dpy
, screen
, depth
, visclass
);
564 /* didn't find a visual */
571 /**********************************************************************/
572 /*** Display-related functions ***/
573 /**********************************************************************/
577 * Free all XMesaVisuals which are associated with the given display.
580 destroy_visuals_on_display(Display
*dpy
)
583 for (i
= 0; i
< NumVisuals
; i
++) {
584 if (VisualTable
[i
]->display
== dpy
) {
585 /* remove this visual */
587 free(VisualTable
[i
]);
588 for (j
= i
; j
< NumVisuals
- 1; j
++)
589 VisualTable
[j
] = VisualTable
[j
+ 1];
597 * Called from XCloseDisplay() to let us free our display-related data.
600 close_display_callback(Display
*dpy
, XExtCodes
*codes
)
602 destroy_visuals_on_display(dpy
);
603 xmesa_destroy_buffers_on_display(dpy
);
609 * Look for the named extension on given display and return a pointer
610 * to the _XExtension data, or NULL if extension not found.
613 lookup_extension(Display
*dpy
, const char *extName
)
616 for (ext
= dpy
->ext_procs
; ext
; ext
= ext
->next
) {
617 if (ext
->name
&& strcmp(ext
->name
, extName
) == 0) {
626 * Whenever we're given a new Display pointer, call this function to
627 * register our close_display_callback function.
630 register_with_display(Display
*dpy
)
632 const char *extName
= "MesaGLX";
635 ext
= lookup_extension(dpy
, extName
);
637 XExtCodes
*c
= XAddExtension(dpy
);
638 ext
= dpy
->ext_procs
; /* new extension is at head of list */
639 assert(c
->extension
== ext
->codes
.extension
);
640 ext
->name
= _mesa_strdup(extName
);
641 ext
->close_display
= close_display_callback
;
646 /**********************************************************************/
647 /*** Begin Fake GLX API Functions ***/
648 /**********************************************************************/
652 * Helper used by glXChooseVisual and glXChooseFBConfig.
653 * The fbConfig parameter must be GL_FALSE for the former and GL_TRUE for
655 * In either case, the attribute list is terminated with the value 'None'.
658 choose_visual( Display
*dpy
, int screen
, const int *list
, GLboolean fbConfig
)
660 const GLboolean rgbModeDefault
= fbConfig
;
661 const int *parselist
;
664 int min_red
=0, min_green
=0, min_blue
=0;
665 GLboolean rgb_flag
= rgbModeDefault
;
666 GLboolean alpha_flag
= GL_FALSE
;
667 GLboolean double_flag
= GL_FALSE
;
668 GLboolean stereo_flag
= GL_FALSE
;
669 GLint depth_size
= 0;
670 GLint stencil_size
= 0;
671 GLint accumRedSize
= 0;
672 GLint accumGreenSize
= 0;
673 GLint accumBlueSize
= 0;
674 GLint accumAlphaSize
= 0;
676 int visual_type
= DONT_CARE
;
677 int trans_type
= DONT_CARE
;
678 int trans_value
= DONT_CARE
;
679 GLint caveat
= DONT_CARE
;
680 XMesaVisual xmvis
= NULL
;
681 int desiredVisualID
= -1;
688 switch (*parselist
) {
699 case GLX_BUFFER_SIZE
:
701 min_ci
= *parselist
++;
705 level
= *parselist
++;
717 case GLX_DOUBLEBUFFER
:
720 double_flag
= *parselist
++;
723 double_flag
= GL_TRUE
;
729 stereo_flag
= *parselist
++;
732 stereo_flag
= GL_TRUE
;
735 case GLX_AUX_BUFFERS
:
737 numAux
= *parselist
++;
738 if (numAux
> MAX_AUX_BUFFERS
)
743 min_red
= *parselist
++;
747 min_green
= *parselist
++;
751 min_blue
= *parselist
++;
756 GLint size
= *parselist
++;
757 alpha_flag
= size
? GL_TRUE
: GL_FALSE
;
762 depth_size
= *parselist
++;
764 case GLX_STENCIL_SIZE
:
766 stencil_size
= *parselist
++;
768 case GLX_ACCUM_RED_SIZE
:
771 GLint size
= *parselist
++;
772 accumRedSize
= MAX2( accumRedSize
, size
);
775 case GLX_ACCUM_GREEN_SIZE
:
778 GLint size
= *parselist
++;
779 accumGreenSize
= MAX2( accumGreenSize
, size
);
782 case GLX_ACCUM_BLUE_SIZE
:
785 GLint size
= *parselist
++;
786 accumBlueSize
= MAX2( accumBlueSize
, size
);
789 case GLX_ACCUM_ALPHA_SIZE
:
792 GLint size
= *parselist
++;
793 accumAlphaSize
= MAX2( accumAlphaSize
, size
);
798 * GLX_EXT_visual_info extension
800 case GLX_X_VISUAL_TYPE_EXT
:
802 visual_type
= *parselist
++;
804 case GLX_TRANSPARENT_TYPE_EXT
:
806 trans_type
= *parselist
++;
808 case GLX_TRANSPARENT_INDEX_VALUE_EXT
:
810 trans_value
= *parselist
++;
812 case GLX_TRANSPARENT_RED_VALUE_EXT
:
813 case GLX_TRANSPARENT_GREEN_VALUE_EXT
:
814 case GLX_TRANSPARENT_BLUE_VALUE_EXT
:
815 case GLX_TRANSPARENT_ALPHA_VALUE_EXT
:
822 * GLX_EXT_visual_info extension
824 case GLX_VISUAL_CAVEAT_EXT
:
826 caveat
= *parselist
++; /* ignored for now */
830 * GLX_ARB_multisample
832 case GLX_SAMPLE_BUFFERS_ARB
:
833 /* ms not supported */
835 case GLX_SAMPLES_ARB
:
836 /* ms not supported */
842 case GLX_RENDER_TYPE
:
846 if (*parselist
== GLX_RGBA_BIT
) {
849 else if (*parselist
== GLX_COLOR_INDEX_BIT
) {
852 else if (*parselist
== 0) {
857 case GLX_DRAWABLE_TYPE
:
861 if (*parselist
& ~(GLX_WINDOW_BIT
| GLX_PIXMAP_BIT
| GLX_PBUFFER_BIT
)) {
862 return NULL
; /* bad bit */
866 case GLX_FBCONFIG_ID
:
870 desiredVisualID
= *parselist
++;
872 case GLX_X_RENDERABLE
:
879 #ifdef GLX_EXT_texture_from_pixmap
880 case GLX_BIND_TO_TEXTURE_RGB_EXT
:
881 parselist
++; /*skip*/
883 case GLX_BIND_TO_TEXTURE_RGBA_EXT
:
884 parselist
++; /*skip*/
886 case GLX_BIND_TO_MIPMAP_TEXTURE_EXT
:
887 parselist
++; /*skip*/
889 case GLX_BIND_TO_TEXTURE_TARGETS_EXT
:
891 if (*parselist
& ~(GLX_TEXTURE_1D_BIT_EXT
|
892 GLX_TEXTURE_2D_BIT_EXT
|
893 GLX_TEXTURE_RECTANGLE_BIT_EXT
)) {
898 case GLX_Y_INVERTED_EXT
:
899 parselist
++; /*skip*/
908 /* undefined attribute */
909 _mesa_warning(NULL
, "unexpected attrib 0x%x in choose_visual()",
919 * Since we're only simulating the GLX extension this function will never
920 * find any real GL visuals. Instead, all we can do is try to find an RGB
921 * or CI visual of appropriate depth. Other requested attributes such as
922 * double buffering, depth buffer, etc. will be associated with the X
923 * visual and stored in the VisualTable[].
925 if (desiredVisualID
!= -1) {
926 /* try to get a specific visual, by visualID */
929 temp
.visualid
= desiredVisualID
;
930 temp
.screen
= screen
;
931 vis
= XGetVisualInfo(dpy
, VisualIDMask
| VisualScreenMask
, &temp
, &n
);
933 /* give the visual some useful GLX attributes */
934 double_flag
= GL_TRUE
;
936 depth_size
= default_depth_bits();
937 stencil_size
= STENCIL_BITS
;
942 /* normal color planes */
943 /* Get an RGB visual */
944 int min_rgb
= min_red
+ min_green
+ min_blue
;
945 if (min_rgb
>1 && min_rgb
<8) {
946 /* a special case to be sure we can get a monochrome visual */
949 vis
= choose_x_visual( dpy
, screen
, min_rgb
, visual_type
);
952 _mesa_warning(NULL
, "overlay not supported");
957 /* Note: we're not exactly obeying the glXChooseVisual rules here.
958 * When GLX_DEPTH_SIZE = 1 is specified we're supposed to choose the
959 * largest depth buffer size, which is 32bits/value. Instead, we
960 * return 16 to maintain performance with earlier versions of Mesa.
962 if (stencil_size
> 0)
963 depth_size
= 24; /* if Z and stencil, always use 24+8 format */
964 else if (depth_size
> 24)
966 else if (depth_size
> 16)
968 else if (depth_size
> 0) {
969 depth_size
= default_depth_bits();
973 alpha_flag
= default_alpha_bits() > 0;
976 /* we only support one size of stencil and accum buffers. */
977 if (stencil_size
> 0)
978 stencil_size
= STENCIL_BITS
;
980 if (accumRedSize
> 0 ||
981 accumGreenSize
> 0 ||
983 accumAlphaSize
> 0) {
987 accumBlueSize
= default_accum_bits();
989 accumAlphaSize
= alpha_flag
? accumRedSize
: 0;
992 xmvis
= save_glx_visual( dpy
, vis
, rgb_flag
, alpha_flag
, double_flag
,
993 stereo_flag
, depth_size
, stencil_size
,
994 accumRedSize
, accumGreenSize
,
995 accumBlueSize
, accumAlphaSize
, level
, numAux
);
1002 static XVisualInfo
*
1003 Fake_glXChooseVisual( Display
*dpy
, int screen
, int *list
)
1007 /* register ourselves as an extension on this display */
1008 register_with_display(dpy
);
1010 xmvis
= choose_visual(dpy
, screen
, list
, GL_FALSE
);
1012 /* create a new vishandle - the cached one may be stale */
1013 xmvis
->vishandle
= (XVisualInfo
*) _mesa_malloc(sizeof(XVisualInfo
));
1014 if (xmvis
->vishandle
) {
1015 _mesa_memcpy(xmvis
->vishandle
, xmvis
->visinfo
, sizeof(XVisualInfo
));
1017 return xmvis
->vishandle
;
1025 Fake_glXCreateContext( Display
*dpy
, XVisualInfo
*visinfo
,
1026 GLXContext share_list
, Bool direct
)
1029 struct fake_glx_context
*glxCtx
;
1030 struct fake_glx_context
*shareCtx
= (struct fake_glx_context
*) share_list
;
1032 if (!dpy
|| !visinfo
)
1035 glxCtx
= CALLOC_STRUCT(fake_glx_context
);
1039 /* deallocate unused windows/buffers */
1041 XMesaGarbageCollect();
1044 xmvis
= find_glx_visual( dpy
, visinfo
);
1046 /* This visual wasn't found with glXChooseVisual() */
1047 xmvis
= create_glx_visual( dpy
, visinfo
);
1049 /* unusable visual */
1055 glxCtx
->xmesaContext
= XMesaCreateContext(xmvis
,
1056 shareCtx
? shareCtx
->xmesaContext
: NULL
);
1057 if (!glxCtx
->xmesaContext
) {
1062 glxCtx
->glxContext
.isDirect
= GL_FALSE
;
1063 glxCtx
->glxContext
.currentDpy
= dpy
;
1064 glxCtx
->glxContext
.xid
= (XID
) glxCtx
; /* self pointer */
1066 assert((void *) glxCtx
== (void *) &(glxCtx
->glxContext
));
1068 return (GLXContext
) glxCtx
;
1072 /* XXX these may have to be removed due to thread-safety issues. */
1073 static GLXContext MakeCurrent_PrevContext
= 0;
1074 static GLXDrawable MakeCurrent_PrevDrawable
= 0;
1075 static GLXDrawable MakeCurrent_PrevReadable
= 0;
1076 static XMesaBuffer MakeCurrent_PrevDrawBuffer
= 0;
1077 static XMesaBuffer MakeCurrent_PrevReadBuffer
= 0;
1080 /* GLX 1.3 and later */
1082 Fake_glXMakeContextCurrent( Display
*dpy
, GLXDrawable draw
,
1083 GLXDrawable read
, GLXContext ctx
)
1085 struct fake_glx_context
*glxCtx
= (struct fake_glx_context
*) ctx
;
1086 static boolean firsttime
= 1, no_rast
= 0;
1089 no_rast
= getenv("SP_NO_RAST") != NULL
;
1094 if (ctx
&& draw
&& read
) {
1095 XMesaBuffer drawBuffer
, readBuffer
;
1096 XMesaContext xmctx
= glxCtx
->xmesaContext
;
1098 /* Find the XMesaBuffer which corresponds to the GLXDrawable 'draw' */
1099 if (ctx
== MakeCurrent_PrevContext
1100 && draw
== MakeCurrent_PrevDrawable
) {
1101 drawBuffer
= MakeCurrent_PrevDrawBuffer
;
1104 drawBuffer
= XMesaFindBuffer( dpy
, draw
);
1107 /* drawable must be a new window! */
1108 drawBuffer
= XMesaCreateWindowBuffer( xmctx
->xm_visual
, draw
);
1110 /* Out of memory, or context/drawable depth mismatch */
1115 /* Find the XMesaBuffer which corresponds to the GLXDrawable 'read' */
1116 if (ctx
== MakeCurrent_PrevContext
1117 && read
== MakeCurrent_PrevReadable
) {
1118 readBuffer
= MakeCurrent_PrevReadBuffer
;
1121 readBuffer
= XMesaFindBuffer( dpy
, read
);
1124 /* drawable must be a new window! */
1125 readBuffer
= XMesaCreateWindowBuffer( xmctx
->xm_visual
, read
);
1127 /* Out of memory, or context/drawable depth mismatch */
1133 MakeCurrent_PrevContext
== ctx
&&
1134 MakeCurrent_PrevDrawable
== draw
&&
1135 MakeCurrent_PrevReadable
== read
&&
1136 MakeCurrent_PrevDrawBuffer
== drawBuffer
&&
1137 MakeCurrent_PrevReadBuffer
== readBuffer
)
1140 MakeCurrent_PrevContext
= ctx
;
1141 MakeCurrent_PrevDrawable
= draw
;
1142 MakeCurrent_PrevReadable
= read
;
1143 MakeCurrent_PrevDrawBuffer
= drawBuffer
;
1144 MakeCurrent_PrevReadBuffer
= readBuffer
;
1146 /* Now make current! */
1147 if (XMesaMakeCurrent2(xmctx
, drawBuffer
, readBuffer
)) {
1148 ((__GLXcontext
*) ctx
)->currentDpy
= dpy
;
1149 ((__GLXcontext
*) ctx
)->currentDrawable
= draw
;
1150 ((__GLXcontext
*) ctx
)->currentReadable
= read
;
1157 else if (!ctx
&& !draw
&& !read
) {
1158 /* release current context w/out assigning new one. */
1159 XMesaMakeCurrent2( NULL
, NULL
, NULL
);
1160 MakeCurrent_PrevContext
= 0;
1161 MakeCurrent_PrevDrawable
= 0;
1162 MakeCurrent_PrevReadable
= 0;
1163 MakeCurrent_PrevDrawBuffer
= 0;
1164 MakeCurrent_PrevReadBuffer
= 0;
1168 /* The args must either all be non-zero or all zero.
1177 Fake_glXMakeCurrent( Display
*dpy
, GLXDrawable drawable
, GLXContext ctx
)
1179 return Fake_glXMakeContextCurrent( dpy
, drawable
, drawable
, ctx
);
1184 Fake_glXCreateGLXPixmap( Display
*dpy
, XVisualInfo
*visinfo
, Pixmap pixmap
)
1189 v
= find_glx_visual( dpy
, visinfo
);
1191 v
= create_glx_visual( dpy
, visinfo
);
1193 /* unusable visual */
1198 b
= XMesaCreatePixmapBuffer( v
, pixmap
, 0 );
1206 /*** GLX_MESA_pixmap_colormap ***/
1209 Fake_glXCreateGLXPixmapMESA( Display
*dpy
, XVisualInfo
*visinfo
,
1210 Pixmap pixmap
, Colormap cmap
)
1215 v
= find_glx_visual( dpy
, visinfo
);
1217 v
= create_glx_visual( dpy
, visinfo
);
1219 /* unusable visual */
1224 b
= XMesaCreatePixmapBuffer( v
, pixmap
, cmap
);
1233 Fake_glXDestroyGLXPixmap( Display
*dpy
, GLXPixmap pixmap
)
1235 XMesaBuffer b
= XMesaFindBuffer(dpy
, pixmap
);
1237 XMesaDestroyBuffer(b
);
1239 else if (_mesa_getenv("MESA_DEBUG")) {
1240 _mesa_warning(NULL
, "Mesa: glXDestroyGLXPixmap: invalid pixmap\n");
1246 Fake_glXCopyContext( Display
*dpy
, GLXContext src
, GLXContext dst
,
1247 unsigned long mask
)
1249 struct fake_glx_context
*fakeSrc
= (struct fake_glx_context
*) src
;
1250 struct fake_glx_context
*fakeDst
= (struct fake_glx_context
*) dst
;
1251 XMesaContext xm_src
= fakeSrc
->xmesaContext
;
1252 XMesaContext xm_dst
= fakeDst
->xmesaContext
;
1254 if (MakeCurrent_PrevContext
== src
) {
1257 st_copy_context_state( xm_src
->st
, xm_dst
->st
, (GLuint
) mask
);
1262 Fake_glXQueryExtension( Display
*dpy
, int *errorb
, int *event
)
1264 /* Mesa's GLX isn't really an X extension but we try to act like one. */
1272 extern void _kw_ungrab_all( Display
*dpy
);
1273 void _kw_ungrab_all( Display
*dpy
)
1275 XUngrabPointer( dpy
, CurrentTime
);
1276 XUngrabKeyboard( dpy
, CurrentTime
);
1281 Fake_glXDestroyContext( Display
*dpy
, GLXContext ctx
)
1283 struct fake_glx_context
*glxCtx
= (struct fake_glx_context
*) ctx
;
1285 MakeCurrent_PrevContext
= 0;
1286 MakeCurrent_PrevDrawable
= 0;
1287 MakeCurrent_PrevReadable
= 0;
1288 MakeCurrent_PrevDrawBuffer
= 0;
1289 MakeCurrent_PrevReadBuffer
= 0;
1290 XMesaDestroyContext( glxCtx
->xmesaContext
);
1291 XMesaGarbageCollect();
1297 Fake_glXIsDirect( Display
*dpy
, GLXContext ctx
)
1307 Fake_glXSwapBuffers( Display
*dpy
, GLXDrawable drawable
)
1309 XMesaBuffer buffer
= XMesaFindBuffer( dpy
, drawable
);
1310 static boolean firsttime
= 1, no_rast
= 0;
1313 no_rast
= getenv("SP_NO_RAST") != NULL
;
1321 XMesaSwapBuffers(buffer
);
1323 else if (_mesa_getenv("MESA_DEBUG")) {
1324 _mesa_warning(NULL
, "glXSwapBuffers: invalid drawable 0x%x\n",
1331 /*** GLX_MESA_copy_sub_buffer ***/
1334 Fake_glXCopySubBufferMESA( Display
*dpy
, GLXDrawable drawable
,
1335 int x
, int y
, int width
, int height
)
1337 XMesaBuffer buffer
= XMesaFindBuffer( dpy
, drawable
);
1339 XMesaCopySubBuffer(buffer
, x
, y
, width
, height
);
1341 else if (_mesa_getenv("MESA_DEBUG")) {
1342 _mesa_warning(NULL
, "Mesa: glXCopySubBufferMESA: invalid drawable\n");
1348 Fake_glXQueryVersion( Display
*dpy
, int *maj
, int *min
)
1351 /* Return GLX version, not Mesa version */
1352 assert(CLIENT_MAJOR_VERSION
== SERVER_MAJOR_VERSION
);
1353 *maj
= CLIENT_MAJOR_VERSION
;
1354 *min
= MIN2( CLIENT_MINOR_VERSION
, SERVER_MINOR_VERSION
);
1360 * Query the GLX attributes of the given XVisualInfo.
1363 get_config( XMesaVisual xmvis
, int attrib
, int *value
, GLboolean fbconfig
)
1369 return GLX_BAD_ATTRIBUTE
;
1370 *value
= (int) True
;
1372 case GLX_BUFFER_SIZE
:
1373 *value
= xmvis
->visinfo
->depth
;
1376 *value
= xmvis
->mesa_visual
.level
;
1380 return GLX_BAD_ATTRIBUTE
;
1381 if (xmvis
->mesa_visual
.rgbMode
) {
1388 case GLX_DOUBLEBUFFER
:
1389 *value
= (int) xmvis
->mesa_visual
.doubleBufferMode
;
1392 *value
= (int) xmvis
->mesa_visual
.stereoMode
;
1394 case GLX_AUX_BUFFERS
:
1395 *value
= xmvis
->mesa_visual
.numAuxBuffers
;
1398 *value
= xmvis
->mesa_visual
.redBits
;
1400 case GLX_GREEN_SIZE
:
1401 *value
= xmvis
->mesa_visual
.greenBits
;
1404 *value
= xmvis
->mesa_visual
.blueBits
;
1406 case GLX_ALPHA_SIZE
:
1407 *value
= xmvis
->mesa_visual
.alphaBits
;
1409 case GLX_DEPTH_SIZE
:
1410 *value
= xmvis
->mesa_visual
.depthBits
;
1412 case GLX_STENCIL_SIZE
:
1413 *value
= xmvis
->mesa_visual
.stencilBits
;
1415 case GLX_ACCUM_RED_SIZE
:
1416 *value
= xmvis
->mesa_visual
.accumRedBits
;
1418 case GLX_ACCUM_GREEN_SIZE
:
1419 *value
= xmvis
->mesa_visual
.accumGreenBits
;
1421 case GLX_ACCUM_BLUE_SIZE
:
1422 *value
= xmvis
->mesa_visual
.accumBlueBits
;
1424 case GLX_ACCUM_ALPHA_SIZE
:
1425 *value
= xmvis
->mesa_visual
.accumAlphaBits
;
1429 * GLX_EXT_visual_info extension
1431 case GLX_X_VISUAL_TYPE_EXT
:
1432 switch (xmvis
->visinfo
->CLASS
) {
1433 case StaticGray
: *value
= GLX_STATIC_GRAY_EXT
; return 0;
1434 case GrayScale
: *value
= GLX_GRAY_SCALE_EXT
; return 0;
1435 case StaticColor
: *value
= GLX_STATIC_GRAY_EXT
; return 0;
1436 case PseudoColor
: *value
= GLX_PSEUDO_COLOR_EXT
; return 0;
1437 case TrueColor
: *value
= GLX_TRUE_COLOR_EXT
; return 0;
1438 case DirectColor
: *value
= GLX_DIRECT_COLOR_EXT
; return 0;
1441 case GLX_TRANSPARENT_TYPE_EXT
:
1443 *value
= GLX_NONE_EXT
;
1445 case GLX_TRANSPARENT_INDEX_VALUE_EXT
:
1448 case GLX_TRANSPARENT_RED_VALUE_EXT
:
1451 case GLX_TRANSPARENT_GREEN_VALUE_EXT
:
1454 case GLX_TRANSPARENT_BLUE_VALUE_EXT
:
1457 case GLX_TRANSPARENT_ALPHA_VALUE_EXT
:
1462 * GLX_EXT_visual_info extension
1464 case GLX_VISUAL_CAVEAT_EXT
:
1465 /* test for zero, just in case */
1466 if (xmvis
->mesa_visual
.visualRating
> 0)
1467 *value
= xmvis
->mesa_visual
.visualRating
;
1469 *value
= GLX_NONE_EXT
;
1473 * GLX_ARB_multisample
1475 case GLX_SAMPLE_BUFFERS_ARB
:
1478 case GLX_SAMPLES_ARB
:
1485 case GLX_SCREEN_EXT
:
1487 return GLX_BAD_ATTRIBUTE
;
1488 *value
= xmvis
->visinfo
->screen
;
1490 case GLX_DRAWABLE_TYPE
: /*SGIX too */
1492 return GLX_BAD_ATTRIBUTE
;
1493 *value
= GLX_WINDOW_BIT
| GLX_PIXMAP_BIT
| GLX_PBUFFER_BIT
;
1495 case GLX_RENDER_TYPE_SGIX
:
1497 return GLX_BAD_ATTRIBUTE
;
1498 if (xmvis
->mesa_visual
.rgbMode
)
1499 *value
= GLX_RGBA_BIT
;
1501 *value
= GLX_COLOR_INDEX_BIT
;
1503 case GLX_X_RENDERABLE_SGIX
:
1505 return GLX_BAD_ATTRIBUTE
;
1506 *value
= True
; /* XXX really? */
1508 case GLX_FBCONFIG_ID_SGIX
:
1510 return GLX_BAD_ATTRIBUTE
;
1511 *value
= xmvis
->visinfo
->visualid
;
1513 case GLX_MAX_PBUFFER_WIDTH
:
1515 return GLX_BAD_ATTRIBUTE
;
1516 /* XXX or MAX_WIDTH? */
1517 *value
= DisplayWidth(xmvis
->display
, xmvis
->visinfo
->screen
);
1519 case GLX_MAX_PBUFFER_HEIGHT
:
1521 return GLX_BAD_ATTRIBUTE
;
1522 *value
= DisplayHeight(xmvis
->display
, xmvis
->visinfo
->screen
);
1524 case GLX_MAX_PBUFFER_PIXELS
:
1526 return GLX_BAD_ATTRIBUTE
;
1527 *value
= DisplayWidth(xmvis
->display
, xmvis
->visinfo
->screen
) *
1528 DisplayHeight(xmvis
->display
, xmvis
->visinfo
->screen
);
1532 return GLX_BAD_ATTRIBUTE
;
1533 *value
= xmvis
->visinfo
->visualid
;
1536 #ifdef GLX_EXT_texture_from_pixmap
1537 case GLX_BIND_TO_TEXTURE_RGB_EXT
:
1538 *value
= True
; /*XXX*/
1540 case GLX_BIND_TO_TEXTURE_RGBA_EXT
:
1542 *value
= xmvis
->mesa_visual
.alphaBits
> 0 ? True
: False
;
1544 case GLX_BIND_TO_MIPMAP_TEXTURE_EXT
:
1545 *value
= True
; /*XXX*/
1547 case GLX_BIND_TO_TEXTURE_TARGETS_EXT
:
1548 *value
= (GLX_TEXTURE_1D_BIT_EXT
|
1549 GLX_TEXTURE_2D_BIT_EXT
|
1550 GLX_TEXTURE_RECTANGLE_BIT_EXT
); /*XXX*/
1552 case GLX_Y_INVERTED_EXT
:
1553 *value
= True
; /*XXX*/
1558 return GLX_BAD_ATTRIBUTE
;
1565 Fake_glXGetConfig( Display
*dpy
, XVisualInfo
*visinfo
,
1566 int attrib
, int *value
)
1570 if (!dpy
|| !visinfo
)
1571 return GLX_BAD_ATTRIBUTE
;
1573 xmvis
= find_glx_visual( dpy
, visinfo
);
1575 /* this visual wasn't obtained with glXChooseVisual */
1576 xmvis
= create_glx_visual( dpy
, visinfo
);
1578 /* this visual can't be used for GL rendering */
1579 if (attrib
==GLX_USE_GL
) {
1580 *value
= (int) False
;
1584 return GLX_BAD_VISUAL
;
1589 k
= get_config(xmvis
, attrib
, value
, GL_FALSE
);
1595 Fake_glXWaitGL( void )
1597 XMesaContext xmesa
= XMesaGetCurrentContext();
1598 XMesaFlush( xmesa
);
1604 Fake_glXWaitX( void )
1606 XMesaContext xmesa
= XMesaGetCurrentContext();
1607 XMesaFlush( xmesa
);
1612 get_extensions( void )
1619 /* GLX 1.1 and later */
1621 Fake_glXQueryExtensionsString( Display
*dpy
, int screen
)
1625 return get_extensions();
1630 /* GLX 1.1 and later */
1632 Fake_glXQueryServerString( Display
*dpy
, int screen
, int name
)
1634 static char version
[1000];
1635 _mesa_sprintf(version
, "%d.%d %s",
1636 SERVER_MAJOR_VERSION
, SERVER_MINOR_VERSION
, MESA_GLX_VERSION
);
1642 case GLX_EXTENSIONS
:
1643 return get_extensions();
1655 /* GLX 1.1 and later */
1657 Fake_glXGetClientString( Display
*dpy
, int name
)
1659 static char version
[1000];
1660 _mesa_sprintf(version
, "%d.%d %s", CLIENT_MAJOR_VERSION
,
1661 CLIENT_MINOR_VERSION
, MESA_GLX_VERSION
);
1666 case GLX_EXTENSIONS
:
1667 return get_extensions();
1685 Fake_glXGetFBConfigAttrib( Display
*dpy
, GLXFBConfig config
,
1686 int attribute
, int *value
)
1688 XMesaVisual v
= (XMesaVisual
) config
;
1692 if (!dpy
|| !config
|| !value
)
1695 return get_config(v
, attribute
, value
, GL_TRUE
);
1699 static GLXFBConfig
*
1700 Fake_glXGetFBConfigs( Display
*dpy
, int screen
, int *nelements
)
1702 XVisualInfo
*visuals
, visTemplate
;
1703 const long visMask
= VisualScreenMask
;
1706 /* Get list of all X visuals */
1707 visTemplate
.screen
= screen
;
1708 visuals
= XGetVisualInfo(dpy
, visMask
, &visTemplate
, nelements
);
1709 if (*nelements
> 0) {
1710 XMesaVisual
*results
;
1711 results
= (XMesaVisual
*) _mesa_malloc(*nelements
* sizeof(XMesaVisual
));
1716 for (i
= 0; i
< *nelements
; i
++) {
1717 results
[i
] = create_glx_visual(dpy
, visuals
+ i
);
1719 return (GLXFBConfig
*) results
;
1725 static GLXFBConfig
*
1726 Fake_glXChooseFBConfig( Display
*dpy
, int screen
,
1727 const int *attribList
, int *nitems
)
1731 if (!attribList
|| !attribList
[0]) {
1732 /* return list of all configs (per GLX_SGIX_fbconfig spec) */
1733 return Fake_glXGetFBConfigs(dpy
, screen
, nitems
);
1736 xmvis
= choose_visual(dpy
, screen
, attribList
, GL_TRUE
);
1738 GLXFBConfig
*config
= (GLXFBConfig
*) _mesa_malloc(sizeof(XMesaVisual
));
1744 config
[0] = (GLXFBConfig
) xmvis
;
1745 return (GLXFBConfig
*) config
;
1754 static XVisualInfo
*
1755 Fake_glXGetVisualFromFBConfig( Display
*dpy
, GLXFBConfig config
)
1757 if (dpy
&& config
) {
1758 XMesaVisual xmvis
= (XMesaVisual
) config
;
1760 return xmvis
->vishandle
;
1762 /* create a new vishandle - the cached one may be stale */
1763 xmvis
->vishandle
= (XVisualInfo
*) _mesa_malloc(sizeof(XVisualInfo
));
1764 if (xmvis
->vishandle
) {
1765 _mesa_memcpy(xmvis
->vishandle
, xmvis
->visinfo
, sizeof(XVisualInfo
));
1767 return xmvis
->vishandle
;
1777 Fake_glXCreateWindow( Display
*dpy
, GLXFBConfig config
, Window win
,
1778 const int *attribList
)
1780 XMesaVisual xmvis
= (XMesaVisual
) config
;
1785 xmbuf
= XMesaCreateWindowBuffer(xmvis
, win
);
1790 (void) attribList
; /* Ignored in GLX 1.3 */
1792 return win
; /* A hack for now */
1797 Fake_glXDestroyWindow( Display
*dpy
, GLXWindow window
)
1799 XMesaBuffer b
= XMesaFindBuffer(dpy
, (Drawable
) window
);
1801 XMesaDestroyBuffer(b
);
1802 /* don't destroy X window */
1808 Fake_glXCreatePixmap( Display
*dpy
, GLXFBConfig config
, Pixmap pixmap
,
1809 const int *attribList
)
1811 XMesaVisual v
= (XMesaVisual
) config
;
1814 int target
= 0, format
= 0, mipmap
= 0;
1817 if (!dpy
|| !config
|| !pixmap
)
1820 for (attr
= attribList
; *attr
; attr
++) {
1822 case GLX_TEXTURE_FORMAT_EXT
:
1825 case GLX_TEXTURE_FORMAT_NONE_EXT
:
1826 case GLX_TEXTURE_FORMAT_RGB_EXT
:
1827 case GLX_TEXTURE_FORMAT_RGBA_EXT
:
1835 case GLX_TEXTURE_TARGET_EXT
:
1838 case GLX_TEXTURE_1D_EXT
:
1839 case GLX_TEXTURE_2D_EXT
:
1840 case GLX_TEXTURE_RECTANGLE_EXT
:
1848 case GLX_MIPMAP_TEXTURE_EXT
:
1859 if (format
== GLX_TEXTURE_FORMAT_RGB_EXT
) {
1860 if (get_config(v
, GLX_BIND_TO_TEXTURE_RGB_EXT
,
1861 &value
, GL_TRUE
) != Success
1863 return 0; /* error! */
1866 else if (format
== GLX_TEXTURE_FORMAT_RGBA_EXT
) {
1867 if (get_config(v
, GLX_BIND_TO_TEXTURE_RGBA_EXT
,
1868 &value
, GL_TRUE
) != Success
1870 return 0; /* error! */
1874 if (get_config(v
, GLX_BIND_TO_MIPMAP_TEXTURE_EXT
,
1875 &value
, GL_TRUE
) != Success
1877 return 0; /* error! */
1880 if (target
== GLX_TEXTURE_1D_EXT
) {
1881 if (get_config(v
, GLX_BIND_TO_TEXTURE_TARGETS_EXT
,
1882 &value
, GL_TRUE
) != Success
1883 || (value
& GLX_TEXTURE_1D_BIT_EXT
) == 0) {
1884 return 0; /* error! */
1887 else if (target
== GLX_TEXTURE_2D_EXT
) {
1888 if (get_config(v
, GLX_BIND_TO_TEXTURE_TARGETS_EXT
,
1889 &value
, GL_TRUE
) != Success
1890 || (value
& GLX_TEXTURE_2D_BIT_EXT
) == 0) {
1891 return 0; /* error! */
1894 if (target
== GLX_TEXTURE_RECTANGLE_EXT
) {
1895 if (get_config(v
, GLX_BIND_TO_TEXTURE_TARGETS_EXT
,
1896 &value
, GL_TRUE
) != Success
1897 || (value
& GLX_TEXTURE_RECTANGLE_BIT_EXT
) == 0) {
1898 return 0; /* error! */
1902 if (format
|| target
|| mipmap
) {
1903 /* texture from pixmap */
1904 b
= XMesaCreatePixmapTextureBuffer(v
, pixmap
, 0, format
, target
, mipmap
);
1907 b
= XMesaCreatePixmapBuffer( v
, pixmap
, 0 );
1918 Fake_glXDestroyPixmap( Display
*dpy
, GLXPixmap pixmap
)
1920 XMesaBuffer b
= XMesaFindBuffer(dpy
, (Drawable
)pixmap
);
1922 XMesaDestroyBuffer(b
);
1923 /* don't destroy X pixmap */
1928 Fake_glXCreatePbuffer( Display
*dpy
, GLXFBConfig config
,
1929 const int *attribList
)
1931 XMesaVisual xmvis
= (XMesaVisual
) config
;
1934 int width
= 0, height
= 0;
1935 GLboolean useLargest
= GL_FALSE
, preserveContents
= GL_FALSE
;
1939 for (attrib
= attribList
; *attrib
; attrib
++) {
1941 case GLX_PBUFFER_WIDTH
:
1945 case GLX_PBUFFER_HEIGHT
:
1949 case GLX_PRESERVED_CONTENTS
:
1951 preserveContents
= *attrib
; /* ignored */
1953 case GLX_LARGEST_PBUFFER
:
1955 useLargest
= *attrib
; /* ignored */
1962 /* not used at this time */
1964 (void) preserveContents
;
1966 if (width
== 0 || height
== 0)
1969 xmbuf
= XMesaCreatePBuffer( xmvis
, 0, width
, height
);
1970 /* A GLXPbuffer handle must be an X Drawable because that's what
1971 * glXMakeCurrent takes.
1974 return (GLXPbuffer
) xmbuf
->drawable
;
1981 Fake_glXDestroyPbuffer( Display
*dpy
, GLXPbuffer pbuf
)
1983 XMesaBuffer b
= XMesaFindBuffer(dpy
, pbuf
);
1985 XMesaDestroyBuffer(b
);
1991 Fake_glXQueryDrawable( Display
*dpy
, GLXDrawable draw
, int attribute
,
1992 unsigned int *value
)
1994 XMesaBuffer xmbuf
= XMesaFindBuffer(dpy
, draw
);
1998 switch (attribute
) {
2000 *value
= xmesa_buffer_width(xmbuf
);
2003 *value
= xmesa_buffer_width(xmbuf
);
2005 case GLX_PRESERVED_CONTENTS
:
2008 case GLX_LARGEST_PBUFFER
:
2009 *value
= xmesa_buffer_width(xmbuf
) * xmesa_buffer_height(xmbuf
);
2011 case GLX_FBCONFIG_ID
:
2012 *value
= xmbuf
->xm_visual
->visinfo
->visualid
;
2014 #ifdef GLX_EXT_texture_from_pixmap
2015 case GLX_TEXTURE_FORMAT_EXT
:
2016 *value
= xmbuf
->TextureFormat
;
2018 case GLX_TEXTURE_TARGET_EXT
:
2019 *value
= xmbuf
->TextureTarget
;
2021 case GLX_MIPMAP_TEXTURE_EXT
:
2022 *value
= xmbuf
->TextureMipmap
;
2027 return; /* raise BadValue error */
2033 Fake_glXCreateNewContext( Display
*dpy
, GLXFBConfig config
,
2034 int renderType
, GLXContext shareList
, Bool direct
)
2036 struct fake_glx_context
*glxCtx
;
2037 struct fake_glx_context
*shareCtx
= (struct fake_glx_context
*) shareList
;
2038 XMesaVisual xmvis
= (XMesaVisual
) config
;
2040 if (!dpy
|| !config
||
2041 (renderType
!= GLX_RGBA_TYPE
&& renderType
!= GLX_COLOR_INDEX_TYPE
))
2044 glxCtx
= CALLOC_STRUCT(fake_glx_context
);
2048 /* deallocate unused windows/buffers */
2049 XMesaGarbageCollect();
2051 glxCtx
->xmesaContext
= XMesaCreateContext(xmvis
,
2052 shareCtx
? shareCtx
->xmesaContext
: NULL
);
2053 if (!glxCtx
->xmesaContext
) {
2058 glxCtx
->glxContext
.isDirect
= GL_FALSE
;
2059 glxCtx
->glxContext
.currentDpy
= dpy
;
2060 glxCtx
->glxContext
.xid
= (XID
) glxCtx
; /* self pointer */
2062 assert((void *) glxCtx
== (void *) &(glxCtx
->glxContext
));
2064 return (GLXContext
) glxCtx
;
2069 Fake_glXQueryContext( Display
*dpy
, GLXContext ctx
, int attribute
, int *value
)
2071 struct fake_glx_context
*glxCtx
= (struct fake_glx_context
*) ctx
;
2072 XMesaContext xmctx
= glxCtx
->xmesaContext
;
2077 switch (attribute
) {
2078 case GLX_FBCONFIG_ID
:
2079 *value
= xmctx
->xm_visual
->visinfo
->visualid
;
2081 case GLX_RENDER_TYPE
:
2082 if (xmctx
->xm_visual
->mesa_visual
.rgbMode
)
2083 *value
= GLX_RGBA_BIT
;
2085 *value
= GLX_COLOR_INDEX_BIT
;
2091 return GLX_BAD_ATTRIBUTE
;
2098 Fake_glXSelectEvent( Display
*dpy
, GLXDrawable drawable
, unsigned long mask
)
2100 XMesaBuffer xmbuf
= XMesaFindBuffer(dpy
, drawable
);
2102 xmbuf
->selectedEvents
= mask
;
2107 Fake_glXGetSelectedEvent( Display
*dpy
, GLXDrawable drawable
,
2108 unsigned long *mask
)
2110 XMesaBuffer xmbuf
= XMesaFindBuffer(dpy
, drawable
);
2112 *mask
= xmbuf
->selectedEvents
;
2119 /*** GLX_SGI_swap_control ***/
2122 Fake_glXSwapIntervalSGI(int interval
)
2130 /*** GLX_SGI_video_sync ***/
2132 static unsigned int FrameCounter
= 0;
2135 Fake_glXGetVideoSyncSGI(unsigned int *count
)
2137 /* this is a bogus implementation */
2138 *count
= FrameCounter
++;
2143 Fake_glXWaitVideoSyncSGI(int divisor
, int remainder
, unsigned int *count
)
2145 if (divisor
<= 0 || remainder
< 0)
2146 return GLX_BAD_VALUE
;
2147 /* this is a bogus implementation */
2149 while (FrameCounter
% divisor
!= remainder
)
2151 *count
= FrameCounter
;
2157 /*** GLX_SGI_make_current_read ***/
2160 Fake_glXMakeCurrentReadSGI(Display
*dpy
, GLXDrawable draw
, GLXDrawable read
, GLXContext ctx
)
2162 return Fake_glXMakeContextCurrent( dpy
, draw
, read
, ctx
);
2167 Fake_glXGetCurrentReadDrawableSGI(void)
2174 /*** GLX_SGIX_video_source ***/
2177 static GLXVideoSourceSGIX
2178 Fake_glXCreateGLXVideoSourceSGIX(Display
*dpy
, int screen
, VLServer server
, VLPath path
, int nodeClass
, VLNode drainNode
)
2190 Fake_glXDestroyGLXVideoSourceSGIX(Display
*dpy
, GLXVideoSourceSGIX src
)
2199 /*** GLX_EXT_import_context ***/
2202 Fake_glXFreeContextEXT(Display
*dpy
, GLXContext context
)
2209 Fake_glXGetContextIDEXT(const GLXContext context
)
2216 Fake_glXImportContextEXT(Display
*dpy
, GLXContextID contextID
)
2224 Fake_glXQueryContextInfoEXT(Display
*dpy
, GLXContext context
, int attribute
, int *value
)
2235 /*** GLX_SGIX_fbconfig ***/
2238 Fake_glXGetFBConfigAttribSGIX(Display
*dpy
, GLXFBConfigSGIX config
, int attribute
, int *value
)
2240 return Fake_glXGetFBConfigAttrib(dpy
, config
, attribute
, value
);
2243 static GLXFBConfigSGIX
*
2244 Fake_glXChooseFBConfigSGIX(Display
*dpy
, int screen
, int *attrib_list
, int *nelements
)
2246 return (GLXFBConfig
*) Fake_glXChooseFBConfig(dpy
, screen
, attrib_list
, nelements
);
2251 Fake_glXCreateGLXPixmapWithConfigSGIX(Display
*dpy
, GLXFBConfigSGIX config
, Pixmap pixmap
)
2253 XMesaVisual xmvis
= (XMesaVisual
) config
;
2254 XMesaBuffer xmbuf
= XMesaCreatePixmapBuffer(xmvis
, pixmap
, 0);
2255 return xmbuf
->drawable
; /* need to return an X ID */
2260 Fake_glXCreateContextWithConfigSGIX(Display
*dpy
, GLXFBConfigSGIX config
, int render_type
, GLXContext share_list
, Bool direct
)
2262 XMesaVisual xmvis
= (XMesaVisual
) config
;
2263 struct fake_glx_context
*glxCtx
;
2264 struct fake_glx_context
*shareCtx
= (struct fake_glx_context
*) share_list
;
2266 glxCtx
= CALLOC_STRUCT(fake_glx_context
);
2270 /* deallocate unused windows/buffers */
2271 XMesaGarbageCollect();
2273 glxCtx
->xmesaContext
= XMesaCreateContext(xmvis
,
2274 shareCtx
? shareCtx
->xmesaContext
: NULL
);
2275 if (!glxCtx
->xmesaContext
) {
2280 glxCtx
->glxContext
.isDirect
= GL_FALSE
;
2281 glxCtx
->glxContext
.currentDpy
= dpy
;
2282 glxCtx
->glxContext
.xid
= (XID
) glxCtx
; /* self pointer */
2284 assert((void *) glxCtx
== (void *) &(glxCtx
->glxContext
));
2286 return (GLXContext
) glxCtx
;
2290 static XVisualInfo
*
2291 Fake_glXGetVisualFromFBConfigSGIX(Display
*dpy
, GLXFBConfigSGIX config
)
2293 return Fake_glXGetVisualFromFBConfig(dpy
, config
);
2297 static GLXFBConfigSGIX
2298 Fake_glXGetFBConfigFromVisualSGIX(Display
*dpy
, XVisualInfo
*vis
)
2300 XMesaVisual xmvis
= find_glx_visual(dpy
, vis
);
2302 /* This visual wasn't found with glXChooseVisual() */
2303 xmvis
= create_glx_visual(dpy
, vis
);
2306 return (GLXFBConfigSGIX
) xmvis
;
2311 /*** GLX_SGIX_pbuffer ***/
2313 static GLXPbufferSGIX
2314 Fake_glXCreateGLXPbufferSGIX(Display
*dpy
, GLXFBConfigSGIX config
,
2315 unsigned int width
, unsigned int height
,
2318 XMesaVisual xmvis
= (XMesaVisual
) config
;
2321 GLboolean useLargest
= GL_FALSE
, preserveContents
= GL_FALSE
;
2325 for (attrib
= attribList
; attrib
&& *attrib
; attrib
++) {
2327 case GLX_PRESERVED_CONTENTS_SGIX
:
2329 preserveContents
= *attrib
; /* ignored */
2331 case GLX_LARGEST_PBUFFER_SGIX
:
2333 useLargest
= *attrib
; /* ignored */
2340 /* not used at this time */
2342 (void) preserveContents
;
2344 xmbuf
= XMesaCreatePBuffer( xmvis
, 0, width
, height
);
2345 /* A GLXPbuffer handle must be an X Drawable because that's what
2346 * glXMakeCurrent takes.
2348 return (GLXPbuffer
) xmbuf
->drawable
;
2353 Fake_glXDestroyGLXPbufferSGIX(Display
*dpy
, GLXPbufferSGIX pbuf
)
2355 XMesaBuffer xmbuf
= XMesaFindBuffer(dpy
, pbuf
);
2357 XMesaDestroyBuffer(xmbuf
);
2363 Fake_glXQueryGLXPbufferSGIX(Display
*dpy
, GLXPbufferSGIX pbuf
, int attribute
, unsigned int *value
)
2365 const XMesaBuffer xmbuf
= XMesaFindBuffer(dpy
, pbuf
);
2368 /* Generate GLXBadPbufferSGIX for bad pbuffer */
2372 switch (attribute
) {
2373 case GLX_PRESERVED_CONTENTS_SGIX
:
2376 case GLX_LARGEST_PBUFFER_SGIX
:
2377 *value
= xmesa_buffer_width(xmbuf
) * xmesa_buffer_height(xmbuf
);
2379 case GLX_WIDTH_SGIX
:
2380 *value
= xmesa_buffer_width(xmbuf
);
2382 case GLX_HEIGHT_SGIX
:
2383 *value
= xmesa_buffer_height(xmbuf
);
2385 case GLX_EVENT_MASK_SGIX
:
2386 *value
= 0; /* XXX might be wrong */
2396 Fake_glXSelectEventSGIX(Display
*dpy
, GLXDrawable drawable
, unsigned long mask
)
2398 XMesaBuffer xmbuf
= XMesaFindBuffer(dpy
, drawable
);
2400 /* Note: we'll never generate clobber events */
2401 xmbuf
->selectedEvents
= mask
;
2407 Fake_glXGetSelectedEventSGIX(Display
*dpy
, GLXDrawable drawable
, unsigned long *mask
)
2409 XMesaBuffer xmbuf
= XMesaFindBuffer(dpy
, drawable
);
2411 *mask
= xmbuf
->selectedEvents
;
2420 /*** GLX_SGI_cushion ***/
2423 Fake_glXCushionSGI(Display
*dpy
, Window win
, float cushion
)
2432 /*** GLX_SGIX_video_resize ***/
2435 Fake_glXBindChannelToWindowSGIX(Display
*dpy
, int screen
, int channel
, Window window
)
2445 Fake_glXChannelRectSGIX(Display
*dpy
, int screen
, int channel
, int x
, int y
, int w
, int h
)
2458 Fake_glXQueryChannelRectSGIX(Display
*dpy
, int screen
, int channel
, int *x
, int *y
, int *w
, int *h
)
2471 Fake_glXQueryChannelDeltasSGIX(Display
*dpy
, int screen
, int channel
, int *dx
, int *dy
, int *dw
, int *dh
)
2484 Fake_glXChannelRectSyncSGIX(Display
*dpy
, int screen
, int channel
, GLenum synctype
)
2495 /*** GLX_SGIX_dmbuffer **/
2497 #if defined(_DM_BUFFER_H_)
2499 Fake_glXAssociateDMPbufferSGIX(Display
*dpy
, GLXPbufferSGIX pbuffer
, DMparams
*params
, DMbuffer dmbuffer
)
2510 /*** GLX_SGIX_swap_group ***/
2513 Fake_glXJoinSwapGroupSGIX(Display
*dpy
, GLXDrawable drawable
, GLXDrawable member
)
2522 /*** GLX_SGIX_swap_barrier ***/
2525 Fake_glXBindSwapBarrierSGIX(Display
*dpy
, GLXDrawable drawable
, int barrier
)
2533 Fake_glXQueryMaxSwapBarriersSGIX(Display
*dpy
, int screen
, int *max
)
2543 /*** GLX_SUN_get_transparent_index ***/
2546 Fake_glXGetTransparentIndexSUN(Display
*dpy
, Window overlay
, Window underlay
, long *pTransparent
)
2551 (void) pTransparent
;
2557 /*** GLX_MESA_release_buffers ***/
2560 * Release the depth, stencil, accum buffers attached to a GLXDrawable
2561 * (a window or pixmap) prior to destroying the GLXDrawable.
2564 Fake_glXReleaseBuffersMESA( Display
*dpy
, GLXDrawable d
)
2566 XMesaBuffer b
= XMesaFindBuffer(dpy
, d
);
2568 XMesaDestroyBuffer(b
);
2574 /*** GLX_EXT_texture_from_pixmap ***/
2577 Fake_glXBindTexImageEXT(Display
*dpy
, GLXDrawable drawable
, int buffer
,
2578 const int *attrib_list
)
2580 XMesaBuffer b
= XMesaFindBuffer(dpy
, drawable
);
2582 XMesaBindTexImage(dpy
, b
, buffer
, attrib_list
);
2586 Fake_glXReleaseTexImageEXT(Display
*dpy
, GLXDrawable drawable
, int buffer
)
2588 XMesaBuffer b
= XMesaFindBuffer(dpy
, drawable
);
2590 XMesaReleaseTexImage(dpy
, b
, buffer
);
2596 * Create a new GLX API dispatch table with its function pointers
2597 * initialized to point to Mesa's "fake" GLX API functions.
2599 * Note: there used to be a similar function
2600 * (_real_GetGLXDispatchTable) that returns a new dispatch table with
2601 * all pointers initalized to point to "real" GLX functions (which
2602 * understand GLX wire protocol, etc).
2604 struct _glxapi_table
*
2605 _mesa_GetGLXDispatchTable(void)
2607 static struct _glxapi_table glx
;
2609 /* be sure our dispatch table size <= libGL's table */
2611 GLuint size
= sizeof(struct _glxapi_table
) / sizeof(void *);
2613 assert(_glxapi_get_dispatch_table_size() >= size
);
2616 /* initialize the whole table to no-ops */
2617 _glxapi_set_no_op_table(&glx
);
2619 /* now initialize the table with the functions I implement */
2620 glx
.ChooseVisual
= Fake_glXChooseVisual
;
2621 glx
.CopyContext
= Fake_glXCopyContext
;
2622 glx
.CreateContext
= Fake_glXCreateContext
;
2623 glx
.CreateGLXPixmap
= Fake_glXCreateGLXPixmap
;
2624 glx
.DestroyContext
= Fake_glXDestroyContext
;
2625 glx
.DestroyGLXPixmap
= Fake_glXDestroyGLXPixmap
;
2626 glx
.GetConfig
= Fake_glXGetConfig
;
2627 /*glx.GetCurrentContext = Fake_glXGetCurrentContext;*/
2628 /*glx.GetCurrentDrawable = Fake_glXGetCurrentDrawable;*/
2629 glx
.IsDirect
= Fake_glXIsDirect
;
2630 glx
.MakeCurrent
= Fake_glXMakeCurrent
;
2631 glx
.QueryExtension
= Fake_glXQueryExtension
;
2632 glx
.QueryVersion
= Fake_glXQueryVersion
;
2633 glx
.SwapBuffers
= Fake_glXSwapBuffers
;
2634 glx
.UseXFont
= Fake_glXUseXFont
;
2635 glx
.WaitGL
= Fake_glXWaitGL
;
2636 glx
.WaitX
= Fake_glXWaitX
;
2638 /*** GLX_VERSION_1_1 ***/
2639 glx
.GetClientString
= Fake_glXGetClientString
;
2640 glx
.QueryExtensionsString
= Fake_glXQueryExtensionsString
;
2641 glx
.QueryServerString
= Fake_glXQueryServerString
;
2643 /*** GLX_VERSION_1_2 ***/
2644 /*glx.GetCurrentDisplay = Fake_glXGetCurrentDisplay;*/
2646 /*** GLX_VERSION_1_3 ***/
2647 glx
.ChooseFBConfig
= Fake_glXChooseFBConfig
;
2648 glx
.CreateNewContext
= Fake_glXCreateNewContext
;
2649 glx
.CreatePbuffer
= Fake_glXCreatePbuffer
;
2650 glx
.CreatePixmap
= Fake_glXCreatePixmap
;
2651 glx
.CreateWindow
= Fake_glXCreateWindow
;
2652 glx
.DestroyPbuffer
= Fake_glXDestroyPbuffer
;
2653 glx
.DestroyPixmap
= Fake_glXDestroyPixmap
;
2654 glx
.DestroyWindow
= Fake_glXDestroyWindow
;
2655 /*glx.GetCurrentReadDrawable = Fake_glXGetCurrentReadDrawable;*/
2656 glx
.GetFBConfigAttrib
= Fake_glXGetFBConfigAttrib
;
2657 glx
.GetFBConfigs
= Fake_glXGetFBConfigs
;
2658 glx
.GetSelectedEvent
= Fake_glXGetSelectedEvent
;
2659 glx
.GetVisualFromFBConfig
= Fake_glXGetVisualFromFBConfig
;
2660 glx
.MakeContextCurrent
= Fake_glXMakeContextCurrent
;
2661 glx
.QueryContext
= Fake_glXQueryContext
;
2662 glx
.QueryDrawable
= Fake_glXQueryDrawable
;
2663 glx
.SelectEvent
= Fake_glXSelectEvent
;
2665 /*** GLX_SGI_swap_control ***/
2666 glx
.SwapIntervalSGI
= Fake_glXSwapIntervalSGI
;
2668 /*** GLX_SGI_video_sync ***/
2669 glx
.GetVideoSyncSGI
= Fake_glXGetVideoSyncSGI
;
2670 glx
.WaitVideoSyncSGI
= Fake_glXWaitVideoSyncSGI
;
2672 /*** GLX_SGI_make_current_read ***/
2673 glx
.MakeCurrentReadSGI
= Fake_glXMakeCurrentReadSGI
;
2674 /*glx.GetCurrentReadDrawableSGI = Fake_glXGetCurrentReadDrawableSGI;*/
2676 /*** GLX_SGIX_video_source ***/
2678 glx
.CreateGLXVideoSourceSGIX
= Fake_glXCreateGLXVideoSourceSGIX
;
2679 glx
.DestroyGLXVideoSourceSGIX
= Fake_glXDestroyGLXVideoSourceSGIX
;
2682 /*** GLX_EXT_import_context ***/
2683 glx
.FreeContextEXT
= Fake_glXFreeContextEXT
;
2684 glx
.GetContextIDEXT
= Fake_glXGetContextIDEXT
;
2685 /*glx.GetCurrentDisplayEXT = Fake_glXGetCurrentDisplayEXT;*/
2686 glx
.ImportContextEXT
= Fake_glXImportContextEXT
;
2687 glx
.QueryContextInfoEXT
= Fake_glXQueryContextInfoEXT
;
2689 /*** GLX_SGIX_fbconfig ***/
2690 glx
.GetFBConfigAttribSGIX
= Fake_glXGetFBConfigAttribSGIX
;
2691 glx
.ChooseFBConfigSGIX
= Fake_glXChooseFBConfigSGIX
;
2692 glx
.CreateGLXPixmapWithConfigSGIX
= Fake_glXCreateGLXPixmapWithConfigSGIX
;
2693 glx
.CreateContextWithConfigSGIX
= Fake_glXCreateContextWithConfigSGIX
;
2694 glx
.GetVisualFromFBConfigSGIX
= Fake_glXGetVisualFromFBConfigSGIX
;
2695 glx
.GetFBConfigFromVisualSGIX
= Fake_glXGetFBConfigFromVisualSGIX
;
2697 /*** GLX_SGIX_pbuffer ***/
2698 glx
.CreateGLXPbufferSGIX
= Fake_glXCreateGLXPbufferSGIX
;
2699 glx
.DestroyGLXPbufferSGIX
= Fake_glXDestroyGLXPbufferSGIX
;
2700 glx
.QueryGLXPbufferSGIX
= Fake_glXQueryGLXPbufferSGIX
;
2701 glx
.SelectEventSGIX
= Fake_glXSelectEventSGIX
;
2702 glx
.GetSelectedEventSGIX
= Fake_glXGetSelectedEventSGIX
;
2704 /*** GLX_SGI_cushion ***/
2705 glx
.CushionSGI
= Fake_glXCushionSGI
;
2707 /*** GLX_SGIX_video_resize ***/
2708 glx
.BindChannelToWindowSGIX
= Fake_glXBindChannelToWindowSGIX
;
2709 glx
.ChannelRectSGIX
= Fake_glXChannelRectSGIX
;
2710 glx
.QueryChannelRectSGIX
= Fake_glXQueryChannelRectSGIX
;
2711 glx
.QueryChannelDeltasSGIX
= Fake_glXQueryChannelDeltasSGIX
;
2712 glx
.ChannelRectSyncSGIX
= Fake_glXChannelRectSyncSGIX
;
2714 /*** GLX_SGIX_dmbuffer **/
2715 #if defined(_DM_BUFFER_H_)
2716 glx
.AssociateDMPbufferSGIX
= NULL
;
2719 /*** GLX_SGIX_swap_group ***/
2720 glx
.JoinSwapGroupSGIX
= Fake_glXJoinSwapGroupSGIX
;
2722 /*** GLX_SGIX_swap_barrier ***/
2723 glx
.BindSwapBarrierSGIX
= Fake_glXBindSwapBarrierSGIX
;
2724 glx
.QueryMaxSwapBarriersSGIX
= Fake_glXQueryMaxSwapBarriersSGIX
;
2726 /*** GLX_SUN_get_transparent_index ***/
2727 glx
.GetTransparentIndexSUN
= Fake_glXGetTransparentIndexSUN
;
2729 /*** GLX_MESA_copy_sub_buffer ***/
2730 glx
.CopySubBufferMESA
= Fake_glXCopySubBufferMESA
;
2732 /*** GLX_MESA_release_buffers ***/
2733 glx
.ReleaseBuffersMESA
= Fake_glXReleaseBuffersMESA
;
2735 /*** GLX_MESA_pixmap_colormap ***/
2736 glx
.CreateGLXPixmapMESA
= Fake_glXCreateGLXPixmapMESA
;
2738 /*** GLX_EXT_texture_from_pixmap ***/
2739 glx
.BindTexImageEXT
= Fake_glXBindTexImageEXT
;
2740 glx
.ReleaseTexImageEXT
= Fake_glXReleaseTexImageEXT
;