glxapi.c

Go to the documentation of this file.
00001 /*
00002  * Mesa 3-D graphics library
00003  * Version:  7.1
00004  * 
00005  * Copyright (C) 1999-2007  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 /*
00027  * This is the GLX API dispatcher.  Calls to the glX* functions are
00028  * either routed to the real GLX encoders or to Mesa's pseudo-GLX functions.
00029  * See the glxapi.h file for more details.
00030  */
00031 
00032 
00033 #include <assert.h>
00034 #include <stdlib.h>
00035 #include <stdio.h>
00036 #include <string.h>
00037 #include "main/glheader.h"
00038 #include "glapi/glapi.h"
00039 #include "glxapi.h"
00040 #include "pipe/p_thread.h"
00041 
00042 
00043 extern struct _glxapi_table *_real_GetGLXDispatchTable(void);
00044 extern struct _glxapi_table *_mesa_GetGLXDispatchTable(void);
00045 
00046 
00047 struct display_dispatch {
00048    Display *Dpy;
00049    struct _glxapi_table *Table;
00050    struct display_dispatch *Next;
00051 };
00052 
00053 static struct display_dispatch *DispatchList = NULL;
00054 
00055 
00056 /* Display -> Dispatch caching */
00057 static Display *prevDisplay = NULL;
00058 static struct _glxapi_table *prevTable = NULL;
00059 
00060 
00061 static struct _glxapi_table *
00062 get_dispatch(Display *dpy)
00063 {
00064    if (!dpy)
00065       return NULL;
00066 
00067    /* search list of display/dispatch pairs for this display */
00068    {
00069       const struct display_dispatch *d = DispatchList;
00070       while (d) {
00071          if (d->Dpy == dpy) {
00072             prevDisplay = dpy;
00073             prevTable = d->Table;
00074             return d->Table;  /* done! */
00075          }
00076          d = d->Next;
00077       }
00078    }
00079 
00080    /* A new display, determine if we should use real GLX
00081     * or Mesa's pseudo-GLX.
00082     */
00083    {
00084       struct _glxapi_table *t = _mesa_GetGLXDispatchTable();
00085 
00086       if (t) {
00087          struct display_dispatch *d;
00088          d = (struct display_dispatch *) malloc(sizeof(struct display_dispatch));
00089          if (d) {
00090             d->Dpy = dpy;
00091             d->Table = t;
00092             /* insert at head of list */
00093             d->Next = DispatchList;
00094             DispatchList = d;
00095             /* update cache */
00096             prevDisplay = dpy;
00097             prevTable = t;
00098             return t;
00099          }
00100       }
00101    }
00102 
00103    /* If we get here that means we can't use real GLX on this display
00104     * and the Mesa pseudo-GLX software renderer wasn't compiled in.
00105     * Or, we ran out of memory!
00106     */
00107    return NULL;
00108 }
00109 
00110 
00111 /* Don't use the GET_DISPATCH defined in glthread.h */
00112 #undef GET_DISPATCH
00113 
00114 #define GET_DISPATCH(DPY, TABLE)        \
00115    if (DPY == prevDisplay) {            \
00116       TABLE = prevTable;                \
00117    }                                    \
00118    else if (!DPY) {                     \
00119       TABLE = NULL;                     \
00120    }                                    \
00121    else {                               \
00122       TABLE = get_dispatch(DPY);        \
00123    }
00124 
00125    
00126 
00127 
00131 pipe_tsd ContextTSD;
00132 
00133 
00134 static void
00135 SetCurrentContext(GLXContext c)
00136 {
00137    pipe_tsd_set(&ContextTSD, c);
00138 }
00139 
00140 
00141 /*
00142  * GLX API entrypoints
00143  */
00144 
00145 /*** GLX_VERSION_1_0 ***/
00146 
00147 XVisualInfo PUBLIC *
00148 glXChooseVisual(Display *dpy, int screen, int *list)
00149 {
00150    struct _glxapi_table *t;
00151    GET_DISPATCH(dpy, t);
00152    if (!t)
00153       return NULL;
00154    return (t->ChooseVisual)(dpy, screen, list);
00155 }
00156 
00157 
00158 void PUBLIC
00159 glXCopyContext(Display *dpy, GLXContext src, GLXContext dst, unsigned long mask)
00160 {
00161    struct _glxapi_table *t;
00162    GET_DISPATCH(dpy, t);
00163    if (!t)
00164       return;
00165    (t->CopyContext)(dpy, src, dst, mask);
00166 }
00167 
00168 
00169 GLXContext PUBLIC
00170 glXCreateContext(Display *dpy, XVisualInfo *visinfo, GLXContext shareList, Bool direct)
00171 {
00172    struct _glxapi_table *t;
00173    GET_DISPATCH(dpy, t);
00174    if (!t)
00175       return 0;
00176    return (t->CreateContext)(dpy, visinfo, shareList, direct);
00177 }
00178 
00179 
00180 GLXPixmap PUBLIC
00181 glXCreateGLXPixmap(Display *dpy, XVisualInfo *visinfo, Pixmap pixmap)
00182 {
00183    struct _glxapi_table *t;
00184    GET_DISPATCH(dpy, t);
00185    if (!t)
00186       return 0;
00187    return (t->CreateGLXPixmap)(dpy, visinfo, pixmap);
00188 }
00189 
00190 
00191 void PUBLIC
00192 glXDestroyContext(Display *dpy, GLXContext ctx)
00193 {
00194    struct _glxapi_table *t;
00195    GET_DISPATCH(dpy, t);
00196    if (!t)
00197       return;
00198    if (glXGetCurrentContext() == ctx)
00199       SetCurrentContext(NULL);
00200    (t->DestroyContext)(dpy, ctx);
00201 }
00202 
00203 
00204 void PUBLIC
00205 glXDestroyGLXPixmap(Display *dpy, GLXPixmap pixmap)
00206 {
00207    struct _glxapi_table *t;
00208    GET_DISPATCH(dpy, t);
00209    if (!t)
00210       return;
00211    (t->DestroyGLXPixmap)(dpy, pixmap);
00212 }
00213 
00214 
00215 int PUBLIC
00216 glXGetConfig(Display *dpy, XVisualInfo *visinfo, int attrib, int *value)
00217 {
00218    struct _glxapi_table *t;
00219    GET_DISPATCH(dpy, t);
00220    if (!t)
00221       return GLX_NO_EXTENSION;
00222    return (t->GetConfig)(dpy, visinfo, attrib, value);
00223 }
00224 
00225 
00226 GLXContext PUBLIC
00227 glXGetCurrentContext(void)
00228 {
00229    return (GLXContext) pipe_tsd_get(&ContextTSD);
00230 }
00231 
00232 
00233 GLXDrawable PUBLIC
00234 glXGetCurrentDrawable(void)
00235 {
00236    __GLXcontext *gc = (__GLXcontext *) glXGetCurrentContext();
00237    return gc ? gc->currentDrawable : 0;
00238 }
00239 
00240 
00241 Bool PUBLIC
00242 glXIsDirect(Display *dpy, GLXContext ctx)
00243 {
00244    struct _glxapi_table *t;
00245    GET_DISPATCH(dpy, t);
00246    if (!t)
00247       return False;
00248    return (t->IsDirect)(dpy, ctx);
00249 }
00250 
00251 
00252 Bool PUBLIC
00253 glXMakeCurrent(Display *dpy, GLXDrawable drawable, GLXContext ctx)
00254 {
00255    Bool b;
00256    struct _glxapi_table *t;
00257    GET_DISPATCH(dpy, t);
00258    if (!t) {
00259       return False;
00260    }
00261    b = (*t->MakeCurrent)(dpy, drawable, ctx);
00262    if (b) {
00263       SetCurrentContext(ctx);
00264    }
00265    return b;
00266 }
00267 
00268 
00269 Bool PUBLIC
00270 glXQueryExtension(Display *dpy, int *errorb, int *event)
00271 {
00272    struct _glxapi_table *t;
00273    GET_DISPATCH(dpy, t);
00274    if (!t)
00275       return False;
00276    return (t->QueryExtension)(dpy, errorb, event);
00277 }
00278 
00279 
00280 Bool PUBLIC
00281 glXQueryVersion(Display *dpy, int *maj, int *min)
00282 {
00283    struct _glxapi_table *t;
00284    GET_DISPATCH(dpy, t);
00285    if (!t)
00286       return False;
00287    return (t->QueryVersion)(dpy, maj, min);
00288 }
00289 
00290 
00291 void PUBLIC
00292 glXSwapBuffers(Display *dpy, GLXDrawable drawable)
00293 {
00294    struct _glxapi_table *t;
00295    GET_DISPATCH(dpy, t);
00296    if (!t)
00297       return;
00298    (t->SwapBuffers)(dpy, drawable);
00299 }
00300 
00301 
00302 void PUBLIC
00303 glXUseXFont(Font font, int first, int count, int listBase)
00304 {
00305    struct _glxapi_table *t;
00306    Display *dpy = glXGetCurrentDisplay();
00307    GET_DISPATCH(dpy, t);
00308    if (!t)
00309       return;
00310    (t->UseXFont)(font, first, count, listBase);
00311 }
00312 
00313 
00314 void PUBLIC
00315 glXWaitGL(void)
00316 {
00317    struct _glxapi_table *t;
00318    Display *dpy = glXGetCurrentDisplay();
00319    GET_DISPATCH(dpy, t);
00320    if (!t)
00321       return;
00322    (t->WaitGL)();
00323 }
00324 
00325 
00326 void PUBLIC
00327 glXWaitX(void)
00328 {
00329    struct _glxapi_table *t;
00330    Display *dpy = glXGetCurrentDisplay();
00331    GET_DISPATCH(dpy, t);
00332    if (!t)
00333       return;
00334    (t->WaitX)();
00335 }
00336 
00337 
00338 
00339 /*** GLX_VERSION_1_1 ***/
00340 
00341 const char PUBLIC *
00342 glXGetClientString(Display *dpy, int name)
00343 {
00344    struct _glxapi_table *t;
00345    GET_DISPATCH(dpy, t);
00346    if (!t)
00347       return NULL;
00348    return (t->GetClientString)(dpy, name);
00349 }
00350 
00351 
00352 const char PUBLIC *
00353 glXQueryExtensionsString(Display *dpy, int screen)
00354 {
00355    struct _glxapi_table *t;
00356    GET_DISPATCH(dpy, t);
00357    if (!t)
00358       return NULL;
00359    return (t->QueryExtensionsString)(dpy, screen);
00360 }
00361 
00362 
00363 const char PUBLIC *
00364 glXQueryServerString(Display *dpy, int screen, int name)
00365 {
00366    struct _glxapi_table *t;
00367    GET_DISPATCH(dpy, t);
00368    if (!t)
00369       return NULL;
00370    return (t->QueryServerString)(dpy, screen, name);
00371 }
00372 
00373 
00374 /*** GLX_VERSION_1_2 ***/
00375 
00376 Display PUBLIC *
00377 glXGetCurrentDisplay(void)
00378 {
00379    /* Same code as in libGL's glxext.c */
00380    __GLXcontext *gc = (__GLXcontext *) glXGetCurrentContext();
00381    if (NULL == gc) return NULL;
00382    return gc->currentDpy;
00383 }
00384 
00385 
00386 
00387 /*** GLX_VERSION_1_3 ***/
00388 
00389 GLXFBConfig PUBLIC *
00390 glXChooseFBConfig(Display *dpy, int screen, const int *attribList, int *nitems)
00391 {
00392    struct _glxapi_table *t;
00393    GET_DISPATCH(dpy, t);
00394    if (!t)
00395       return 0;
00396    return (t->ChooseFBConfig)(dpy, screen, attribList, nitems);
00397 }
00398 
00399 
00400 GLXContext PUBLIC
00401 glXCreateNewContext(Display *dpy, GLXFBConfig config, int renderType, GLXContext shareList, Bool direct)
00402 {
00403    struct _glxapi_table *t;
00404    GET_DISPATCH(dpy, t);
00405    if (!t)
00406       return 0;
00407    return (t->CreateNewContext)(dpy, config, renderType, shareList, direct);
00408 }
00409 
00410 
00411 GLXPbuffer PUBLIC
00412 glXCreatePbuffer(Display *dpy, GLXFBConfig config, const int *attribList)
00413 {
00414    struct _glxapi_table *t;
00415    GET_DISPATCH(dpy, t);
00416    if (!t)
00417       return 0;
00418    return (t->CreatePbuffer)(dpy, config, attribList);
00419 }
00420 
00421 
00422 GLXPixmap PUBLIC
00423 glXCreatePixmap(Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attribList)
00424 {
00425    struct _glxapi_table *t;
00426    GET_DISPATCH(dpy, t);
00427    if (!t)
00428       return 0;
00429    return (t->CreatePixmap)(dpy, config, pixmap, attribList);
00430 }
00431 
00432 
00433 GLXWindow PUBLIC
00434 glXCreateWindow(Display *dpy, GLXFBConfig config, Window win, const int *attribList)
00435 {
00436    struct _glxapi_table *t;
00437    GET_DISPATCH(dpy, t);
00438    if (!t)
00439       return 0;
00440    return (t->CreateWindow)(dpy, config, win, attribList);
00441 }
00442 
00443 
00444 void PUBLIC
00445 glXDestroyPbuffer(Display *dpy, GLXPbuffer pbuf)
00446 {
00447    struct _glxapi_table *t;
00448    GET_DISPATCH(dpy, t);
00449    if (!t)
00450       return;
00451    (t->DestroyPbuffer)(dpy, pbuf);
00452 }
00453 
00454 
00455 void PUBLIC
00456 glXDestroyPixmap(Display *dpy, GLXPixmap pixmap)
00457 {
00458    struct _glxapi_table *t;
00459    GET_DISPATCH(dpy, t);
00460    if (!t)
00461       return;
00462    (t->DestroyPixmap)(dpy, pixmap);
00463 }
00464 
00465 
00466 void PUBLIC
00467 glXDestroyWindow(Display *dpy, GLXWindow window)
00468 {
00469    struct _glxapi_table *t;
00470    GET_DISPATCH(dpy, t);
00471    if (!t)
00472       return;
00473    (t->DestroyWindow)(dpy, window);
00474 }
00475 
00476 
00477 GLXDrawable PUBLIC
00478 glXGetCurrentReadDrawable(void)
00479 {
00480    __GLXcontext *gc = (__GLXcontext *) glXGetCurrentContext();
00481    return gc ? gc->currentReadable : 0;
00482 }
00483 
00484 
00485 int PUBLIC
00486 glXGetFBConfigAttrib(Display *dpy, GLXFBConfig config, int attribute, int *value)
00487 {
00488    struct _glxapi_table *t;
00489    GET_DISPATCH(dpy, t);
00490    if (!t)
00491       return GLX_NO_EXTENSION;
00492    return (t->GetFBConfigAttrib)(dpy, config, attribute, value);
00493 }
00494 
00495 
00496 GLXFBConfig PUBLIC *
00497 glXGetFBConfigs(Display *dpy, int screen, int *nelements)
00498 {
00499    struct _glxapi_table *t;
00500    GET_DISPATCH(dpy, t);
00501    if (!t)
00502       return 0;
00503    return (t->GetFBConfigs)(dpy, screen, nelements);
00504 }
00505 
00506 void PUBLIC
00507 glXGetSelectedEvent(Display *dpy, GLXDrawable drawable, unsigned long *mask)
00508 {
00509    struct _glxapi_table *t;
00510    GET_DISPATCH(dpy, t);
00511    if (!t)
00512       return;
00513    (t->GetSelectedEvent)(dpy, drawable, mask);
00514 }
00515 
00516 
00517 XVisualInfo PUBLIC *
00518 glXGetVisualFromFBConfig(Display *dpy, GLXFBConfig config)
00519 {
00520    struct _glxapi_table *t;
00521    GET_DISPATCH(dpy, t);
00522    if (!t)
00523       return NULL;
00524    return (t->GetVisualFromFBConfig)(dpy, config);
00525 }
00526 
00527 
00528 Bool PUBLIC
00529 glXMakeContextCurrent(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx)
00530 {
00531    Bool b;
00532    struct _glxapi_table *t;
00533    GET_DISPATCH(dpy, t);
00534    if (!t)
00535       return False;
00536    b = (t->MakeContextCurrent)(dpy, draw, read, ctx);
00537    if (b) {
00538       SetCurrentContext(ctx);
00539    }
00540    return b;
00541 }
00542 
00543 
00544 int PUBLIC
00545 glXQueryContext(Display *dpy, GLXContext ctx, int attribute, int *value)
00546 {
00547    struct _glxapi_table *t;
00548    GET_DISPATCH(dpy, t);
00549    assert(t);
00550    if (!t)
00551       return 0; /* XXX correct? */
00552    return (t->QueryContext)(dpy, ctx, attribute, value);
00553 }
00554 
00555 
00556 void PUBLIC
00557 glXQueryDrawable(Display *dpy, GLXDrawable draw, int attribute, unsigned int *value)
00558 {
00559    struct _glxapi_table *t;
00560    GET_DISPATCH(dpy, t);
00561    if (!t)
00562       return;
00563    (t->QueryDrawable)(dpy, draw, attribute, value);
00564 }
00565 
00566 
00567 void PUBLIC
00568 glXSelectEvent(Display *dpy, GLXDrawable drawable, unsigned long mask)
00569 {
00570    struct _glxapi_table *t;
00571    GET_DISPATCH(dpy, t);
00572    if (!t)
00573       return;
00574    (t->SelectEvent)(dpy, drawable, mask);
00575 }
00576 
00577 
00578 
00579 /*** GLX_SGI_swap_control ***/
00580 
00581 int PUBLIC
00582 glXSwapIntervalSGI(int interval)
00583 {
00584    struct _glxapi_table *t;
00585    Display *dpy = glXGetCurrentDisplay();
00586    GET_DISPATCH(dpy, t);
00587    if (!t)
00588       return 0;
00589    return (t->SwapIntervalSGI)(interval);
00590 }
00591 
00592 
00593 
00594 /*** GLX_SGI_video_sync ***/
00595 
00596 int PUBLIC
00597 glXGetVideoSyncSGI(unsigned int *count)
00598 {
00599    struct _glxapi_table *t;
00600    Display *dpy = glXGetCurrentDisplay();
00601    GET_DISPATCH(dpy, t);
00602    if (!t || !glXGetCurrentContext())
00603       return GLX_BAD_CONTEXT;
00604    return (t->GetVideoSyncSGI)(count);
00605 }
00606 
00607 int PUBLIC
00608 glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count)
00609 {
00610    struct _glxapi_table *t;
00611    Display *dpy = glXGetCurrentDisplay();
00612    GET_DISPATCH(dpy, t);
00613    if (!t || !glXGetCurrentContext())
00614       return GLX_BAD_CONTEXT;
00615    return (t->WaitVideoSyncSGI)(divisor, remainder, count);
00616 }
00617 
00618 
00619 
00620 /*** GLX_SGI_make_current_read ***/
00621 
00622 Bool PUBLIC
00623 glXMakeCurrentReadSGI(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx)
00624 {
00625    struct _glxapi_table *t;
00626    GET_DISPATCH(dpy, t);
00627    if (!t)
00628       return False;
00629    return (t->MakeCurrentReadSGI)(dpy, draw, read, ctx);
00630 }
00631 
00632 GLXDrawable PUBLIC
00633 glXGetCurrentReadDrawableSGI(void)
00634 {
00635    return glXGetCurrentReadDrawable();
00636 }
00637 
00638 
00639 #if defined(_VL_H)
00640 
00641 GLXVideoSourceSGIX PUBLIC
00642 glXCreateGLXVideoSourceSGIX(Display *dpy, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode)
00643 {
00644    struct _glxapi_table *t;
00645    GET_DISPATCH(dpy, t);
00646    if (!t)
00647       return 0;
00648    return (t->CreateGLXVideoSourceSGIX)(dpy, screen, server, path, nodeClass, drainNode);
00649 }
00650 
00651 void PUBLIC
00652 glXDestroyGLXVideoSourceSGIX(Display *dpy, GLXVideoSourceSGIX src)
00653 {
00654    struct _glxapi_table *t;
00655    GET_DISPATCH(dpy, t);
00656    if (!t)
00657       return 0;
00658    return (t->DestroyGLXVideoSourceSGIX)(dpy, src);
00659 }
00660 
00661 #endif
00662 
00663 
00664 /*** GLX_EXT_import_context ***/
00665 
00666 void PUBLIC
00667 glXFreeContextEXT(Display *dpy, GLXContext context)
00668 {
00669    struct _glxapi_table *t;
00670    GET_DISPATCH(dpy, t);
00671    if (!t)
00672       return;
00673    (t->FreeContextEXT)(dpy, context);
00674 }
00675 
00676 GLXContextID PUBLIC
00677 glXGetContextIDEXT(const GLXContext context)
00678 {
00679    return ((__GLXcontext *) context)->xid;
00680 }
00681 
00682 Display PUBLIC *
00683 glXGetCurrentDisplayEXT(void)
00684 {
00685    return glXGetCurrentDisplay();
00686 }
00687 
00688 GLXContext PUBLIC
00689 glXImportContextEXT(Display *dpy, GLXContextID contextID)
00690 {
00691    struct _glxapi_table *t;
00692    GET_DISPATCH(dpy, t);
00693    if (!t)
00694       return 0;
00695    return (t->ImportContextEXT)(dpy, contextID);
00696 }
00697 
00698 int PUBLIC
00699 glXQueryContextInfoEXT(Display *dpy, GLXContext context, int attribute,int *value)
00700 {
00701    struct _glxapi_table *t;
00702    GET_DISPATCH(dpy, t);
00703    if (!t)
00704       return 0;  /* XXX ok? */
00705    return (t->QueryContextInfoEXT)(dpy, context, attribute, value);
00706 }
00707 
00708 
00709 
00710 /*** GLX_SGIX_fbconfig ***/
00711 
00712 int PUBLIC
00713 glXGetFBConfigAttribSGIX(Display *dpy, GLXFBConfigSGIX config, int attribute, int *value)
00714 {
00715    struct _glxapi_table *t;
00716    GET_DISPATCH(dpy, t);
00717    if (!t)
00718       return 0;
00719    return (t->GetFBConfigAttribSGIX)(dpy, config, attribute, value);
00720 }
00721 
00722 GLXFBConfigSGIX PUBLIC *
00723 glXChooseFBConfigSGIX(Display *dpy, int screen, int *attrib_list, int *nelements)
00724 {
00725    struct _glxapi_table *t;
00726    GET_DISPATCH(dpy, t);
00727    if (!t)
00728       return 0;
00729    return (t->ChooseFBConfigSGIX)(dpy, screen, attrib_list, nelements);
00730 }
00731 
00732 GLXPixmap PUBLIC
00733 glXCreateGLXPixmapWithConfigSGIX(Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap)
00734 {
00735    struct _glxapi_table *t;
00736    GET_DISPATCH(dpy, t);
00737    if (!t)
00738       return 0;
00739    return (t->CreateGLXPixmapWithConfigSGIX)(dpy, config, pixmap);
00740 }
00741 
00742 GLXContext PUBLIC
00743 glXCreateContextWithConfigSGIX(Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct)
00744 {
00745    struct _glxapi_table *t;
00746    GET_DISPATCH(dpy, t);
00747    if (!t)
00748       return 0;
00749    return (t->CreateContextWithConfigSGIX)(dpy, config, render_type, share_list, direct);
00750 }
00751 
00752 XVisualInfo PUBLIC *
00753 glXGetVisualFromFBConfigSGIX(Display *dpy, GLXFBConfigSGIX config)
00754 {
00755    struct _glxapi_table *t;
00756    GET_DISPATCH(dpy, t);
00757    if (!t)
00758       return 0;
00759    return (t->GetVisualFromFBConfigSGIX)(dpy, config);
00760 }
00761 
00762 GLXFBConfigSGIX PUBLIC
00763 glXGetFBConfigFromVisualSGIX(Display *dpy, XVisualInfo *vis)
00764 {
00765    struct _glxapi_table *t;
00766    GET_DISPATCH(dpy, t);
00767    if (!t)
00768       return 0;
00769    return (t->GetFBConfigFromVisualSGIX)(dpy, vis);
00770 }
00771 
00772 
00773 
00774 /*** GLX_SGIX_pbuffer ***/
00775 
00776 GLXPbufferSGIX PUBLIC
00777 glXCreateGLXPbufferSGIX(Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list)
00778 {
00779    struct _glxapi_table *t;
00780    GET_DISPATCH(dpy, t);
00781    if (!t)
00782       return 0;
00783    return (t->CreateGLXPbufferSGIX)(dpy, config, width, height, attrib_list);
00784 }
00785 
00786 void PUBLIC
00787 glXDestroyGLXPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuf)
00788 {
00789    struct _glxapi_table *t;
00790    GET_DISPATCH(dpy, t);
00791    if (!t)
00792       return;
00793    (t->DestroyGLXPbufferSGIX)(dpy, pbuf);
00794 }
00795 
00796 int PUBLIC
00797 glXQueryGLXPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value)
00798 {
00799    struct _glxapi_table *t;
00800    GET_DISPATCH(dpy, t);
00801    if (!t)
00802       return 0;
00803    return (t->QueryGLXPbufferSGIX)(dpy, pbuf, attribute, value);
00804 }
00805 
00806 void PUBLIC
00807 glXSelectEventSGIX(Display *dpy, GLXDrawable drawable, unsigned long mask)
00808 {
00809    struct _glxapi_table *t;
00810    GET_DISPATCH(dpy, t);
00811    if (!t)
00812       return;
00813    (t->SelectEventSGIX)(dpy, drawable, mask);
00814 }
00815 
00816 void PUBLIC
00817 glXGetSelectedEventSGIX(Display *dpy, GLXDrawable drawable, unsigned long *mask)
00818 {
00819    struct _glxapi_table *t;
00820    GET_DISPATCH(dpy, t);
00821    if (!t)
00822       return;
00823    (t->GetSelectedEventSGIX)(dpy, drawable, mask);
00824 }
00825 
00826 
00827 
00828 /*** GLX_SGI_cushion ***/
00829 
00830 void PUBLIC
00831 glXCushionSGI(Display *dpy, Window win, float cushion)
00832 {
00833    struct _glxapi_table *t;
00834    GET_DISPATCH(dpy, t);
00835    if (!t)
00836       return;
00837    (t->CushionSGI)(dpy, win, cushion);
00838 }
00839 
00840 
00841 
00842 /*** GLX_SGIX_video_resize ***/
00843 
00844 int PUBLIC
00845 glXBindChannelToWindowSGIX(Display *dpy, int screen, int channel , Window window)
00846 {
00847    struct _glxapi_table *t;
00848    GET_DISPATCH(dpy, t);
00849    if (!t)
00850       return 0;
00851    return (t->BindChannelToWindowSGIX)(dpy, screen, channel, window);
00852 }
00853 
00854 int PUBLIC
00855 glXChannelRectSGIX(Display *dpy, int screen, int channel, int x, int y, int w, int h)
00856 {
00857    struct _glxapi_table *t;
00858    GET_DISPATCH(dpy, t);
00859    if (!t)
00860       return 0;
00861    return (t->ChannelRectSGIX)(dpy, screen, channel, x, y, w, h);
00862 }
00863 
00864 int PUBLIC
00865 glXQueryChannelRectSGIX(Display *dpy, int screen, int channel, int *x, int *y, int *w, int *h)
00866 {
00867    struct _glxapi_table *t;
00868    GET_DISPATCH(dpy, t);
00869    if (!t)
00870       return 0;
00871    return (t->QueryChannelRectSGIX)(dpy, screen, channel, x, y, w, h);
00872 }
00873 
00874 int PUBLIC
00875 glXQueryChannelDeltasSGIX(Display *dpy, int screen, int channel, int *dx, int *dy, int *dw, int *dh)
00876 {
00877    struct _glxapi_table *t;
00878    GET_DISPATCH(dpy, t);
00879    if (!t)
00880       return 0;
00881    return (t->QueryChannelDeltasSGIX)(dpy, screen, channel, dx, dy, dw, dh);
00882 }
00883 
00884 int PUBLIC
00885 glXChannelRectSyncSGIX(Display *dpy, int screen, int channel, GLenum synctype)
00886 {
00887    struct _glxapi_table *t;
00888    GET_DISPATCH(dpy, t);
00889    if (!t)
00890       return 0;
00891    return (t->ChannelRectSyncSGIX)(dpy, screen, channel, synctype);
00892 }
00893 
00894 
00895 
00896 #if defined(_DM_BUFFER_H_)
00897 
00898 Bool PUBLIC
00899 glXAssociateDMPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer)
00900 {
00901    struct _glxapi_table *t;
00902    GET_DISPATCH(dpy, t);
00903    if (!t)
00904       return False;
00905    return (t->AssociateDMPbufferSGIX)(dpy, pbuffer, params, dmbuffer);
00906 }
00907 
00908 #endif
00909 
00910 
00911 /*** GLX_SGIX_swap_group ***/
00912 
00913 void PUBLIC
00914 glXJoinSwapGroupSGIX(Display *dpy, GLXDrawable drawable, GLXDrawable member)
00915 {
00916    struct _glxapi_table *t;
00917    GET_DISPATCH(dpy, t);
00918    if (!t)
00919       return;
00920    (*t->JoinSwapGroupSGIX)(dpy, drawable, member);
00921 }
00922 
00923 
00924 /*** GLX_SGIX_swap_barrier ***/
00925 
00926 void PUBLIC
00927 glXBindSwapBarrierSGIX(Display *dpy, GLXDrawable drawable, int barrier)
00928 {
00929    struct _glxapi_table *t;
00930    GET_DISPATCH(dpy, t);
00931    if (!t)
00932       return;
00933    (*t->BindSwapBarrierSGIX)(dpy, drawable, barrier);
00934 }
00935 
00936 Bool PUBLIC
00937 glXQueryMaxSwapBarriersSGIX(Display *dpy, int screen, int *max)
00938 {
00939    struct _glxapi_table *t;
00940    GET_DISPATCH(dpy, t);
00941    if (!t)
00942       return False;
00943    return (*t->QueryMaxSwapBarriersSGIX)(dpy, screen, max);
00944 }
00945 
00946 
00947 
00948 /*** GLX_SUN_get_transparent_index ***/
00949 
00950 Status PUBLIC
00951 glXGetTransparentIndexSUN(Display *dpy, Window overlay, Window underlay, long *pTransparent)
00952 {
00953    struct _glxapi_table *t;
00954    GET_DISPATCH(dpy, t);
00955    if (!t)
00956       return False;
00957    return (*t->GetTransparentIndexSUN)(dpy, overlay, underlay, pTransparent);
00958 }
00959 
00960 
00961 
00962 /*** GLX_MESA_copy_sub_buffer ***/
00963 
00964 void PUBLIC
00965 glXCopySubBufferMESA(Display *dpy, GLXDrawable drawable, int x, int y, int width, int height)
00966 {
00967    struct _glxapi_table *t;
00968    GET_DISPATCH(dpy, t);
00969    if (!t)
00970       return;
00971    (t->CopySubBufferMESA)(dpy, drawable, x, y, width, height);
00972 }
00973 
00974 
00975 
00976 /*** GLX_MESA_release_buffers ***/
00977 
00978 Bool PUBLIC
00979 glXReleaseBuffersMESA(Display *dpy, Window w)
00980 {
00981    struct _glxapi_table *t;
00982    GET_DISPATCH(dpy, t);
00983    if (!t)
00984       return False;
00985    return (t->ReleaseBuffersMESA)(dpy, w);
00986 }
00987 
00988 
00989 
00990 /*** GLX_MESA_pixmap_colormap ***/
00991 
00992 GLXPixmap PUBLIC
00993 glXCreateGLXPixmapMESA(Display *dpy, XVisualInfo *visinfo, Pixmap pixmap, Colormap cmap)
00994 {
00995    struct _glxapi_table *t;
00996    GET_DISPATCH(dpy, t);
00997    if (!t)
00998       return 0;
00999    return (t->CreateGLXPixmapMESA)(dpy, visinfo, pixmap, cmap);
01000 }
01001 
01002 
01003 
01004 /*** GLX_MESA_set_3dfx_mode ***/
01005 
01006 Bool PUBLIC
01007 glXSet3DfxModeMESA(int mode)
01008 {
01009    struct _glxapi_table *t;
01010    Display *dpy = glXGetCurrentDisplay();
01011    GET_DISPATCH(dpy, t);
01012    if (!t)
01013       return False;
01014    return (t->Set3DfxModeMESA)(mode);
01015 }
01016 
01017 
01018 
01019 /*** GLX_NV_vertex_array_range ***/
01020 
01021 void PUBLIC *
01022 glXAllocateMemoryNV( GLsizei size,
01023                      GLfloat readFrequency,
01024                      GLfloat writeFrequency,
01025                      GLfloat priority )
01026 {
01027    struct _glxapi_table *t;
01028    Display *dpy = glXGetCurrentDisplay();
01029    GET_DISPATCH(dpy, t);
01030    if (!t)
01031       return NULL;
01032    return (t->AllocateMemoryNV)(size, readFrequency, writeFrequency, priority);
01033 }
01034 
01035 
01036 void PUBLIC
01037 glXFreeMemoryNV( GLvoid *pointer )
01038 {
01039    struct _glxapi_table *t;
01040    Display *dpy = glXGetCurrentDisplay();
01041    GET_DISPATCH(dpy, t);
01042    if (!t)
01043       return;
01044    (t->FreeMemoryNV)(pointer);
01045 }
01046 
01047 
01048 
01049 
01050 /*** GLX_MESA_agp_offset */
01051 
01052 GLuint PUBLIC
01053 glXGetAGPOffsetMESA( const GLvoid *pointer )
01054 {
01055    struct _glxapi_table *t;
01056    Display *dpy = glXGetCurrentDisplay();
01057    GET_DISPATCH(dpy, t);
01058    if (!t)
01059       return ~0;
01060    return (t->GetAGPOffsetMESA)(pointer);
01061 }
01062 
01063 
01064 /*** GLX_MESA_allocate_memory */
01065 
01066 void *
01067 glXAllocateMemoryMESA(Display *dpy, int scrn, size_t size,
01068                       float readfreq, float writefreq, float priority)
01069 {
01070    /* dummy */
01071    return NULL;
01072 }
01073 
01074 void
01075 glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer)
01076 {
01077    /* dummy */
01078 }
01079 
01080 
01081 GLuint
01082 glXGetMemoryOffsetMESA(Display *dpy, int scrn, const void *pointer)
01083 {
01084    /* dummy */
01085    return 0;
01086 }
01087 
01088 
01089 /*** GLX_EXT_texture_from_pixmap */
01090 
01091 void
01092 glXBindTexImageEXT(Display *dpy, GLXDrawable drawable, int buffer,
01093                    const int *attrib_list)
01094 {
01095    struct _glxapi_table *t;
01096    GET_DISPATCH(dpy, t);
01097    if (t)
01098       t->BindTexImageEXT(dpy, drawable, buffer, attrib_list);
01099 }
01100 
01101 void
01102 glXReleaseTexImageEXT(Display *dpy, GLXDrawable drawable, int buffer)
01103 {
01104    struct _glxapi_table *t;
01105    GET_DISPATCH(dpy, t);
01106    if (t)
01107       t->ReleaseTexImageEXT(dpy, drawable, buffer);
01108 }
01109 
01110 
01111 /**********************************************************************/
01112 /* GLX API management functions                                       */
01113 /**********************************************************************/
01114 
01115 
01116 const char *
01117 _glxapi_get_version(void)
01118 {
01119    return "1.3";
01120 }
01121 
01122 
01123 /*
01124  * Return array of extension strings.
01125  */
01126 const char **
01127 _glxapi_get_extensions(void)
01128 {
01129    static const char *extensions[] = {
01130 #ifdef GLX_EXT_import_context
01131       "GLX_EXT_import_context",
01132 #endif
01133 #ifdef GLX_SGI_video_sync
01134       "GLX_SGI_video_sync",
01135 #endif
01136 #ifdef GLX_MESA_copy_sub_buffer
01137       "GLX_MESA_copy_sub_buffer",
01138 #endif
01139 #ifdef GLX_MESA_release_buffers
01140       "GLX_MESA_release_buffers",
01141 #endif
01142 #ifdef GLX_MESA_pixmap_colormap
01143       "GLX_MESA_pixmap_colormap",
01144 #endif
01145 #ifdef GLX_MESA_set_3dfx_mode
01146       "GLX_MESA_set_3dfx_mode",
01147 #endif
01148 #ifdef GLX_SGIX_fbconfig
01149       "GLX_SGIX_fbconfig",
01150 #endif
01151 #ifdef GLX_SGIX_pbuffer
01152       "GLX_SGIX_pbuffer",
01153 #endif
01154 #ifdef GLX_EXT_texture_from_pixmap
01155       "GLX_EXT_texture_from_pixmap",
01156 #endif
01157       NULL
01158    };
01159    return extensions;
01160 }
01161 
01162 
01163 /*
01164  * Return size of the GLX dispatch table, in entries, not bytes.
01165  */
01166 GLuint
01167 _glxapi_get_dispatch_table_size(void)
01168 {
01169    return sizeof(struct _glxapi_table) / sizeof(void *);
01170 }
01171 
01172 
01173 static int
01174 generic_no_op_func(void)
01175 {
01176    return 0;
01177 }
01178 
01179 
01180 /*
01181  * Initialize all functions in given dispatch table to be no-ops
01182  */
01183 void
01184 _glxapi_set_no_op_table(struct _glxapi_table *t)
01185 {
01186    typedef int (*nop_func)(void);
01187    nop_func *dispatch = (nop_func *) t;
01188    GLuint n = _glxapi_get_dispatch_table_size();
01189    GLuint i;
01190    for (i = 0; i < n; i++) {
01191       dispatch[i] = generic_no_op_func;
01192    }
01193 }
01194 
01195 
01196 struct name_address_pair {
01197    const char *Name;
01198    __GLXextFuncPtr Address;
01199 };
01200 
01201 static struct name_address_pair GLX_functions[] = {
01202    /*** GLX_VERSION_1_0 ***/
01203    { "glXChooseVisual", (__GLXextFuncPtr) glXChooseVisual },
01204    { "glXCopyContext", (__GLXextFuncPtr) glXCopyContext },
01205    { "glXCreateContext", (__GLXextFuncPtr) glXCreateContext },
01206    { "glXCreateGLXPixmap", (__GLXextFuncPtr) glXCreateGLXPixmap },
01207    { "glXDestroyContext", (__GLXextFuncPtr) glXDestroyContext },
01208    { "glXDestroyGLXPixmap", (__GLXextFuncPtr) glXDestroyGLXPixmap },
01209    { "glXGetConfig", (__GLXextFuncPtr) glXGetConfig },
01210    { "glXGetCurrentContext", (__GLXextFuncPtr) glXGetCurrentContext },
01211    { "glXGetCurrentDrawable", (__GLXextFuncPtr) glXGetCurrentDrawable },
01212    { "glXIsDirect", (__GLXextFuncPtr) glXIsDirect },
01213    { "glXMakeCurrent", (__GLXextFuncPtr) glXMakeCurrent },
01214    { "glXQueryExtension", (__GLXextFuncPtr) glXQueryExtension },
01215    { "glXQueryVersion", (__GLXextFuncPtr) glXQueryVersion },
01216    { "glXSwapBuffers", (__GLXextFuncPtr) glXSwapBuffers },
01217    { "glXUseXFont", (__GLXextFuncPtr) glXUseXFont },
01218    { "glXWaitGL", (__GLXextFuncPtr) glXWaitGL },
01219    { "glXWaitX", (__GLXextFuncPtr) glXWaitX },
01220 
01221    /*** GLX_VERSION_1_1 ***/
01222    { "glXGetClientString", (__GLXextFuncPtr) glXGetClientString },
01223    { "glXQueryExtensionsString", (__GLXextFuncPtr) glXQueryExtensionsString },
01224    { "glXQueryServerString", (__GLXextFuncPtr) glXQueryServerString },
01225 
01226    /*** GLX_VERSION_1_2 ***/
01227    { "glXGetCurrentDisplay", (__GLXextFuncPtr) glXGetCurrentDisplay },
01228 
01229    /*** GLX_VERSION_1_3 ***/
01230    { "glXChooseFBConfig", (__GLXextFuncPtr) glXChooseFBConfig },
01231    { "glXCreateNewContext", (__GLXextFuncPtr) glXCreateNewContext },
01232    { "glXCreatePbuffer", (__GLXextFuncPtr) glXCreatePbuffer },
01233    { "glXCreatePixmap", (__GLXextFuncPtr) glXCreatePixmap },
01234    { "glXCreateWindow", (__GLXextFuncPtr) glXCreateWindow },
01235    { "glXDestroyPbuffer", (__GLXextFuncPtr) glXDestroyPbuffer },
01236    { "glXDestroyPixmap", (__GLXextFuncPtr) glXDestroyPixmap },
01237    { "glXDestroyWindow", (__GLXextFuncPtr) glXDestroyWindow },
01238    { "glXGetCurrentReadDrawable", (__GLXextFuncPtr) glXGetCurrentReadDrawable },
01239    { "glXGetFBConfigAttrib", (__GLXextFuncPtr) glXGetFBConfigAttrib },
01240    { "glXGetFBConfigs", (__GLXextFuncPtr) glXGetFBConfigs },
01241    { "glXGetSelectedEvent", (__GLXextFuncPtr) glXGetSelectedEvent },
01242    { "glXGetVisualFromFBConfig", (__GLXextFuncPtr) glXGetVisualFromFBConfig },
01243    { "glXMakeContextCurrent", (__GLXextFuncPtr) glXMakeContextCurrent },
01244    { "glXQueryContext", (__GLXextFuncPtr) glXQueryContext },
01245    { "glXQueryDrawable", (__GLXextFuncPtr) glXQueryDrawable },
01246    { "glXSelectEvent", (__GLXextFuncPtr) glXSelectEvent },
01247 
01248    /*** GLX_VERSION_1_4 ***/
01249    { "glXGetProcAddress", (__GLXextFuncPtr) glXGetProcAddress },
01250 
01251    /*** GLX_SGI_swap_control ***/
01252    { "glXSwapIntervalSGI", (__GLXextFuncPtr) glXSwapIntervalSGI },
01253 
01254    /*** GLX_SGI_video_sync ***/
01255    { "glXGetVideoSyncSGI", (__GLXextFuncPtr) glXGetVideoSyncSGI },
01256    { "glXWaitVideoSyncSGI", (__GLXextFuncPtr) glXWaitVideoSyncSGI },
01257 
01258    /*** GLX_SGI_make_current_read ***/
01259    { "glXMakeCurrentReadSGI", (__GLXextFuncPtr) glXMakeCurrentReadSGI },
01260    { "glXGetCurrentReadDrawableSGI", (__GLXextFuncPtr) glXGetCurrentReadDrawableSGI },
01261 
01262    /*** GLX_SGIX_video_source ***/
01263 #if defined(_VL_H)
01264    { "glXCreateGLXVideoSourceSGIX", (__GLXextFuncPtr) glXCreateGLXVideoSourceSGIX },
01265    { "glXDestroyGLXVideoSourceSGIX", (__GLXextFuncPtr) glXDestroyGLXVideoSourceSGIX },
01266 #endif
01267 
01268    /*** GLX_EXT_import_context ***/
01269    { "glXFreeContextEXT", (__GLXextFuncPtr) glXFreeContextEXT },
01270    { "glXGetContextIDEXT", (__GLXextFuncPtr) glXGetContextIDEXT },
01271    { "glXGetCurrentDisplayEXT", (__GLXextFuncPtr) glXGetCurrentDisplayEXT },
01272    { "glXImportContextEXT", (__GLXextFuncPtr) glXImportContextEXT },
01273    { "glXQueryContextInfoEXT", (__GLXextFuncPtr) glXQueryContextInfoEXT },
01274 
01275    /*** GLX_SGIX_fbconfig ***/
01276    { "glXGetFBConfigAttribSGIX", (__GLXextFuncPtr) glXGetFBConfigAttribSGIX },
01277    { "glXChooseFBConfigSGIX", (__GLXextFuncPtr) glXChooseFBConfigSGIX },
01278    { "glXCreateGLXPixmapWithConfigSGIX", (__GLXextFuncPtr) glXCreateGLXPixmapWithConfigSGIX },
01279    { "glXCreateContextWithConfigSGIX", (__GLXextFuncPtr) glXCreateContextWithConfigSGIX },
01280    { "glXGetVisualFromFBConfigSGIX", (__GLXextFuncPtr) glXGetVisualFromFBConfigSGIX },
01281    { "glXGetFBConfigFromVisualSGIX", (__GLXextFuncPtr) glXGetFBConfigFromVisualSGIX },
01282 
01283    /*** GLX_SGIX_pbuffer ***/
01284    { "glXCreateGLXPbufferSGIX", (__GLXextFuncPtr) glXCreateGLXPbufferSGIX },
01285    { "glXDestroyGLXPbufferSGIX", (__GLXextFuncPtr) glXDestroyGLXPbufferSGIX },
01286    { "glXQueryGLXPbufferSGIX", (__GLXextFuncPtr) glXQueryGLXPbufferSGIX },
01287    { "glXSelectEventSGIX", (__GLXextFuncPtr) glXSelectEventSGIX },
01288    { "glXGetSelectedEventSGIX", (__GLXextFuncPtr) glXGetSelectedEventSGIX },
01289 
01290    /*** GLX_SGI_cushion ***/
01291    { "glXCushionSGI", (__GLXextFuncPtr) glXCushionSGI },
01292 
01293    /*** GLX_SGIX_video_resize ***/
01294    { "glXBindChannelToWindowSGIX", (__GLXextFuncPtr) glXBindChannelToWindowSGIX },
01295    { "glXChannelRectSGIX", (__GLXextFuncPtr) glXChannelRectSGIX },
01296    { "glXQueryChannelRectSGIX", (__GLXextFuncPtr) glXQueryChannelRectSGIX },
01297    { "glXQueryChannelDeltasSGIX", (__GLXextFuncPtr) glXQueryChannelDeltasSGIX },
01298    { "glXChannelRectSyncSGIX", (__GLXextFuncPtr) glXChannelRectSyncSGIX },
01299 
01300    /*** GLX_SGIX_dmbuffer **/
01301 #if defined(_DM_BUFFER_H_)
01302    { "glXAssociateDMPbufferSGIX", (__GLXextFuncPtr) glXAssociateDMPbufferSGIX },
01303 #endif
01304 
01305    /*** GLX_SGIX_swap_group ***/
01306    { "glXJoinSwapGroupSGIX", (__GLXextFuncPtr) glXJoinSwapGroupSGIX },
01307 
01308    /*** GLX_SGIX_swap_barrier ***/
01309    { "glXBindSwapBarrierSGIX", (__GLXextFuncPtr) glXBindSwapBarrierSGIX },
01310    { "glXQueryMaxSwapBarriersSGIX", (__GLXextFuncPtr) glXQueryMaxSwapBarriersSGIX },
01311 
01312    /*** GLX_SUN_get_transparent_index ***/
01313    { "glXGetTransparentIndexSUN", (__GLXextFuncPtr) glXGetTransparentIndexSUN },
01314 
01315    /*** GLX_MESA_copy_sub_buffer ***/
01316    { "glXCopySubBufferMESA", (__GLXextFuncPtr) glXCopySubBufferMESA },
01317 
01318    /*** GLX_MESA_pixmap_colormap ***/
01319    { "glXCreateGLXPixmapMESA", (__GLXextFuncPtr) glXCreateGLXPixmapMESA },
01320 
01321    /*** GLX_MESA_release_buffers ***/
01322    { "glXReleaseBuffersMESA", (__GLXextFuncPtr) glXReleaseBuffersMESA },
01323 
01324    /*** GLX_MESA_set_3dfx_mode ***/
01325    { "glXSet3DfxModeMESA", (__GLXextFuncPtr) glXSet3DfxModeMESA },
01326 
01327    /*** GLX_ARB_get_proc_address ***/
01328    { "glXGetProcAddressARB", (__GLXextFuncPtr) glXGetProcAddressARB },
01329 
01330    /*** GLX_NV_vertex_array_range ***/
01331    { "glXAllocateMemoryNV", (__GLXextFuncPtr) glXAllocateMemoryNV },
01332    { "glXFreeMemoryNV", (__GLXextFuncPtr) glXFreeMemoryNV },
01333 
01334    /*** GLX_MESA_agp_offset ***/
01335    { "glXGetAGPOffsetMESA", (__GLXextFuncPtr) glXGetAGPOffsetMESA },
01336 
01337    /*** GLX_MESA_allocate_memory ***/
01338    { "glXAllocateMemoryMESA", (__GLXextFuncPtr) glXAllocateMemoryMESA },
01339    { "glXFreeMemoryMESA", (__GLXextFuncPtr) glXFreeMemoryMESA },
01340    { "glXGetMemoryOffsetMESA", (__GLXextFuncPtr) glXGetMemoryOffsetMESA },
01341 
01342    /*** GLX_EXT_texture_from_pixmap ***/
01343    { "glXBindTexImageEXT", (__GLXextFuncPtr) glXBindTexImageEXT },
01344    { "glXReleaseTexImageEXT", (__GLXextFuncPtr) glXReleaseTexImageEXT },
01345 
01346    { NULL, NULL }   /* end of list */
01347 };
01348 
01349 
01350 
01351 /*
01352  * Return address of named glX function, or NULL if not found.
01353  */
01354 __GLXextFuncPtr
01355 _glxapi_get_proc_address(const char *funcName)
01356 {
01357    GLuint i;
01358    for (i = 0; GLX_functions[i].Name; i++) {
01359       if (strcmp(GLX_functions[i].Name, funcName) == 0)
01360          return GLX_functions[i].Address;
01361    }
01362    return NULL;
01363 }
01364 
01365 
01366 
01367 /*
01368  * This function does not get dispatched through the dispatch table
01369  * since it's really a "meta" function.
01370  */
01371 __GLXextFuncPtr
01372 glXGetProcAddressARB(const GLubyte *procName)
01373 {
01374    __GLXextFuncPtr f;
01375 
01376    f = _glxapi_get_proc_address((const char *) procName);
01377    if (f) {
01378       return f;
01379    }
01380 
01381    f = (__GLXextFuncPtr) _glapi_get_proc_address((const char *) procName);
01382    return f;
01383 }
01384 
01385 
01386 /* GLX 1.4 */
01387 void (*glXGetProcAddress(const GLubyte *procName))()
01388 {
01389    return glXGetProcAddressARB(procName);
01390 }

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