Messed with GL loader some more.

I've branched well off of upstream glloadgen since they don't appear to be very active in between GL versions.

1) Changed how the address finder functions are set to be more sane.
2) Added *all* possible extensions. For the lulz.
3) Fixed a retarded bug in IsVersionGEQ.
4) Slapped myself for not seeing IsVersionGEQ bug earlier. Most important change.
master
Zachary Lund 2014-02-06 00:20:03 -06:00
parent 021d9522ea
commit 019d8d83ee
4 changed files with 18931 additions and 1105 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -6,39 +6,18 @@
#if defined(__APPLE__)
#include <dlfcn.h>
static void* AppleGLGetProcAddress (const char *name)
static void* AppleGLGetProcAddress (const const char *name)
{
static void* image = NULL;
if (image == NULL)
if (NULL == image)
image = dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", RTLD_LAZY);
return (image ? dlsym(image, name) : NULL);
}
#define IntGetProcAddress(name) AppleGLGetProcAddress(name)
#endif /* __APPLE__ */
#if defined(__sgi) || defined (__sun)
#include <dlfcn.h>
#include <stdio.h>
static void* SunGetProcAddress (const GLubyte* name)
{
static void* h = NULL;
static void* gpa;
if (h == NULL)
{
if ((h = dlopen(NULL, RTLD_LAZY | RTLD_LOCAL)) == NULL) return NULL;
gpa = dlsym(h, "glXGetProcAddress");
}
if (gpa != NULL)
return ((void*(*)(const GLubyte*))gpa)(name);
else
return dlsym(h, (const char*)name);
}
#endif /* __sgi || __sun */
#if defined(_WIN32)
#ifdef _MSC_VER
@ -47,43 +26,21 @@ static void* SunGetProcAddress (const GLubyte* name)
#pragma warning(disable: 4996)
#endif
static int TestPointer(const PROC pTest)
{
ptrdiff_t iTest;
if(!pTest) return 0;
iTest = (ptrdiff_t)pTest;
#define IntGetProcAddress(name) wglGetProcAddress((LPCSTR)name)
#endif
if(iTest == 1 || iTest == 2 || iTest == 3 || iTest == -1) return 0;
/* Linux, FreeBSD, other */
#ifndef IntGetProcAddress
#ifndef GLX_ARB_get_proc_address
#define GLX_ARB_get_proc_address 1
return 1;
}
typedef void (*__GLXextFuncPtr)(void);
extern __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *);
static PROC WinGetProcAddress(const char *name)
{
HMODULE glMod = NULL;
PROC pFunc = wglGetProcAddress((LPCSTR)name);
if(TestPointer(pFunc))
{
return pFunc;
}
glMod = GetModuleHandleA("OpenGL32.dll");
return (PROC)GetProcAddress(glMod, (LPCSTR)name);
}
#define IntGetProcAddress(name) WinGetProcAddress(name)
#else
#if defined(__APPLE__)
#define IntGetProcAddress(name) AppleGLGetProcAddress(name)
#else
#if defined(__sgi) || defined(__sun)
#define IntGetProcAddress(name) SunGetProcAddress(name)
#else /* GLX */
#include <GL/glx.h>
#endif /* GLX_ARB_get_proc_address */
#define IntGetProcAddress(name) (*glXGetProcAddressARB)((const GLubyte*)name)
#endif
#endif
#endif
int glx_ext_ARB_create_context = glx_LOAD_FAILED;
int glx_ext_ARB_create_context_profile = glx_LOAD_FAILED;

View File

@ -6,39 +6,18 @@
#if defined(__APPLE__)
#include <dlfcn.h>
static void* AppleGLGetProcAddress (const char *name)
static void* AppleGLGetProcAddress (const const char *name)
{
static void* image = NULL;
if (image == NULL)
if (NULL == image)
image = dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", RTLD_LAZY);
return (image ? dlsym(image, name) : NULL);
}
#define IntGetProcAddress(name) AppleGLGetProcAddress(name)
#endif /* __APPLE__ */
#if defined(__sgi) || defined (__sun)
#include <dlfcn.h>
#include <stdio.h>
static void* SunGetProcAddress (const GLubyte* name)
{
static void* h = NULL;
static void* gpa;
if (h == NULL)
{
if ((h = dlopen(NULL, RTLD_LAZY | RTLD_LOCAL)) == NULL) return NULL;
gpa = dlsym(h, "glXGetProcAddress");
}
if (gpa != NULL)
return ((void*(*)(const GLubyte*))gpa)(name);
else
return dlsym(h, (const char*)name);
}
#endif /* __sgi || __sun */
#if defined(_WIN32)
#ifdef _MSC_VER
@ -47,43 +26,21 @@ static void* SunGetProcAddress (const GLubyte* name)
#pragma warning(disable: 4996)
#endif
static int TestPointer(const PROC pTest)
{
ptrdiff_t iTest;
if(!pTest) return 0;
iTest = (ptrdiff_t)pTest;
#define IntGetProcAddress(name) wglGetProcAddress((LPCSTR)name)
#endif
if(iTest == 1 || iTest == 2 || iTest == 3 || iTest == -1) return 0;
/* Linux, FreeBSD, other */
#ifndef IntGetProcAddress
#ifndef GLX_ARB_get_proc_address
#define GLX_ARB_get_proc_address 1
return 1;
}
typedef void (*__GLXextFuncPtr)(void);
extern __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *);
static PROC WinGetProcAddress(const char *name)
{
HMODULE glMod = NULL;
PROC pFunc = wglGetProcAddress((LPCSTR)name);
if(TestPointer(pFunc))
{
return pFunc;
}
glMod = GetModuleHandleA("OpenGL32.dll");
return (PROC)GetProcAddress(glMod, (LPCSTR)name);
}
#define IntGetProcAddress(name) WinGetProcAddress(name)
#else
#if defined(__APPLE__)
#define IntGetProcAddress(name) AppleGLGetProcAddress(name)
#else
#if defined(__sgi) || defined(__sun)
#define IntGetProcAddress(name) SunGetProcAddress(name)
#else /* GLX */
#include <GL/glx.h>
#endif /* GLX_ARB_get_proc_address */
#define IntGetProcAddress(name) (*glXGetProcAddressARB)((const GLubyte*)name)
#endif
#endif
#endif
int wgl_ext_ARB_multisample = wgl_LOAD_FAILED;
int wgl_ext_ARB_extensions_string = wgl_LOAD_FAILED;