471 lines
20 KiB
C
471 lines
20 KiB
C
/* AUTOGENERATED BY glLoadGen, DO NOT EDIT */
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <stddef.h>
|
|
#include "glx_obs.h"
|
|
|
|
#if defined(__APPLE__)
|
|
#include <dlfcn.h>
|
|
|
|
static void* AppleGLGetProcAddress (const char *name)
|
|
{
|
|
static void* 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(_WIN32)
|
|
|
|
#ifdef _MSC_VER
|
|
#pragma warning(disable: 4055)
|
|
#pragma warning(disable: 4054)
|
|
#pragma warning(disable: 4996)
|
|
#endif
|
|
|
|
static PROC WinGetProcAddress(const char *name)
|
|
{
|
|
static HMODULE glMod = NULL;
|
|
PROC pFunc = wglGetProcAddress((LPCSTR)name);
|
|
|
|
if (pFunc) return pFunc;
|
|
|
|
if (NULL == glMod)
|
|
glMod = GetModuleHandleA("OpenGL32.dll");
|
|
|
|
return (PROC)GetProcAddress(glMod, (LPCSTR)name);
|
|
}
|
|
|
|
#define IntGetProcAddress(name) WinGetProcAddress(name)
|
|
#endif
|
|
|
|
/* Linux, FreeBSD, other */
|
|
#ifndef IntGetProcAddress
|
|
extern void ( * glXGetProcAddressARB (const GLubyte *procName)) (void);
|
|
|
|
#define IntGetProcAddress(name) (*glXGetProcAddressARB)((const GLubyte*)name)
|
|
#endif
|
|
|
|
/* TODO: Need to eventually use eglGetProcAddress */
|
|
|
|
int glx_ext_AMD_gpu_association = glx_LOAD_FAILED;
|
|
int glx_ext_ARB_create_context = glx_LOAD_FAILED;
|
|
int glx_ext_ARB_create_context_profile = glx_LOAD_FAILED;
|
|
int glx_ext_ARB_create_context_robustness = glx_LOAD_FAILED;
|
|
int glx_ext_ARB_fbconfig_float = glx_LOAD_FAILED;
|
|
int glx_ext_ARB_framebuffer_sRGB = glx_LOAD_FAILED;
|
|
int glx_ext_ARB_get_proc_address = glx_LOAD_FAILED;
|
|
int glx_ext_ARB_multisample = glx_LOAD_FAILED;
|
|
int glx_ext_ARB_robustness_application_isolation = glx_LOAD_FAILED;
|
|
int glx_ext_ARB_robustness_share_group_isolation = glx_LOAD_FAILED;
|
|
int glx_ext_ARB_vertex_buffer_object = glx_LOAD_FAILED;
|
|
int glx_ext_EXT_buffer_age = glx_LOAD_FAILED;
|
|
int glx_ext_EXT_create_context_es2_profile = glx_LOAD_FAILED;
|
|
int glx_ext_EXT_create_context_es_profile = glx_LOAD_FAILED;
|
|
int glx_ext_EXT_fbconfig_packed_float = glx_LOAD_FAILED;
|
|
int glx_ext_EXT_framebuffer_sRGB = glx_LOAD_FAILED;
|
|
int glx_ext_EXT_import_context = glx_LOAD_FAILED;
|
|
int glx_ext_EXT_swap_control = glx_LOAD_FAILED;
|
|
int glx_ext_EXT_swap_control_tear = glx_LOAD_FAILED;
|
|
int glx_ext_EXT_texture_from_pixmap = glx_LOAD_FAILED;
|
|
int glx_ext_EXT_visual_info = glx_LOAD_FAILED;
|
|
int glx_ext_EXT_visual_rating = glx_LOAD_FAILED;
|
|
int glx_ext_INTEL_swap_event = glx_LOAD_FAILED;
|
|
int glx_ext_MESA_agp_offset = glx_LOAD_FAILED;
|
|
int glx_ext_MESA_copy_sub_buffer = glx_LOAD_FAILED;
|
|
int glx_ext_MESA_pixmap_colormap = glx_LOAD_FAILED;
|
|
int glx_ext_MESA_release_buffers = glx_LOAD_FAILED;
|
|
int glx_ext_MESA_set_3dfx_mode = glx_LOAD_FAILED;
|
|
int glx_ext_NV_copy_image = glx_LOAD_FAILED;
|
|
int glx_ext_NV_float_buffer = glx_LOAD_FAILED;
|
|
int glx_ext_NV_multisample_coverage = glx_LOAD_FAILED;
|
|
int glx_ext_NV_present_video = glx_LOAD_FAILED;
|
|
int glx_ext_NV_swap_group = glx_LOAD_FAILED;
|
|
int glx_ext_NV_video_capture = glx_LOAD_FAILED;
|
|
int glx_ext_NV_video_output = glx_LOAD_FAILED;
|
|
|
|
GLXContext (CODEGEN_FUNCPTR *_ptrc_glXCreateContextAttribsARB)(Display *, GLXFBConfig, GLXContext, Bool, const int *) = NULL;
|
|
|
|
static int Load_ARB_create_context(void)
|
|
{
|
|
int numFailed = 0;
|
|
_ptrc_glXCreateContextAttribsARB = (GLXContext (CODEGEN_FUNCPTR *)(Display *, GLXFBConfig, GLXContext, Bool, const int *))IntGetProcAddress("glXCreateContextAttribsARB");
|
|
if(!_ptrc_glXCreateContextAttribsARB) numFailed++;
|
|
return numFailed;
|
|
}
|
|
|
|
__GLXextFuncPtr (CODEGEN_FUNCPTR *_ptrc_glXGetProcAddressARB)(const GLubyte *) = NULL;
|
|
|
|
static int Load_ARB_get_proc_address(void)
|
|
{
|
|
int numFailed = 0;
|
|
_ptrc_glXGetProcAddressARB = (__GLXextFuncPtr (CODEGEN_FUNCPTR *)(const GLubyte *))IntGetProcAddress("glXGetProcAddressARB");
|
|
if(!_ptrc_glXGetProcAddressARB) numFailed++;
|
|
return numFailed;
|
|
}
|
|
|
|
void (CODEGEN_FUNCPTR *_ptrc_glXFreeContextEXT)(Display *, GLXContext) = NULL;
|
|
GLXContextID (CODEGEN_FUNCPTR *_ptrc_glXGetContextIDEXT)(const GLXContext) = NULL;
|
|
Display * (CODEGEN_FUNCPTR *_ptrc_glXGetCurrentDisplayEXT)(void) = NULL;
|
|
GLXContext (CODEGEN_FUNCPTR *_ptrc_glXImportContextEXT)(Display *, GLXContextID) = NULL;
|
|
int (CODEGEN_FUNCPTR *_ptrc_glXQueryContextInfoEXT)(Display *, GLXContext, int, int *) = NULL;
|
|
|
|
static int Load_EXT_import_context(void)
|
|
{
|
|
int numFailed = 0;
|
|
_ptrc_glXFreeContextEXT = (void (CODEGEN_FUNCPTR *)(Display *, GLXContext))IntGetProcAddress("glXFreeContextEXT");
|
|
if(!_ptrc_glXFreeContextEXT) numFailed++;
|
|
_ptrc_glXGetContextIDEXT = (GLXContextID (CODEGEN_FUNCPTR *)(const GLXContext))IntGetProcAddress("glXGetContextIDEXT");
|
|
if(!_ptrc_glXGetContextIDEXT) numFailed++;
|
|
_ptrc_glXGetCurrentDisplayEXT = (Display * (CODEGEN_FUNCPTR *)(void))IntGetProcAddress("glXGetCurrentDisplayEXT");
|
|
if(!_ptrc_glXGetCurrentDisplayEXT) numFailed++;
|
|
_ptrc_glXImportContextEXT = (GLXContext (CODEGEN_FUNCPTR *)(Display *, GLXContextID))IntGetProcAddress("glXImportContextEXT");
|
|
if(!_ptrc_glXImportContextEXT) numFailed++;
|
|
_ptrc_glXQueryContextInfoEXT = (int (CODEGEN_FUNCPTR *)(Display *, GLXContext, int, int *))IntGetProcAddress("glXQueryContextInfoEXT");
|
|
if(!_ptrc_glXQueryContextInfoEXT) numFailed++;
|
|
return numFailed;
|
|
}
|
|
|
|
void (CODEGEN_FUNCPTR *_ptrc_glXSwapIntervalEXT)(Display *, GLXDrawable, int) = NULL;
|
|
|
|
static int Load_EXT_swap_control(void)
|
|
{
|
|
int numFailed = 0;
|
|
_ptrc_glXSwapIntervalEXT = (void (CODEGEN_FUNCPTR *)(Display *, GLXDrawable, int))IntGetProcAddress("glXSwapIntervalEXT");
|
|
if(!_ptrc_glXSwapIntervalEXT) numFailed++;
|
|
return numFailed;
|
|
}
|
|
|
|
void (CODEGEN_FUNCPTR *_ptrc_glXBindTexImageEXT)(Display *, GLXDrawable, int, const int *) = NULL;
|
|
void (CODEGEN_FUNCPTR *_ptrc_glXReleaseTexImageEXT)(Display *, GLXDrawable, int) = NULL;
|
|
|
|
static int Load_EXT_texture_from_pixmap(void)
|
|
{
|
|
int numFailed = 0;
|
|
_ptrc_glXBindTexImageEXT = (void (CODEGEN_FUNCPTR *)(Display *, GLXDrawable, int, const int *))IntGetProcAddress("glXBindTexImageEXT");
|
|
if(!_ptrc_glXBindTexImageEXT) numFailed++;
|
|
_ptrc_glXReleaseTexImageEXT = (void (CODEGEN_FUNCPTR *)(Display *, GLXDrawable, int))IntGetProcAddress("glXReleaseTexImageEXT");
|
|
if(!_ptrc_glXReleaseTexImageEXT) numFailed++;
|
|
return numFailed;
|
|
}
|
|
|
|
unsigned int (CODEGEN_FUNCPTR *_ptrc_glXGetAGPOffsetMESA)(const void *) = NULL;
|
|
|
|
static int Load_MESA_agp_offset(void)
|
|
{
|
|
int numFailed = 0;
|
|
_ptrc_glXGetAGPOffsetMESA = (unsigned int (CODEGEN_FUNCPTR *)(const void *))IntGetProcAddress("glXGetAGPOffsetMESA");
|
|
if(!_ptrc_glXGetAGPOffsetMESA) numFailed++;
|
|
return numFailed;
|
|
}
|
|
|
|
void (CODEGEN_FUNCPTR *_ptrc_glXCopySubBufferMESA)(Display *, GLXDrawable, int, int, int, int) = NULL;
|
|
|
|
static int Load_MESA_copy_sub_buffer(void)
|
|
{
|
|
int numFailed = 0;
|
|
_ptrc_glXCopySubBufferMESA = (void (CODEGEN_FUNCPTR *)(Display *, GLXDrawable, int, int, int, int))IntGetProcAddress("glXCopySubBufferMESA");
|
|
if(!_ptrc_glXCopySubBufferMESA) numFailed++;
|
|
return numFailed;
|
|
}
|
|
|
|
GLXPixmap (CODEGEN_FUNCPTR *_ptrc_glXCreateGLXPixmapMESA)(Display *, XVisualInfo *, Pixmap, Colormap) = NULL;
|
|
|
|
static int Load_MESA_pixmap_colormap(void)
|
|
{
|
|
int numFailed = 0;
|
|
_ptrc_glXCreateGLXPixmapMESA = (GLXPixmap (CODEGEN_FUNCPTR *)(Display *, XVisualInfo *, Pixmap, Colormap))IntGetProcAddress("glXCreateGLXPixmapMESA");
|
|
if(!_ptrc_glXCreateGLXPixmapMESA) numFailed++;
|
|
return numFailed;
|
|
}
|
|
|
|
Bool (CODEGEN_FUNCPTR *_ptrc_glXReleaseBuffersMESA)(Display *, GLXDrawable) = NULL;
|
|
|
|
static int Load_MESA_release_buffers(void)
|
|
{
|
|
int numFailed = 0;
|
|
_ptrc_glXReleaseBuffersMESA = (Bool (CODEGEN_FUNCPTR *)(Display *, GLXDrawable))IntGetProcAddress("glXReleaseBuffersMESA");
|
|
if(!_ptrc_glXReleaseBuffersMESA) numFailed++;
|
|
return numFailed;
|
|
}
|
|
|
|
Bool (CODEGEN_FUNCPTR *_ptrc_glXSet3DfxModeMESA)(int) = NULL;
|
|
|
|
static int Load_MESA_set_3dfx_mode(void)
|
|
{
|
|
int numFailed = 0;
|
|
_ptrc_glXSet3DfxModeMESA = (Bool (CODEGEN_FUNCPTR *)(int))IntGetProcAddress("glXSet3DfxModeMESA");
|
|
if(!_ptrc_glXSet3DfxModeMESA) numFailed++;
|
|
return numFailed;
|
|
}
|
|
|
|
void (CODEGEN_FUNCPTR *_ptrc_glXCopyImageSubDataNV)(Display *, GLXContext, GLuint, GLenum, GLint, GLint, GLint, GLint, GLXContext, GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei) = NULL;
|
|
|
|
static int Load_NV_copy_image(void)
|
|
{
|
|
int numFailed = 0;
|
|
_ptrc_glXCopyImageSubDataNV = (void (CODEGEN_FUNCPTR *)(Display *, GLXContext, GLuint, GLenum, GLint, GLint, GLint, GLint, GLXContext, GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei))IntGetProcAddress("glXCopyImageSubDataNV");
|
|
if(!_ptrc_glXCopyImageSubDataNV) numFailed++;
|
|
return numFailed;
|
|
}
|
|
|
|
int (CODEGEN_FUNCPTR *_ptrc_glXBindVideoDeviceNV)(Display *, unsigned int, unsigned int, const int *) = NULL;
|
|
unsigned int * (CODEGEN_FUNCPTR *_ptrc_glXEnumerateVideoDevicesNV)(Display *, int, int *) = NULL;
|
|
|
|
static int Load_NV_present_video(void)
|
|
{
|
|
int numFailed = 0;
|
|
_ptrc_glXBindVideoDeviceNV = (int (CODEGEN_FUNCPTR *)(Display *, unsigned int, unsigned int, const int *))IntGetProcAddress("glXBindVideoDeviceNV");
|
|
if(!_ptrc_glXBindVideoDeviceNV) numFailed++;
|
|
_ptrc_glXEnumerateVideoDevicesNV = (unsigned int * (CODEGEN_FUNCPTR *)(Display *, int, int *))IntGetProcAddress("glXEnumerateVideoDevicesNV");
|
|
if(!_ptrc_glXEnumerateVideoDevicesNV) numFailed++;
|
|
return numFailed;
|
|
}
|
|
|
|
Bool (CODEGEN_FUNCPTR *_ptrc_glXBindSwapBarrierNV)(Display *, GLuint, GLuint) = NULL;
|
|
Bool (CODEGEN_FUNCPTR *_ptrc_glXJoinSwapGroupNV)(Display *, GLXDrawable, GLuint) = NULL;
|
|
Bool (CODEGEN_FUNCPTR *_ptrc_glXQueryFrameCountNV)(Display *, int, GLuint *) = NULL;
|
|
Bool (CODEGEN_FUNCPTR *_ptrc_glXQueryMaxSwapGroupsNV)(Display *, int, GLuint *, GLuint *) = NULL;
|
|
Bool (CODEGEN_FUNCPTR *_ptrc_glXQuerySwapGroupNV)(Display *, GLXDrawable, GLuint *, GLuint *) = NULL;
|
|
Bool (CODEGEN_FUNCPTR *_ptrc_glXResetFrameCountNV)(Display *, int) = NULL;
|
|
|
|
static int Load_NV_swap_group(void)
|
|
{
|
|
int numFailed = 0;
|
|
_ptrc_glXBindSwapBarrierNV = (Bool (CODEGEN_FUNCPTR *)(Display *, GLuint, GLuint))IntGetProcAddress("glXBindSwapBarrierNV");
|
|
if(!_ptrc_glXBindSwapBarrierNV) numFailed++;
|
|
_ptrc_glXJoinSwapGroupNV = (Bool (CODEGEN_FUNCPTR *)(Display *, GLXDrawable, GLuint))IntGetProcAddress("glXJoinSwapGroupNV");
|
|
if(!_ptrc_glXJoinSwapGroupNV) numFailed++;
|
|
_ptrc_glXQueryFrameCountNV = (Bool (CODEGEN_FUNCPTR *)(Display *, int, GLuint *))IntGetProcAddress("glXQueryFrameCountNV");
|
|
if(!_ptrc_glXQueryFrameCountNV) numFailed++;
|
|
_ptrc_glXQueryMaxSwapGroupsNV = (Bool (CODEGEN_FUNCPTR *)(Display *, int, GLuint *, GLuint *))IntGetProcAddress("glXQueryMaxSwapGroupsNV");
|
|
if(!_ptrc_glXQueryMaxSwapGroupsNV) numFailed++;
|
|
_ptrc_glXQuerySwapGroupNV = (Bool (CODEGEN_FUNCPTR *)(Display *, GLXDrawable, GLuint *, GLuint *))IntGetProcAddress("glXQuerySwapGroupNV");
|
|
if(!_ptrc_glXQuerySwapGroupNV) numFailed++;
|
|
_ptrc_glXResetFrameCountNV = (Bool (CODEGEN_FUNCPTR *)(Display *, int))IntGetProcAddress("glXResetFrameCountNV");
|
|
if(!_ptrc_glXResetFrameCountNV) numFailed++;
|
|
return numFailed;
|
|
}
|
|
|
|
int (CODEGEN_FUNCPTR *_ptrc_glXBindVideoCaptureDeviceNV)(Display *, unsigned int, GLXVideoCaptureDeviceNV) = NULL;
|
|
GLXVideoCaptureDeviceNV * (CODEGEN_FUNCPTR *_ptrc_glXEnumerateVideoCaptureDevicesNV)(Display *, int, int *) = NULL;
|
|
void (CODEGEN_FUNCPTR *_ptrc_glXLockVideoCaptureDeviceNV)(Display *, GLXVideoCaptureDeviceNV) = NULL;
|
|
int (CODEGEN_FUNCPTR *_ptrc_glXQueryVideoCaptureDeviceNV)(Display *, GLXVideoCaptureDeviceNV, int, int *) = NULL;
|
|
void (CODEGEN_FUNCPTR *_ptrc_glXReleaseVideoCaptureDeviceNV)(Display *, GLXVideoCaptureDeviceNV) = NULL;
|
|
|
|
static int Load_NV_video_capture(void)
|
|
{
|
|
int numFailed = 0;
|
|
_ptrc_glXBindVideoCaptureDeviceNV = (int (CODEGEN_FUNCPTR *)(Display *, unsigned int, GLXVideoCaptureDeviceNV))IntGetProcAddress("glXBindVideoCaptureDeviceNV");
|
|
if(!_ptrc_glXBindVideoCaptureDeviceNV) numFailed++;
|
|
_ptrc_glXEnumerateVideoCaptureDevicesNV = (GLXVideoCaptureDeviceNV * (CODEGEN_FUNCPTR *)(Display *, int, int *))IntGetProcAddress("glXEnumerateVideoCaptureDevicesNV");
|
|
if(!_ptrc_glXEnumerateVideoCaptureDevicesNV) numFailed++;
|
|
_ptrc_glXLockVideoCaptureDeviceNV = (void (CODEGEN_FUNCPTR *)(Display *, GLXVideoCaptureDeviceNV))IntGetProcAddress("glXLockVideoCaptureDeviceNV");
|
|
if(!_ptrc_glXLockVideoCaptureDeviceNV) numFailed++;
|
|
_ptrc_glXQueryVideoCaptureDeviceNV = (int (CODEGEN_FUNCPTR *)(Display *, GLXVideoCaptureDeviceNV, int, int *))IntGetProcAddress("glXQueryVideoCaptureDeviceNV");
|
|
if(!_ptrc_glXQueryVideoCaptureDeviceNV) numFailed++;
|
|
_ptrc_glXReleaseVideoCaptureDeviceNV = (void (CODEGEN_FUNCPTR *)(Display *, GLXVideoCaptureDeviceNV))IntGetProcAddress("glXReleaseVideoCaptureDeviceNV");
|
|
if(!_ptrc_glXReleaseVideoCaptureDeviceNV) numFailed++;
|
|
return numFailed;
|
|
}
|
|
|
|
int (CODEGEN_FUNCPTR *_ptrc_glXBindVideoImageNV)(Display *, GLXVideoDeviceNV, GLXPbuffer, int) = NULL;
|
|
int (CODEGEN_FUNCPTR *_ptrc_glXGetVideoDeviceNV)(Display *, int, int, GLXVideoDeviceNV *) = NULL;
|
|
int (CODEGEN_FUNCPTR *_ptrc_glXGetVideoInfoNV)(Display *, int, GLXVideoDeviceNV, unsigned long *, unsigned long *) = NULL;
|
|
int (CODEGEN_FUNCPTR *_ptrc_glXReleaseVideoDeviceNV)(Display *, int, GLXVideoDeviceNV) = NULL;
|
|
int (CODEGEN_FUNCPTR *_ptrc_glXReleaseVideoImageNV)(Display *, GLXPbuffer) = NULL;
|
|
int (CODEGEN_FUNCPTR *_ptrc_glXSendPbufferToVideoNV)(Display *, GLXPbuffer, int, unsigned long *, GLboolean) = NULL;
|
|
|
|
static int Load_NV_video_output(void)
|
|
{
|
|
int numFailed = 0;
|
|
_ptrc_glXBindVideoImageNV = (int (CODEGEN_FUNCPTR *)(Display *, GLXVideoDeviceNV, GLXPbuffer, int))IntGetProcAddress("glXBindVideoImageNV");
|
|
if(!_ptrc_glXBindVideoImageNV) numFailed++;
|
|
_ptrc_glXGetVideoDeviceNV = (int (CODEGEN_FUNCPTR *)(Display *, int, int, GLXVideoDeviceNV *))IntGetProcAddress("glXGetVideoDeviceNV");
|
|
if(!_ptrc_glXGetVideoDeviceNV) numFailed++;
|
|
_ptrc_glXGetVideoInfoNV = (int (CODEGEN_FUNCPTR *)(Display *, int, GLXVideoDeviceNV, unsigned long *, unsigned long *))IntGetProcAddress("glXGetVideoInfoNV");
|
|
if(!_ptrc_glXGetVideoInfoNV) numFailed++;
|
|
_ptrc_glXReleaseVideoDeviceNV = (int (CODEGEN_FUNCPTR *)(Display *, int, GLXVideoDeviceNV))IntGetProcAddress("glXReleaseVideoDeviceNV");
|
|
if(!_ptrc_glXReleaseVideoDeviceNV) numFailed++;
|
|
_ptrc_glXReleaseVideoImageNV = (int (CODEGEN_FUNCPTR *)(Display *, GLXPbuffer))IntGetProcAddress("glXReleaseVideoImageNV");
|
|
if(!_ptrc_glXReleaseVideoImageNV) numFailed++;
|
|
_ptrc_glXSendPbufferToVideoNV = (int (CODEGEN_FUNCPTR *)(Display *, GLXPbuffer, int, unsigned long *, GLboolean))IntGetProcAddress("glXSendPbufferToVideoNV");
|
|
if(!_ptrc_glXSendPbufferToVideoNV) numFailed++;
|
|
return numFailed;
|
|
}
|
|
|
|
typedef int (*PFN_LOADFUNCPOINTERS)(void);
|
|
typedef struct glx_StrToExtMap_s
|
|
{
|
|
const char *extensionName;
|
|
int *extensionVariable;
|
|
PFN_LOADFUNCPOINTERS LoadExtension;
|
|
} glx_StrToExtMap;
|
|
|
|
static glx_StrToExtMap ExtensionMap[35] = {
|
|
{"GLX_AMD_gpu_association", &glx_ext_AMD_gpu_association, NULL},
|
|
{"GLX_ARB_create_context", &glx_ext_ARB_create_context, Load_ARB_create_context},
|
|
{"GLX_ARB_create_context_profile", &glx_ext_ARB_create_context_profile, NULL},
|
|
{"GLX_ARB_create_context_robustness", &glx_ext_ARB_create_context_robustness, NULL},
|
|
{"GLX_ARB_fbconfig_float", &glx_ext_ARB_fbconfig_float, NULL},
|
|
{"GLX_ARB_framebuffer_sRGB", &glx_ext_ARB_framebuffer_sRGB, NULL},
|
|
{"GLX_ARB_get_proc_address", &glx_ext_ARB_get_proc_address, Load_ARB_get_proc_address},
|
|
{"GLX_ARB_multisample", &glx_ext_ARB_multisample, NULL},
|
|
{"GLX_ARB_robustness_application_isolation", &glx_ext_ARB_robustness_application_isolation, NULL},
|
|
{"GLX_ARB_robustness_share_group_isolation", &glx_ext_ARB_robustness_share_group_isolation, NULL},
|
|
{"GLX_ARB_vertex_buffer_object", &glx_ext_ARB_vertex_buffer_object, NULL},
|
|
{"GLX_EXT_buffer_age", &glx_ext_EXT_buffer_age, NULL},
|
|
{"GLX_EXT_create_context_es2_profile", &glx_ext_EXT_create_context_es2_profile, NULL},
|
|
{"GLX_EXT_create_context_es_profile", &glx_ext_EXT_create_context_es_profile, NULL},
|
|
{"GLX_EXT_fbconfig_packed_float", &glx_ext_EXT_fbconfig_packed_float, NULL},
|
|
{"GLX_EXT_framebuffer_sRGB", &glx_ext_EXT_framebuffer_sRGB, NULL},
|
|
{"GLX_EXT_import_context", &glx_ext_EXT_import_context, Load_EXT_import_context},
|
|
{"GLX_EXT_swap_control", &glx_ext_EXT_swap_control, Load_EXT_swap_control},
|
|
{"GLX_EXT_swap_control_tear", &glx_ext_EXT_swap_control_tear, NULL},
|
|
{"GLX_EXT_texture_from_pixmap", &glx_ext_EXT_texture_from_pixmap, Load_EXT_texture_from_pixmap},
|
|
{"GLX_EXT_visual_info", &glx_ext_EXT_visual_info, NULL},
|
|
{"GLX_EXT_visual_rating", &glx_ext_EXT_visual_rating, NULL},
|
|
{"GLX_INTEL_swap_event", &glx_ext_INTEL_swap_event, NULL},
|
|
{"GLX_MESA_agp_offset", &glx_ext_MESA_agp_offset, Load_MESA_agp_offset},
|
|
{"GLX_MESA_copy_sub_buffer", &glx_ext_MESA_copy_sub_buffer, Load_MESA_copy_sub_buffer},
|
|
{"GLX_MESA_pixmap_colormap", &glx_ext_MESA_pixmap_colormap, Load_MESA_pixmap_colormap},
|
|
{"GLX_MESA_release_buffers", &glx_ext_MESA_release_buffers, Load_MESA_release_buffers},
|
|
{"GLX_MESA_set_3dfx_mode", &glx_ext_MESA_set_3dfx_mode, Load_MESA_set_3dfx_mode},
|
|
{"GLX_NV_copy_image", &glx_ext_NV_copy_image, Load_NV_copy_image},
|
|
{"GLX_NV_float_buffer", &glx_ext_NV_float_buffer, NULL},
|
|
{"GLX_NV_multisample_coverage", &glx_ext_NV_multisample_coverage, NULL},
|
|
{"GLX_NV_present_video", &glx_ext_NV_present_video, Load_NV_present_video},
|
|
{"GLX_NV_swap_group", &glx_ext_NV_swap_group, Load_NV_swap_group},
|
|
{"GLX_NV_video_capture", &glx_ext_NV_video_capture, Load_NV_video_capture},
|
|
{"GLX_NV_video_output", &glx_ext_NV_video_output, Load_NV_video_output},
|
|
};
|
|
|
|
static int g_extensionMapSize = 35;
|
|
|
|
static glx_StrToExtMap *FindExtEntry(const char *extensionName)
|
|
{
|
|
int loop;
|
|
glx_StrToExtMap *currLoc = ExtensionMap;
|
|
for(loop = 0; loop < g_extensionMapSize; ++loop, ++currLoc)
|
|
{
|
|
if(strcmp(extensionName, currLoc->extensionName) == 0)
|
|
return currLoc;
|
|
}
|
|
|
|
return NULL;
|
|
}
|
|
|
|
static void ClearExtensionVars(void)
|
|
{
|
|
glx_ext_AMD_gpu_association = glx_LOAD_FAILED;
|
|
glx_ext_ARB_create_context = glx_LOAD_FAILED;
|
|
glx_ext_ARB_create_context_profile = glx_LOAD_FAILED;
|
|
glx_ext_ARB_create_context_robustness = glx_LOAD_FAILED;
|
|
glx_ext_ARB_fbconfig_float = glx_LOAD_FAILED;
|
|
glx_ext_ARB_framebuffer_sRGB = glx_LOAD_FAILED;
|
|
glx_ext_ARB_get_proc_address = glx_LOAD_FAILED;
|
|
glx_ext_ARB_multisample = glx_LOAD_FAILED;
|
|
glx_ext_ARB_robustness_application_isolation = glx_LOAD_FAILED;
|
|
glx_ext_ARB_robustness_share_group_isolation = glx_LOAD_FAILED;
|
|
glx_ext_ARB_vertex_buffer_object = glx_LOAD_FAILED;
|
|
glx_ext_EXT_buffer_age = glx_LOAD_FAILED;
|
|
glx_ext_EXT_create_context_es2_profile = glx_LOAD_FAILED;
|
|
glx_ext_EXT_create_context_es_profile = glx_LOAD_FAILED;
|
|
glx_ext_EXT_fbconfig_packed_float = glx_LOAD_FAILED;
|
|
glx_ext_EXT_framebuffer_sRGB = glx_LOAD_FAILED;
|
|
glx_ext_EXT_import_context = glx_LOAD_FAILED;
|
|
glx_ext_EXT_swap_control = glx_LOAD_FAILED;
|
|
glx_ext_EXT_swap_control_tear = glx_LOAD_FAILED;
|
|
glx_ext_EXT_texture_from_pixmap = glx_LOAD_FAILED;
|
|
glx_ext_EXT_visual_info = glx_LOAD_FAILED;
|
|
glx_ext_EXT_visual_rating = glx_LOAD_FAILED;
|
|
glx_ext_INTEL_swap_event = glx_LOAD_FAILED;
|
|
glx_ext_MESA_agp_offset = glx_LOAD_FAILED;
|
|
glx_ext_MESA_copy_sub_buffer = glx_LOAD_FAILED;
|
|
glx_ext_MESA_pixmap_colormap = glx_LOAD_FAILED;
|
|
glx_ext_MESA_release_buffers = glx_LOAD_FAILED;
|
|
glx_ext_MESA_set_3dfx_mode = glx_LOAD_FAILED;
|
|
glx_ext_NV_copy_image = glx_LOAD_FAILED;
|
|
glx_ext_NV_float_buffer = glx_LOAD_FAILED;
|
|
glx_ext_NV_multisample_coverage = glx_LOAD_FAILED;
|
|
glx_ext_NV_present_video = glx_LOAD_FAILED;
|
|
glx_ext_NV_swap_group = glx_LOAD_FAILED;
|
|
glx_ext_NV_video_capture = glx_LOAD_FAILED;
|
|
glx_ext_NV_video_output = glx_LOAD_FAILED;
|
|
}
|
|
|
|
|
|
static void LoadExtByName(const char *extensionName)
|
|
{
|
|
glx_StrToExtMap *entry = NULL;
|
|
entry = FindExtEntry(extensionName);
|
|
if(entry)
|
|
{
|
|
if(entry->LoadExtension)
|
|
{
|
|
int numFailed = entry->LoadExtension();
|
|
if(numFailed == 0)
|
|
{
|
|
*(entry->extensionVariable) = glx_LOAD_SUCCEEDED;
|
|
}
|
|
else
|
|
{
|
|
*(entry->extensionVariable) = glx_LOAD_SUCCEEDED + numFailed;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
*(entry->extensionVariable) = glx_LOAD_SUCCEEDED;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
static void ProcExtsFromExtString(const char *strExtList)
|
|
{
|
|
size_t iExtListLen = strlen(strExtList);
|
|
const char *strExtListEnd = strExtList + iExtListLen;
|
|
const char *strCurrPos = strExtList;
|
|
char strWorkBuff[256];
|
|
|
|
while(*strCurrPos)
|
|
{
|
|
/*Get the extension at our position.*/
|
|
int iStrLen = 0;
|
|
const char *strEndStr = strchr(strCurrPos, ' ');
|
|
int iStop = 0;
|
|
if(strEndStr == NULL)
|
|
{
|
|
strEndStr = strExtListEnd;
|
|
iStop = 1;
|
|
}
|
|
|
|
iStrLen = (int)((ptrdiff_t)strEndStr - (ptrdiff_t)strCurrPos);
|
|
|
|
if(iStrLen > 255)
|
|
return;
|
|
|
|
strncpy(strWorkBuff, strCurrPos, iStrLen);
|
|
strWorkBuff[iStrLen] = '\0';
|
|
|
|
LoadExtByName(strWorkBuff);
|
|
|
|
strCurrPos = strEndStr + 1;
|
|
if(iStop) break;
|
|
}
|
|
}
|
|
|
|
int glx_LoadFunctions(Display *display, int screen)
|
|
{
|
|
ClearExtensionVars();
|
|
|
|
|
|
ProcExtsFromExtString((const char *)glXQueryExtensionsString(display, screen));
|
|
return glx_LOAD_SUCCEEDED;
|
|
}
|
|
|