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
parent
021d9522ea
commit
019d8d83ee
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -6,39 +6,18 @@
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
|
||||||
static void* AppleGLGetProcAddress (const char *name)
|
static void* AppleGLGetProcAddress (const const char *name)
|
||||||
{
|
{
|
||||||
static void* image = NULL;
|
static void* image = NULL;
|
||||||
|
|
||||||
if (image == NULL)
|
if (NULL == image)
|
||||||
image = dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", RTLD_LAZY);
|
image = dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", RTLD_LAZY);
|
||||||
|
|
||||||
return (image ? dlsym(image, name) : NULL);
|
return (image ? dlsym(image, name) : NULL);
|
||||||
}
|
}
|
||||||
|
#define IntGetProcAddress(name) AppleGLGetProcAddress(name)
|
||||||
#endif /* __APPLE__ */
|
#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)
|
#if defined(_WIN32)
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
@ -46,43 +25,21 @@ static void* SunGetProcAddress (const GLubyte* name)
|
||||||
#pragma warning(disable: 4054)
|
#pragma warning(disable: 4054)
|
||||||
#pragma warning(disable: 4996)
|
#pragma warning(disable: 4996)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int TestPointer(const PROC pTest)
|
|
||||||
{
|
|
||||||
ptrdiff_t iTest;
|
|
||||||
if(!pTest) return 0;
|
|
||||||
iTest = (ptrdiff_t)pTest;
|
|
||||||
|
|
||||||
if(iTest == 1 || iTest == 2 || iTest == 3 || iTest == -1) return 0;
|
#define IntGetProcAddress(name) wglGetProcAddress((LPCSTR)name)
|
||||||
|
#endif
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static PROC WinGetProcAddress(const char *name)
|
/* Linux, FreeBSD, other */
|
||||||
{
|
#ifndef IntGetProcAddress
|
||||||
HMODULE glMod = NULL;
|
#ifndef GLX_ARB_get_proc_address
|
||||||
PROC pFunc = wglGetProcAddress((LPCSTR)name);
|
#define GLX_ARB_get_proc_address 1
|
||||||
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>
|
|
||||||
|
|
||||||
#define IntGetProcAddress(name) (*glXGetProcAddressARB)((const GLubyte*)name)
|
typedef void (*__GLXextFuncPtr)(void);
|
||||||
#endif
|
extern __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *);
|
||||||
#endif
|
|
||||||
|
#endif /* GLX_ARB_get_proc_address */
|
||||||
|
|
||||||
|
#define IntGetProcAddress(name) (*glXGetProcAddressARB)((const GLubyte*)name)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int glx_ext_ARB_create_context = glx_LOAD_FAILED;
|
int glx_ext_ARB_create_context = glx_LOAD_FAILED;
|
||||||
|
|
|
@ -6,39 +6,18 @@
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
|
||||||
static void* AppleGLGetProcAddress (const char *name)
|
static void* AppleGLGetProcAddress (const const char *name)
|
||||||
{
|
{
|
||||||
static void* image = NULL;
|
static void* image = NULL;
|
||||||
|
|
||||||
if (image == NULL)
|
if (NULL == image)
|
||||||
image = dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", RTLD_LAZY);
|
image = dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", RTLD_LAZY);
|
||||||
|
|
||||||
return (image ? dlsym(image, name) : NULL);
|
return (image ? dlsym(image, name) : NULL);
|
||||||
}
|
}
|
||||||
|
#define IntGetProcAddress(name) AppleGLGetProcAddress(name)
|
||||||
#endif /* __APPLE__ */
|
#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)
|
#if defined(_WIN32)
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
@ -46,43 +25,21 @@ static void* SunGetProcAddress (const GLubyte* name)
|
||||||
#pragma warning(disable: 4054)
|
#pragma warning(disable: 4054)
|
||||||
#pragma warning(disable: 4996)
|
#pragma warning(disable: 4996)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int TestPointer(const PROC pTest)
|
|
||||||
{
|
|
||||||
ptrdiff_t iTest;
|
|
||||||
if(!pTest) return 0;
|
|
||||||
iTest = (ptrdiff_t)pTest;
|
|
||||||
|
|
||||||
if(iTest == 1 || iTest == 2 || iTest == 3 || iTest == -1) return 0;
|
#define IntGetProcAddress(name) wglGetProcAddress((LPCSTR)name)
|
||||||
|
#endif
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static PROC WinGetProcAddress(const char *name)
|
/* Linux, FreeBSD, other */
|
||||||
{
|
#ifndef IntGetProcAddress
|
||||||
HMODULE glMod = NULL;
|
#ifndef GLX_ARB_get_proc_address
|
||||||
PROC pFunc = wglGetProcAddress((LPCSTR)name);
|
#define GLX_ARB_get_proc_address 1
|
||||||
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>
|
|
||||||
|
|
||||||
#define IntGetProcAddress(name) (*glXGetProcAddressARB)((const GLubyte*)name)
|
typedef void (*__GLXextFuncPtr)(void);
|
||||||
#endif
|
extern __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *);
|
||||||
#endif
|
|
||||||
|
#endif /* GLX_ARB_get_proc_address */
|
||||||
|
|
||||||
|
#define IntGetProcAddress(name) (*glXGetProcAddressARB)((const GLubyte*)name)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int wgl_ext_ARB_multisample = wgl_LOAD_FAILED;
|
int wgl_ext_ARB_multisample = wgl_LOAD_FAILED;
|
||||||
|
|
Loading…
Reference in New Issue