1848b8605Smrg/* 2848b8605Smrg * Mesa 3-D graphics library 3848b8605Smrg * 4848b8605Smrg * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. 5848b8605Smrg * 6848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a 7848b8605Smrg * copy of this software and associated documentation files (the "Software"), 8848b8605Smrg * to deal in the Software without restriction, including without limitation 9848b8605Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10848b8605Smrg * and/or sell copies of the Software, and to permit persons to whom the 11848b8605Smrg * Software is furnished to do so, subject to the following conditions: 12848b8605Smrg * 13848b8605Smrg * The above copyright notice and this permission notice shall be included 14848b8605Smrg * in all copies or substantial portions of the Software. 15848b8605Smrg * 16848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17848b8605Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18848b8605Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19848b8605Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20848b8605Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21848b8605Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22848b8605Smrg * OTHER DEALINGS IN THE SOFTWARE. 23848b8605Smrg */ 24848b8605Smrg 25848b8605Smrg 26848b8605Smrg#ifndef _glxapi_h_ 27848b8605Smrg#define _glxapi_h_ 28848b8605Smrg 29848b8605Smrg 30848b8605Smrg#define GLX_GLXEXT_PROTOTYPES 31848b8605Smrg#include "GL/glx.h" 32848b8605Smrg 33848b8605Smrg 34848b8605Smrg/* The GLX API dispatcher (i.e. this code) is being built into stand-alone 35848b8605Smrg * Mesa. We don't know anything about XFree86 or real GLX so we define a 36848b8605Smrg * minimal __GLXContextRec here so some of the functions in this file can 37848b8605Smrg * work properly. 38848b8605Smrg */ 39848b8605Smrgtypedef struct __GLXcontextRec { 40848b8605Smrg GLboolean isDirect; 41848b8605Smrg GLXDrawable currentDrawable; 42848b8605Smrg GLXDrawable currentReadable; 43848b8605Smrg XID xid; 44848b8605Smrg} __GLXcontext; 45848b8605Smrg 46848b8605Smrg 47848b8605Smrg/* 48848b8605Smrg * Almost all the GLX API functions get routed through this dispatch table. 49848b8605Smrg * The exceptions are the glXGetCurrentXXX() functions. 50848b8605Smrg * 51848b8605Smrg * This dispatch table allows multiple GLX client-side modules to coexist. 52848b8605Smrg * Specifically, a real GLX library (like SGI's or the Utah GLX) and Mesa's 53848b8605Smrg * pseudo-GLX can be present at the same time. The former being used on 54848b8605Smrg * GLX-enabled X servers and the later on non-GLX X servers. 55848b8605Smrg * 56848b8605Smrg * Red Hat has been using this since Red Hat Linux 7.0 (I think). 57848b8605Smrg * This'll be a standard feature in XFree86 4.3. It basically allows one 58848b8605Smrg * libGL to do both DRI-rendering and "fake GLX" rendering to X displays 59848b8605Smrg * that lack the GLX extension. 60848b8605Smrg */ 61848b8605Smrgstruct _glxapi_table { 62848b8605Smrg /*** GLX_VERSION_1_0 ***/ 63848b8605Smrg XVisualInfo *(*ChooseVisual)(Display *dpy, int screen, int *list); 64848b8605Smrg void (*CopyContext)(Display *dpy, GLXContext src, GLXContext dst, unsigned long mask); 65848b8605Smrg GLXContext (*CreateContext)(Display *dpy, XVisualInfo *visinfo, GLXContext shareList, Bool direct); 66848b8605Smrg GLXPixmap (*CreateGLXPixmap)(Display *dpy, XVisualInfo *visinfo, Pixmap pixmap); 67848b8605Smrg void (*DestroyContext)(Display *dpy, GLXContext ctx); 68848b8605Smrg void (*DestroyGLXPixmap)(Display *dpy, GLXPixmap pixmap); 69848b8605Smrg int (*GetConfig)(Display *dpy, XVisualInfo *visinfo, int attrib, int *value); 70848b8605Smrg GLXContext (*GetCurrentContext)(void); 71848b8605Smrg /*GLXDrawable (*GetCurrentDrawable)(void);*/ 72848b8605Smrg Bool (*IsDirect)(Display *dpy, GLXContext ctx); 73848b8605Smrg Bool (*MakeCurrent)(Display *dpy, GLXDrawable drawable, GLXContext ctx); 74848b8605Smrg Bool (*QueryExtension)(Display *dpy, int *errorb, int *event); 75848b8605Smrg Bool (*QueryVersion)(Display *dpy, int *maj, int *min); 76848b8605Smrg void (*SwapBuffers)(Display *dpy, GLXDrawable drawable); 77848b8605Smrg void (*UseXFont)(Font font, int first, int count, int listBase); 78848b8605Smrg void (*WaitGL)(void); 79848b8605Smrg void (*WaitX)(void); 80848b8605Smrg 81848b8605Smrg /*** GLX_VERSION_1_1 ***/ 82848b8605Smrg const char *(*GetClientString)(Display *dpy, int name); 83848b8605Smrg const char *(*QueryExtensionsString)(Display *dpy, int screen); 84848b8605Smrg const char *(*QueryServerString)(Display *dpy, int screen, int name); 85848b8605Smrg 86848b8605Smrg /*** GLX_VERSION_1_2 ***/ 87848b8605Smrg /*Display *(*GetCurrentDisplay)(void);*/ 88848b8605Smrg 89848b8605Smrg /*** GLX_VERSION_1_3 ***/ 90848b8605Smrg GLXFBConfig *(*ChooseFBConfig)(Display *dpy, int screen, const int *attribList, int *nitems); 91848b8605Smrg GLXContext (*CreateNewContext)(Display *dpy, GLXFBConfig config, int renderType, GLXContext shareList, Bool direct); 92848b8605Smrg GLXPbuffer (*CreatePbuffer)(Display *dpy, GLXFBConfig config, const int *attribList); 93848b8605Smrg GLXPixmap (*CreatePixmap)(Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attribList); 94848b8605Smrg GLXWindow (*CreateWindow)(Display *dpy, GLXFBConfig config, Window win, const int *attribList); 95848b8605Smrg void (*DestroyPbuffer)(Display *dpy, GLXPbuffer pbuf); 96848b8605Smrg void (*DestroyPixmap)(Display *dpy, GLXPixmap pixmap); 97848b8605Smrg void (*DestroyWindow)(Display *dpy, GLXWindow window); 98848b8605Smrg /*GLXDrawable (*GetCurrentReadDrawable)(void);*/ 99848b8605Smrg int (*GetFBConfigAttrib)(Display *dpy, GLXFBConfig config, int attribute, int *value); 100848b8605Smrg GLXFBConfig *(*GetFBConfigs)(Display *dpy, int screen, int *nelements); 101848b8605Smrg void (*GetSelectedEvent)(Display *dpy, GLXDrawable drawable, unsigned long *mask); 102848b8605Smrg XVisualInfo *(*GetVisualFromFBConfig)(Display *dpy, GLXFBConfig config); 103848b8605Smrg Bool (*MakeContextCurrent)(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); 104848b8605Smrg int (*QueryContext)(Display *dpy, GLXContext ctx, int attribute, int *value); 105848b8605Smrg void (*QueryDrawable)(Display *dpy, GLXDrawable draw, int attribute, unsigned int *value); 106848b8605Smrg void (*SelectEvent)(Display *dpy, GLXDrawable drawable, unsigned long mask); 107848b8605Smrg 108848b8605Smrg /*** GLX_SGI_swap_control ***/ 109848b8605Smrg int (*SwapIntervalSGI)(int); 110848b8605Smrg 111848b8605Smrg /*** GLX_SGI_video_sync ***/ 112848b8605Smrg int (*GetVideoSyncSGI)(unsigned int *count); 113848b8605Smrg int (*WaitVideoSyncSGI)(int divisor, int remainder, unsigned int *count); 114848b8605Smrg 115848b8605Smrg /*** GLX_SGI_make_current_read ***/ 116848b8605Smrg Bool (*MakeCurrentReadSGI)(Display *, GLXDrawable, GLXDrawable, GLXContext); 117848b8605Smrg /*GLXDrawable (*GetCurrentReadDrawableSGI)(void);*/ 118848b8605Smrg 119848b8605Smrg /*** GLX_SGIX_video_source (needs video library) ***/ 120848b8605Smrg#if defined(_VL_H_) 121848b8605Smrg GLXVideoSourceSGIX (*CreateGLXVideoSourceSGIX)(Display *, int, VLServer, VLPath, int, VLNode); 122848b8605Smrg void (*DestroyGLXVideoSourceSGIX)(Display *, GLXVideoSourceSGIX); 123848b8605Smrg#else 124848b8605Smrg void *CreateGLXVideoSourceSGIX; 125848b8605Smrg void *DestroyGLXVideoSourceSGIX; 126848b8605Smrg#endif 127848b8605Smrg 128848b8605Smrg /*** GLX_EXT_import_context ***/ 129848b8605Smrg void (*FreeContextEXT)(Display *dpy, GLXContext context); 130848b8605Smrg GLXContextID (*GetContextIDEXT)(const GLXContext context); 131848b8605Smrg /*Display *(*GetCurrentDisplayEXT)(void);*/ 132848b8605Smrg GLXContext (*ImportContextEXT)(Display *dpy, GLXContextID contextID); 133848b8605Smrg int (*QueryContextInfoEXT)(Display *dpy, GLXContext context, int attribute,int *value); 134848b8605Smrg 135848b8605Smrg /*** GLX_SGIX_fbconfig ***/ 136848b8605Smrg int (*GetFBConfigAttribSGIX)(Display *, GLXFBConfigSGIX, int, int *); 137848b8605Smrg GLXFBConfigSGIX * (*ChooseFBConfigSGIX)(Display *, int, int *, int *); 138848b8605Smrg GLXPixmap (*CreateGLXPixmapWithConfigSGIX)(Display *, GLXFBConfigSGIX, Pixmap); 139848b8605Smrg GLXContext (*CreateContextWithConfigSGIX)(Display *, GLXFBConfigSGIX, int, GLXContext, Bool); 140848b8605Smrg XVisualInfo * (*GetVisualFromFBConfigSGIX)(Display *, GLXFBConfigSGIX); 141848b8605Smrg GLXFBConfigSGIX (*GetFBConfigFromVisualSGIX)(Display *, XVisualInfo *); 142848b8605Smrg 143848b8605Smrg /*** GLX_SGIX_pbuffer ***/ 144848b8605Smrg GLXPbufferSGIX (*CreateGLXPbufferSGIX)(Display *, GLXFBConfigSGIX, unsigned int, unsigned int, int *); 145848b8605Smrg void (*DestroyGLXPbufferSGIX)(Display *, GLXPbufferSGIX); 146848b8605Smrg int (*QueryGLXPbufferSGIX)(Display *, GLXPbufferSGIX, int, unsigned int *); 147848b8605Smrg void (*SelectEventSGIX)(Display *, GLXDrawable, unsigned long); 148848b8605Smrg void (*GetSelectedEventSGIX)(Display *, GLXDrawable, unsigned long *); 149848b8605Smrg 150848b8605Smrg /*** GLX_SGI_cushion ***/ 151848b8605Smrg void (*CushionSGI)(Display *, Window, float); 152848b8605Smrg 153848b8605Smrg /*** GLX_SGIX_video_resize ***/ 154848b8605Smrg int (*BindChannelToWindowSGIX)(Display *, int, int, Window); 155848b8605Smrg int (*ChannelRectSGIX)(Display *, int, int, int, int, int, int); 156848b8605Smrg int (*QueryChannelRectSGIX)(Display *, int, int, int *, int *, int *, int *); 157848b8605Smrg int (*QueryChannelDeltasSGIX)(Display *, int, int, int *, int *, int *, int *); 158848b8605Smrg int (*ChannelRectSyncSGIX)(Display *, int, int, GLenum); 159848b8605Smrg 160848b8605Smrg /*** GLX_SGIX_dmbuffer (needs dmedia library) ***/ 161848b8605Smrg#if defined (_DM_BUFFER_H_) 162848b8605Smrg Bool (*AssociateDMPbufferSGIX)(Display *, GLXPbufferSGIX, DMparams *, DMbuffer); 163848b8605Smrg#else 164848b8605Smrg void *AssociciateDMPbufferSGIX; 165848b8605Smrg#endif 166848b8605Smrg 167848b8605Smrg /*** GLX_SUN_get_transparent_index ***/ 168848b8605Smrg Status (*GetTransparentIndexSUN)(Display *, Window, Window, long *); 169848b8605Smrg 170848b8605Smrg /*** GLX_MESA_copy_sub_buffer ***/ 171848b8605Smrg void (*CopySubBufferMESA)(Display *dpy, GLXDrawable drawable, int x, int y, int width, int height); 172848b8605Smrg 173848b8605Smrg /*** GLX_MESA_release_buffers ***/ 174848b8605Smrg Bool (*ReleaseBuffersMESA)(Display *dpy, Window w); 175848b8605Smrg 176848b8605Smrg /*** GLX_MESA_pixmap_colormap ***/ 177848b8605Smrg GLXPixmap (*CreateGLXPixmapMESA)(Display *dpy, XVisualInfo *visinfo, Pixmap pixmap, Colormap cmap); 178848b8605Smrg 179848b8605Smrg /*** GLX_EXT_texture_from_pixmap ***/ 180848b8605Smrg void (*BindTexImageEXT)(Display *dpy, GLXDrawable drawable, int buffer, 181848b8605Smrg const int *attrib_list); 182848b8605Smrg void (*ReleaseTexImageEXT)(Display *dpy, GLXDrawable drawable, int buffer); 183b8e80941Smrg 184b8e80941Smrg /*** GLX_ARB_create_context ***/ 185b8e80941Smrg GLXContext (*CreateContextAttribs)(Display *dpy, GLXFBConfig config, 186b8e80941Smrg GLXContext share_context, Bool direct, 187b8e80941Smrg const int *attrib_list); 188848b8605Smrg}; 189848b8605Smrg 190848b8605Smrg 191848b8605Smrg 192848b8605Smrgextern const char * 193848b8605Smrg_glxapi_get_version(void); 194848b8605Smrg 195848b8605Smrg 196848b8605Smrgextern const char ** 197848b8605Smrg_glxapi_get_extensions(void); 198848b8605Smrg 199848b8605Smrg 200848b8605Smrgextern GLuint 201848b8605Smrg_glxapi_get_dispatch_table_size(void); 202848b8605Smrg 203848b8605Smrg 204848b8605Smrgextern void 205848b8605Smrg_glxapi_set_no_op_table(struct _glxapi_table *t); 206848b8605Smrg 207848b8605Smrg 208848b8605Smrgextern __GLXextFuncPtr 209848b8605Smrg_glxapi_get_proc_address(const char *funcName); 210848b8605Smrg 211848b8605Smrg 212848b8605Smrg#endif 213