From 7e35cc53ceaa85be27ffc758d43c9f4114d009b0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 4 Sep 2002 14:14:36 +0000 Subject: [PATCH] updated wglGetProcAddress --- src/mesa/drivers/glide/fxwgl.c | 91 ++-------------------------------- src/mesa/drivers/windows/wgl.c | 61 +++-------------------- 2 files changed, 13 insertions(+), 139 deletions(-) diff --git a/src/mesa/drivers/glide/fxwgl.c b/src/mesa/drivers/glide/fxwgl.c index b684afa62f8..11df0933663 100644 --- a/src/mesa/drivers/glide/fxwgl.c +++ b/src/mesa/drivers/glide/fxwgl.c @@ -1,4 +1,4 @@ -/* $Id: fxwgl.c,v 1.14 2001/09/23 16:50:01 brianp Exp $ */ +/* $Id: fxwgl.c,v 1.15 2002/09/04 14:14:36 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -45,6 +45,7 @@ extern "C" #include "fxdrv.h" #include #include "GL/gl.h" +#include "glapi.h" #ifdef __cplusplus } @@ -69,80 +70,6 @@ struct __pixelformat__ WINGDIAPI void GLAPIENTRY gl3DfxSetPaletteEXT(GLuint *); -static struct __extensions__ ext[] = { - -#ifdef GL_EXT_polygon_offset - {(PROC) glPolygonOffsetEXT, "glPolygonOffsetEXT"}, -#endif - {(PROC) glBlendEquationEXT, "glBlendEquationEXT"}, - {(PROC) glBlendColorEXT, "glBlendColorExt"}, - {(PROC) glVertexPointerEXT, "glVertexPointerEXT"}, - {(PROC) glNormalPointerEXT, "glNormalPointerEXT"}, - {(PROC) glColorPointerEXT, "glColorPointerEXT"}, - {(PROC) glIndexPointerEXT, "glIndexPointerEXT"}, - {(PROC) glTexCoordPointerEXT, "glTexCoordPointer"}, - {(PROC) glEdgeFlagPointerEXT, "glEdgeFlagPointerEXT"}, - {(PROC) glGetPointervEXT, "glGetPointervEXT"}, - {(PROC) glArrayElementEXT, "glArrayElementEXT"}, - {(PROC) glDrawArraysEXT, "glDrawArrayEXT"}, - {(PROC) glAreTexturesResidentEXT, "glAreTexturesResidentEXT"}, - {(PROC) glBindTextureEXT, "glBindTextureEXT"}, - {(PROC) glDeleteTexturesEXT, "glDeleteTexturesEXT"}, - {(PROC) glGenTexturesEXT, "glGenTexturesEXT"}, - {(PROC) glIsTextureEXT, "glIsTextureEXT"}, - {(PROC) glPrioritizeTexturesEXT, "glPrioritizeTexturesEXT"}, - {(PROC) glCopyTexSubImage3DEXT, "glCopyTexSubImage3DEXT"}, - {(PROC) glTexImage3DEXT, "glTexImage3DEXT"}, - {(PROC) glTexSubImage3DEXT, "glTexSubImage3DEXT"}, - {(PROC) gl3DfxSetPaletteEXT, "3DFX_set_global_palette"}, - {(PROC) glColorTableEXT, "glColorTableEXT"}, - {(PROC) glColorSubTableEXT, "glColorSubTableEXT"}, - {(PROC) glGetColorTableEXT, "glGetColorTableEXT"}, - {(PROC) glGetColorTableParameterfvEXT, "glGetColorTableParameterfvEXT"}, - {(PROC) glGetColorTableParameterivEXT, "glGetColorTableParameterivEXT"}, - {(PROC) glPointParameterfEXT, "glPointParameterfEXT"}, - {(PROC) glPointParameterfvEXT, "glPointParameterfvEXT"}, - {(PROC) glBlendFuncSeparateINGR, "glBlendFuncSeparateINGR"}, - {(PROC) glActiveTextureARB, "glActiveTextureARB"}, - {(PROC) glClientActiveTextureARB, "glClientActiveTextureARB"}, - {(PROC) glMultiTexCoord1dARB, "glMultiTexCoord1dARB"}, - {(PROC) glMultiTexCoord1dvARB, "glMultiTexCoord1dvARB"}, - {(PROC) glMultiTexCoord1fARB, "glMultiTexCoord1fARB"}, - {(PROC) glMultiTexCoord1fvARB, "glMultiTexCoord1fvARB"}, - {(PROC) glMultiTexCoord1iARB, "glMultiTexCoord1iARB"}, - {(PROC) glMultiTexCoord1ivARB, "glMultiTexCoord1ivARB"}, - {(PROC) glMultiTexCoord1sARB, "glMultiTexCoord1sARB"}, - {(PROC) glMultiTexCoord1svARB, "glMultiTexCoord1svARB"}, - {(PROC) glMultiTexCoord2dARB, "glMultiTexCoord2dARB"}, - {(PROC) glMultiTexCoord2dvARB, "glMultiTexCoord2dvARB"}, - {(PROC) glMultiTexCoord2fARB, "glMultiTexCoord2fARB"}, - {(PROC) glMultiTexCoord2fvARB, "glMultiTexCoord2fvARB"}, - {(PROC) glMultiTexCoord2iARB, "glMultiTexCoord2iARB"}, - {(PROC) glMultiTexCoord2ivARB, "glMultiTexCoord2ivARB"}, - {(PROC) glMultiTexCoord2sARB, "glMultiTexCoord2sARB"}, - {(PROC) glMultiTexCoord2svARB, "glMultiTexCoord2svARB"}, - {(PROC) glMultiTexCoord3dARB, "glMultiTexCoord3dARB"}, - {(PROC) glMultiTexCoord3dvARB, "glMultiTexCoord3dvARB"}, - {(PROC) glMultiTexCoord3fARB, "glMultiTexCoord3fARB"}, - {(PROC) glMultiTexCoord3fvARB, "glMultiTexCoord3fvARB"}, - {(PROC) glMultiTexCoord3iARB, "glMultiTexCoord3iARB"}, - {(PROC) glMultiTexCoord3ivARB, "glMultiTexCoord3ivARB"}, - {(PROC) glMultiTexCoord3sARB, "glMultiTexCoord3sARB"}, - {(PROC) glMultiTexCoord3svARB, "glMultiTexCoord3svARB"}, - {(PROC) glMultiTexCoord4dARB, "glMultiTexCoord4dARB"}, - {(PROC) glMultiTexCoord4dvARB, "glMultiTexCoord4dvARB"}, - {(PROC) glMultiTexCoord4fARB, "glMultiTexCoord4fARB"}, - {(PROC) glMultiTexCoord4fvARB, "glMultiTexCoord4fvARB"}, - {(PROC) glMultiTexCoord4iARB, "glMultiTexCoord4iARB"}, - {(PROC) glMultiTexCoord4ivARB, "glMultiTexCoord4ivARB"}, - {(PROC) glMultiTexCoord4sARB, "glMultiTexCoord4sARB"}, - {(PROC) glMultiTexCoord4svARB, "glMultiTexCoord4svARB"}, - {(PROC) glLockArraysEXT, "glLockArraysEXT"}, - {(PROC) glUnlockArraysEXT, "glUnlockArraysEXT"} -}; - -static int qt_ext = sizeof(ext) / sizeof(ext[0]); - struct __pixelformat__ pix[] = { /* None */ { @@ -509,18 +436,10 @@ wglGetCurrentDC(VOID) PROC GLAPIENTRY wglGetProcAddress(LPCSTR lpszProc) { - int i; - - /*fprintf(stderr,"fxMesa: looking for extension %s\n",lpszProc); - fflush(stderr); */ + PROC p = (PROC) _glapi_get_proc_address((const char *) lpszProc); + if (p) + return p; - for (i = 0; i < qt_ext; i++) - if (!strcmp(lpszProc, ext[i].name)) { - /*fprintf(stderr,"fxMesa: found extension %s\n",lpszProc); - fflush(stderr); */ - - return (ext[i].proc); - } SetLastError(0); return (NULL); } diff --git a/src/mesa/drivers/windows/wgl.c b/src/mesa/drivers/windows/wgl.c index 62a4c1704ce..b69e5f07d53 100644 --- a/src/mesa/drivers/windows/wgl.c +++ b/src/mesa/drivers/windows/wgl.c @@ -1,4 +1,4 @@ -/* $Id: wgl.c,v 1.10 2002/04/23 18:23:33 kschultz Exp $ */ +/* $Id: wgl.c,v 1.11 2002/09/04 14:14:36 brianp Exp $ */ /* * This library is free software; you can redistribute it and/or @@ -44,60 +44,16 @@ extern "C" { #include "wmesadef.h" #include "GL/wmesa.h" #include "mtypes.h" +#include "glapi.h" #define MAX_MESA_ATTRS 20 -struct __extensions__ -{ - PROC proc; - char *name; -}; - struct __pixelformat__ { PIXELFORMATDESCRIPTOR pfd; GLboolean doubleBuffered; }; -struct __extensions__ ext[] = { - -#ifdef GL_EXT_polygon_offset - { (PROC)glPolygonOffsetEXT, "glPolygonOffsetEXT" }, -#endif - { (PROC)glBlendEquationEXT, "glBlendEquationEXT" }, - { (PROC)glBlendColorEXT, "glBlendColorExt" }, - { (PROC)glVertexPointerEXT, "glVertexPointerEXT" }, - { (PROC)glNormalPointerEXT, "glNormalPointerEXT" }, - { (PROC)glColorPointerEXT, "glColorPointerEXT" }, - { (PROC)glIndexPointerEXT, "glIndexPointerEXT" }, - { (PROC)glTexCoordPointerEXT, "glTexCoordPointer" }, - { (PROC)glEdgeFlagPointerEXT, "glEdgeFlagPointerEXT" }, - { (PROC)glGetPointervEXT, "glGetPointervEXT" }, - { (PROC)glArrayElementEXT, "glArrayElementEXT" }, - { (PROC)glDrawArraysEXT, "glDrawArrayEXT" }, - { (PROC)glAreTexturesResidentEXT, "glAreTexturesResidentEXT" }, - { (PROC)glBindTextureEXT, "glBindTextureEXT" }, - { (PROC)glDeleteTexturesEXT, "glDeleteTexturesEXT" }, - { (PROC)glGenTexturesEXT, "glGenTexturesEXT" }, - { (PROC)glIsTextureEXT, "glIsTextureEXT" }, - { (PROC)glPrioritizeTexturesEXT, "glPrioritizeTexturesEXT" }, - { (PROC)glCopyTexSubImage3DEXT, "glCopyTexSubImage3DEXT" }, - { (PROC)glTexImage3DEXT, "glTexImage3DEXT" }, - { (PROC)glTexSubImage3DEXT, "glTexSubImage3DEXT" }, - { (PROC)glColorTableEXT, "glColorTableEXT" }, - { (PROC)glColorSubTableEXT, "glColorSubTableEXT" }, - { (PROC)glGetColorTableEXT, "glGetColorTableEXT" }, - { (PROC)glGetColorTableParameterfvEXT, "glGetColorTableParameterfvEXT" }, - { (PROC)glGetColorTableParameterivEXT, "glGetColorTableParameterivEXT" }, - { (PROC)glPointParameterfEXT, "glPointParameterfEXT" }, - { (PROC)glPointParameterfvEXT, "glPointParameterfvEXT" }, - { (PROC)glBlendFuncSeparateEXT, "glBlendFuncSeparateEXT" }, - { (PROC)glLockArraysEXT, "glLockArraysEXT" }, - { (PROC)glUnlockArraysEXT, "glUnlockArraysEXT" } -}; - -int qt_ext = sizeof(ext) / sizeof(ext[0]); - struct __pixelformat__ pix[] = { /* Double Buffer, alpha */ @@ -134,7 +90,7 @@ struct __pixelformat__ pix[] = }, }; -int qt_pix = sizeof(pix) / sizeof(pix[0]); +int qt_pix = sizeof(pix) / sizeof(pix[0]); typedef struct { WMesaContext ctx; @@ -616,13 +572,12 @@ WGLAPI int GLAPIENTRY wglDescribePixelFormat(HDC hdc,int iPixelFormat,UINT nByte */ WGLAPI PROC GLAPIENTRY wglGetProcAddress(LPCSTR lpszProc) { - int i; - for(i = 0;i < qt_ext;i++) - if(!strcmp(lpszProc,ext[i].name)) - return(ext[i].proc); + PROC p = (PROC) _glapi_get_proc_address((const char *) lpszProc); + if (p) + return p; - SetLastError(0); - return(NULL); + SetLastError(0); + return(NULL); } WGLAPI int GLAPIENTRY wglGetPixelFormat(HDC hdc) -- 2.30.2