From 43c9c2cfae458cf0d7618af5f25d57c0a5ebae08 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 16 Sep 1999 15:52:51 +0000 Subject: added GLX_MESA_set_3dfx_mode. clean-up of glXGetProcAddress --- include/GL/glx.h | 37 ++++++++++++++++------------ src/mesa/drivers/x11/fakeglx.c | 55 ++++++++++++++++++++++++++++++------------ src/mesa/drivers/x11/glxapi.c | 23 +++++++++++++++--- 3 files changed, 80 insertions(+), 35 deletions(-) diff --git a/include/GL/glx.h b/include/GL/glx.h index 4163fe2857..e7576e741c 100644 --- a/include/GL/glx.h +++ b/include/GL/glx.h @@ -1,4 +1,4 @@ -/* $Id: glx.h,v 1.2 1999/09/11 11:33:45 brianp Exp $ */ +/* $Id: glx.h,v 1.3 1999/09/16 15:52:51 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -27,6 +27,9 @@ /* * $Log: glx.h,v $ + * Revision 1.3 1999/09/16 15:52:51 brianp + * added GLX_MESA_set_3dfx_mode. clean-up of glXGetProcAddress + * * Revision 1.2 1999/09/11 11:33:45 brianp * added GLX_EXT_get_proc_address * @@ -158,11 +161,12 @@ enum _GLX_CONFIGS { * Compile-time extension tests */ #define GLX_EXT_visual_info 1 +#define GLX_EXT_get_proc_address 1 #define GLX_MESA_pixmap_colormap 1 #define GLX_MESA_release_buffers 1 #define GLX_MESA_copy_sub_buffer 1 +#define GLX_MESA_set_3dfx_mode 1 #define GLX_SGI_video_sync 1 -#define GLX_EXT_get_proc_address 1 @@ -229,33 +233,36 @@ extern const char *glXQueryServerString( Display *dpy, int screen, int name ); extern const char *glXGetClientString( Display *dpy, int name ); -/* GLX_EXT_get_proc_address */ -extern GLfunction glXGetProcAddressEXT(const GLubyte *procName); - -/* - * Mesa GLX Extensions +/* GLX_EXT_get_proc_address */ +/* WARNING: this extension is not finalized yet! Do not release code + * which uses this extension yet! It may change! */ +extern void (*glXGetProcAddressEXT(const GLubyte *procName))(); -#ifdef GLX_MESA_pixmap_colormap + +/* GLX_MESA_pixmap_colormap */ extern GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap ); -#endif -#ifdef GLX_MESA_release_buffers + +/* GLX_MESA_release_buffers */ extern Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d ); -#endif -#ifdef GLX_MESA_copy_sub_buffer + +/* GLX_MESA_copy_sub_buffer */ extern void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable, int x, int y, int width, int height ); -#endif -#ifdef GLX_SGI_video_sync + +/* GLX_MESA_set_3dfx_mode */ +extern GLboolean glXSet3DfxModeMESA( GLint mode ); + + +/* GLX_SGI_video_sync */ extern int glXGetVideoSyncSGI(unsigned int *count); extern int glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count); -#endif diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c index 87a9dd1b71..716e0599b9 100644 --- a/src/mesa/drivers/x11/fakeglx.c +++ b/src/mesa/drivers/x11/fakeglx.c @@ -1,4 +1,4 @@ -/* $Id: fakeglx.c,v 1.6 1999/09/15 20:04:04 brianp Exp $ */ +/* $Id: fakeglx.c,v 1.7 1999/09/16 15:53:51 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -65,6 +65,17 @@ +/* Silence compiler warnings */ +void Fake_glXDummyFunc( void ) +{ + (void) kernel8; + (void) DitherValues; + (void) HPCR_DRGB; + (void) kernel1; +} + + + #define DONT_CARE -1 @@ -1387,17 +1398,28 @@ void Fake_glXWaitX( void ) } +/* + * Return the extensions string, which is 3Dfx-dependant. + */ +static const char *get_extensions( void ) +{ +#ifdef FX + const char *fx = getenv("MESA_GLX_FX"); + if (fx && fx[0] != 'd') { + return "GLX_MESA_pixmap_colormap GLX_EXT_visual_info GLX_MESA_release_buffers GLX_MESA_copy_sub_buffer GLX_SGI_video_sync GLX_MESA_set_3dfx_mode"; + } +#endif + return "GLX_MESA_pixmap_colormap GLX_EXT_visual_info GLX_MESA_release_buffers GLX_MESA_copy_sub_buffer GLX_SGI_video_sync"; +} -#define EXTENSIONS "GLX_MESA_pixmap_colormap GLX_EXT_visual_info GLX_MESA_release_buffers GLX_MESA_copy_sub_buffer GLX_SGI_video_sync" /* GLX 1.1 and later */ const char *Fake_glXQueryExtensionsString( Display *dpy, int screen ) { - static char *extensions = EXTENSIONS; (void) dpy; (void) screen; - return extensions; + return get_extensions(); } @@ -1405,7 +1427,6 @@ const char *Fake_glXQueryExtensionsString( Display *dpy, int screen ) /* GLX 1.1 and later */ const char *Fake_glXQueryServerString( Display *dpy, int screen, int name ) { - static char *extensions = EXTENSIONS; static char *vendor = "Brian Paul"; static char *version = "1.1 Mesa 3.1"; @@ -1414,7 +1435,7 @@ const char *Fake_glXQueryServerString( Display *dpy, int screen, int name ) switch (name) { case GLX_EXTENSIONS: - return extensions; + return get_extensions(); case GLX_VENDOR: return vendor; case GLX_VERSION: @@ -1429,7 +1450,6 @@ const char *Fake_glXQueryServerString( Display *dpy, int screen, int name ) /* GLX 1.1 and later */ const char *Fake_glXGetClientString( Display *dpy, int name ) { - static char *extensions = EXTENSIONS; static char *vendor = "Brian Paul"; static char *version = "1.1 Mesa 3.1"; @@ -1437,7 +1457,7 @@ const char *Fake_glXGetClientString( Display *dpy, int name ) switch (name) { case GLX_EXTENSIONS: - return extensions; + return get_extensions(); case GLX_VENDOR: return vendor; case GLX_VERSION: @@ -1464,19 +1484,21 @@ Bool Fake_glXReleaseBuffersMESA( Display *dpy, GLXDrawable d ) } -/* Silence compiler warnings */ -void Fake_glXDummyFunc( void ) +/* + * GLX_MESA_set_3dfx_mode + */ +GLboolean Fake_glXSet3DfxModeMESA( GLint mode ) { - (void) kernel8; - (void) DitherValues; - (void) HPCR_DRGB; - (void) kernel1; + return XMesaSetFXmode( mode ); } -GLfunction Fake_glXGetProcAddress( const GLubyte *procName ) + +/*GLfunction Fake_glXGetProcAddress( const GLubyte *procName )*/ +void (*Fake_glXGetProcAddress( const GLubyte *procName ))() { - struct proc { + typedef void (*GLfunction)(); + struct proc { const char *name; GLfunction address; }; @@ -1485,6 +1507,7 @@ GLfunction Fake_glXGetProcAddress( const GLubyte *procName ) { "glXCreateGLXPixmapMESA", (GLfunction) glXCreateGLXPixmapMESA }, { "glXReleaseBuffersMESA", (GLfunction) glXReleaseBuffersMESA }, { "glXCopySubBufferMESA", (GLfunction) glXCopySubBufferMESA }, + { "glXSet3DfxModeMESA", (GLfunction) glXSet3DfxModeMESA }, /* NOTE: GLX_SGI_video_sync not implemented in Mesa */ { NULL, NULL } /* end of list token */ }; diff --git a/src/mesa/drivers/x11/glxapi.c b/src/mesa/drivers/x11/glxapi.c index 23b23b90cb..dba92aa04d 100644 --- a/src/mesa/drivers/x11/glxapi.c +++ b/src/mesa/drivers/x11/glxapi.c @@ -1,4 +1,4 @@ -/* $Id: glxapi.c,v 1.2 1999/09/11 11:35:11 brianp Exp $ */ +/* $Id: glxapi.c,v 1.3 1999/09/16 15:54:21 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -405,12 +405,27 @@ int glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count) #endif -#ifdef GLX_EXT_get_proc_address -GLfunction glXGetProcAddressEXT( const GLubyte *procName ) + +#ifdef GLX_MESA_set_3dfx_mode +GLboolean glXSet3DfxModeMESA( GLint mode ) { #ifdef REALGLX - return 0; /* XXX todo */ + return GL_FALSE; +#else + return Fake_glXSet3DfxModeMESA( mode ); #endif +} +#endif + + + +#ifdef GLX_EXT_get_proc_address +void (*glXGetProcAddressEXT( const GLubyte *procName ))() +{ +#ifdef REALGLX + return NULL; +#else return Fake_glXGetProcAddress( procName ); +#endif } #endif -- cgit v1.2.3