Have OSMesaGetProcAddress() return new OSMESAproc typedef.

This commit is contained in:
Brian Paul 2004-11-27 16:24:39 +00:00
parent 21f6978c53
commit 4d880987d2
2 changed files with 27 additions and 22 deletions

View File

@ -1,8 +1,8 @@
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 4.1 * Version: 6.3
* *
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@ -60,8 +60,8 @@ extern "C" {
#include <GL/gl.h> #include <GL/gl.h>
#define OSMESA_MAJOR_VERSION 4 #define OSMESA_MAJOR_VERSION 6
#define OSMESA_MINOR_VERSION 1 #define OSMESA_MINOR_VERSION 3
#define OSMESA_PATCH_VERSION 0 #define OSMESA_PATCH_VERSION 0
@ -252,12 +252,18 @@ OSMesaGetColorBuffer( OSMesaContext c, GLint *width, GLint *height,
/**
* This typedef is new in Mesa 6.3.
*/
typedef void (*OSMESAproc)();
/* /*
* Return pointer to the named function. * Return pointer to the named function.
*
* New in Mesa 4.1 * New in Mesa 4.1
* Return OSMESAproc in 6.3.
*/ */
GLAPI void * GLAPIENTRY GLAPI OSMESAproc GLAPIENTRY
OSMesaGetProcAddress( const char *funcName ); OSMesaGetProcAddress( const char *funcName );

View File

@ -1276,35 +1276,34 @@ OSMesaGetColorBuffer( OSMesaContext c, GLint *width,
} }
typedef void (*generic_function)();
struct name_function struct name_function
{ {
const char *Name; const char *Name;
generic_function Function; OSMESAproc Function;
}; };
static struct name_function functions[] = { static struct name_function functions[] = {
{ "OSMesaCreateContext", (generic_function) OSMesaCreateContext }, { "OSMesaCreateContext", (OSMESAproc) OSMesaCreateContext },
{ "OSMesaCreateContextExt", (generic_function) OSMesaCreateContextExt }, { "OSMesaCreateContextExt", (OSMESAproc) OSMesaCreateContextExt },
{ "OSMesaDestroyContext", (generic_function) OSMesaDestroyContext }, { "OSMesaDestroyContext", (OSMESAproc) OSMesaDestroyContext },
{ "OSMesaMakeCurrent", (generic_function) OSMesaMakeCurrent }, { "OSMesaMakeCurrent", (OSMESAproc) OSMesaMakeCurrent },
{ "OSMesaGetCurrentContext", (generic_function) OSMesaGetCurrentContext }, { "OSMesaGetCurrentContext", (OSMESAproc) OSMesaGetCurrentContext },
{ "OSMesaPixelsStore", (generic_function) OSMesaPixelStore }, { "OSMesaPixelsStore", (OSMESAproc) OSMesaPixelStore },
{ "OSMesaGetIntegerv", (generic_function) OSMesaGetIntegerv }, { "OSMesaGetIntegerv", (OSMESAproc) OSMesaGetIntegerv },
{ "OSMesaGetDepthBuffer", (generic_function) OSMesaGetDepthBuffer }, { "OSMesaGetDepthBuffer", (OSMESAproc) OSMesaGetDepthBuffer },
{ "OSMesaGetColorBuffer", (generic_function) OSMesaGetColorBuffer }, { "OSMesaGetColorBuffer", (OSMESAproc) OSMesaGetColorBuffer },
{ "OSMesaGetProcAddress", (generic_function) OSMesaGetProcAddress }, { "OSMesaGetProcAddress", (OSMESAproc) OSMesaGetProcAddress },
{ NULL, NULL } { NULL, NULL }
}; };
GLAPI void * GLAPIENTRY
GLAPI OSMESAproc GLAPIENTRY
OSMesaGetProcAddress( const char *funcName ) OSMesaGetProcAddress( const char *funcName )
{ {
int i; int i;
for (i = 0; functions[i].Name; i++) { for (i = 0; functions[i].Name; i++) {
if (_mesa_strcmp(functions[i].Name, funcName) == 0) if (_mesa_strcmp(functions[i].Name, funcName) == 0)
return (void *) functions[i].Function; return functions[i].Function;
} }
return (void *) _glapi_get_proc_address(funcName); return _glapi_get_proc_address(funcName);
} }