diff options
Diffstat (limited to 'xc/lib/GL/glx')
-rw-r--r-- | xc/lib/GL/glx/Imakefile | 24 | ||||
-rw-r--r-- | xc/lib/GL/glx/compsize.c | 32 | ||||
-rw-r--r-- | xc/lib/GL/glx/dispatch.c | 19 | ||||
-rw-r--r-- | xc/lib/GL/glx/g_render.c | 64 | ||||
-rw-r--r-- | xc/lib/GL/glx/glxclient.h | 59 | ||||
-rw-r--r-- | xc/lib/GL/glx/glxcmds.c | 508 | ||||
-rw-r--r-- | xc/lib/GL/glx/glxext.c | 8 | ||||
-rw-r--r-- | xc/lib/GL/glx/indirect.h | 7 | ||||
-rw-r--r-- | xc/lib/GL/glx/indirect_init.c | 6 | ||||
-rw-r--r-- | xc/lib/GL/glx/pixel.c | 1 | ||||
-rw-r--r-- | xc/lib/GL/glx/renderpix.c | 6 | ||||
-rw-r--r-- | xc/lib/GL/glx/single2.c | 124 |
12 files changed, 749 insertions, 109 deletions
diff --git a/xc/lib/GL/glx/Imakefile b/xc/lib/GL/glx/Imakefile index 21032942f..393c022c7 100644 --- a/xc/lib/GL/glx/Imakefile +++ b/xc/lib/GL/glx/Imakefile @@ -34,9 +34,11 @@ XCOMM glw # Files from Mesa LinkSourceFile(glapi.c, $(MESASRCDIR)/src) -LinkSourceFile(glapinoop.c, $(MESASRCDIR)/src) LinkSourceFile(glthread.c, $(MESASRCDIR)/src) LinkSourceFile(glapi_x86.S, $(MESASRCDIR)/src/X86) +LinkSourceFile(glapi_sparc.S, $(MESASRCDIR)/src/SPARC) + + # Maybe some of these could come from # xc/extras/ogl-sample/main/glx/lib at some point. @@ -50,7 +52,6 @@ LinkSourceFile(glapi_x86.S, $(MESASRCDIR)/src/X86) g_single.c \ g_vendpriv.c \ glapi.c \ - glapinoop.c \ glthread.c \ glxcmds.c \ glxext.c \ @@ -73,7 +74,6 @@ LinkSourceFile(glapi_x86.S, $(MESASRCDIR)/src/X86) g_single.o \ g_vendpriv.o \ glapi.o \ - glapinoop.o \ glthread.o \ glxcmds.o \ glxext.o \ @@ -96,11 +96,20 @@ LinkSourceFile(glapi_x86.S, $(MESASRCDIR)/src/X86) ASM_OBJS = glapi_x86.o ASM_DEFS = -DUSE_X86_ASM #endif +#if defined(SparcArchitecture) + ASM_SRCS = glapi_sparc.S + ASM_OBJS = glapi_sparc.o + ASM_DEFS = -DUSE_SPARC_ASM +#endif +#endif + +#if GlxBuiltInXMesa + XMESA_DEFINES = -DGLX_BUILT_IN_XMESA #endif SRCS = $(GLX_SRCS) $(ASM_SRCS) OBJS = $(GLX_OBJS) $(ASM_OBJS) - DEFINES = $(GLX_DEFS) $(ASM_DEFS) + DEFINES = $(GLX_DEFS) $(ASM_DEFS) $(XMESA_DEFINES) INCLUDES = -I$(INCLUDESRC) \ -I$(XINCLUDESRC) \ @@ -108,8 +117,11 @@ LinkSourceFile(glapi_x86.S, $(MESASRCDIR)/src/X86) -I$(INCLUDESRC)/GL \ -I$(GLXLIBSRC)/glx \ -I$(MESASRCDIR)/src \ + -I$(MESASRCDIR)/src/X \ -I$(MESASRCDIR)/src/X86 \ + -I$(MESASRCDIR)/src/SPARC \ -I$(MESASRCDIR)/include \ + -I$(GLXLIBSRC)/include \ $(DRI_INCS) #include <Library.tmpl> @@ -119,6 +131,10 @@ LibraryObjectRule() #if BuildXF86DRI && defined(i386Architecture) ObjectFromAsmSource(glapi_x86, NullParameter) #endif +#if BuildXF86DRI && defined(SparcArchitecture) +STD_CPP_DEFINES = StandardDefines $(PROJECT_DEFINES) +ObjectFromAsmSource(glapi_sparc, NullParameter) +#endif SubdirLibraryRule($(OBJS)) NormalLintTarget($(SRCS)) diff --git a/xc/lib/GL/glx/compsize.c b/xc/lib/GL/glx/compsize.c index 11ba23fe2..1cfdd323e 100644 --- a/xc/lib/GL/glx/compsize.c +++ b/xc/lib/GL/glx/compsize.c @@ -94,15 +94,18 @@ GLint __glDrawPixels_size(GLenum format, GLenum type, GLsizei w, GLsizei h) case GL_BLUE: case GL_ALPHA: case GL_LUMINANCE: + case GL_INTENSITY: elements = 1; break; case GL_LUMINANCE_ALPHA: elements = 2; break; case GL_RGB: + case GL_BGR: elements = 3; break; case GL_RGBA: + case GL_BGRA: case GL_ABGR_EXT: elements = 4; break; @@ -219,6 +222,26 @@ GLint __glTexEnvfv_size(GLenum e) return 1; case GL_TEXTURE_ENV_COLOR: return 4; + /* GL_EXT_texture_env_combine */ + case GL_COMBINE_RGB_EXT: + case GL_COMBINE_ALPHA_EXT: + case GL_SOURCE0_RGB_EXT: + case GL_SOURCE1_RGB_EXT: + case GL_SOURCE2_RGB_EXT: + case GL_SOURCE0_ALPHA_EXT: + case GL_SOURCE1_ALPHA_EXT: + case GL_SOURCE2_ALPHA_EXT: + case GL_OPERAND0_RGB_EXT: + case GL_OPERAND1_RGB_EXT: + case GL_OPERAND0_ALPHA_EXT: + case GL_OPERAND1_ALPHA_EXT: + case GL_OPERAND2_RGB_EXT: + case GL_OPERAND2_ALPHA_EXT: + case GL_RGB_SCALE_EXT: + case GL_ALPHA_SCALE: + /* GL_EXT_texture_lod */ + case GL_TEXTURE_LOD_BIAS_EXT: + return 1; default: return 0; } @@ -243,15 +266,18 @@ GLint __glTexImage1D_size(GLenum format, GLenum type, GLsizei w) case GL_BLUE: case GL_ALPHA: case GL_LUMINANCE: + case GL_INTENSITY: elements = 1; break; case GL_LUMINANCE_ALPHA: elements = 2; break; case GL_RGB: + case GL_BGR: elements = 3; break; case GL_RGBA: + case GL_BGRA: case GL_ABGR_EXT: elements = 4; break; @@ -320,15 +346,18 @@ GLint __glTexImage2D_size(GLenum format, GLenum type, GLsizei w, GLsizei h) case GL_BLUE: case GL_ALPHA: case GL_LUMINANCE: + case GL_INTENSITY: elements = 1; break; case GL_LUMINANCE_ALPHA: elements = 2; break; case GL_RGB: + case GL_BGR: elements = 3; break; case GL_RGBA: + case GL_BGRA: case GL_ABGR_EXT: elements = 4; break; @@ -399,15 +428,18 @@ GLint __glTexImage3D_size(GLenum format, GLenum type, GLsizei w, GLsizei h, case GL_BLUE: case GL_ALPHA: case GL_LUMINANCE: + case GL_INTENSITY: elements = 1; break; case GL_LUMINANCE_ALPHA: elements = 2; break; case GL_RGB: + case GL_BGR: elements = 3; break; case GL_RGBA: + case GL_BGRA: case GL_ABGR_EXT: elements = 4; break; diff --git a/xc/lib/GL/glx/dispatch.c b/xc/lib/GL/glx/dispatch.c index bc3288044..3cff3db77 100644 --- a/xc/lib/GL/glx/dispatch.c +++ b/xc/lib/GL/glx/dispatch.c @@ -37,15 +37,21 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "glapitable.h" +/* + * NOTE: this file implements C-based dispatch of the OpenGL entrypoints + * (glAccum, glBegin, etc). + * This code IS NOT USED if we're compiling on an x86 system and using + * the glapi_x86.S assembly code. + */ + + +#if !(defined(USE_X86_ASM) || defined(USE_SPARC_ASM)) + #define KEYWORD1 #define KEYWORD2 -#if defined(USE_X86_ASM) -#define NAME(func) _glapi_fallback_##func -#else #define NAME(func) gl##func -#endif #define DISPATCH(func, args, msg) \ const struct _glapi_table *dispatch; \ @@ -60,7 +66,4 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "glapitemp.h" - - - - +#endif /* USE_X86_ASM */ diff --git a/xc/lib/GL/glx/g_render.c b/xc/lib/GL/glx/g_render.c index 8d81f8d64..87df50a82 100644 --- a/xc/lib/GL/glx/g_render.c +++ b/xc/lib/GL/glx/g_render.c @@ -3396,3 +3396,67 @@ void glMultiTexCoord4svARB(GLenum target, const GLshort *v) __GLX_END(16); } +void glLoadTransposeMatrixfARB(const GLfloat *m) +{ + __GLX_DECLARE_VARIABLES(); + GLfloat t[16]; + int i, j; + for (i = 0; i < 4; i++) { + for (j = 0; j < 4; j++) { + t[i*4+j] = m[j*4+i]; + } + } + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_LoadMatrixf,68); + __GLX_PUT_FLOAT_ARRAY(4,t,16); + __GLX_END(68); +} + +void glMultTransposeMatrixfARB(const GLfloat *m) +{ + __GLX_DECLARE_VARIABLES(); + GLfloat t[16]; + int i, j; + for (i = 0; i < 4; i++) { + for (j = 0; j < 4; j++) { + t[i*4+j] = m[j*4+i]; + } + } + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultMatrixf,68); + __GLX_PUT_FLOAT_ARRAY(4,t,16); + __GLX_END(68); +} + +void glLoadTransposeMatrixdARB(const GLdouble *m) +{ + __GLX_DECLARE_VARIABLES(); + GLdouble t[16]; + int i, j; + for (i = 0; i < 4; i++) { + for (j = 0; j < 4; j++) { + t[i*4+j] = m[j*4+i]; + } + } + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_LoadMatrixd,132); + __GLX_PUT_DOUBLE_ARRAY(4,t,16); + __GLX_END(132); +} + +void glMultTransposeMatrixdARB(const GLdouble *m) +{ + __GLX_DECLARE_VARIABLES(); + GLdouble t[16]; + int i, j; + for (i = 0; i < 4; i++) { + for (j = 0; j < 4; j++) { + t[i*4+j] = m[j*4+i]; + } + } + __GLX_LOAD_VARIABLES(); + __GLX_BEGIN(X_GLrop_MultMatrixd,132); + __GLX_PUT_DOUBLE_ARRAY(4,t,16); + __GLX_END(132); +} + diff --git a/xc/lib/GL/glx/glxclient.h b/xc/lib/GL/glx/glxclient.h index 0973bd682..dbd642542 100644 --- a/xc/lib/GL/glx/glxclient.h +++ b/xc/lib/GL/glx/glxclient.h @@ -47,11 +47,12 @@ #define NEED_EVENTS #include <X11/Xproto.h> #include <X11/Xlibint.h> +#define GLX_GLXEXT_PROTOTYPES #include <GL/glx.h> #include <string.h> #include <stdlib.h> -#include "glxint.h" -#include "glxproto.h" +#include "GL/glxint.h" +#include "GL/glxproto.h" #include "glapitable.h" #ifdef NEED_GL_FUNCS_WRAPPED #include "indirect.h" @@ -59,7 +60,9 @@ #ifdef XTHREADS #include "Xthreads.h" #endif - +#ifdef GLX_BUILT_IN_XMESA +#include "realglx.h" /* just silences prototype warnings */ +#endif #define GLX_MAJOR_VERSION 1 /* current version numbers */ #define GLX_MINOR_VERSION 2 @@ -95,7 +98,7 @@ struct __DRIdisplayRec { /* ** Method to destroy the private DRI display data. */ - void (*destroyDisplay)(Display *dpy, void *private); + void (*destroyDisplay)(Display *dpy, void *displayPrivate); /* ** Methods to create the private DRI screen data and initialize the @@ -108,7 +111,7 @@ struct __DRIdisplayRec { /* ** Opaque pointer to private per display direct rendering data. ** NULL if direct rendering is not supported on this display. Never - ** dereference by this code. + ** dereferenced in libGL. */ void *private; }; @@ -121,13 +124,13 @@ struct __DRIscreenRec { /* ** Method to destroy the private DRI screen data. */ - void (*destroyScreen)(Display *dpy, int scrn, void *private); + void (*destroyScreen)(Display *dpy, int scrn, void *screenPrivate); /* ** Method to create the private DRI context data and initialize the ** context dependent methods. */ - void *(*createContext)(Display *dpy, XVisualInfo *vis, void *shared, + void *(*createContext)(Display *dpy, XVisualInfo *vis, void *sharedPrivate, __DRIcontext *pctx); /* @@ -141,12 +144,18 @@ struct __DRIscreenRec { ** Method to return a pointer to the DRI drawable data. */ __DRIdrawable *(*getDrawable)(Display *dpy, GLXDrawable draw, - void *private); + void *drawablePrivate); + + /* + ** XXX in the future, implement this: + void *(*createPBuffer)(Display *dpy, int scrn, GLXPbuffer pbuffer, + GLXFBConfig config, __DRIdrawable *pdraw); + **/ /* ** Opaque pointer to private per screen direct rendering data. NULL ** if direct rendering is not supported on this screen. Never - ** dereference by this code. + ** dereferenced in libGL. */ void *private; }; @@ -159,10 +168,12 @@ struct __DRIcontextRec { /* ** Method to destroy the private DRI context data. */ - void (*destroyContext)(Display *dpy, int scrn, void *private); + void (*destroyContext)(Display *dpy, int scrn, void *contextPrivate); /* ** Method to bind a DRI drawable to a DRI graphics context. + ** XXX in the future, also pass a 'read' GLXDrawable for + ** glXMakeCurrentReadSGI() and GLX 1.3's glXMakeContextCurrent(). */ Bool (*bindContext)(Display *dpy, int scrn, GLXDrawable draw, GLXContext gc); @@ -176,33 +187,31 @@ struct __DRIcontextRec { /* ** Opaque pointer to private per context direct rendering data. ** NULL if direct rendering is not supported on the display or - ** screen used to create this context. Never dereference by this - ** code. + ** screen used to create this context. Never dereferenced in libGL. */ void *private; }; /* ** Drawable dependent methods. This structure is initialized during the -** (*createDrawable)() call. These methods are not currently called -** from GLX 1.2, but could be used in GLX 1.3. +** (*createDrawable)() call. createDrawable() is not called by libGL at +** this time. It's currently used via the dri_util.c utility code instead. */ struct __DRIdrawableRec { /* ** Method to destroy the private DRI drawable data. */ - void (*destroyDrawable)(Display *dpy, void *private); + void (*destroyDrawable)(Display *dpy, void *drawablePrivate); /* ** Method to swap the front and back buffers. */ - void (*swapBuffers)(Display *dpy, void *private); + void (*swapBuffers)(Display *dpy, void *drawablePrivate); /* ** Opaque pointer to private per drawable direct rendering data. ** NULL if direct rendering is not supported on the display or - ** screen used to create this drawable. Never dereference by this - ** code. + ** screen used to create this drawable. Never dereferenced in libGL. */ void *private; }; @@ -395,6 +404,7 @@ struct __GLXcontextRec { ** context is not current to any drawable. */ GLXDrawable currentDrawable; + GLXDrawable currentReadable; /* ** Constant strings that describe the server implementation @@ -560,7 +570,6 @@ extern __GLXcontext *__glXcurrentContext; */ #if defined(GLX_DIRECT_RENDERING) && defined(XTHREADS) extern xmutex_rec __glXmutex; -extern xmutex_rec __glXSwapBuffersMutex; #define __glXLock() xmutex_lock(&__glXmutex) #define __glXUnlock() xmutex_unlock(&__glXmutex) #else @@ -676,4 +685,16 @@ extern void _XRead(Display*, void*, long); extern void _XSend(Display*, const void*, long); #endif + +/* +** GLX_BUILT_IN_XMESA controls whether libGL has a built-in verions of +** Mesa that can render to non-GLX displays. +*/ +#ifdef GLX_BUILT_IN_XMESA +#define GLX_PREFIX(function) _real_##function +#else +#define GLX_PREFIX(function) function +#endif + + #endif /* !__GLX_client_h__ */ diff --git a/xc/lib/GL/glx/glxcmds.c b/xc/lib/GL/glx/glxcmds.c index 2bfcc1a8d..4b2ee97a9 100644 --- a/xc/lib/GL/glx/glxcmds.c +++ b/xc/lib/GL/glx/glxcmds.c @@ -38,19 +38,29 @@ #include "glxclient.h" #include <extutil.h> #include <Xext.h> -#include <string.h> +#include <strings.h> #include "glapi.h" #ifdef GLX_DIRECT_RENDERING #include "indirect_init.h" #endif static const char __glXGLClientExtensions[] = - "GL_ARB_multitexture " "GL_ARB_imaging " + "GL_ARB_multitexture " + "GL_ARB_texture_border_clamp " + "GL_ARB_texture_cube_map " + "GL_ARB_texture_env_add " + "GL_ARB_texture_env_combine " + "GL_ARB_texture_env_dot3 " + "GL_ARB_transpose_matrix " "GL_EXT_abgr " "GL_EXT_blend_color " "GL_EXT_blend_minmax " "GL_EXT_blend_subtract " + "GL_EXT_texture_env_add " + "GL_EXT_texture_env_combine " + "GL_EXT_texture_env_dot3 " + "GL_EXT_texture_lod_bias " ; static const char __glXGLXClientVendorName[] = "SGI"; @@ -190,10 +200,10 @@ GLXContext CreateContext(Display *dpy, XVisualInfo *vis, return gc; } -GLXContext glXCreateContext(Display *dpy, XVisualInfo *vis, +GLXContext GLX_PREFIX(glXCreateContext)(Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool allowDirect) { - return CreateContext(dpy, vis, shareList, allowDirect, None); + return CreateContext(dpy, vis, shareList, allowDirect, None); } void __glXFreeContext(__GLXcontext *gc) @@ -263,7 +273,7 @@ DestroyContext(Display *dpy, GLXContext gc) SyncHandle(); } } -void glXDestroyContext(Display *dpy, GLXContext gc) +void GLX_PREFIX(glXDestroyContext)(Display *dpy, GLXContext gc) { DestroyContext(dpy, gc); } @@ -271,7 +281,7 @@ void glXDestroyContext(Display *dpy, GLXContext gc) /* ** Return the major and minor version #s for the GLX extension */ -Bool glXQueryVersion(Display *dpy, int *major, int *minor) +Bool GLX_PREFIX(glXQueryVersion)(Display *dpy, int *major, int *minor) { __GLXdisplayPrivate *priv; @@ -287,7 +297,7 @@ Bool glXQueryVersion(Display *dpy, int *major, int *minor) /* ** Query the existance of the GLX extension */ -Bool glXQueryExtension(Display *dpy, int *errorBase, int *eventBase) +Bool GLX_PREFIX(glXQueryExtension)(Display *dpy, int *errorBase, int *eventBase) { int major_op, erb, evb; Bool rv; @@ -304,7 +314,7 @@ Bool glXQueryExtension(Display *dpy, int *errorBase, int *eventBase) ** Put a barrier in the token stream that forces the GL to finish its ** work before X can proceed. */ -void glXWaitGL(void) +void GLX_PREFIX(glXWaitGL)(void) { xGLXWaitGLReq *req; GLXContext gc = __glXGetCurrentContext(); @@ -340,7 +350,7 @@ void glXWaitGL(void) ** Put a barrier in the token stream that forces X to finish its ** work before GL can proceed. */ -void glXWaitX(void) +void GLX_PREFIX(glXWaitX)(void) { xGLXWaitXReq *req; GLXContext gc = __glXGetCurrentContext(); @@ -370,7 +380,7 @@ void glXWaitX(void) SyncHandle(); } -void glXUseXFont(Font font, int first, int count, int listBase) +void GLX_PREFIX(glXUseXFont)(Font font, int first, int count, int listBase) { xGLXUseXFontReq *req; GLXContext gc = __glXGetCurrentContext(); @@ -408,7 +418,7 @@ void glXUseXFont(Font font, int first, int count, int listBase) ** Copy the source context to the destination context using the ** attribute "mask". */ -void glXCopyContext(Display *dpy, GLXContext source, GLXContext dest, +void GLX_PREFIX(glXCopyContext)(Display *dpy, GLXContext source, GLXContext dest, unsigned long mask) { xGLXCopyContextReq *req; @@ -478,7 +488,7 @@ static Bool __glXIsDirect(Display *dpy, GLXContextID contextID) return reply.isDirect; } -Bool glXIsDirect(Display *dpy, GLXContext gc) +Bool GLX_PREFIX(glXIsDirect)(Display *dpy, GLXContext gc) { if (!gc) { return GL_FALSE; @@ -490,7 +500,7 @@ Bool glXIsDirect(Display *dpy, GLXContext gc) return __glXIsDirect(dpy, gc->xid); } -GLXPixmap glXCreateGLXPixmap(Display *dpy, XVisualInfo *vis, Pixmap pixmap) +GLXPixmap GLX_PREFIX(glXCreateGLXPixmap)(Display *dpy, XVisualInfo *vis, Pixmap pixmap) { xGLXCreateGLXPixmapReq *req; GLXPixmap xid; @@ -518,7 +528,7 @@ GLXPixmap glXCreateGLXPixmap(Display *dpy, XVisualInfo *vis, Pixmap pixmap) /* ** Destroy the named pixmap */ -void glXDestroyGLXPixmap(Display *dpy, GLXPixmap glxpixmap) +void GLX_PREFIX(glXDestroyGLXPixmap)(Display *dpy, GLXPixmap glxpixmap) { xGLXDestroyGLXPixmapReq *req; CARD8 opcode; @@ -538,7 +548,7 @@ void glXDestroyGLXPixmap(Display *dpy, GLXPixmap glxpixmap) SyncHandle(); } -void glXSwapBuffers(Display *dpy, GLXDrawable drawable) +void GLX_PREFIX(glXSwapBuffers)(Display *dpy, GLXDrawable drawable) { xGLXSwapBuffersReq *req; GLXContext gc = __glXGetCurrentContext(); @@ -548,10 +558,6 @@ void glXSwapBuffers(Display *dpy, GLXDrawable drawable) __GLXdisplayPrivate *priv; __DRIdrawable *pdraw; -#if defined(XTHREADS) - xmutex_lock(&__glXSwapBuffersMutex); -#endif - priv = __glXInitialize(dpy); if (priv->driDisplay.private) { __GLXscreenConfigs *psc = &priv->screenConfigs[gc->screen]; @@ -564,9 +570,6 @@ void glXSwapBuffers(Display *dpy, GLXDrawable drawable) psc->driScreen.private); if (pdraw) { (*pdraw->swapBuffers)(dpy, pdraw->private); -#if defined(XTHREADS) - xmutex_unlock(&__glXSwapBuffersMutex); -#endif return; } } @@ -575,9 +578,6 @@ void glXSwapBuffers(Display *dpy, GLXDrawable drawable) opcode = __glXSetupForCommand(dpy); if (!opcode) { -#if defined(GLX_DIRECT_RENDERING) && defined(XTHREADS) - xmutex_unlock(&__glXSwapBuffersMutex); -#endif return; } @@ -601,16 +601,13 @@ void glXSwapBuffers(Display *dpy, GLXDrawable drawable) UnlockDisplay(dpy); SyncHandle(); XFlush(dpy); -#if defined(GLX_DIRECT_RENDERING) && defined(XTHREADS) - xmutex_unlock(&__glXSwapBuffersMutex); -#endif } /* ** Return configuration information for the given display, screen and ** visual combination. */ -int glXGetConfig(Display *dpy, XVisualInfo *vis, int attribute, +int GLX_PREFIX(glXGetConfig)(Display *dpy, XVisualInfo *vis, int attribute, int *value_return) { __GLXvisualConfig *pConfig; @@ -822,7 +819,7 @@ static int StencilScore(int minStencil, int stencil) /* Fetch a configuration value */ #define __GLX_GCONF(attrib) \ - if (glXGetConfig(dpy, thisVis, attrib, &val)) { \ + if (GLX_PREFIX(glXGetConfig)(dpy, thisVis, attrib, &val)) { \ XFree((char *)visualList); \ return NULL; \ } @@ -832,7 +829,7 @@ static int StencilScore(int minStencil, int stencil) ** Return the visual that best matches the template. Return None if no ** visual matches the template. */ -XVisualInfo *glXChooseVisual(Display *dpy, int screen, int *attribList) +XVisualInfo *GLX_PREFIX(glXChooseVisual)(Display *dpy, int screen, int *attribList) { XVisualInfo visualTemplate; XVisualInfo *visualList; @@ -1253,7 +1250,7 @@ static char *combine_strings( const char *cext_string, const char *sext_string ) return combo_string; } -const char *glXQueryExtensionsString( Display *dpy, int screen ) +const char *GLX_PREFIX(glXQueryExtensionsString)( Display *dpy, int screen ) { __GLXvisualConfig *pConfig; __GLXscreenConfigs *psc; @@ -1291,7 +1288,7 @@ const char *glXQueryExtensionsString( Display *dpy, int screen ) return psc->effectiveGLXexts; } -const char *glXGetClientString( Display *dpy, int name ) +const char *GLX_PREFIX(glXGetClientString)( Display *dpy, int name ) { switch(name) { case GLX_VENDOR: @@ -1305,7 +1302,7 @@ const char *glXGetClientString( Display *dpy, int name ) } } -const char *glXQueryServerString( Display *dpy, int screen, int name ) +const char *GLX_PREFIX(glXQueryServerString)( Display *dpy, int screen, int name ) { __GLXvisualConfig *pConfig; __GLXscreenConfigs *psc; @@ -1395,6 +1392,14 @@ Display *glXGetCurrentDisplay(void) } +Display *glXGetCurrentDisplayEXT(void) +{ + GLXContext gc = __glXGetCurrentContext(); + if (NULL == gc) return NULL; + return gc->currentDpy; +} + + static int __glXQueryContextInfo(Display *dpy, GLXContext ctx) { xGLXVendorPrivateReq *vpreq; @@ -1461,7 +1466,7 @@ static int __glXQueryContextInfo(Display *dpy, GLXContext ctx) return Success; } -int glXQueryContextInfoEXT(Display *dpy, GLXContext ctx, +int GLX_PREFIX(glXQueryContextInfoEXT)(Display *dpy, GLXContext ctx, int attribute, int *value) { int retVal; @@ -1492,7 +1497,7 @@ GLXContextID glXGetContextIDEXT(const GLXContext ctx) return ctx->xid; } -GLXContext glXImportContextEXT(Display *dpy, GLXContextID contextID) +GLXContext GLX_PREFIX(glXImportContextEXT)(Display *dpy, GLXContextID contextID) { GLXContext ctx; @@ -1512,7 +1517,7 @@ GLXContext glXImportContextEXT(Display *dpy, GLXContextID contextID) return ctx; } -void glXFreeContextEXT(Display *dpy, GLXContext ctx) +void GLX_PREFIX(glXFreeContextEXT)(Display *dpy, GLXContext ctx) { DestroyContext(dpy, ctx); } @@ -1523,7 +1528,7 @@ void glXFreeContextEXT(Display *dpy, GLXContext ctx) * GLX 1.3 functions - these are just stubs for now! */ -GLXFBConfig *glXChooseFBConfig(Display *dpy, int screen, const int *attribList, int *nitems) +GLXFBConfig *GLX_PREFIX(glXChooseFBConfig)(Display *dpy, int screen, const int *attribList, int *nitems) { (void) dpy; (void) screen; @@ -1533,7 +1538,7 @@ GLXFBConfig *glXChooseFBConfig(Display *dpy, int screen, const int *attribList, } -GLXContext glXCreateNewContext(Display *dpy, GLXFBConfig config, int renderType, GLXContext shareList, Bool direct) +GLXContext GLX_PREFIX(glXCreateNewContext)(Display *dpy, GLXFBConfig config, int renderType, GLXContext shareList, Bool direct) { (void) dpy; (void) config; @@ -1544,7 +1549,7 @@ GLXContext glXCreateNewContext(Display *dpy, GLXFBConfig config, int renderType, } -GLXPbuffer glXCreatePbuffer(Display *dpy, GLXFBConfig config, const int *attribList) +GLXPbuffer GLX_PREFIX(glXCreatePbuffer)(Display *dpy, GLXFBConfig config, const int *attribList) { (void) dpy; (void) config; @@ -1553,7 +1558,7 @@ GLXPbuffer glXCreatePbuffer(Display *dpy, GLXFBConfig config, const int *attribL } -GLXPixmap glXCreatePixmap(Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attribList) +GLXPixmap GLX_PREFIX(glXCreatePixmap)(Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attribList) { (void) dpy; (void) config; @@ -1563,7 +1568,7 @@ GLXPixmap glXCreatePixmap(Display *dpy, GLXFBConfig config, Pixmap pixmap, const } -GLXWindow glXCreateWindow(Display *dpy, GLXFBConfig config, Window win, const int *attribList) +GLXWindow GLX_PREFIX(glXCreateWindow)(Display *dpy, GLXFBConfig config, Window win, const int *attribList) { (void) dpy; (void) config; @@ -1573,21 +1578,21 @@ GLXWindow glXCreateWindow(Display *dpy, GLXFBConfig config, Window win, const in } -void glXDestroyPbuffer(Display *dpy, GLXPbuffer pbuf) +void GLX_PREFIX(glXDestroyPbuffer)(Display *dpy, GLXPbuffer pbuf) { (void) dpy; (void) pbuf; } -void glXDestroyPixmap(Display *dpy, GLXPixmap pixmap) +void GLX_PREFIX(glXDestroyPixmap)(Display *dpy, GLXPixmap pixmap) { (void) dpy; (void) pixmap; } -void glXDestroyWindow(Display *dpy, GLXWindow window) +void GLX_PREFIX(glXDestroyWindow)(Display *dpy, GLXWindow window) { (void) dpy; (void) window; @@ -1596,11 +1601,12 @@ void glXDestroyWindow(Display *dpy, GLXWindow window) GLXDrawable glXGetCurrentReadDrawable(void) { - return 0; + GLXContext gc = __glXGetCurrentContext(); + return gc->currentReadable; } -GLXFBConfig *glXGetFBConfigs(Display *dpy, int screen, int *nelements) +GLXFBConfig *GLX_PREFIX(glXGetFBConfigs)(Display *dpy, int screen, int *nelements) { (void) dpy; (void) screen; @@ -1609,7 +1615,7 @@ GLXFBConfig *glXGetFBConfigs(Display *dpy, int screen, int *nelements) } -int glXGetFBConfigAttrib(Display *dpy, GLXFBConfig config, int attribute, int *value) +int GLX_PREFIX(glXGetFBConfigAttrib)(Display *dpy, GLXFBConfig config, int attribute, int *value) { (void) dpy; (void) config; @@ -1619,7 +1625,7 @@ int glXGetFBConfigAttrib(Display *dpy, GLXFBConfig config, int attribute, int *v } -void glXGetSelectedEvent(Display *dpy, GLXDrawable drawable, unsigned long *mask) +void GLX_PREFIX(glXGetSelectedEvent)(Display *dpy, GLXDrawable drawable, unsigned long *mask) { (void) dpy; (void) drawable; @@ -1627,7 +1633,7 @@ void glXGetSelectedEvent(Display *dpy, GLXDrawable drawable, unsigned long *mask } -XVisualInfo *glXGetVisualFromFBConfig(Display *dpy, GLXFBConfig config) +XVisualInfo *GLX_PREFIX(glXGetVisualFromFBConfig)(Display *dpy, GLXFBConfig config) { (void) dpy; (void) config; @@ -1635,7 +1641,7 @@ XVisualInfo *glXGetVisualFromFBConfig(Display *dpy, GLXFBConfig config) } -Bool glXMakeContextCurrent(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx) +Bool GLX_PREFIX(glXMakeContextCurrent)(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx) { (void) dpy; (void) draw; @@ -1645,7 +1651,7 @@ Bool glXMakeContextCurrent(Display *dpy, GLXDrawable draw, GLXDrawable read, GLX } -int glXQueryContext(Display *dpy, GLXContext ctx, int attribute, int *value) +int GLX_PREFIX(glXQueryContext)(Display *dpy, GLXContext ctx, int attribute, int *value) { (void) dpy; (void) ctx; @@ -1655,7 +1661,7 @@ int glXQueryContext(Display *dpy, GLXContext ctx, int attribute, int *value) } -void glXQueryDrawable(Display *dpy, GLXDrawable draw, int attribute, unsigned int *value) +void GLX_PREFIX(glXQueryDrawable)(Display *dpy, GLXDrawable draw, int attribute, unsigned int *value) { (void) dpy; (void) draw; @@ -1664,7 +1670,7 @@ void glXQueryDrawable(Display *dpy, GLXDrawable draw, int attribute, unsigned in } -void glXSelectEvent(Display *dpy, GLXDrawable drawable, unsigned long mask) +void GLX_PREFIX(glXSelectEvent)(Display *dpy, GLXDrawable drawable, unsigned long mask) { (void) dpy; (void) drawable; @@ -1672,21 +1678,316 @@ void glXSelectEvent(Display *dpy, GLXDrawable drawable, unsigned long mask) } +/* +** GLX_SGIS_make_current_read +*/ +Bool GLX_PREFIX(glXMakeCurrentReadSGI)(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx) +{ + (void) dpy; + (void) draw; + (void) read; + (void) ctx; + return False; +} + +GLXDrawable glXGetCurrentReadDrawableSGI(void) +{ + return 0; +} + + +/* +** GLX_SGI_swap_control +*/ +int GLX_PREFIX(glXSwapIntervalSGI)(int interval) +{ + (void) interval; + return 0; +} + + +/* +** GLX_SGI_video_sync +*/ +int GLX_PREFIX(glXGetVideoSyncSGI)(unsigned int *count) +{ + (void) count; + return 0; +} + +int GLX_PREFIX(glXWaitVideoSyncSGI)(int divisor, int remainder, unsigned int *count) +{ + (void) divisor; + (void) remainder; + (void) count; + return 0; +} + + +/* +** GLX_SGIS_video_source +*/ +#if defined(_VL_H) + +GLXVideoSourceSGIX GLX_PREFIX(glXCreateGLXVideoSourceSGIX)(Display *dpy, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode) +{ + (void) dpy; + (void) screen; + (void) server; + (void) path; + (void) nodeClass; + (void) drainNode; + return 0; +} + +void GLX_PREFIX(glXDestroyGLXVideoSourceSGIX)(Display *dpy, GLXVideoSourceSGIX src) +{ + (void) dpy; + (void) src; +} + +#endif + + +/* +** GLX_SGIX_fbconfig +*/ +int GLX_PREFIX(glXGetFBConfigAttribSGIX)(Display *dpy, GLXFBConfigSGIX config, int attribute, int *value) +{ + (void) dpy; + (void) config; + (void) attribute; + (void) value; + return 0; +} + +GLXFBConfigSGIX * GLX_PREFIX(glXChooseFBConfigSGIX)(Display *dpy, int screen, int *attrib_list, int *nelements) +{ + (void) dpy; + (void) screen; + (void) attrib_list; + (void) nelements; + return 0; +} + +GLXPixmap GLX_PREFIX(glXCreateGLXPixmapWithConfigSGIX)(Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap) +{ + (void) dpy; + (void) config; + (void) pixmap; + return 0; +} + +GLXContext GLX_PREFIX(glXCreateContextWithConfigSGIX)(Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct) +{ + (void) dpy; + (void) config; + (void) render_type; + (void) share_list; + (void) direct; + return 0; +} + +XVisualInfo * GLX_PREFIX(glXGetVisualFromFBConfigSGIX)(Display *dpy, GLXFBConfigSGIX config) +{ + (void) dpy; + (void) config; + return NULL; +} + +GLXFBConfigSGIX GLX_PREFIX(glXGetFBConfigFromVisualSGIX)(Display *dpy, XVisualInfo *vis) +{ + (void) dpy; + (void) vis; + return 0; +} + + +/* +** GLX_SGIX_pbuffer +*/ +GLXPbufferSGIX GLX_PREFIX(glXCreateGLXPbufferSGIX)(Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list) +{ + (void) dpy; + (void) config; + (void) width; + (void) height; + (void) attrib_list; + return 0; +} + +void GLX_PREFIX(glXDestroyGLXPbufferSGIX)(Display *dpy, GLXPbufferSGIX pbuf) +{ + (void) dpy; + (void) pbuf; +} + +int GLX_PREFIX(glXQueryGLXPbufferSGIX)(Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value) +{ + (void) dpy; + (void) pbuf; + (void) attribute; + (void) value; + return 0; +} + +void GLX_PREFIX(glXSelectEventSGIX)(Display *dpy, GLXDrawable drawable, unsigned long mask) +{ + (void) dpy; + (void) drawable; + (void) mask; +} + +void GLX_PREFIX(glXGetSelectedEventSGIX)(Display *dpy, GLXDrawable drawable, unsigned long *mask) +{ + (void) dpy; + (void) drawable; + (void) mask; +} + + +/* +** GLX_SGI_cushion +*/ +void GLX_PREFIX(glXCushionSGI)(Display *dpy, Window win, float cushion) +{ + (void) dpy; + (void) win; + (void) cushion; +} + + +/* +** GLX_SGIX_video_resize +*/ +int GLX_PREFIX(glXBindChannelToWindowSGIX)(Display *dpy, int screen, int channel , Window window) +{ + (void) dpy; + (void) screen; + (void) channel; + (void) window; + return 0; +} + +int GLX_PREFIX(glXChannelRectSGIX)(Display *dpy, int screen, int channel, int x, int y, int w, int h) +{ + (void) dpy; + (void) screen; + (void) channel; + (void) x; + (void) y; + (void) w; + (void) h; + return 0; +} + +int GLX_PREFIX(glXQueryChannelRectSGIX)(Display *dpy, int screen, int channel, int *x, int *y, int *w, int *h) +{ + (void) dpy; + (void) screen; + (void) channel; + (void) x; + (void) y; + (void) w; + (void) h; + return 0; +} + +int GLX_PREFIX(glXQueryChannelDeltasSGIX)(Display *dpy, int screen, int channel, int *dx, int *dy, int *dw, int *dh) +{ + (void) dpy; + (void) screen; + (void) channel; + (void) dx; + (void) dy; + (void) dw; + (void) dh; + return 0; +} + +int GLX_PREFIX(glXChannelRectSyncSGIX)(Display *dpy, int screen, int channel, GLenum synctype) +{ + (void) dpy; + (void) screen; + (void) channel; + (void) synctype; + return 0; +} + + +#if defined(_DM_BUFFER_H_) + +Bool GLX_PREFIX(glXAssociateDMPbufferSGIX)(Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer) +{ + (void) dpy; + (void) pbuffer; + (void) params; + (void) dmbuffer; + return False; +} + +#endif + + +/* +** GLX_SGIX_swap_group +*/ +void GLX_PREFIX(glXJoinSwapGroupSGIX)(Display *dpy, GLXDrawable drawable, GLXDrawable member) +{ + (void) dpy; + (void) drawable; + (void) member; +} + + +/* +** GLX_SGIX_swap_barrier +*/ +void GLX_PREFIX(glXBindSwapBarrierSGIX)(Display *dpy, GLXDrawable drawable, int barrier) +{ + (void) dpy; + (void) drawable; + (void) barrier; +} + +Bool GLX_PREFIX(glXQueryMaxSwapBarriersSGIX)(Display *dpy, int screen, int *max) +{ + (void) dpy; + (void) screen; + (void) max; + return False; +} + + +/* +** GLX_SUN_get_transparent_index +*/ +Status GLX_PREFIX(glXGetTransparentIndexSUN)(Display *dpy, Window overlay, Window underlay, long *pTransparent) +{ + (void) dpy; + (void) overlay; + (void) underlay; + (void) pTransparent; + return 0; +} + + /* ** Mesa extension stubs. These will help reduce portability problems. */ -void glXReleaseBuffersMESA( Display *dpy, GLXDrawable d ) +Bool GLX_PREFIX(glXReleaseBuffersMESA)( Display *dpy, GLXDrawable d ) { (void) dpy; (void) d; - /* no-op stub */ + return False; } -GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual, - Pixmap pixmap, Colormap cmap ) +GLXPixmap GLX_PREFIX(glXCreateGLXPixmapMESA)( Display *dpy, + XVisualInfo *visual, + Pixmap pixmap, Colormap cmap ) { (void) dpy; (void) visual; @@ -1696,8 +1997,8 @@ GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual, } -void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable, - int x, int y, int width, int height ) +void GLX_PREFIX(glXCopySubBufferMESA)( Display *dpy, GLXDrawable drawable, + int x, int y, int width, int height ) { (void) dpy; (void) drawable; @@ -1708,7 +2009,7 @@ void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable, } -GLboolean glXSet3DfxModeMESA( GLint mode ) +Bool GLX_PREFIX(glXSet3DfxModeMESA)( int mode ) { (void) mode; return GL_FALSE; @@ -1725,6 +2026,7 @@ struct name_address_pair { }; static struct name_address_pair GLX_functions[] = { + /*** GLX_VERSION_1_0 ***/ { "glXChooseVisual", (GLvoid *) glXChooseVisual }, { "glXCopyContext", (GLvoid *) glXCopyContext }, { "glXCreateContext", (GLvoid *) glXCreateContext }, @@ -1743,12 +2045,15 @@ static struct name_address_pair GLX_functions[] = { { "glXWaitGL", (GLvoid *) glXWaitGL }, { "glXWaitX", (GLvoid *) glXWaitX }, + /*** GLX_VERSION_1_1 ***/ { "glXGetClientString", (GLvoid *) glXGetClientString }, { "glXQueryExtensionsString", (GLvoid *) glXQueryExtensionsString }, { "glXQueryServerString", (GLvoid *) glXQueryServerString }, + /*** GLX_VERSION_1_2 ***/ { "glXGetCurrentDisplay", (GLvoid *) glXGetCurrentDisplay }, + /*** GLX_VERSION_1_3 ***/ { "glXChooseFBConfig", (GLvoid *) glXChooseFBConfig }, { "glXCreateNewContext", (GLvoid *) glXCreateNewContext }, { "glXCreatePbuffer", (GLvoid *) glXCreatePbuffer }, @@ -1767,20 +2072,85 @@ static struct name_address_pair GLX_functions[] = { { "glXQueryDrawable", (GLvoid *) glXQueryDrawable }, { "glXSelectEvent", (GLvoid *) glXSelectEvent }, - /* extension functions */ + /*** GLX_SGI_swap_control ***/ + { "glXSwapIntervalSGI", (GLvoid *) glXSwapIntervalSGI }, + + /*** GLX_SGI_video_sync ***/ + { "glXGetVideoSyncSGI", (GLvoid *) glXGetVideoSyncSGI }, + { "glXWaitVideoSyncSGI", (GLvoid *) glXWaitVideoSyncSGI }, + + /*** GLX_SGI_make_current_read ***/ + { "glXMakeCurrentReadSGI", (GLvoid *) glXMakeCurrentReadSGI }, + { "glXGetCurrentReadDrawableSGI", (GLvoid *) glXGetCurrentReadDrawableSGI }, + + /*** GLX_SGIX_video_source ***/ +#if defined(_VL_H) + { "glXCreateGLXVideoSourceSGIX", (GLvoid *) glXCreateGLXVideoSourceSGIX }, + { "glXDestroyGLXVideoSourceSGIX", (GLvoid *) glXDestroyGLXVideoSourceSGIX }, +#endif + + /*** GLX_EXT_import_context ***/ + { "glXFreeContextEXT", (GLvoid *) glXFreeContextEXT }, { "glXGetContextIDEXT", (GLvoid *) glXGetContextIDEXT }, - { "glXGetCurrentDrawableEXT", (GLvoid *) glXGetCurrentDrawableEXT }, + { "glXGetCurrentDisplayEXT", (GLvoid *) glXGetCurrentDisplayEXT }, { "glXImportContextEXT", (GLvoid *) glXImportContextEXT }, - { "glXFreeContextEXT", (GLvoid *) glXFreeContextEXT }, { "glXQueryContextInfoEXT", (GLvoid *) glXQueryContextInfoEXT }, - { "glXGetProcAddressARB", (GLvoid *) glXGetProcAddressARB }, - /* Mesa extensions */ - { "glXReleaseBuffersMESA", (GLvoid *) glXReleaseBuffersMESA }, - { "glXCreateGLXPixmapMESA", (GLvoid *) glXCreateGLXPixmapMESA }, + /*** GLX_SGIX_fbconfig ***/ + { "glXGetFBConfigAttribSGIX", (GLvoid *) glXGetFBConfigAttribSGIX }, + { "glXChooseFBConfigSGIX", (GLvoid *) glXChooseFBConfigSGIX }, + { "glXCreateGLXPixmapWithConfigSGIX", (GLvoid *) glXCreateGLXPixmapWithConfigSGIX }, + { "glXCreateContextWithConfigSGIX", (GLvoid *) glXCreateContextWithConfigSGIX }, + { "glXGetVisualFromFBConfigSGIX", (GLvoid *) glXGetVisualFromFBConfigSGIX }, + { "glXGetFBConfigFromVisualSGIX", (GLvoid *) glXGetFBConfigFromVisualSGIX }, + + /*** GLX_SGIX_pbuffer ***/ + { "glXCreateGLXPbufferSGIX", (GLvoid *) glXCreateGLXPbufferSGIX }, + { "glXDestroyGLXPbufferSGIX", (GLvoid *) glXDestroyGLXPbufferSGIX }, + { "glXQueryGLXPbufferSGIX", (GLvoid *) glXQueryGLXPbufferSGIX }, + { "glXSelectEventSGIX", (GLvoid *) glXSelectEventSGIX }, + { "glXGetSelectedEventSGIX", (GLvoid *) glXGetSelectedEventSGIX }, + + /*** GLX_SGI_cushion ***/ + { "glXCushionSGI", (GLvoid *) glXCushionSGI }, + + /*** GLX_SGIX_video_resize ***/ + { "glXBindChannelToWindowSGIX", (GLvoid *) glXBindChannelToWindowSGIX }, + { "glXChannelRectSGIX", (GLvoid *) glXChannelRectSGIX }, + { "glXQueryChannelRectSGIX", (GLvoid *) glXQueryChannelRectSGIX }, + { "glXQueryChannelDeltasSGIX", (GLvoid *) glXQueryChannelDeltasSGIX }, + { "glXChannelRectSyncSGIX", (GLvoid *) glXChannelRectSyncSGIX }, + + /*** GLX_SGIX_dmbuffer **/ +#if defined(_DM_BUFFER_H_) + { "glXAssociateDMPbufferSGIX", (GLvoid *) glXAssociateDMPbufferSGIX }, +#endif + + /*** GLX_SGIX_swap_group ***/ + { "glXJoinSwapGroupSGIX", (GLvoid *) glXJoinSwapGroupSGIX }, + + /*** GLX_SGIX_swap_barrier ***/ + { "glXBindSwapBarrierSGIX", (GLvoid *) glXBindSwapBarrierSGIX }, + { "glXQueryMaxSwapBarriersSGIX", (GLvoid *) glXQueryMaxSwapBarriersSGIX }, + + /*** GLX_SUN_get_transparent_index ***/ + { "glXGetTransparentIndexSUN", (GLvoid *) glXGetTransparentIndexSUN }, + + /*** GLX_MESA_copy_sub_buffer ***/ { "glXCopySubBufferMESA", (GLvoid *) glXCopySubBufferMESA }, + + /*** GLX_MESA_pixmap_colormap ***/ + { "glXCreateGLXPixmapMESA", (GLvoid *) glXCreateGLXPixmapMESA }, + + /*** GLX_MESA_release_buffers ***/ + { "glXReleaseBuffersMESA", (GLvoid *) glXReleaseBuffersMESA }, + + /*** GLX_MESA_set_3dfx_mode ***/ { "glXSet3DfxModeMESA", (GLvoid *) glXSet3DfxModeMESA }, + /*** GLX_ARB_get_proc_address ***/ + { "glXGetProcAddressARB", (GLvoid *) glXGetProcAddressARB }, + { NULL, NULL } /* end of list */ }; @@ -1797,6 +2167,7 @@ get_glx_proc_address(const char *funcName) } +#ifndef GLX_BUILT_IN_XMESA void (*glXGetProcAddressARB(const GLubyte *procName))() { typedef void (*gl_function)(); @@ -1814,3 +2185,4 @@ void (*glXGetProcAddressARB(const GLubyte *procName))() f = (gl_function) _glapi_get_proc_address((const char *) procName); return f; } +#endif diff --git a/xc/lib/GL/glx/glxext.c b/xc/lib/GL/glx/glxext.c index f25a8a9eb..4edfbd4bd 100644 --- a/xc/lib/GL/glx/glxext.c +++ b/xc/lib/GL/glx/glxext.c @@ -125,7 +125,6 @@ void __glXSetCurrentContext(__GLXcontext *c) /* Used by the __glXLock() and __glXUnlock() macros */ xmutex_rec __glXmutex; -xmutex_rec __glXSwapBuffersMutex; #else @@ -479,7 +478,6 @@ __GLXdisplayPrivate *__glXInitialize(Display* dpy) if (firstCall) { /* initialize the GLX mutexes */ xmutex_init(&__glXmutex); - xmutex_init(&__glXSwapBuffersMutex); firstCall = 0; } } @@ -726,10 +724,6 @@ GLXDrawable glXGetCurrentDrawable(void) return gc->currentDrawable; } -GLXDrawable glXGetCurrentDrawableEXT(void) -{ - return glXGetCurrentDrawable(); -} /************************************************************************/ @@ -764,7 +758,7 @@ __DRIscreen *__glXFindDRIScreen(Display *dpy, int scrn) ** Make a particular context current. ** NOTE: this is in this file so that it can access dummyContext. */ -Bool glXMakeCurrent(Display *dpy, GLXDrawable draw, GLXContext gc) +Bool GLX_PREFIX(glXMakeCurrent)(Display *dpy, GLXDrawable draw, GLXContext gc) { xGLXMakeCurrentReq *req; xGLXMakeCurrentReply reply; diff --git a/xc/lib/GL/glx/indirect.h b/xc/lib/GL/glx/indirect.h index 76b72b6e8..8cca28b95 100644 --- a/xc/lib/GL/glx/indirect.h +++ b/xc/lib/GL/glx/indirect.h @@ -381,7 +381,7 @@ void __indirect_glTexGeni(GLenum coord, GLenum pname, GLint param); void __indirect_glTexGeniv(GLenum coord, GLenum pname, const GLint *params); void __indirect_glTexImage1D(GLenum target, GLint level, GLint components, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *image); void __indirect_glTexImage2D(GLenum target, GLint level, GLint components, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *image); -void __indirect_glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *image); +void __indirect_glTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *image); void __indirect_glTexParameterf(GLenum target, GLenum pname, GLfloat param); void __indirect_glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params); void __indirect_glTexParameteri(GLenum target, GLenum pname, GLint param); @@ -455,4 +455,9 @@ void __indirect_glMultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshor void __indirect_glMultiTexCoord4svARB(GLenum target, const GLshort *v); +void __indirect_glLoadTransposeMatrixfARB(const GLfloat *m); +void __indirect_glMultTransposeMatrixfARB(const GLfloat *m); +void __indirect_glLoadTransposeMatrixdARB(const GLdouble *m); +void __indirect_glMultTransposeMatrixdARB(const GLdouble *m); + #endif /* _INDIRECT_H_ */ diff --git a/xc/lib/GL/glx/indirect_init.c b/xc/lib/GL/glx/indirect_init.c index 1af30a6ef..a6a80ee7d 100644 --- a/xc/lib/GL/glx/indirect_init.c +++ b/xc/lib/GL/glx/indirect_init.c @@ -487,5 +487,11 @@ __GLapi *__glXNewIndirectAPI(void) glAPI->MultiTexCoord4sARB = __indirect_glMultiTexCoord4sARB; glAPI->MultiTexCoord4svARB = __indirect_glMultiTexCoord4svARB; + /* ARB 3. GL_ARB_transpose_matrix */ + glAPI->LoadTransposeMatrixdARB = __indirect_glLoadTransposeMatrixdARB; + glAPI->LoadTransposeMatrixfARB = __indirect_glLoadTransposeMatrixfARB; + glAPI->MultTransposeMatrixdARB = __indirect_glMultTransposeMatrixdARB; + glAPI->MultTransposeMatrixfARB = __indirect_glMultTransposeMatrixfARB; + return glAPI; } diff --git a/xc/lib/GL/glx/pixel.c b/xc/lib/GL/glx/pixel.c index 353516b4a..710e5b0d3 100644 --- a/xc/lib/GL/glx/pixel.c +++ b/xc/lib/GL/glx/pixel.c @@ -124,6 +124,7 @@ static GLint ElementsPerGroup(GLenum format, GLenum type) case GL_BLUE: case GL_ALPHA: case GL_LUMINANCE: + case GL_INTENSITY: return 1; default: return 0; diff --git a/xc/lib/GL/glx/renderpix.c b/xc/lib/GL/glx/renderpix.c index a4eb61e8c..431bfbe8b 100644 --- a/xc/lib/GL/glx/renderpix.c +++ b/xc/lib/GL/glx/renderpix.c @@ -260,7 +260,8 @@ void glTexImage2D(GLenum target, GLint level, GLint components, { __GLX_DECLARE_VARIABLES(); - if (target == GL_PROXY_TEXTURE_2D) { + if (target == GL_PROXY_TEXTURE_2D || + target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) { compsize = 0; } else { compsize = __glImageSize(width, height, 1, format, type); @@ -478,6 +479,7 @@ void glColorTable(GLenum target, GLenum internalformat, GLsizei width, case GL_PROXY_COLOR_TABLE: case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE: case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: + case GL_PROXY_TEXTURE_CUBE_MAP_ARB: compsize = 0; break; default: @@ -741,7 +743,7 @@ void glSeparableFilter2D(GLenum target, GLenum internalformat, } } -void glTexImage3D(GLenum target, GLint level, GLint internalformat, +void glTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *image) { diff --git a/xc/lib/GL/glx/single2.c b/xc/lib/GL/glx/single2.c index a027ff129..3c1fc939c 100644 --- a/xc/lib/GL/glx/single2.c +++ b/xc/lib/GL/glx/single2.c @@ -38,6 +38,58 @@ #include "glxclient.h" #include "packsingle.h" +/* Used for GL_ARB_transpose_matrix */ +static void TransposeMatrixf(GLfloat m[16]) +{ + int i, j; + for (i = 0; i < 4; i++) { + for (j = 0; j < i; j++) { + GLfloat tmp = m[i*4+j]; + m[i*4+j] = m[j*4+i]; + m[j*4+i] = tmp; + } + } +} + +/* Used for GL_ARB_transpose_matrix */ +static void TransposeMatrixb(GLboolean m[16]) +{ + int i, j; + for (i = 0; i < 4; i++) { + for (j = 0; j < i; j++) { + GLboolean tmp = m[i*4+j]; + m[i*4+j] = m[j*4+i]; + m[j*4+i] = tmp; + } + } +} + +/* Used for GL_ARB_transpose_matrix */ +static void TransposeMatrixd(GLdouble m[16]) +{ + int i, j; + for (i = 0; i < 4; i++) { + for (j = 0; j < i; j++) { + GLdouble tmp = m[i*4+j]; + m[i*4+j] = m[j*4+i]; + m[j*4+i] = tmp; + } + } +} + +/* Used for GL_ARB_transpose_matrix */ +static void TransposeMatrixi(GLint m[16]) +{ + int i, j; + for (i = 0; i < 4; i++) { + for (j = 0; j < i; j++) { + GLint tmp = m[i*4+j]; + m[i*4+j] = m[j*4+i]; + m[j*4+i] = tmp; + } + } +} + GLenum glGetError(void) { __GLX_SINGLE_DECLARE_VARIABLES(); @@ -76,9 +128,23 @@ void glGetClipPlane(GLenum plane, GLdouble *equation) void glGetBooleanv(GLenum val, GLboolean *b) { + const GLenum origVal = val; __GLX_SINGLE_DECLARE_VARIABLES(); xGLXSingleReply reply; + if (val == GL_TRANSPOSE_MODELVIEW_MATRIX_ARB) { + val = GL_MODELVIEW_MATRIX; + } + else if (val == GL_TRANSPOSE_PROJECTION_MATRIX_ARB) { + val = GL_PROJECTION_MATRIX; + } + else if (val == GL_TRANSPOSE_TEXTURE_MATRIX_ARB) { + val = GL_TEXTURE_MATRIX; + } + else if (val == GL_TRANSPOSE_COLOR_MATRIX_ARB) { + val = GL_COLOR_MATRIX; + } + __GLX_SINGLE_LOAD_VARIABLES(); __GLX_SINGLE_BEGIN(X_GLsop_GetBooleanv,4); __GLX_SINGLE_PUT_LONG(0,val); @@ -226,6 +292,10 @@ void glGetBooleanv(GLenum val, GLboolean *b) __GLX_SINGLE_GET_CHAR(b); } else { __GLX_SINGLE_GET_CHAR_ARRAY(b,compsize); + if (val != origVal) { + /* matrix transpose */ + TransposeMatrixb(b); + } } } } @@ -234,9 +304,23 @@ void glGetBooleanv(GLenum val, GLboolean *b) void glGetDoublev(GLenum val, GLdouble *d) { + const GLenum origVal = val; __GLX_SINGLE_DECLARE_VARIABLES(); xGLXSingleReply reply; + if (val == GL_TRANSPOSE_MODELVIEW_MATRIX_ARB) { + val = GL_MODELVIEW_MATRIX; + } + else if (val == GL_TRANSPOSE_PROJECTION_MATRIX_ARB) { + val = GL_PROJECTION_MATRIX; + } + else if (val == GL_TRANSPOSE_TEXTURE_MATRIX_ARB) { + val = GL_TEXTURE_MATRIX; + } + else if (val == GL_TRANSPOSE_COLOR_MATRIX_ARB) { + val = GL_COLOR_MATRIX; + } + __GLX_SINGLE_LOAD_VARIABLES(); __GLX_SINGLE_BEGIN(X_GLsop_GetDoublev,4); __GLX_SINGLE_PUT_LONG(0,val); @@ -384,6 +468,10 @@ void glGetDoublev(GLenum val, GLdouble *d) __GLX_SINGLE_GET_DOUBLE(d); } else { __GLX_SINGLE_GET_DOUBLE_ARRAY(d,compsize); + if (val != origVal) { + /* matrix transpose */ + TransposeMatrixd(d); + } } } } @@ -392,9 +480,23 @@ void glGetDoublev(GLenum val, GLdouble *d) void glGetFloatv(GLenum val, GLfloat *f) { + const GLenum origVal = val; __GLX_SINGLE_DECLARE_VARIABLES(); xGLXSingleReply reply; + if (val == GL_TRANSPOSE_MODELVIEW_MATRIX_ARB) { + val = GL_MODELVIEW_MATRIX; + } + else if (val == GL_TRANSPOSE_PROJECTION_MATRIX_ARB) { + val = GL_PROJECTION_MATRIX; + } + else if (val == GL_TRANSPOSE_TEXTURE_MATRIX_ARB) { + val = GL_TEXTURE_MATRIX; + } + else if (val == GL_TRANSPOSE_COLOR_MATRIX_ARB) { + val = GL_COLOR_MATRIX; + } + __GLX_SINGLE_LOAD_VARIABLES(); __GLX_SINGLE_BEGIN(X_GLsop_GetFloatv,4); __GLX_SINGLE_PUT_LONG(0,val); @@ -542,6 +644,10 @@ void glGetFloatv(GLenum val, GLfloat *f) __GLX_SINGLE_GET_FLOAT(f); } else { __GLX_SINGLE_GET_FLOAT_ARRAY(f,compsize); + if (val != origVal) { + /* matrix transpose */ + TransposeMatrixf(f); + } } } } @@ -550,9 +656,23 @@ void glGetFloatv(GLenum val, GLfloat *f) void glGetIntegerv(GLenum val, GLint *i) { + const GLenum origVal = val; __GLX_SINGLE_DECLARE_VARIABLES(); xGLXSingleReply reply; + if (val == GL_TRANSPOSE_MODELVIEW_MATRIX_ARB) { + val = GL_MODELVIEW_MATRIX; + } + else if (val == GL_TRANSPOSE_PROJECTION_MATRIX_ARB) { + val = GL_PROJECTION_MATRIX; + } + else if (val == GL_TRANSPOSE_TEXTURE_MATRIX_ARB) { + val = GL_TEXTURE_MATRIX; + } + else if (val == GL_TRANSPOSE_COLOR_MATRIX_ARB) { + val = GL_COLOR_MATRIX; + } + __GLX_SINGLE_LOAD_VARIABLES(); __GLX_SINGLE_BEGIN(X_GLsop_GetIntegerv,4); __GLX_SINGLE_PUT_LONG(0,val); @@ -700,6 +820,10 @@ void glGetIntegerv(GLenum val, GLint *i) __GLX_SINGLE_GET_LONG(i); } else { __GLX_SINGLE_GET_LONG_ARRAY(i,compsize); + if (val != origVal) { + /* matrix transpose */ + TransposeMatrixi(i); + } } } } |