glxapi.h

Go to the documentation of this file.
00001 /*
00002  * Mesa 3-D graphics library
00003  * Version:  6.3
00004  * 
00005  * Copyright (C) 1999-2004  Brian Paul   All Rights Reserved.
00006  * 
00007  * Permission is hereby granted, free of charge, to any person obtaining a
00008  * copy of this software and associated documentation files (the "Software"),
00009  * to deal in the Software without restriction, including without limitation
00010  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00011  * and/or sell copies of the Software, and to permit persons to whom the
00012  * Software is furnished to do so, subject to the following conditions:
00013  * 
00014  * The above copyright notice and this permission notice shall be included
00015  * in all copies or substantial portions of the Software.
00016  * 
00017  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00018  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00019  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00020  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00021  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00022  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00023  */
00024 
00025 
00026 #ifndef _glxapi_h_
00027 #define _glxapi_h_
00028 
00029 
00030 #define GLX_GLXEXT_PROTOTYPES
00031 #include "GL/glx.h"
00032 
00033 
00034 /* The GLX API dispatcher (i.e. this code) is being built into stand-alone
00035  * Mesa.  We don't know anything about XFree86 or real GLX so we define a
00036  * minimal __GLXContextRec here so some of the functions in this file can
00037  * work properly.
00038  */
00039 typedef struct __GLXcontextRec {
00040    Display *currentDpy;
00041    GLboolean isDirect;
00042    GLXDrawable currentDrawable;
00043    GLXDrawable currentReadable;
00044    XID xid;
00045 } __GLXcontext;
00046 
00047 
00048 /*
00049  * Almost all the GLX API functions get routed through this dispatch table.
00050  * The exceptions are the glXGetCurrentXXX() functions.
00051  *
00052  * This dispatch table allows multiple GLX client-side modules to coexist.
00053  * Specifically, a real GLX library (like SGI's or the Utah GLX) and Mesa's
00054  * pseudo-GLX can be present at the same time.  The former being used on
00055  * GLX-enabled X servers and the later on non-GLX X servers.
00056  *
00057  * Red Hat has been using this since Red Hat Linux 7.0 (I think).
00058  * This'll be a standard feature in XFree86 4.3.  It basically allows one
00059  * libGL to do both DRI-rendering and "fake GLX" rendering to X displays
00060  * that lack the GLX extension.
00061  */
00062 struct _glxapi_table {
00063    /*** GLX_VERSION_1_0 ***/
00064    XVisualInfo *(*ChooseVisual)(Display *dpy, int screen, int *list);
00065    void (*CopyContext)(Display *dpy, GLXContext src, GLXContext dst, unsigned long mask);
00066    GLXContext (*CreateContext)(Display *dpy, XVisualInfo *visinfo, GLXContext shareList, Bool direct);
00067    GLXPixmap (*CreateGLXPixmap)(Display *dpy, XVisualInfo *visinfo, Pixmap pixmap);
00068    void (*DestroyContext)(Display *dpy, GLXContext ctx);
00069    void (*DestroyGLXPixmap)(Display *dpy, GLXPixmap pixmap);
00070    int (*GetConfig)(Display *dpy, XVisualInfo *visinfo, int attrib, int *value);
00071    /*GLXContext (*GetCurrentContext)(void);*/
00072    /*GLXDrawable (*GetCurrentDrawable)(void);*/
00073    Bool (*IsDirect)(Display *dpy, GLXContext ctx);
00074    Bool (*MakeCurrent)(Display *dpy, GLXDrawable drawable, GLXContext ctx);
00075    Bool (*QueryExtension)(Display *dpy, int *errorb, int *event);
00076    Bool (*QueryVersion)(Display *dpy, int *maj, int *min);
00077    void (*SwapBuffers)(Display *dpy, GLXDrawable drawable);
00078    void (*UseXFont)(Font font, int first, int count, int listBase);
00079    void (*WaitGL)(void);
00080    void (*WaitX)(void);
00081 
00082    /*** GLX_VERSION_1_1 ***/
00083    const char *(*GetClientString)(Display *dpy, int name);
00084    const char *(*QueryExtensionsString)(Display *dpy, int screen);
00085    const char *(*QueryServerString)(Display *dpy, int screen, int name);
00086 
00087    /*** GLX_VERSION_1_2 ***/
00088    /*Display *(*GetCurrentDisplay)(void);*/
00089 
00090    /*** GLX_VERSION_1_3 ***/
00091    GLXFBConfig *(*ChooseFBConfig)(Display *dpy, int screen, const int *attribList, int *nitems);
00092    GLXContext (*CreateNewContext)(Display *dpy, GLXFBConfig config, int renderType, GLXContext shareList, Bool direct);
00093    GLXPbuffer (*CreatePbuffer)(Display *dpy, GLXFBConfig config, const int *attribList);
00094    GLXPixmap (*CreatePixmap)(Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attribList);
00095    GLXWindow (*CreateWindow)(Display *dpy, GLXFBConfig config, Window win, const int *attribList);
00096    void (*DestroyPbuffer)(Display *dpy, GLXPbuffer pbuf);
00097    void (*DestroyPixmap)(Display *dpy, GLXPixmap pixmap);
00098    void (*DestroyWindow)(Display *dpy, GLXWindow window);
00099    /*GLXDrawable (*GetCurrentReadDrawable)(void);*/
00100    int (*GetFBConfigAttrib)(Display *dpy, GLXFBConfig config, int attribute, int *value);
00101    GLXFBConfig *(*GetFBConfigs)(Display *dpy, int screen, int *nelements);
00102    void (*GetSelectedEvent)(Display *dpy, GLXDrawable drawable, unsigned long *mask);
00103    XVisualInfo *(*GetVisualFromFBConfig)(Display *dpy, GLXFBConfig config);
00104    Bool (*MakeContextCurrent)(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
00105    int (*QueryContext)(Display *dpy, GLXContext ctx, int attribute, int *value);
00106    void (*QueryDrawable)(Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
00107    void (*SelectEvent)(Display *dpy, GLXDrawable drawable, unsigned long mask);
00108 
00109    /*** GLX_SGI_swap_control ***/
00110    int (*SwapIntervalSGI)(int);
00111 
00112    /*** GLX_SGI_video_sync ***/
00113    int (*GetVideoSyncSGI)(unsigned int *count);
00114    int (*WaitVideoSyncSGI)(int divisor, int remainder, unsigned int *count);
00115 
00116    /*** GLX_SGI_make_current_read ***/
00117    Bool (*MakeCurrentReadSGI)(Display *, GLXDrawable, GLXDrawable, GLXContext);
00118    /*GLXDrawable (*GetCurrentReadDrawableSGI)(void);*/
00119 
00120    /*** GLX_SGIX_video_source (needs video library) ***/
00121 #if defined(_VL_H_)
00122    GLXVideoSourceSGIX (*CreateGLXVideoSourceSGIX)(Display *, int, VLServer, VLPath, int, VLNode);
00123    void (*DestroyGLXVideoSourceSGIX)(Display *, GLXVideoSourceSGIX);
00124 #else
00125    void *CreateGLXVideoSourceSGIX;
00126    void *DestroyGLXVideoSourceSGIX;
00127 #endif
00128 
00129    /*** GLX_EXT_import_context ***/
00130    void (*FreeContextEXT)(Display *dpy, GLXContext context);
00131    GLXContextID (*GetContextIDEXT)(const GLXContext context);
00132    /*Display *(*GetCurrentDisplayEXT)(void);*/
00133    GLXContext (*ImportContextEXT)(Display *dpy, GLXContextID contextID);
00134    int (*QueryContextInfoEXT)(Display *dpy, GLXContext context, int attribute,int *value);
00135 
00136    /*** GLX_SGIX_fbconfig ***/
00137    int (*GetFBConfigAttribSGIX)(Display *, GLXFBConfigSGIX, int, int *);
00138    GLXFBConfigSGIX * (*ChooseFBConfigSGIX)(Display *, int, int *, int *);
00139    GLXPixmap (*CreateGLXPixmapWithConfigSGIX)(Display *, GLXFBConfigSGIX, Pixmap);
00140    GLXContext (*CreateContextWithConfigSGIX)(Display *, GLXFBConfigSGIX, int, GLXContext, Bool);
00141    XVisualInfo * (*GetVisualFromFBConfigSGIX)(Display *, GLXFBConfigSGIX);
00142    GLXFBConfigSGIX (*GetFBConfigFromVisualSGIX)(Display *, XVisualInfo *);
00143 
00144    /*** GLX_SGIX_pbuffer ***/
00145    GLXPbufferSGIX (*CreateGLXPbufferSGIX)(Display *, GLXFBConfigSGIX, unsigned int, unsigned int, int *);
00146    void (*DestroyGLXPbufferSGIX)(Display *, GLXPbufferSGIX);
00147    int (*QueryGLXPbufferSGIX)(Display *, GLXPbufferSGIX, int, unsigned int *);
00148    void (*SelectEventSGIX)(Display *, GLXDrawable, unsigned long);
00149    void (*GetSelectedEventSGIX)(Display *, GLXDrawable, unsigned long *);
00150 
00151    /*** GLX_SGI_cushion ***/
00152    void (*CushionSGI)(Display *, Window, float);
00153 
00154    /*** GLX_SGIX_video_resize ***/
00155    int (*BindChannelToWindowSGIX)(Display *, int, int, Window);
00156    int (*ChannelRectSGIX)(Display *, int, int, int, int, int, int);
00157    int (*QueryChannelRectSGIX)(Display *, int, int, int *, int *, int *, int *);
00158    int (*QueryChannelDeltasSGIX)(Display *, int, int, int *, int *, int *, int *);
00159    int (*ChannelRectSyncSGIX)(Display *, int, int, GLenum);
00160 
00161    /*** GLX_SGIX_dmbuffer (needs dmedia library) ***/
00162 #if defined (_DM_BUFFER_H_)
00163    Bool (*AssociateDMPbufferSGIX)(Display *, GLXPbufferSGIX, DMparams *, DMbuffer);
00164 #else
00165    void *AssociciateDMPbufferSGIX;
00166 #endif
00167 
00168    /*** GLX_SGIX_swap_group ***/
00169    void (*JoinSwapGroupSGIX)(Display *, GLXDrawable, GLXDrawable);
00170 
00171    /*** GLX_SGIX_swap_barrier ***/
00172    void (*BindSwapBarrierSGIX)(Display *, GLXDrawable, int);
00173    Bool (*QueryMaxSwapBarriersSGIX)(Display *, int, int *);
00174 
00175    /*** GLX_SUN_get_transparent_index ***/
00176    Status (*GetTransparentIndexSUN)(Display *, Window, Window, long *);
00177 
00178    /*** GLX_MESA_copy_sub_buffer ***/
00179    void (*CopySubBufferMESA)(Display *dpy, GLXDrawable drawable, int x, int y, int width, int height);
00180 
00181    /*** GLX_MESA_release_buffers ***/
00182    Bool (*ReleaseBuffersMESA)(Display *dpy, Window w);
00183 
00184    /*** GLX_MESA_pixmap_colormap ***/
00185    GLXPixmap (*CreateGLXPixmapMESA)(Display *dpy, XVisualInfo *visinfo, Pixmap pixmap, Colormap cmap);
00186 
00187    /*** GLX_MESA_set_3dfx_mode ***/
00188    Bool (*Set3DfxModeMESA)(int mode);
00189 
00190    /*** GLX_NV_vertex_array_range ***/
00191    void * (*AllocateMemoryNV)( GLsizei size,
00192                                GLfloat readFrequency,
00193                                GLfloat writeFrequency,
00194                                GLfloat priority );
00195    void (*FreeMemoryNV)( GLvoid *pointer );
00196 
00197    /*** GLX_MESA_agp_offset ***/
00198    GLuint (*GetAGPOffsetMESA)( const GLvoid *pointer );
00199 
00200    /*** GLX_EXT_texture_from_pixmap ***/
00201    void (*BindTexImageEXT)(Display *dpy, GLXDrawable drawable, int buffer,
00202                            const int *attrib_list);
00203    void (*ReleaseTexImageEXT)(Display *dpy, GLXDrawable drawable, int buffer);
00204 };
00205 
00206 
00207 
00208 extern const char *
00209 _glxapi_get_version(void);
00210 
00211 
00212 extern const char **
00213 _glxapi_get_extensions(void);
00214 
00215 
00216 extern GLuint
00217 _glxapi_get_dispatch_table_size(void);
00218 
00219 
00220 extern void
00221 _glxapi_set_no_op_table(struct _glxapi_table *t);
00222 
00223 
00224 extern __GLXextFuncPtr
00225 _glxapi_get_proc_address(const char *funcName);
00226 
00227 
00228 #endif

Generated on Tue Sep 29 06:25:17 2009 for Gallium3D by  doxygen 1.5.4