|
|
@ -89,27 +89,26 @@ |
|
|
|
|
|
|
|
|
|
|
|
#include <assert.h> |
|
|
|
#include <assert.h> |
|
|
|
#include <stdlib.h> |
|
|
|
#include <stdlib.h> |
|
|
|
|
|
|
|
#ifdef _WIN32 |
|
|
|
|
|
|
|
#include <windows.h> |
|
|
|
|
|
|
|
#else |
|
|
|
#include <dlfcn.h> |
|
|
|
#include <dlfcn.h> |
|
|
|
|
|
|
|
#include <err.h> |
|
|
|
|
|
|
|
#include <pthread.h> |
|
|
|
|
|
|
|
#endif |
|
|
|
#include <string.h> |
|
|
|
#include <string.h> |
|
|
|
#include <ctype.h> |
|
|
|
#include <ctype.h> |
|
|
|
#include <stdio.h> |
|
|
|
#include <stdio.h> |
|
|
|
#include <pthread.h> |
|
|
|
|
|
|
|
#include <err.h> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "epoxy/gl.h" |
|
|
|
|
|
|
|
#if PLATFORM_HAS_GLX |
|
|
|
|
|
|
|
#include "epoxy/glx.h" |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
#if PLATFORM_HAS_EGL |
|
|
|
|
|
|
|
#include "epoxy/egl.h" |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
#include "dispatch_common.h" |
|
|
|
#include "dispatch_common.h" |
|
|
|
|
|
|
|
|
|
|
|
struct api { |
|
|
|
struct api { |
|
|
|
|
|
|
|
#ifndef _WIN32 |
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Locking for making sure we don't double-dlopen(). |
|
|
|
* Locking for making sure we don't double-dlopen(). |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
pthread_mutex_t mutex; |
|
|
|
pthread_mutex_t mutex; |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
/** dlopen() return value for libGL.so.1. */ |
|
|
|
/** dlopen() return value for libGL.so.1. */ |
|
|
|
void *glx_handle; |
|
|
|
void *glx_handle; |
|
|
@ -139,9 +138,12 @@ struct api { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
static struct api api = { |
|
|
|
static struct api api = { |
|
|
|
|
|
|
|
#ifndef _WIN32 |
|
|
|
.mutex = PTHREAD_MUTEX_INITIALIZER, |
|
|
|
.mutex = PTHREAD_MUTEX_INITIALIZER, |
|
|
|
|
|
|
|
#endif |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _WIN32 |
|
|
|
static void |
|
|
|
static void |
|
|
|
get_dlopen_handle(void **handle, const char *lib_name, bool exit_on_fail) |
|
|
|
get_dlopen_handle(void **handle, const char *lib_name, bool exit_on_fail) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -173,6 +175,14 @@ do_dlsym(void **handle, const char *lib_name, const char *name, |
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
static void * |
|
|
|
|
|
|
|
do_dlsym(void **handle, const char *lib_name, const char *name, |
|
|
|
|
|
|
|
bool exit_on_fail) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return NULL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
PUBLIC bool |
|
|
|
PUBLIC bool |
|
|
|
epoxy_is_desktop_gl(void) |
|
|
|
epoxy_is_desktop_gl(void) |
|
|
@ -331,6 +341,9 @@ epoxy_gles2_dlsym(const char *name) |
|
|
|
void * |
|
|
|
void * |
|
|
|
epoxy_get_proc_address(const char *name) |
|
|
|
epoxy_get_proc_address(const char *name) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
#ifdef _WIN32 |
|
|
|
|
|
|
|
return wglGetProcAddress(name); |
|
|
|
|
|
|
|
#else |
|
|
|
if (api.egl_handle) { |
|
|
|
if (api.egl_handle) { |
|
|
|
return eglGetProcAddress(name); |
|
|
|
return eglGetProcAddress(name); |
|
|
|
} else if (api.glx_handle) { |
|
|
|
} else if (api.glx_handle) { |
|
|
@ -370,6 +383,7 @@ epoxy_get_proc_address(const char *name) |
|
|
|
|
|
|
|
|
|
|
|
errx(1, "Couldn't find GLX or EGL libraries.\n"); |
|
|
|
errx(1, "Couldn't find GLX or EGL libraries.\n"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void |
|
|
|
void |
|
|
@ -395,9 +409,13 @@ epoxy_print_failure_reasons(const char *name, |
|
|
|
PUBLIC void |
|
|
|
PUBLIC void |
|
|
|
epoxy_glBegin(GLenum primtype) |
|
|
|
epoxy_glBegin(GLenum primtype) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
#ifdef _WIN32 |
|
|
|
|
|
|
|
#warning missing locking |
|
|
|
|
|
|
|
#else |
|
|
|
pthread_mutex_lock(&api.mutex); |
|
|
|
pthread_mutex_lock(&api.mutex); |
|
|
|
api.begin_count++; |
|
|
|
api.begin_count++; |
|
|
|
pthread_mutex_unlock(&api.mutex); |
|
|
|
pthread_mutex_unlock(&api.mutex); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
epoxy_glBegin_unwrapped(primtype); |
|
|
|
epoxy_glBegin_unwrapped(primtype); |
|
|
|
} |
|
|
|
} |
|
|
@ -407,7 +425,11 @@ epoxy_glEnd(void) |
|
|
|
{ |
|
|
|
{ |
|
|
|
epoxy_glEnd_unwrapped(); |
|
|
|
epoxy_glEnd_unwrapped(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef _WIN32 |
|
|
|
|
|
|
|
#warning missing locking |
|
|
|
|
|
|
|
#else |
|
|
|
pthread_mutex_lock(&api.mutex); |
|
|
|
pthread_mutex_lock(&api.mutex); |
|
|
|
api.begin_count--; |
|
|
|
api.begin_count--; |
|
|
|
pthread_mutex_unlock(&api.mutex); |
|
|
|
pthread_mutex_unlock(&api.mutex); |
|
|
|
|
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|