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.
43
#include "glxheader.h"
56
#define _mesa_sprintf sprintf
59
/* This indicates the client-side GLX API and GLX encoder version. */
60
#define CLIENT_MAJOR_VERSION 1
61
#define CLIENT_MINOR_VERSION 4 /* but don't have 1.3's pbuffers, etc yet */
63
/* This indicates the server-side GLX decoder version.
64
* GLX 1.4 indicates OpenGL 1.3 support
66
#define SERVER_MAJOR_VERSION 1
67
#define SERVER_MINOR_VERSION 4
69
/* This is appended onto the glXGetClient/ServerString version strings. */
70
#define MESA_GLX_VERSION "Mesa " MESA_VERSION_STRING
72
/* Who implemented this GLX? */
73
#define VENDOR "Brian Paul"
76
"GLX_MESA_set_3dfx_mode " \
77
"GLX_MESA_copy_sub_buffer " \
78
"GLX_MESA_pixmap_colormap " \
79
"GLX_MESA_release_buffers " \
80
"GLX_ARB_get_proc_address " \
81
"GLX_EXT_visual_info " \
82
"GLX_EXT_visual_rating " \
83
/*"GLX_SGI_video_sync "*/ \
84
"GLX_SGIX_fbconfig " \
88
* Our fake GLX context will contain a "real" GLX context and an XMesa context.
90
* Note that a pointer to a __GLXcontext is a pointer to a fake_glx_context,
93
* We really just need this structure in order to make the libGL functions
94
* glXGetCurrentContext(), glXGetCurrentDrawable() and glXGetCurrentDisplay()
97
struct fake_glx_context {
98
__GLXcontext glxContext; /* this MUST be first! */
99
XMesaContext xmesaContext;
104
/**********************************************************************/
105
/*** GLX Visual Code ***/
106
/**********************************************************************/
111
static XMesaVisual *VisualTable = NULL;
112
static int NumVisuals = 0;
116
* This struct and some code fragments borrowed
117
* from Mark Kilgard's GLUT library.
119
typedef struct _OverlayInfo {
120
/* Avoid 64-bit portability problems by being careful to use
121
longs due to the way XGetWindowProperty is specified. Note
122
that these parameters are passed as CARD32s over X
124
unsigned long overlay_visual;
125
long transparent_type;
132
/* Macro to handle c_class vs class field name in XVisualInfo struct */
133
#if defined(__cplusplus) || defined(c_plusplus)
134
#define CLASS c_class
142
* Test if the given XVisualInfo is usable for Mesa rendering.
145
is_usable_visual( XVisualInfo *vinfo )
147
switch (vinfo->CLASS) {
150
/* Any StaticGray/GrayScale visual works in RGB or CI mode */
154
/* Any StaticColor/PseudoColor visual of at least 4 bits */
155
if (vinfo->depth>=4) {
163
/* Any depth of TrueColor or DirectColor works in RGB mode */
166
/* This should never happen */
174
* Get an array OverlayInfo records for specified screen.
175
* \param dpy the display
176
* \param screen screen number
177
* \param numOverlays returns numver of OverlayInfo records
178
* \return pointer to OverlayInfo array, free with XFree()
181
GetOverlayInfo(Display *dpy, int screen, int *numOverlays)
183
Atom overlayVisualsAtom;
186
unsigned char *ovInfo;
187
unsigned long sizeData, bytesLeft;
191
* The SERVER_OVERLAY_VISUALS property on the root window contains
192
* a list of overlay visuals. Get that list now.
194
overlayVisualsAtom = XInternAtom(dpy,"SERVER_OVERLAY_VISUALS", True);
195
if (overlayVisualsAtom == None) {
199
status = XGetWindowProperty(dpy, RootWindow(dpy, screen),
200
overlayVisualsAtom, 0L, (long) 10000, False,
201
overlayVisualsAtom, &actualType, &actualFormat,
202
&sizeData, &bytesLeft,
205
if (status != Success || actualType != overlayVisualsAtom ||
206
actualFormat != 32 || sizeData < 4) {
207
/* something went wrong */
208
XFree((void *) ovInfo);
213
*numOverlays = sizeData / 4;
214
return (OverlayInfo *) ovInfo;
220
* Return the level (overlay, normal, underlay) of a given XVisualInfo.
221
* Input: dpy - the X display
222
* vinfo - the XVisualInfo to test
223
* Return: level of the visual:
225
* >0 = overlay planes
226
* <0 = underlay planes
229
level_of_visual( Display *dpy, XVisualInfo *vinfo )
231
OverlayInfo *overlay_info;
232
int numOverlaysPerScreen, i;
234
overlay_info = GetOverlayInfo(dpy, vinfo->screen, &numOverlaysPerScreen);
239
/* search the overlay visual list for the visual ID of interest */
240
for (i = 0; i < numOverlaysPerScreen; i++) {
241
const OverlayInfo *ov = overlay_info + i;
242
if (ov->overlay_visual == vinfo->visualid) {
243
/* found the visual */
244
if (/*ov->transparent_type==1 &&*/ ov->layer!=0) {
245
int level = ov->layer;
246
XFree((void *) overlay_info);
250
XFree((void *) overlay_info);
256
/* The visual ID was not found in the overlay list. */
257
XFree((void *) overlay_info);
265
* Given an XVisualInfo and RGB, Double, and Depth buffer flags, save the
266
* configuration in our list of GLX visuals.
269
save_glx_visual( Display *dpy, XVisualInfo *vinfo,
270
GLboolean rgbFlag, GLboolean alphaFlag, GLboolean dbFlag,
271
GLboolean stereoFlag,
272
GLint depth_size, GLint stencil_size,
273
GLint accumRedSize, GLint accumGreenSize,
274
GLint accumBlueSize, GLint accumAlphaSize,
275
GLint level, GLint numAuxBuffers )
277
GLboolean ximageFlag = GL_TRUE;
280
GLboolean comparePointers;
283
/* Check if the MESA_BACK_BUFFER env var is set */
284
char *backbuffer = _mesa_getenv("MESA_BACK_BUFFER");
286
if (backbuffer[0]=='p' || backbuffer[0]=='P') {
287
ximageFlag = GL_FALSE;
289
else if (backbuffer[0]=='x' || backbuffer[0]=='X') {
290
ximageFlag = GL_TRUE;
293
_mesa_warning(NULL, "Mesa: invalid value for MESA_BACK_BUFFER environment variable, using an XImage.");
299
/* stereo not supported */
303
/* Comparing IDs uses less memory but sometimes fails. */
304
/* XXX revisit this after 3.0 is finished. */
305
if (_mesa_getenv("MESA_GLX_VISUAL_HACK"))
306
comparePointers = GL_TRUE;
308
comparePointers = GL_FALSE;
310
/* Force the visual to have an alpha channel */
311
if (rgbFlag && _mesa_getenv("MESA_GLX_FORCE_ALPHA"))
314
/* First check if a matching visual is already in the list */
315
for (i=0; i<NumVisuals; i++) {
316
XMesaVisual v = VisualTable[i];
317
if (v->display == dpy
318
&& v->mesa_visual.level == level
319
&& v->mesa_visual.numAuxBuffers == numAuxBuffers
320
&& v->ximage_flag == ximageFlag
321
&& v->mesa_visual.rgbMode == rgbFlag
322
&& v->mesa_visual.doubleBufferMode == dbFlag
323
&& v->mesa_visual.stereoMode == stereoFlag
324
&& (v->mesa_visual.alphaBits > 0) == alphaFlag
325
&& (v->mesa_visual.depthBits >= depth_size || depth_size == 0)
326
&& (v->mesa_visual.stencilBits >= stencil_size || stencil_size == 0)
327
&& (v->mesa_visual.accumRedBits >= accumRedSize || accumRedSize == 0)
328
&& (v->mesa_visual.accumGreenBits >= accumGreenSize || accumGreenSize == 0)
329
&& (v->mesa_visual.accumBlueBits >= accumBlueSize || accumBlueSize == 0)
330
&& (v->mesa_visual.accumAlphaBits >= accumAlphaSize || accumAlphaSize == 0)) {
331
/* now either compare XVisualInfo pointers or visual IDs */
332
if ((!comparePointers && v->visinfo->visualid == vinfo->visualid)
333
|| (comparePointers && v->vishandle == vinfo)) {
339
/* Create a new visual and add it to the list. */
341
xmvis = XMesaCreateVisual( dpy, vinfo, rgbFlag, alphaFlag, dbFlag,
342
stereoFlag, ximageFlag,
343
depth_size, stencil_size,
344
accumRedSize, accumBlueSize,
345
accumBlueSize, accumAlphaSize, 0, level,
348
/* Save a copy of the pointer now so we can find this visual again
349
* if we need to search for it in find_glx_visual().
351
xmvis->vishandle = vinfo;
352
/* Allocate more space for additional visual */
353
VisualTable = (XMesaVisual *) _mesa_realloc( VisualTable,
354
sizeof(XMesaVisual) * NumVisuals,
355
sizeof(XMesaVisual) * (NumVisuals + 1));
356
/* add xmvis to the list */
357
VisualTable[NumVisuals] = xmvis;
359
/* XXX minor hack, because XMesaCreateVisual doesn't support an
360
* aux buffers parameter.
362
xmvis->mesa_visual.numAuxBuffers = numAuxBuffers;
369
* Return the default number of bits for the Z buffer.
370
* If defined, use the MESA_GLX_DEPTH_BITS env var value.
371
* Otherwise, use the DEFAULT_SOFTWARE_DEPTH_BITS constant.
372
* XXX probably do the same thing for stencil, accum, etc.
375
default_depth_bits(void)
378
const char *zEnv = _mesa_getenv("MESA_GLX_DEPTH_BITS");
380
zBits = _mesa_atoi(zEnv);
382
zBits = DEFAULT_SOFTWARE_DEPTH_BITS;
387
default_alpha_bits(void)
390
const char *aEnv = _mesa_getenv("MESA_GLX_ALPHA_BITS");
392
aBits = _mesa_atoi(aEnv);
399
default_accum_bits(void)
407
* Create a GLX visual from a regular XVisualInfo.
408
* This is called when Fake GLX is given an XVisualInfo which wasn't
409
* returned by glXChooseVisual. Since this is the first time we're
410
* considering this visual we'll take a guess at reasonable values
411
* for depth buffer size, stencil size, accum size, etc.
412
* This is the best we can do with a client-side emulation of GLX.
415
create_glx_visual( Display *dpy, XVisualInfo *visinfo )
418
GLint zBits = default_depth_bits();
419
GLint accBits = default_accum_bits();
420
GLboolean alphaFlag = default_alpha_bits() > 0;
422
vislevel = level_of_visual( dpy, visinfo );
424
/* Configure this visual as a CI, single-buffered overlay */
425
return save_glx_visual( dpy, visinfo,
427
GL_FALSE, /* alpha */
428
GL_FALSE, /* double */
429
GL_FALSE, /* stereo */
431
0, /* stencil bits */
432
0,0,0,0, /* accum bits */
433
vislevel, /* level */
437
else if (is_usable_visual( visinfo )) {
438
if (_mesa_getenv("MESA_GLX_FORCE_CI")) {
439
/* Configure this visual as a COLOR INDEX visual. */
440
return save_glx_visual( dpy, visinfo,
442
GL_FALSE, /* alpha */
443
GL_TRUE, /* double */
444
GL_FALSE, /* stereo */
447
0, 0, 0, 0, /* accum bits */
453
/* Configure this visual as RGB, double-buffered, depth-buffered. */
454
/* This is surely wrong for some people's needs but what else */
455
/* can be done? They should use glXChooseVisual(). */
456
return save_glx_visual( dpy, visinfo,
458
alphaFlag, /* alpha */
459
GL_TRUE, /* double */
460
GL_FALSE, /* stereo */
473
_mesa_warning(NULL, "Mesa: error in glXCreateContext: bad visual\n");
481
* Find the GLX visual associated with an XVisualInfo.
484
find_glx_visual( Display *dpy, XVisualInfo *vinfo )
488
/* try to match visual id */
489
for (i=0;i<NumVisuals;i++) {
490
if (VisualTable[i]->display==dpy
491
&& VisualTable[i]->visinfo->visualid == vinfo->visualid) {
492
return VisualTable[i];
496
/* if that fails, try to match pointers */
497
for (i=0;i<NumVisuals;i++) {
498
if (VisualTable[i]->display==dpy && VisualTable[i]->vishandle==vinfo) {
499
return VisualTable[i];
509
* Return the transparent pixel value for a GLX visual.
510
* Input: glxvis - the glx_visual
511
* Return: a pixel value or -1 if no transparent pixel
514
transparent_pixel( XMesaVisual glxvis )
516
Display *dpy = glxvis->display;
517
XVisualInfo *vinfo = glxvis->visinfo;
518
OverlayInfo *overlay_info;
519
int numOverlaysPerScreen, i;
521
overlay_info = GetOverlayInfo(dpy, vinfo->screen, &numOverlaysPerScreen);
526
for (i = 0; i < numOverlaysPerScreen; i++) {
527
const OverlayInfo *ov = overlay_info + i;
528
if (ov->overlay_visual == vinfo->visualid) {
530
if (ov->transparent_type == 0) {
531
/* type 0 indicates no transparency */
532
XFree((void *) overlay_info);
536
/* ov->value is the transparent pixel */
537
XFree((void *) overlay_info);
543
/* The visual ID was not found in the overlay list. */
544
XFree((void *) overlay_info);
551
* Try to get an X visual which matches the given arguments.
554
get_visual( Display *dpy, int scr, unsigned int depth, int xclass )
556
XVisualInfo temp, *vis;
559
unsigned int default_depth;
562
mask = VisualScreenMask | VisualDepthMask | VisualClassMask;
567
default_depth = DefaultDepth(dpy,scr);
568
default_class = DefaultVisual(dpy,scr)->CLASS;
570
if (depth==default_depth && xclass==default_class) {
571
/* try to get root window's visual */
572
temp.visualid = DefaultVisual(dpy,scr)->visualid;
573
mask |= VisualIDMask;
576
vis = XGetVisualInfo( dpy, mask, &temp, &n );
578
/* In case bits/pixel > 24, make sure color channels are still <=8 bits.
579
* An SGI Infinite Reality system, for example, can have 30bpp pixels:
580
* 10 bits per color channel. Mesa's limited to a max of 8 bits/channel.
582
if (vis && depth > 24 && (xclass==TrueColor || xclass==DirectColor)) {
583
if (_mesa_bitcount((GLuint) vis->red_mask ) <= 8 &&
584
_mesa_bitcount((GLuint) vis->green_mask) <= 8 &&
585
_mesa_bitcount((GLuint) vis->blue_mask ) <= 8) {
600
* Retrieve the value of the given environment variable and find
601
* the X visual which matches it.
602
* Input: dpy - the display
603
* screen - the screen number
604
* varname - the name of the environment variable
605
* Return: an XVisualInfo pointer to NULL if error.
608
get_env_visual(Display *dpy, int scr, const char *varname)
610
char value[100], type[100];
611
int depth, xclass = -1;
614
if (!_mesa_getenv( varname )) {
618
_mesa_strncpy( value, _mesa_getenv(varname), 100 );
621
sscanf( value, "%s %d", type, &depth );
623
if (_mesa_strcmp(type,"TrueColor")==0) xclass = TrueColor;
624
else if (_mesa_strcmp(type,"DirectColor")==0) xclass = DirectColor;
625
else if (_mesa_strcmp(type,"PseudoColor")==0) xclass = PseudoColor;
626
else if (_mesa_strcmp(type,"StaticColor")==0) xclass = StaticColor;
627
else if (_mesa_strcmp(type,"GrayScale")==0) xclass = GrayScale;
628
else if (_mesa_strcmp(type,"StaticGray")==0) xclass = StaticGray;
630
if (xclass>-1 && depth>0) {
631
vis = get_visual( dpy, scr, depth, xclass );
637
_mesa_warning(NULL, "GLX unable to find visual class=%s, depth=%d.",
646
* Select an X visual which satisfies the RGBA/CI flag and minimum depth.
647
* Input: dpy, screen - X display and screen number
648
* rgba - GL_TRUE = RGBA mode, GL_FALSE = CI mode
649
* min_depth - minimum visual depth
650
* preferred_class - preferred GLX visual class or DONT_CARE
651
* Return: pointer to an XVisualInfo or NULL.
654
choose_x_visual( Display *dpy, int screen, GLboolean rgba, int min_depth,
655
int preferred_class )
658
int xclass, visclass = 0;
662
Atom hp_cr_maps = XInternAtom(dpy, "_HP_RGB_SMOOTH_MAP_LIST", True);
663
/* First see if the MESA_RGB_VISUAL env var is defined */
664
vis = get_env_visual( dpy, screen, "MESA_RGB_VISUAL" );
668
/* Otherwise, search for a suitable visual */
669
if (preferred_class==DONT_CARE) {
670
for (xclass=0;xclass<6;xclass++) {
672
case 0: visclass = TrueColor; break;
673
case 1: visclass = DirectColor; break;
674
case 2: visclass = PseudoColor; break;
675
case 3: visclass = StaticColor; break;
676
case 4: visclass = GrayScale; break;
677
case 5: visclass = StaticGray; break;
680
/* start with shallowest */
681
for (depth=0;depth<=32;depth++) {
682
if (visclass==TrueColor && depth==8 && !hp_cr_maps) {
683
/* Special case: try to get 8-bit PseudoColor before */
684
/* 8-bit TrueColor */
685
vis = get_visual( dpy, screen, 8, PseudoColor );
690
vis = get_visual( dpy, screen, depth, visclass );
697
/* start with deepest */
698
for (depth=32;depth>=min_depth;depth--) {
699
if (visclass==TrueColor && depth==8 && !hp_cr_maps) {
700
/* Special case: try to get 8-bit PseudoColor before */
701
/* 8-bit TrueColor */
702
vis = get_visual( dpy, screen, 8, PseudoColor );
707
vis = get_visual( dpy, screen, depth, visclass );
716
/* search for a specific visual class */
717
switch (preferred_class) {
718
case GLX_TRUE_COLOR_EXT: visclass = TrueColor; break;
719
case GLX_DIRECT_COLOR_EXT: visclass = DirectColor; break;
720
case GLX_PSEUDO_COLOR_EXT: visclass = PseudoColor; break;
721
case GLX_STATIC_COLOR_EXT: visclass = StaticColor; break;
722
case GLX_GRAY_SCALE_EXT: visclass = GrayScale; break;
723
case GLX_STATIC_GRAY_EXT: visclass = StaticGray; break;
724
default: return NULL;
727
/* start with shallowest */
728
for (depth=0;depth<=32;depth++) {
729
vis = get_visual( dpy, screen, depth, visclass );
736
/* start with deepest */
737
for (depth=32;depth>=min_depth;depth--) {
738
vis = get_visual( dpy, screen, depth, visclass );
747
/* First see if the MESA_CI_VISUAL env var is defined */
748
vis = get_env_visual( dpy, screen, "MESA_CI_VISUAL" );
752
/* Otherwise, search for a suitable visual, starting with shallowest */
753
if (preferred_class==DONT_CARE) {
754
for (xclass=0;xclass<4;xclass++) {
756
case 0: visclass = PseudoColor; break;
757
case 1: visclass = StaticColor; break;
758
case 2: visclass = GrayScale; break;
759
case 3: visclass = StaticGray; break;
761
/* try 8-bit up through 16-bit */
762
for (depth=8;depth<=16;depth++) {
763
vis = get_visual( dpy, screen, depth, visclass );
768
/* try min_depth up to 8-bit */
769
for (depth=min_depth;depth<8;depth++) {
770
vis = get_visual( dpy, screen, depth, visclass );
778
/* search for a specific visual class */
779
switch (preferred_class) {
780
case GLX_TRUE_COLOR_EXT: visclass = TrueColor; break;
781
case GLX_DIRECT_COLOR_EXT: visclass = DirectColor; break;
782
case GLX_PSEUDO_COLOR_EXT: visclass = PseudoColor; break;
783
case GLX_STATIC_COLOR_EXT: visclass = StaticColor; break;
784
case GLX_GRAY_SCALE_EXT: visclass = GrayScale; break;
785
case GLX_STATIC_GRAY_EXT: visclass = StaticGray; break;
786
default: return NULL;
788
/* try 8-bit up through 16-bit */
789
for (depth=8;depth<=16;depth++) {
790
vis = get_visual( dpy, screen, depth, visclass );
795
/* try min_depth up to 8-bit */
796
for (depth=min_depth;depth<8;depth++) {
797
vis = get_visual( dpy, screen, depth, visclass );
805
/* didn't find a visual */
812
* Find the deepest X over/underlay visual of at least min_depth.
813
* Input: dpy, screen - X display and screen number
814
* level - the over/underlay level
815
* trans_type - transparent pixel type: GLX_NONE_EXT,
816
* GLX_TRANSPARENT_RGB_EXT, GLX_TRANSPARENT_INDEX_EXT,
818
* trans_value - transparent pixel value or DONT_CARE
819
* min_depth - minimum visual depth
820
* preferred_class - preferred GLX visual class or DONT_CARE
821
* Return: pointer to an XVisualInfo or NULL.
824
choose_x_overlay_visual( Display *dpy, int scr, GLboolean rgbFlag,
825
int level, int trans_type, int trans_value,
826
int min_depth, int preferred_class )
828
OverlayInfo *overlay_info;
829
int numOverlaysPerScreen;
831
XVisualInfo *deepvis;
834
/*DEBUG int tt, tv; */
836
switch (preferred_class) {
837
case GLX_TRUE_COLOR_EXT: preferred_class = TrueColor; break;
838
case GLX_DIRECT_COLOR_EXT: preferred_class = DirectColor; break;
839
case GLX_PSEUDO_COLOR_EXT: preferred_class = PseudoColor; break;
840
case GLX_STATIC_COLOR_EXT: preferred_class = StaticColor; break;
841
case GLX_GRAY_SCALE_EXT: preferred_class = GrayScale; break;
842
case GLX_STATIC_GRAY_EXT: preferred_class = StaticGray; break;
843
default: preferred_class = DONT_CARE;
846
overlay_info = GetOverlayInfo(dpy, scr, &numOverlaysPerScreen);
851
/* Search for the deepest overlay which satisifies all criteria. */
855
for (i = 0; i < numOverlaysPerScreen; i++) {
856
const OverlayInfo *ov = overlay_info + i;
857
XVisualInfo *vislist, vistemplate;
860
if (ov->layer!=level) {
861
/* failed overlay level criteria */
864
if (!(trans_type==DONT_CARE
865
|| (trans_type==GLX_TRANSPARENT_INDEX_EXT
866
&& ov->transparent_type>0)
867
|| (trans_type==GLX_NONE_EXT && ov->transparent_type==0))) {
868
/* failed transparent pixel type criteria */
871
if (trans_value!=DONT_CARE && trans_value!=ov->value) {
872
/* failed transparent pixel value criteria */
876
/* get XVisualInfo and check the depth */
877
vistemplate.visualid = ov->overlay_visual;
878
vistemplate.screen = scr;
879
vislist = XGetVisualInfo( dpy, VisualIDMask | VisualScreenMask,
880
&vistemplate, &count );
883
/* something went wrong */
886
if (preferred_class!=DONT_CARE && preferred_class!=vislist->CLASS) {
887
/* wrong visual class */
891
/* if RGB was requested, make sure we have True/DirectColor */
892
if (rgbFlag && vislist->CLASS != TrueColor
893
&& vislist->CLASS != DirectColor)
896
/* if CI was requested, make sure we have a color indexed visual */
898
&& (vislist->CLASS == TrueColor || vislist->CLASS == DirectColor))
901
if (deepvis==NULL || vislist->depth > deepest) {
902
/* YES! found a satisfactory visual */
906
deepest = vislist->depth;
908
/* DEBUG tt = ov->transparent_type;*/
909
/* DEBUG tv = ov->value; */
915
printf("chose 0x%x: layer=%d depth=%d trans_type=%d trans_value=%d\n",
916
deepvis->visualid, level, deepvis->depth, tt, tv );
923
/**********************************************************************/
924
/*** Display-related functions ***/
925
/**********************************************************************/
929
* Free all XMesaVisuals which are associated with the given display.
932
destroy_visuals_on_display(Display *dpy)
935
for (i = 0; i < NumVisuals; i++) {
936
if (VisualTable[i]->display == dpy) {
937
/* remove this visual */
939
free(VisualTable[i]);
940
for (j = i; j < NumVisuals - 1; j++)
941
VisualTable[j] = VisualTable[j + 1];
949
* Called from XCloseDisplay() to let us free our display-related data.
952
close_display_callback(Display *dpy, XExtCodes *codes)
954
destroy_visuals_on_display(dpy);
955
xmesa_destroy_buffers_on_display(dpy);
961
* Look for the named extension on given display and return a pointer
962
* to the _XExtension data, or NULL if extension not found.
965
lookup_extension(Display *dpy, const char *extName)
968
for (ext = dpy->ext_procs; ext; ext = ext->next) {
969
if (ext->name && strcmp(ext->name, extName) == 0) {
978
* Whenever we're given a new Display pointer, call this function to
979
* register our close_display_callback function.
982
register_with_display(Display *dpy)
984
const char *extName = "MesaGLX";
987
ext = lookup_extension(dpy, extName);
989
XExtCodes *c = XAddExtension(dpy);
990
ext = dpy->ext_procs; /* new extension is at head of list */
991
assert(c->extension == ext->codes.extension);
992
ext->name = _mesa_strdup(extName);
993
ext->close_display = close_display_callback;
998
/**********************************************************************/
999
/*** Begin Fake GLX API Functions ***/
1000
/**********************************************************************/
1004
* Helper used by glXChooseVisual and glXChooseFBConfig.
1005
* The fbConfig parameter must be GL_FALSE for the former and GL_TRUE for
1007
* In either case, the attribute list is terminated with the value 'None'.
1010
choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig )
1012
const GLboolean rgbModeDefault = fbConfig;
1013
const int *parselist;
1016
int min_red=0, min_green=0, min_blue=0;
1017
GLboolean rgb_flag = rgbModeDefault;
1018
GLboolean alpha_flag = GL_FALSE;
1019
GLboolean double_flag = GL_FALSE;
1020
GLboolean stereo_flag = GL_FALSE;
1021
GLint depth_size = 0;
1022
GLint stencil_size = 0;
1023
GLint accumRedSize = 0;
1024
GLint accumGreenSize = 0;
1025
GLint accumBlueSize = 0;
1026
GLint accumAlphaSize = 0;
1028
int visual_type = DONT_CARE;
1029
int trans_type = DONT_CARE;
1030
int trans_value = DONT_CARE;
1031
GLint caveat = DONT_CARE;
1032
XMesaVisual xmvis = NULL;
1033
int desiredVisualID = -1;
1038
while (*parselist) {
1040
switch (*parselist) {
1051
case GLX_BUFFER_SIZE:
1053
min_ci = *parselist++;
1057
level = *parselist++;
1069
case GLX_DOUBLEBUFFER:
1072
double_flag = *parselist++;
1075
double_flag = GL_TRUE;
1081
stereo_flag = *parselist++;
1084
stereo_flag = GL_TRUE;
1087
case GLX_AUX_BUFFERS:
1089
numAux = *parselist++;
1090
if (numAux > MAX_AUX_BUFFERS)
1095
min_red = *parselist++;
1097
case GLX_GREEN_SIZE:
1099
min_green = *parselist++;
1103
min_blue = *parselist++;
1105
case GLX_ALPHA_SIZE:
1108
GLint size = *parselist++;
1109
alpha_flag = size ? GL_TRUE : GL_FALSE;
1112
case GLX_DEPTH_SIZE:
1114
depth_size = *parselist++;
1116
case GLX_STENCIL_SIZE:
1118
stencil_size = *parselist++;
1120
case GLX_ACCUM_RED_SIZE:
1123
GLint size = *parselist++;
1124
accumRedSize = MAX2( accumRedSize, size );
1127
case GLX_ACCUM_GREEN_SIZE:
1130
GLint size = *parselist++;
1131
accumGreenSize = MAX2( accumGreenSize, size );
1134
case GLX_ACCUM_BLUE_SIZE:
1137
GLint size = *parselist++;
1138
accumBlueSize = MAX2( accumBlueSize, size );
1141
case GLX_ACCUM_ALPHA_SIZE:
1144
GLint size = *parselist++;
1145
accumAlphaSize = MAX2( accumAlphaSize, size );
1150
* GLX_EXT_visual_info extension
1152
case GLX_X_VISUAL_TYPE_EXT:
1154
visual_type = *parselist++;
1156
case GLX_TRANSPARENT_TYPE_EXT:
1158
trans_type = *parselist++;
1160
case GLX_TRANSPARENT_INDEX_VALUE_EXT:
1162
trans_value = *parselist++;
1164
case GLX_TRANSPARENT_RED_VALUE_EXT:
1165
case GLX_TRANSPARENT_GREEN_VALUE_EXT:
1166
case GLX_TRANSPARENT_BLUE_VALUE_EXT:
1167
case GLX_TRANSPARENT_ALPHA_VALUE_EXT:
1174
* GLX_EXT_visual_info extension
1176
case GLX_VISUAL_CAVEAT_EXT:
1178
caveat = *parselist++; /* ignored for now */
1182
* GLX_ARB_multisample
1184
case GLX_SAMPLE_BUFFERS_ARB:
1185
/* ms not supported */
1187
case GLX_SAMPLES_ARB:
1188
/* ms not supported */
1194
case GLX_RENDER_TYPE:
1198
if (*parselist == GLX_RGBA_BIT) {
1201
else if (*parselist == GLX_COLOR_INDEX_BIT) {
1202
rgb_flag = GL_FALSE;
1204
else if (*parselist == 0) {
1209
case GLX_DRAWABLE_TYPE:
1213
if (*parselist & ~(GLX_WINDOW_BIT | GLX_PIXMAP_BIT | GLX_PBUFFER_BIT)) {
1214
return NULL; /* bad bit */
1218
case GLX_FBCONFIG_ID:
1222
desiredVisualID = *parselist++;
1224
case GLX_X_RENDERABLE:
1236
/* undefined attribute */
1237
_mesa_warning(NULL, "unexpected attrib 0x%x in choose_visual()",
1246
* Since we're only simulating the GLX extension this function will never
1247
* find any real GL visuals. Instead, all we can do is try to find an RGB
1248
* or CI visual of appropriate depth. Other requested attributes such as
1249
* double buffering, depth buffer, etc. will be associated with the X
1250
* visual and stored in the VisualTable[].
1252
if (desiredVisualID != -1) {
1253
/* try to get a specific visual, by visualID */
1256
temp.visualid = desiredVisualID;
1257
temp.screen = screen;
1258
vis = XGetVisualInfo(dpy, VisualIDMask | VisualScreenMask, &temp, &n);
1260
/* give the visual some useful GLX attributes */
1261
double_flag = GL_TRUE;
1264
depth_size = default_depth_bits();
1265
stencil_size = STENCIL_BITS;
1269
else if (level==0) {
1270
/* normal color planes */
1272
/* Get an RGB visual */
1273
int min_rgb = min_red + min_green + min_blue;
1274
if (min_rgb>1 && min_rgb<8) {
1275
/* a special case to be sure we can get a monochrome visual */
1278
vis = choose_x_visual( dpy, screen, rgb_flag, min_rgb, visual_type );
1281
/* Get a color index visual */
1282
vis = choose_x_visual( dpy, screen, rgb_flag, min_ci, visual_type );
1283
accumRedSize = accumGreenSize = accumBlueSize = accumAlphaSize = 0;
1287
/* over/underlay planes */
1290
int min_rgb = min_red + min_green + min_blue;
1291
if (min_rgb>1 && min_rgb<8) {
1292
/* a special case to be sure we can get a monochrome visual */
1295
vis = choose_x_overlay_visual( dpy, screen, rgb_flag, level,
1296
trans_type, trans_value, min_rgb, visual_type );
1299
/* color index overlay */
1300
vis = choose_x_overlay_visual( dpy, screen, rgb_flag, level,
1301
trans_type, trans_value, min_ci, visual_type );
1306
/* Note: we're not exactly obeying the glXChooseVisual rules here.
1307
* When GLX_DEPTH_SIZE = 1 is specified we're supposed to choose the
1308
* largest depth buffer size, which is 32bits/value. Instead, we
1309
* return 16 to maintain performance with earlier versions of Mesa.
1311
if (depth_size > 24)
1313
else if (depth_size > 16)
1315
else if (depth_size > 0) {
1316
depth_size = default_depth_bits();
1320
alpha_flag = default_alpha_bits() > 0;
1323
/* we only support one size of stencil and accum buffers. */
1324
if (stencil_size > 0)
1325
stencil_size = STENCIL_BITS;
1326
if (accumRedSize > 0 || accumGreenSize > 0 || accumBlueSize > 0 ||
1327
accumAlphaSize > 0) {
1330
accumBlueSize = default_accum_bits();
1331
accumAlphaSize = alpha_flag ? accumRedSize : 0;
1334
xmvis = save_glx_visual( dpy, vis, rgb_flag, alpha_flag, double_flag,
1335
stereo_flag, depth_size, stencil_size,
1336
accumRedSize, accumGreenSize,
1337
accumBlueSize, accumAlphaSize, level, numAux );
1344
static XVisualInfo *
1345
Fake_glXChooseVisual( Display *dpy, int screen, int *list )
1349
/* register ourselves as an extension on this display */
1350
register_with_display(dpy);
1352
xmvis = choose_visual(dpy, screen, list, GL_FALSE);
1355
return xmvis->vishandle;
1357
/* create a new vishandle - the cached one may be stale */
1358
xmvis->vishandle = (XVisualInfo *) _mesa_malloc(sizeof(XVisualInfo));
1359
if (xmvis->vishandle) {
1360
_mesa_memcpy(xmvis->vishandle, xmvis->visinfo, sizeof(XVisualInfo));
1362
return xmvis->vishandle;
1371
Fake_glXCreateContext( Display *dpy, XVisualInfo *visinfo,
1372
GLXContext share_list, Bool direct )
1375
struct fake_glx_context *glxCtx;
1376
struct fake_glx_context *shareCtx = (struct fake_glx_context *) share_list;
1378
if (!dpy || !visinfo)
1381
glxCtx = CALLOC_STRUCT(fake_glx_context);
1385
/* deallocate unused windows/buffers */
1387
XMesaGarbageCollect();
1390
xmvis = find_glx_visual( dpy, visinfo );
1392
/* This visual wasn't found with glXChooseVisual() */
1393
xmvis = create_glx_visual( dpy, visinfo );
1395
/* unusable visual */
1401
glxCtx->xmesaContext = XMesaCreateContext(xmvis,
1402
shareCtx ? shareCtx->xmesaContext : NULL);
1403
if (!glxCtx->xmesaContext) {
1408
glxCtx->xmesaContext->direct = GL_FALSE;
1409
glxCtx->glxContext.isDirect = GL_FALSE;
1410
glxCtx->glxContext.currentDpy = dpy;
1411
glxCtx->glxContext.xid = (XID) glxCtx; /* self pointer */
1413
assert((void *) glxCtx == (void *) &(glxCtx->glxContext));
1415
return (GLXContext) glxCtx;
1419
/* XXX these may have to be removed due to thread-safety issues. */
1420
static GLXContext MakeCurrent_PrevContext = 0;
1421
static GLXDrawable MakeCurrent_PrevDrawable = 0;
1422
static GLXDrawable MakeCurrent_PrevReadable = 0;
1423
static XMesaBuffer MakeCurrent_PrevDrawBuffer = 0;
1424
static XMesaBuffer MakeCurrent_PrevReadBuffer = 0;
1427
/* GLX 1.3 and later */
1429
Fake_glXMakeContextCurrent( Display *dpy, GLXDrawable draw,
1430
GLXDrawable read, GLXContext ctx )
1432
struct fake_glx_context *glxCtx = (struct fake_glx_context *) ctx;
1434
if (ctx && draw && read) {
1435
XMesaBuffer drawBuffer, readBuffer;
1436
XMesaContext xmctx = glxCtx->xmesaContext;
1438
/* Find the XMesaBuffer which corresponds to the GLXDrawable 'draw' */
1439
if (ctx == MakeCurrent_PrevContext
1440
&& draw == MakeCurrent_PrevDrawable) {
1441
drawBuffer = MakeCurrent_PrevDrawBuffer;
1444
drawBuffer = XMesaFindBuffer( dpy, draw );
1447
/* drawable must be a new window! */
1448
drawBuffer = XMesaCreateWindowBuffer( xmctx->xm_visual, draw );
1450
/* Out of memory, or context/drawable depth mismatch */
1454
FXcreateContext( xmctx->xm_visual, draw, xmctx, drawBuffer );
1458
/* Find the XMesaBuffer which corresponds to the GLXDrawable 'read' */
1459
if (ctx == MakeCurrent_PrevContext
1460
&& read == MakeCurrent_PrevReadable) {
1461
readBuffer = MakeCurrent_PrevReadBuffer;
1464
readBuffer = XMesaFindBuffer( dpy, read );
1467
/* drawable must be a new window! */
1468
readBuffer = XMesaCreateWindowBuffer( xmctx->xm_visual, read );
1470
/* Out of memory, or context/drawable depth mismatch */
1474
FXcreateContext( xmctx->xm_visual, read, xmctx, readBuffer );
1478
MakeCurrent_PrevContext = ctx;
1479
MakeCurrent_PrevDrawable = draw;
1480
MakeCurrent_PrevReadable = read;
1481
MakeCurrent_PrevDrawBuffer = drawBuffer;
1482
MakeCurrent_PrevReadBuffer = readBuffer;
1484
/* Now make current! */
1485
if (XMesaMakeCurrent2(xmctx, drawBuffer, readBuffer)) {
1486
((__GLXcontext *) ctx)->currentDpy = dpy;
1487
((__GLXcontext *) ctx)->currentDrawable = draw;
1488
((__GLXcontext *) ctx)->currentReadable = read;
1495
else if (!ctx && !draw && !read) {
1496
/* release current context w/out assigning new one. */
1497
XMesaMakeCurrent( NULL, NULL );
1498
MakeCurrent_PrevContext = 0;
1499
MakeCurrent_PrevDrawable = 0;
1500
MakeCurrent_PrevReadable = 0;
1501
MakeCurrent_PrevDrawBuffer = 0;
1502
MakeCurrent_PrevReadBuffer = 0;
1506
/* The args must either all be non-zero or all zero.
1515
Fake_glXMakeCurrent( Display *dpy, GLXDrawable drawable, GLXContext ctx )
1517
return Fake_glXMakeContextCurrent( dpy, drawable, drawable, ctx );
1522
Fake_glXCreateGLXPixmap( Display *dpy, XVisualInfo *visinfo, Pixmap pixmap )
1527
v = find_glx_visual( dpy, visinfo );
1529
v = create_glx_visual( dpy, visinfo );
1531
/* unusable visual */
1536
b = XMesaCreatePixmapBuffer( v, pixmap, 0 );
1540
return b->frontxrb->pixmap;
1544
/*** GLX_MESA_pixmap_colormap ***/
1547
Fake_glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visinfo,
1548
Pixmap pixmap, Colormap cmap )
1553
v = find_glx_visual( dpy, visinfo );
1555
v = create_glx_visual( dpy, visinfo );
1557
/* unusable visual */
1562
b = XMesaCreatePixmapBuffer( v, pixmap, cmap );
1566
return b->frontxrb->pixmap;
1571
Fake_glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap )
1573
XMesaBuffer b = XMesaFindBuffer(dpy, pixmap);
1575
XMesaDestroyBuffer(b);
1577
else if (_mesa_getenv("MESA_DEBUG")) {
1578
_mesa_warning(NULL, "Mesa: glXDestroyGLXPixmap: invalid pixmap\n");
1584
Fake_glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
1585
unsigned long mask )
1587
struct fake_glx_context *fakeSrc = (struct fake_glx_context *) src;
1588
struct fake_glx_context *fakeDst = (struct fake_glx_context *) dst;
1589
XMesaContext xm_src = fakeSrc->xmesaContext;
1590
XMesaContext xm_dst = fakeDst->xmesaContext;
1592
if (MakeCurrent_PrevContext == src) {
1595
_mesa_copy_context( &(xm_src->mesa), &(xm_dst->mesa), (GLuint) mask );
1600
Fake_glXQueryExtension( Display *dpy, int *errorb, int *event )
1602
/* Mesa's GLX isn't really an X extension but we try to act like one. */
1610
extern void _kw_ungrab_all( Display *dpy );
1611
void _kw_ungrab_all( Display *dpy )
1613
XUngrabPointer( dpy, CurrentTime );
1614
XUngrabKeyboard( dpy, CurrentTime );
1619
Fake_glXDestroyContext( Display *dpy, GLXContext ctx )
1621
struct fake_glx_context *glxCtx = (struct fake_glx_context *) ctx;
1623
MakeCurrent_PrevContext = 0;
1624
MakeCurrent_PrevDrawable = 0;
1625
MakeCurrent_PrevReadable = 0;
1626
MakeCurrent_PrevDrawBuffer = 0;
1627
MakeCurrent_PrevReadBuffer = 0;
1628
XMesaDestroyContext( glxCtx->xmesaContext );
1629
XMesaGarbageCollect();
1635
Fake_glXIsDirect( Display *dpy, GLXContext ctx )
1637
struct fake_glx_context *glxCtx = (struct fake_glx_context *) ctx;
1639
return glxCtx->xmesaContext->direct;
1645
Fake_glXSwapBuffers( Display *dpy, GLXDrawable drawable )
1647
XMesaBuffer buffer = XMesaFindBuffer( dpy, drawable );
1650
XMesaSwapBuffers(buffer);
1652
else if (_mesa_getenv("MESA_DEBUG")) {
1653
_mesa_warning(NULL, "glXSwapBuffers: invalid drawable 0x%x\n",
1660
/*** GLX_MESA_copy_sub_buffer ***/
1663
Fake_glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable,
1664
int x, int y, int width, int height )
1666
XMesaBuffer buffer = XMesaFindBuffer( dpy, drawable );
1668
XMesaCopySubBuffer(buffer, x, y, width, height);
1670
else if (_mesa_getenv("MESA_DEBUG")) {
1671
_mesa_warning(NULL, "Mesa: glXCopySubBufferMESA: invalid drawable\n");
1677
Fake_glXQueryVersion( Display *dpy, int *maj, int *min )
1680
/* Return GLX version, not Mesa version */
1681
assert(CLIENT_MAJOR_VERSION == SERVER_MAJOR_VERSION);
1682
*maj = CLIENT_MAJOR_VERSION;
1683
*min = MIN2( CLIENT_MINOR_VERSION, SERVER_MINOR_VERSION );
1689
* Query the GLX attributes of the given XVisualInfo.
1692
get_config( XMesaVisual xmvis, int attrib, int *value, GLboolean fbconfig )
1698
return GLX_BAD_ATTRIBUTE;
1699
*value = (int) True;
1701
case GLX_BUFFER_SIZE:
1702
*value = xmvis->visinfo->depth;
1705
*value = xmvis->mesa_visual.level;
1709
return GLX_BAD_ATTRIBUTE;
1710
if (xmvis->mesa_visual.rgbMode) {
1717
case GLX_DOUBLEBUFFER:
1718
*value = (int) xmvis->mesa_visual.doubleBufferMode;
1721
*value = (int) xmvis->mesa_visual.stereoMode;
1723
case GLX_AUX_BUFFERS:
1724
*value = xmvis->mesa_visual.numAuxBuffers;
1727
*value = xmvis->mesa_visual.redBits;
1729
case GLX_GREEN_SIZE:
1730
*value = xmvis->mesa_visual.greenBits;
1733
*value = xmvis->mesa_visual.blueBits;
1735
case GLX_ALPHA_SIZE:
1736
*value = xmvis->mesa_visual.alphaBits;
1738
case GLX_DEPTH_SIZE:
1739
*value = xmvis->mesa_visual.depthBits;
1741
case GLX_STENCIL_SIZE:
1742
*value = xmvis->mesa_visual.stencilBits;
1744
case GLX_ACCUM_RED_SIZE:
1745
*value = xmvis->mesa_visual.accumRedBits;
1747
case GLX_ACCUM_GREEN_SIZE:
1748
*value = xmvis->mesa_visual.accumGreenBits;
1750
case GLX_ACCUM_BLUE_SIZE:
1751
*value = xmvis->mesa_visual.accumBlueBits;
1753
case GLX_ACCUM_ALPHA_SIZE:
1754
*value = xmvis->mesa_visual.accumAlphaBits;
1758
* GLX_EXT_visual_info extension
1760
case GLX_X_VISUAL_TYPE_EXT:
1761
switch (xmvis->visinfo->CLASS) {
1762
case StaticGray: *value = GLX_STATIC_GRAY_EXT; return 0;
1763
case GrayScale: *value = GLX_GRAY_SCALE_EXT; return 0;
1764
case StaticColor: *value = GLX_STATIC_GRAY_EXT; return 0;
1765
case PseudoColor: *value = GLX_PSEUDO_COLOR_EXT; return 0;
1766
case TrueColor: *value = GLX_TRUE_COLOR_EXT; return 0;
1767
case DirectColor: *value = GLX_DIRECT_COLOR_EXT; return 0;
1770
case GLX_TRANSPARENT_TYPE_EXT:
1771
if (xmvis->mesa_visual.level==0) {
1773
*value = GLX_NONE_EXT;
1775
else if (xmvis->mesa_visual.level>0) {
1777
if (xmvis->mesa_visual.rgbMode) {
1778
*value = GLX_TRANSPARENT_RGB_EXT;
1781
*value = GLX_TRANSPARENT_INDEX_EXT;
1784
else if (xmvis->mesa_visual.level<0) {
1786
*value = GLX_NONE_EXT;
1789
case GLX_TRANSPARENT_INDEX_VALUE_EXT:
1791
int pixel = transparent_pixel( xmvis );
1795
/* else undefined */
1798
case GLX_TRANSPARENT_RED_VALUE_EXT:
1801
case GLX_TRANSPARENT_GREEN_VALUE_EXT:
1804
case GLX_TRANSPARENT_BLUE_VALUE_EXT:
1807
case GLX_TRANSPARENT_ALPHA_VALUE_EXT:
1812
* GLX_EXT_visual_info extension
1814
case GLX_VISUAL_CAVEAT_EXT:
1815
/* test for zero, just in case */
1816
if (xmvis->mesa_visual.visualRating > 0)
1817
*value = xmvis->mesa_visual.visualRating;
1819
*value = GLX_NONE_EXT;
1823
* GLX_ARB_multisample
1825
case GLX_SAMPLE_BUFFERS_ARB:
1828
case GLX_SAMPLES_ARB:
1835
case GLX_SCREEN_EXT:
1837
return GLX_BAD_ATTRIBUTE;
1838
*value = xmvis->visinfo->screen;
1840
case GLX_DRAWABLE_TYPE: /*SGIX too */
1842
return GLX_BAD_ATTRIBUTE;
1843
*value = GLX_WINDOW_BIT | GLX_PIXMAP_BIT | GLX_PBUFFER_BIT;
1845
case GLX_RENDER_TYPE_SGIX:
1847
return GLX_BAD_ATTRIBUTE;
1848
if (xmvis->mesa_visual.rgbMode)
1849
*value = GLX_RGBA_BIT;
1851
*value = GLX_COLOR_INDEX_BIT;
1853
case GLX_X_RENDERABLE_SGIX:
1855
return GLX_BAD_ATTRIBUTE;
1856
*value = True; /* XXX really? */
1858
case GLX_FBCONFIG_ID_SGIX:
1860
return GLX_BAD_ATTRIBUTE;
1861
*value = xmvis->visinfo->visualid;
1863
case GLX_MAX_PBUFFER_WIDTH:
1865
return GLX_BAD_ATTRIBUTE;
1866
/* XXX or MAX_WIDTH? */
1867
*value = DisplayWidth(xmvis->display, xmvis->visinfo->screen);
1869
case GLX_MAX_PBUFFER_HEIGHT:
1871
return GLX_BAD_ATTRIBUTE;
1872
*value = DisplayHeight(xmvis->display, xmvis->visinfo->screen);
1874
case GLX_MAX_PBUFFER_PIXELS:
1876
return GLX_BAD_ATTRIBUTE;
1877
*value = DisplayWidth(xmvis->display, xmvis->visinfo->screen) *
1878
DisplayHeight(xmvis->display, xmvis->visinfo->screen);
1882
return GLX_BAD_ATTRIBUTE;
1883
*value = xmvis->visinfo->visualid;
1887
return GLX_BAD_ATTRIBUTE;
1894
Fake_glXGetConfig( Display *dpy, XVisualInfo *visinfo,
1895
int attrib, int *value )
1899
if (!dpy || !visinfo)
1900
return GLX_BAD_ATTRIBUTE;
1902
xmvis = find_glx_visual( dpy, visinfo );
1904
/* this visual wasn't obtained with glXChooseVisual */
1905
xmvis = create_glx_visual( dpy, visinfo );
1907
/* this visual can't be used for GL rendering */
1908
if (attrib==GLX_USE_GL) {
1909
*value = (int) False;
1913
return GLX_BAD_VISUAL;
1918
k = get_config(xmvis, attrib, value, GL_FALSE);
1924
Fake_glXWaitGL( void )
1926
XMesaContext xmesa = XMesaGetCurrentContext();
1927
XMesaFlush( xmesa );
1933
Fake_glXWaitX( void )
1935
XMesaContext xmesa = XMesaGetCurrentContext();
1936
XMesaFlush( xmesa );
1941
get_extensions( void )
1944
const char *fx = _mesa_getenv("MESA_GLX_FX");
1945
if (fx && fx[0] != 'd') {
1949
return EXTENSIONS + 23; /* skip "GLX_MESA_set_3dfx_mode" */
1954
/* GLX 1.1 and later */
1956
Fake_glXQueryExtensionsString( Display *dpy, int screen )
1960
return get_extensions();
1965
/* GLX 1.1 and later */
1967
Fake_glXQueryServerString( Display *dpy, int screen, int name )
1969
static char version[1000];
1970
_mesa_sprintf(version, "%d.%d %s",
1971
SERVER_MAJOR_VERSION, SERVER_MINOR_VERSION, MESA_GLX_VERSION);
1977
case GLX_EXTENSIONS:
1978
return get_extensions();
1990
/* GLX 1.1 and later */
1992
Fake_glXGetClientString( Display *dpy, int name )
1994
static char version[1000];
1995
_mesa_sprintf(version, "%d.%d %s", CLIENT_MAJOR_VERSION,
1996
CLIENT_MINOR_VERSION, MESA_GLX_VERSION);
2001
case GLX_EXTENSIONS:
2002
return get_extensions();
2020
Fake_glXGetFBConfigAttrib( Display *dpy, GLXFBConfig config,
2021
int attribute, int *value )
2023
XMesaVisual v = (XMesaVisual) config;
2027
if (!dpy || !config || !value)
2030
return get_config(v, attribute, value, GL_TRUE);
2034
static GLXFBConfig *
2035
Fake_glXGetFBConfigs( Display *dpy, int screen, int *nelements )
2037
XVisualInfo *visuals, visTemplate;
2038
const long visMask = VisualScreenMask;
2041
/* Get list of all X visuals */
2042
visTemplate.screen = screen;
2043
visuals = XGetVisualInfo(dpy, visMask, &visTemplate, nelements);
2044
if (*nelements > 0) {
2045
XMesaVisual *results;
2046
results = (XMesaVisual *) _mesa_malloc(*nelements * sizeof(XMesaVisual));
2051
for (i = 0; i < *nelements; i++) {
2052
results[i] = create_glx_visual(dpy, visuals + i);
2054
return (GLXFBConfig *) results;
2060
static GLXFBConfig *
2061
Fake_glXChooseFBConfig( Display *dpy, int screen,
2062
const int *attribList, int *nitems )
2066
if (!attribList || !attribList[0]) {
2067
/* return list of all configs (per GLX_SGIX_fbconfig spec) */
2068
return Fake_glXGetFBConfigs(dpy, screen, nitems);
2071
xmvis = choose_visual(dpy, screen, attribList, GL_TRUE);
2073
GLXFBConfig *config = (GLXFBConfig *) _mesa_malloc(sizeof(XMesaVisual));
2079
config[0] = (GLXFBConfig) xmvis;
2080
return (GLXFBConfig *) config;
2089
static XVisualInfo *
2090
Fake_glXGetVisualFromFBConfig( Display *dpy, GLXFBConfig config )
2092
if (dpy && config) {
2093
XMesaVisual xmvis = (XMesaVisual) config;
2095
return xmvis->vishandle;
2097
/* create a new vishandle - the cached one may be stale */
2098
xmvis->vishandle = (XVisualInfo *) _mesa_malloc(sizeof(XVisualInfo));
2099
if (xmvis->vishandle) {
2100
_mesa_memcpy(xmvis->vishandle, xmvis->visinfo, sizeof(XVisualInfo));
2102
return xmvis->vishandle;
2112
Fake_glXCreateWindow( Display *dpy, GLXFBConfig config, Window win,
2113
const int *attribList )
2115
XMesaVisual xmvis = (XMesaVisual) config;
2120
xmbuf = XMesaCreateWindowBuffer(xmvis, win);
2125
/* XXX this will segfault if actually called */
2126
FXcreateContext(xmvis, win, NULL, xmbuf);
2130
(void) attribList; /* Ignored in GLX 1.3 */
2132
return win; /* A hack for now */
2137
Fake_glXDestroyWindow( Display *dpy, GLXWindow window )
2139
XMesaBuffer b = XMesaFindBuffer(dpy, (XMesaDrawable) window);
2141
XMesaDestroyBuffer(b);
2142
/* don't destroy X window */
2148
Fake_glXCreatePixmap( Display *dpy, GLXFBConfig config, Pixmap pixmap,
2149
const int *attribList )
2151
XMesaVisual v = (XMesaVisual) config;
2157
(void) attribList; /* Ignored in GLX 1.3 */
2159
if (!dpy || !config || !pixmap)
2162
b = XMesaCreatePixmapBuffer( v, pixmap, 0 );
2172
Fake_glXDestroyPixmap( Display *dpy, GLXPixmap pixmap )
2174
XMesaBuffer b = XMesaFindBuffer(dpy, (XMesaDrawable)pixmap);
2176
XMesaDestroyBuffer(b);
2177
/* don't destroy X pixmap */
2182
Fake_glXCreatePbuffer( Display *dpy, GLXFBConfig config,
2183
const int *attribList )
2185
XMesaVisual xmvis = (XMesaVisual) config;
2188
int width = 0, height = 0;
2189
GLboolean useLargest = GL_FALSE, preserveContents = GL_FALSE;
2193
for (attrib = attribList; *attrib; attrib++) {
2195
case GLX_PBUFFER_WIDTH:
2199
case GLX_PBUFFER_HEIGHT:
2203
case GLX_PRESERVED_CONTENTS:
2205
preserveContents = *attrib; /* ignored */
2207
case GLX_LARGEST_PBUFFER:
2209
useLargest = *attrib; /* ignored */
2216
/* not used at this time */
2218
(void) preserveContents;
2220
if (width == 0 || height == 0)
2223
xmbuf = XMesaCreatePBuffer( xmvis, 0, width, height);
2224
/* A GLXPbuffer handle must be an X Drawable because that's what
2225
* glXMakeCurrent takes.
2228
return (GLXPbuffer) xmbuf->frontxrb->pixmap;
2235
Fake_glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf )
2237
XMesaBuffer b = XMesaFindBuffer(dpy, pbuf);
2239
XMesaDestroyBuffer(b);
2245
Fake_glXQueryDrawable( Display *dpy, GLXDrawable draw, int attribute,
2246
unsigned int *value )
2248
XMesaBuffer xmbuf = XMesaFindBuffer(dpy, draw);
2252
switch (attribute) {
2254
*value = xmbuf->mesa_buffer.Width;
2257
*value = xmbuf->mesa_buffer.Height;
2259
case GLX_PRESERVED_CONTENTS:
2262
case GLX_LARGEST_PBUFFER:
2263
*value = xmbuf->mesa_buffer.Width * xmbuf->mesa_buffer.Height;
2265
case GLX_FBCONFIG_ID:
2266
*value = xmbuf->xm_visual->visinfo->visualid;
2269
return; /* GLX_BAD_ATTRIBUTE? */
2275
Fake_glXCreateNewContext( Display *dpy, GLXFBConfig config,
2276
int renderType, GLXContext shareList, Bool direct )
2278
struct fake_glx_context *glxCtx;
2279
struct fake_glx_context *shareCtx = (struct fake_glx_context *) shareList;
2280
XMesaVisual xmvis = (XMesaVisual) config;
2282
if (!dpy || !config ||
2283
(renderType != GLX_RGBA_TYPE && renderType != GLX_COLOR_INDEX_TYPE))
2286
glxCtx = CALLOC_STRUCT(fake_glx_context);
2290
/* deallocate unused windows/buffers */
2291
XMesaGarbageCollect();
2293
glxCtx->xmesaContext = XMesaCreateContext(xmvis,
2294
shareCtx ? shareCtx->xmesaContext : NULL);
2295
if (!glxCtx->xmesaContext) {
2300
glxCtx->xmesaContext->direct = GL_FALSE;
2301
glxCtx->glxContext.isDirect = GL_FALSE;
2302
glxCtx->glxContext.currentDpy = dpy;
2303
glxCtx->glxContext.xid = (XID) glxCtx; /* self pointer */
2305
assert((void *) glxCtx == (void *) &(glxCtx->glxContext));
2307
return (GLXContext) glxCtx;
2312
Fake_glXQueryContext( Display *dpy, GLXContext ctx, int attribute, int *value )
2314
struct fake_glx_context *glxCtx = (struct fake_glx_context *) ctx;
2315
XMesaContext xmctx = glxCtx->xmesaContext;
2320
switch (attribute) {
2321
case GLX_FBCONFIG_ID:
2322
*value = xmctx->xm_visual->visinfo->visualid;
2324
case GLX_RENDER_TYPE:
2325
if (xmctx->xm_visual->mesa_visual.rgbMode)
2326
*value = GLX_RGBA_BIT;
2328
*value = GLX_COLOR_INDEX_BIT;
2334
return GLX_BAD_ATTRIBUTE;
2341
Fake_glXSelectEvent( Display *dpy, GLXDrawable drawable, unsigned long mask )
2343
XMesaBuffer xmbuf = XMesaFindBuffer(dpy, drawable);
2345
xmbuf->selectedEvents = mask;
2350
Fake_glXGetSelectedEvent( Display *dpy, GLXDrawable drawable,
2351
unsigned long *mask )
2353
XMesaBuffer xmbuf = XMesaFindBuffer(dpy, drawable);
2355
*mask = xmbuf->selectedEvents;
2362
/*** GLX_SGI_swap_control ***/
2365
Fake_glXSwapIntervalSGI(int interval)
2373
/*** GLX_SGI_video_sync ***/
2375
static unsigned int FrameCounter = 0;
2378
Fake_glXGetVideoSyncSGI(unsigned int *count)
2380
/* this is a bogus implementation */
2381
*count = FrameCounter++;
2386
Fake_glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count)
2388
if (divisor <= 0 || remainder < 0)
2389
return GLX_BAD_VALUE;
2390
/* this is a bogus implementation */
2392
while (FrameCounter % divisor != remainder)
2394
*count = FrameCounter;
2400
/*** GLX_SGI_make_current_read ***/
2403
Fake_glXMakeCurrentReadSGI(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx)
2405
return Fake_glXMakeContextCurrent( dpy, draw, read, ctx );
2410
Fake_glXGetCurrentReadDrawableSGI(void)
2417
/*** GLX_SGIX_video_source ***/
2420
static GLXVideoSourceSGIX
2421
Fake_glXCreateGLXVideoSourceSGIX(Display *dpy, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode)
2433
Fake_glXDestroyGLXVideoSourceSGIX(Display *dpy, GLXVideoSourceSGIX src)
2442
/*** GLX_EXT_import_context ***/
2445
Fake_glXFreeContextEXT(Display *dpy, GLXContext context)
2452
Fake_glXGetContextIDEXT(const GLXContext context)
2459
Fake_glXImportContextEXT(Display *dpy, GLXContextID contextID)
2467
Fake_glXQueryContextInfoEXT(Display *dpy, GLXContext context, int attribute, int *value)
2478
/*** GLX_SGIX_fbconfig ***/
2481
Fake_glXGetFBConfigAttribSGIX(Display *dpy, GLXFBConfigSGIX config, int attribute, int *value)
2483
return Fake_glXGetFBConfigAttrib(dpy, config, attribute, value);
2486
static GLXFBConfigSGIX *
2487
Fake_glXChooseFBConfigSGIX(Display *dpy, int screen, int *attrib_list, int *nelements)
2489
return (GLXFBConfig *) Fake_glXChooseFBConfig(dpy, screen, attrib_list, nelements);
2494
Fake_glXCreateGLXPixmapWithConfigSGIX(Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap)
2496
XMesaVisual xmvis = (XMesaVisual) config;
2497
XMesaBuffer xmbuf = XMesaCreatePixmapBuffer(xmvis, pixmap, 0);
2498
return xmbuf->frontxrb->pixmap; /* need to return an X ID */
2503
Fake_glXCreateContextWithConfigSGIX(Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct)
2505
XMesaVisual xmvis = (XMesaVisual) config;
2506
struct fake_glx_context *glxCtx;
2507
struct fake_glx_context *shareCtx = (struct fake_glx_context *) share_list;
2509
glxCtx = CALLOC_STRUCT(fake_glx_context);
2513
/* deallocate unused windows/buffers */
2514
XMesaGarbageCollect();
2516
glxCtx->xmesaContext = XMesaCreateContext(xmvis,
2517
shareCtx ? shareCtx->xmesaContext : NULL);
2518
if (!glxCtx->xmesaContext) {
2523
glxCtx->xmesaContext->direct = GL_FALSE;
2524
glxCtx->glxContext.isDirect = GL_FALSE;
2525
glxCtx->glxContext.currentDpy = dpy;
2526
glxCtx->glxContext.xid = (XID) glxCtx; /* self pointer */
2528
assert((void *) glxCtx == (void *) &(glxCtx->glxContext));
2530
return (GLXContext) glxCtx;
2534
static XVisualInfo *
2535
Fake_glXGetVisualFromFBConfigSGIX(Display *dpy, GLXFBConfigSGIX config)
2537
return Fake_glXGetVisualFromFBConfig(dpy, config);
2541
static GLXFBConfigSGIX
2542
Fake_glXGetFBConfigFromVisualSGIX(Display *dpy, XVisualInfo *vis)
2544
XMesaVisual xmvis = find_glx_visual(dpy, vis);
2546
/* This visual wasn't found with glXChooseVisual() */
2547
xmvis = create_glx_visual(dpy, vis);
2550
return (GLXFBConfigSGIX) xmvis;
2555
/*** GLX_SGIX_pbuffer ***/
2557
static GLXPbufferSGIX
2558
Fake_glXCreateGLXPbufferSGIX(Display *dpy, GLXFBConfigSGIX config,
2559
unsigned int width, unsigned int height,
2562
XMesaVisual xmvis = (XMesaVisual) config;
2565
GLboolean useLargest = GL_FALSE, preserveContents = GL_FALSE;
2569
for (attrib = attribList; attrib && *attrib; attrib++) {
2571
case GLX_PRESERVED_CONTENTS_SGIX:
2573
preserveContents = *attrib; /* ignored */
2575
case GLX_LARGEST_PBUFFER_SGIX:
2577
useLargest = *attrib; /* ignored */
2584
/* not used at this time */
2586
(void) preserveContents;
2588
xmbuf = XMesaCreatePBuffer( xmvis, 0, width, height);
2589
/* A GLXPbuffer handle must be an X Drawable because that's what
2590
* glXMakeCurrent takes.
2592
return (GLXPbuffer) xmbuf->frontxrb->pixmap;
2597
Fake_glXDestroyGLXPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuf)
2599
XMesaBuffer xmbuf = XMesaFindBuffer(dpy, pbuf);
2601
XMesaDestroyBuffer(xmbuf);
2607
Fake_glXQueryGLXPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value)
2609
const XMesaBuffer xmbuf = XMesaFindBuffer(dpy, pbuf);
2612
/* Generate GLXBadPbufferSGIX for bad pbuffer */
2616
switch (attribute) {
2617
case GLX_PRESERVED_CONTENTS_SGIX:
2620
case GLX_LARGEST_PBUFFER_SGIX:
2621
*value = xmbuf->mesa_buffer.Width * xmbuf->mesa_buffer.Height;
2623
case GLX_WIDTH_SGIX:
2624
*value = xmbuf->mesa_buffer.Width;
2626
case GLX_HEIGHT_SGIX:
2627
*value = xmbuf->mesa_buffer.Height;
2629
case GLX_EVENT_MASK_SGIX:
2630
*value = 0; /* XXX might be wrong */
2640
Fake_glXSelectEventSGIX(Display *dpy, GLXDrawable drawable, unsigned long mask)
2642
XMesaBuffer xmbuf = XMesaFindBuffer(dpy, drawable);
2644
/* Note: we'll never generate clobber events */
2645
xmbuf->selectedEvents = mask;
2651
Fake_glXGetSelectedEventSGIX(Display *dpy, GLXDrawable drawable, unsigned long *mask)
2653
XMesaBuffer xmbuf = XMesaFindBuffer(dpy, drawable);
2655
*mask = xmbuf->selectedEvents;
2664
/*** GLX_SGI_cushion ***/
2667
Fake_glXCushionSGI(Display *dpy, Window win, float cushion)
2676
/*** GLX_SGIX_video_resize ***/
2679
Fake_glXBindChannelToWindowSGIX(Display *dpy, int screen, int channel , Window window)
2689
Fake_glXChannelRectSGIX(Display *dpy, int screen, int channel, int x, int y, int w, int h)
2702
Fake_glXQueryChannelRectSGIX(Display *dpy, int screen, int channel, int *x, int *y, int *w, int *h)
2715
Fake_glXQueryChannelDeltasSGIX(Display *dpy, int screen, int channel, int *dx, int *dy, int *dw, int *dh)
2728
Fake_glXChannelRectSyncSGIX(Display *dpy, int screen, int channel, GLenum synctype)
2739
/*** GLX_SGIX_dmbuffer **/
2741
#if defined(_DM_BUFFER_H_)
2743
Fake_glXAssociateDMPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer)
2754
/*** GLX_SGIX_swap_group ***/
2757
Fake_glXJoinSwapGroupSGIX(Display *dpy, GLXDrawable drawable, GLXDrawable member)
2766
/*** GLX_SGIX_swap_barrier ***/
2769
Fake_glXBindSwapBarrierSGIX(Display *dpy, GLXDrawable drawable, int barrier)
2777
Fake_glXQueryMaxSwapBarriersSGIX(Display *dpy, int screen, int *max)
2787
/*** GLX_SUN_get_transparent_index ***/
2790
Fake_glXGetTransparentIndexSUN(Display *dpy, Window overlay, Window underlay, long *pTransparent)
2795
(void) pTransparent;
2801
/*** GLX_MESA_release_buffers ***/
2804
* Release the depth, stencil, accum buffers attached to a GLXDrawable
2805
* (a window or pixmap) prior to destroying the GLXDrawable.
2808
Fake_glXReleaseBuffersMESA( Display *dpy, GLXDrawable d )
2810
XMesaBuffer b = XMesaFindBuffer(dpy, d);
2812
XMesaDestroyBuffer(b);
2820
/*** GLX_MESA_set_3dfx_mode ***/
2823
Fake_glXSet3DfxModeMESA( int mode )
2825
return XMesaSetFXmode( mode );
2830
/*** GLX_NV_vertex_array range ***/
2832
Fake_glXAllocateMemoryNV( GLsizei size,
2833
GLfloat readFrequency,
2834
GLfloat writeFrequency,
2838
(void) readFrequency;
2839
(void) writeFrequency;
2846
Fake_glXFreeMemoryNV( GLvoid *pointer )
2852
/*** GLX_MESA_agp_offset ***/
2855
Fake_glXGetAGPOffsetMESA( const GLvoid *pointer )
2862
/* silence warning */
2863
extern struct _glxapi_table *_mesa_GetGLXDispatchTable(void);
2867
* Create a new GLX API dispatch table with its function pointers
2868
* initialized to point to Mesa's "fake" GLX API functions.
2869
* Note: there's a similar function (_real_GetGLXDispatchTable) that
2870
* returns a new dispatch table with all pointers initalized to point
2871
* to "real" GLX functions (which understand GLX wire protocol, etc).
2873
struct _glxapi_table *
2874
_mesa_GetGLXDispatchTable(void)
2876
static struct _glxapi_table glx;
2878
/* be sure our dispatch table size <= libGL's table */
2880
GLuint size = sizeof(struct _glxapi_table) / sizeof(void *);
2882
assert(_glxapi_get_dispatch_table_size() >= size);
2885
/* initialize the whole table to no-ops */
2886
_glxapi_set_no_op_table(&glx);
2888
/* now initialize the table with the functions I implement */
2889
glx.ChooseVisual = Fake_glXChooseVisual;
2890
glx.CopyContext = Fake_glXCopyContext;
2891
glx.CreateContext = Fake_glXCreateContext;
2892
glx.CreateGLXPixmap = Fake_glXCreateGLXPixmap;
2893
glx.DestroyContext = Fake_glXDestroyContext;
2894
glx.DestroyGLXPixmap = Fake_glXDestroyGLXPixmap;
2895
glx.GetConfig = Fake_glXGetConfig;
2896
/*glx.GetCurrentContext = Fake_glXGetCurrentContext;*/
2897
/*glx.GetCurrentDrawable = Fake_glXGetCurrentDrawable;*/
2898
glx.IsDirect = Fake_glXIsDirect;
2899
glx.MakeCurrent = Fake_glXMakeCurrent;
2900
glx.QueryExtension = Fake_glXQueryExtension;
2901
glx.QueryVersion = Fake_glXQueryVersion;
2902
glx.SwapBuffers = Fake_glXSwapBuffers;
2903
glx.UseXFont = Fake_glXUseXFont;
2904
glx.WaitGL = Fake_glXWaitGL;
2905
glx.WaitX = Fake_glXWaitX;
2907
/*** GLX_VERSION_1_1 ***/
2908
glx.GetClientString = Fake_glXGetClientString;
2909
glx.QueryExtensionsString = Fake_glXQueryExtensionsString;
2910
glx.QueryServerString = Fake_glXQueryServerString;
2912
/*** GLX_VERSION_1_2 ***/
2913
/*glx.GetCurrentDisplay = Fake_glXGetCurrentDisplay;*/
2915
/*** GLX_VERSION_1_3 ***/
2916
glx.ChooseFBConfig = Fake_glXChooseFBConfig;
2917
glx.CreateNewContext = Fake_glXCreateNewContext;
2918
glx.CreatePbuffer = Fake_glXCreatePbuffer;
2919
glx.CreatePixmap = Fake_glXCreatePixmap;
2920
glx.CreateWindow = Fake_glXCreateWindow;
2921
glx.DestroyPbuffer = Fake_glXDestroyPbuffer;
2922
glx.DestroyPixmap = Fake_glXDestroyPixmap;
2923
glx.DestroyWindow = Fake_glXDestroyWindow;
2924
/*glx.GetCurrentReadDrawable = Fake_glXGetCurrentReadDrawable;*/
2925
glx.GetFBConfigAttrib = Fake_glXGetFBConfigAttrib;
2926
glx.GetFBConfigs = Fake_glXGetFBConfigs;
2927
glx.GetSelectedEvent = Fake_glXGetSelectedEvent;
2928
glx.GetVisualFromFBConfig = Fake_glXGetVisualFromFBConfig;
2929
glx.MakeContextCurrent = Fake_glXMakeContextCurrent;
2930
glx.QueryContext = Fake_glXQueryContext;
2931
glx.QueryDrawable = Fake_glXQueryDrawable;
2932
glx.SelectEvent = Fake_glXSelectEvent;
2934
/*** GLX_SGI_swap_control ***/
2935
glx.SwapIntervalSGI = Fake_glXSwapIntervalSGI;
2937
/*** GLX_SGI_video_sync ***/
2938
glx.GetVideoSyncSGI = Fake_glXGetVideoSyncSGI;
2939
glx.WaitVideoSyncSGI = Fake_glXWaitVideoSyncSGI;
2941
/*** GLX_SGI_make_current_read ***/
2942
glx.MakeCurrentReadSGI = Fake_glXMakeCurrentReadSGI;
2943
/*glx.GetCurrentReadDrawableSGI = Fake_glXGetCurrentReadDrawableSGI;*/
2945
/*** GLX_SGIX_video_source ***/
2947
glx.CreateGLXVideoSourceSGIX = Fake_glXCreateGLXVideoSourceSGIX;
2948
glx.DestroyGLXVideoSourceSGIX = Fake_glXDestroyGLXVideoSourceSGIX;
2951
/*** GLX_EXT_import_context ***/
2952
glx.FreeContextEXT = Fake_glXFreeContextEXT;
2953
glx.GetContextIDEXT = Fake_glXGetContextIDEXT;
2954
/*glx.GetCurrentDisplayEXT = Fake_glXGetCurrentDisplayEXT;*/
2955
glx.ImportContextEXT = Fake_glXImportContextEXT;
2956
glx.QueryContextInfoEXT = Fake_glXQueryContextInfoEXT;
2958
/*** GLX_SGIX_fbconfig ***/
2959
glx.GetFBConfigAttribSGIX = Fake_glXGetFBConfigAttribSGIX;
2960
glx.ChooseFBConfigSGIX = Fake_glXChooseFBConfigSGIX;
2961
glx.CreateGLXPixmapWithConfigSGIX = Fake_glXCreateGLXPixmapWithConfigSGIX;
2962
glx.CreateContextWithConfigSGIX = Fake_glXCreateContextWithConfigSGIX;
2963
glx.GetVisualFromFBConfigSGIX = Fake_glXGetVisualFromFBConfigSGIX;
2964
glx.GetFBConfigFromVisualSGIX = Fake_glXGetFBConfigFromVisualSGIX;
2966
/*** GLX_SGIX_pbuffer ***/
2967
glx.CreateGLXPbufferSGIX = Fake_glXCreateGLXPbufferSGIX;
2968
glx.DestroyGLXPbufferSGIX = Fake_glXDestroyGLXPbufferSGIX;
2969
glx.QueryGLXPbufferSGIX = Fake_glXQueryGLXPbufferSGIX;
2970
glx.SelectEventSGIX = Fake_glXSelectEventSGIX;
2971
glx.GetSelectedEventSGIX = Fake_glXGetSelectedEventSGIX;
2973
/*** GLX_SGI_cushion ***/
2974
glx.CushionSGI = Fake_glXCushionSGI;
2976
/*** GLX_SGIX_video_resize ***/
2977
glx.BindChannelToWindowSGIX = Fake_glXBindChannelToWindowSGIX;
2978
glx.ChannelRectSGIX = Fake_glXChannelRectSGIX;
2979
glx.QueryChannelRectSGIX = Fake_glXQueryChannelRectSGIX;
2980
glx.QueryChannelDeltasSGIX = Fake_glXQueryChannelDeltasSGIX;
2981
glx.ChannelRectSyncSGIX = Fake_glXChannelRectSyncSGIX;
2983
/*** GLX_SGIX_dmbuffer **/
2984
#if defined(_DM_BUFFER_H_)
2985
glx.AssociateDMPbufferSGIX = NULL;
2988
/*** GLX_SGIX_swap_group ***/
2989
glx.JoinSwapGroupSGIX = Fake_glXJoinSwapGroupSGIX;
2991
/*** GLX_SGIX_swap_barrier ***/
2992
glx.BindSwapBarrierSGIX = Fake_glXBindSwapBarrierSGIX;
2993
glx.QueryMaxSwapBarriersSGIX = Fake_glXQueryMaxSwapBarriersSGIX;
2995
/*** GLX_SUN_get_transparent_index ***/
2996
glx.GetTransparentIndexSUN = Fake_glXGetTransparentIndexSUN;
2998
/*** GLX_MESA_copy_sub_buffer ***/
2999
glx.CopySubBufferMESA = Fake_glXCopySubBufferMESA;
3001
/*** GLX_MESA_release_buffers ***/
3002
glx.ReleaseBuffersMESA = Fake_glXReleaseBuffersMESA;
3004
/*** GLX_MESA_pixmap_colormap ***/
3005
glx.CreateGLXPixmapMESA = Fake_glXCreateGLXPixmapMESA;
3007
/*** GLX_MESA_set_3dfx_mode ***/
3008
glx.Set3DfxModeMESA = Fake_glXSet3DfxModeMESA;
3010
/*** GLX_NV_vertex_array_range ***/
3011
glx.AllocateMemoryNV = Fake_glXAllocateMemoryNV;
3012
glx.FreeMemoryNV = Fake_glXFreeMemoryNV;
3014
/*** GLX_MESA_agp_offset ***/
3015
glx.GetAGPOffsetMESA = Fake_glXGetAGPOffsetMESA;