summaryrefslogtreecommitdiff
path: root/src/mapi/glapi
diff options
context:
space:
mode:
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>2010-09-02 18:31:49 +0200
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>2010-09-02 18:31:49 +0200
commit222d2f2ac2c7d93cbc0643082c78278ad2c8cfce (patch)
treeb79152c238022b2a901201c22e5809ac520732bf /src/mapi/glapi
parent443abc80db9e1a288ce770e76cccd43664348098 (diff)
parente73c5501b2fe20290d1b691c85a5d82ac3a0431c (diff)
Merge remote branch 'origin/master' into nv50-compiler
Conflicts: src/gallium/drivers/nv50/nv50_program.c
Diffstat (limited to 'src/mapi/glapi')
-rw-r--r--src/mapi/glapi/gen/glX_proto_send.py6
-rw-r--r--src/mapi/glapi/glapi.h116
-rw-r--r--src/mapi/glapi/glapi_dispatch.c11
-rw-r--r--src/mapi/glapi/glapi_entrypoint.c9
-rw-r--r--src/mapi/glapi/glapi_getproc.c9
-rw-r--r--src/mapi/glapi/glapi_nop.c21
-rw-r--r--src/mapi/glapi/glapi_priv.h25
-rw-r--r--src/mapi/glapi/glthread.c2
-rw-r--r--src/mapi/glapi/glthread.h5
9 files changed, 136 insertions, 68 deletions
diff --git a/src/mapi/glapi/gen/glX_proto_send.py b/src/mapi/glapi/gen/glX_proto_send.py
index 0ca0ff92a6..bd41c9e667 100644
--- a/src/mapi/glapi/gen/glX_proto_send.py
+++ b/src/mapi/glapi/gen/glX_proto_send.py
@@ -895,13 +895,13 @@ static int NoOp(void)
* Create and initialize a new GL dispatch table. The table is initialized
* with GLX indirect rendering protocol functions.
*/
-__GLapi * __glXNewIndirectAPI( void )
+struct _glapi_table * __glXNewIndirectAPI( void )
{
- __GLapi *glAPI;
+ struct _glapi_table *glAPI;
GLuint entries;
entries = _glapi_get_dispatch_table_size();
- glAPI = (__GLapi *) Xmalloc(entries * sizeof(void *));
+ glAPI = (struct _glapi_table *) Xmalloc(entries * sizeof(void *));
/* first, set all entries to point to no-op functions */
{
diff --git a/src/mapi/glapi/glapi.h b/src/mapi/glapi/glapi.h
index a74884d595..a0bb078106 100644
--- a/src/mapi/glapi/glapi.h
+++ b/src/mapi/glapi/glapi.h
@@ -44,10 +44,30 @@
#ifndef _GLAPI_H
#define _GLAPI_H
-#ifndef MAPI_GLAPI_CURRENT
-#define MAPI_GLAPI_CURRENT
+
+/* opengl.dll does not export _glapi_* */
+#if defined(_WIN32)
+#define _GLAPI_NO_EXPORTS
#endif
+#ifdef _GLAPI_NO_EXPORTS
+# define _GLAPI_EXPORT
+#else /* _GLAPI_NO_EXPORTS */
+# ifdef _WIN32
+# ifdef _GLAPI_DLL_EXPORTS
+# define _GLAPI_EXPORT __declspec(dllexport)
+# else
+# define _GLAPI_EXPORT __declspec(dllimport)
+# endif
+# elif defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
+# define _GLAPI_EXPORT __attribute__((visibility("default")))
+# else
+# define _GLAPI_EXPORT
+# endif
+#endif /* _GLAPI_NO_EXPORTS */
+
+
+/* Is this needed? It is incomplete anyway. */
#ifdef USE_MGL_NAMESPACE
#define _glapi_set_dispatch _mglapi_set_dispatch
#define _glapi_get_dispatch _mglapi_get_dispatch
@@ -57,32 +77,106 @@
#define _glapi_Context _mglapi_Context
#endif
-#include "mapi/u_current.h"
#include "glapi/glthread.h"
typedef void (*_glapi_proc)(void);
+struct _glapi_table;
+
+
+#if defined (GLX_USE_TLS)
+
+_GLAPI_EXPORT extern __thread struct _glapi_table * _glapi_tls_Dispatch
+ __attribute__((tls_model("initial-exec")));
+
+_GLAPI_EXPORT extern __thread void * _glapi_tls_Context
+ __attribute__((tls_model("initial-exec")));
+
+_GLAPI_EXPORT extern const struct _glapi_table *_glapi_Dispatch;
+_GLAPI_EXPORT extern const void *_glapi_Context;
+
+# define GET_DISPATCH() _glapi_tls_Dispatch
+# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_tls_Context
+
+#else
+
+_GLAPI_EXPORT extern struct _glapi_table *_glapi_Dispatch;
+_GLAPI_EXPORT extern void *_glapi_Context;
+
+# ifdef THREADS
+
+# define GET_DISPATCH() \
+ (likely(_glapi_Dispatch) ? _glapi_Dispatch : _glapi_get_dispatch())
+
+# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) \
+ (likely(_glapi_Context) ? _glapi_Context : _glapi_get_context())
+
+# else
+
+# define GET_DISPATCH() _glapi_Dispatch
+# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_Context
+
+# endif
+
+#endif /* defined (GLX_USE_TLS) */
+
+
+void
+_glapi_destroy_multithread(void);
+
-#define GET_DISPATCH() ((struct _glapi_table *) u_current_get())
-#define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) u_current_get_user()
+_GLAPI_EXPORT void
+_glapi_check_multithread(void);
-PUBLIC unsigned int
+
+_GLAPI_EXPORT void
+_glapi_set_context(void *context);
+
+
+_GLAPI_EXPORT void *
+_glapi_get_context(void);
+
+
+_GLAPI_EXPORT void
+_glapi_set_dispatch(struct _glapi_table *dispatch);
+
+
+_GLAPI_EXPORT struct _glapi_table *
+_glapi_get_dispatch(void);
+
+
+_GLAPI_EXPORT unsigned int
_glapi_get_dispatch_table_size(void);
-PUBLIC int
+_GLAPI_EXPORT int
_glapi_add_dispatch( const char * const * function_names,
const char * parameter_signature );
-PUBLIC int
+_GLAPI_EXPORT int
_glapi_get_proc_offset(const char *funcName);
-PUBLIC _glapi_proc
+_GLAPI_EXPORT _glapi_proc
_glapi_get_proc_address(const char *funcName);
-PUBLIC const char *
+_GLAPI_EXPORT const char *
_glapi_get_proc_name(unsigned int offset);
-#endif
+_GLAPI_EXPORT unsigned long
+_glthread_GetID(void);
+
+
+/*
+ * These stubs are kept so that the old DRI drivers still load.
+ */
+_GLAPI_EXPORT void
+_glapi_noop_enable_warnings(unsigned char enable);
+
+
+_GLAPI_EXPORT void
+_glapi_set_warning_func(_glapi_proc func);
+
+
+#endif /* _GLAPI_H */
diff --git a/src/mapi/glapi/glapi_dispatch.c b/src/mapi/glapi/glapi_dispatch.c
index ae59140ad3..7421a36d35 100644
--- a/src/mapi/glapi/glapi_dispatch.c
+++ b/src/mapi/glapi/glapi_dispatch.c
@@ -37,18 +37,9 @@
* \author Brian Paul <brian@precisioninsight.com>
*/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#include "glapi/mesa.h"
-#else
-#include "main/glheader.h"
-#include "main/compiler.h"
-#endif
-
-#include "glapi/glapi.h"
+#include "glapi/glapi_priv.h"
#include "glapi/glapitable.h"
#include "glapi/glapidispatch.h"
-#include "glapi/glthread.h"
#if !(defined(USE_X86_ASM) || defined(USE_X86_64_ASM) || defined(USE_SPARC_ASM))
diff --git a/src/mapi/glapi/glapi_entrypoint.c b/src/mapi/glapi/glapi_entrypoint.c
index 82c68c27c8..993ccb94c2 100644
--- a/src/mapi/glapi/glapi_entrypoint.c
+++ b/src/mapi/glapi/glapi_entrypoint.c
@@ -29,15 +29,6 @@
*/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#include "glapi/mesa.h"
-#else
-#include "main/glheader.h"
-#include "main/compiler.h"
-#endif
-
-#include "glapi/glapi.h"
#include "glapi/glapi_priv.h"
#include "mapi/u_execmem.h"
diff --git a/src/mapi/glapi/glapi_getproc.c b/src/mapi/glapi/glapi_getproc.c
index 3c134f929d..dc4905b64e 100644
--- a/src/mapi/glapi/glapi_getproc.c
+++ b/src/mapi/glapi/glapi_getproc.c
@@ -30,15 +30,6 @@
*/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#include "glapi/mesa.h"
-#else
-#include "main/glheader.h"
-#include "main/compiler.h"
-#endif
-
-#include "glapi/glapi.h"
#include "glapi/glapi_priv.h"
#include "glapi/glapitable.h"
#include "glapi/glapioffsets.h"
diff --git a/src/mapi/glapi/glapi_nop.c b/src/mapi/glapi/glapi_nop.c
index 9709551ee7..9b09297150 100644
--- a/src/mapi/glapi/glapi_nop.c
+++ b/src/mapi/glapi/glapi_nop.c
@@ -38,28 +38,11 @@
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#include "glapi/mesa.h"
-#else
-#include "main/compiler.h"
-#include "main/glheader.h"
-#endif
-
-#include "glapi/glapi.h"
-
-
-/*
- * These stubs are kept so that the old DRI drivers still load.
- */
-PUBLIC void
-_glapi_noop_enable_warnings(GLboolean enable);
+#include "glapi/glapi_priv.h"
-PUBLIC void
-_glapi_set_warning_func(_glapi_proc func);
void
-_glapi_noop_enable_warnings(GLboolean enable)
+_glapi_noop_enable_warnings(unsigned char enable)
{
}
diff --git a/src/mapi/glapi/glapi_priv.h b/src/mapi/glapi/glapi_priv.h
index 1c2a704211..89f81c723e 100644
--- a/src/mapi/glapi/glapi_priv.h
+++ b/src/mapi/glapi/glapi_priv.h
@@ -26,9 +26,30 @@
#ifndef _GLAPI_PRIV_H
#define _GLAPI_PRIV_H
-#include "glthread.h"
-#include "glapi.h"
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#include "glapi/mesa.h"
+#else /* HAVE_DIX_CONFIG_H */
+#define GL_GLEXT_PROTOTYPES
+#include "GL/gl.h"
+#include "GL/glext.h"
+
+#ifndef GL_FIXED
+typedef int GLfixed;
+typedef int GLclampx;
+#endif
+
+#ifndef GL_OES_EGL_image
+typedef void *GLeglImageOES;
+#endif
+
+#endif /* HAVE_DIX_CONFIG_H */
+#include "glapi/glapi.h"
/* getproc */
diff --git a/src/mapi/glapi/glthread.c b/src/mapi/glapi/glthread.c
index 9dbc0e9a56..00915380f9 100644
--- a/src/mapi/glapi/glthread.c
+++ b/src/mapi/glapi/glthread.c
@@ -1,4 +1,4 @@
-#include "glthread.h"
+#include "glapi/glapi.h"
unsigned long
_glthread_GetID(void)
diff --git a/src/mapi/glapi/glthread.h b/src/mapi/glapi/glthread.h
index 54292706ac..fc4ece7c33 100644
--- a/src/mapi/glapi/glthread.h
+++ b/src/mapi/glapi/glthread.h
@@ -17,7 +17,4 @@
typedef struct u_tsd _glthread_TSD;
typedef u_mutex _glthread_Mutex;
-PUBLIC unsigned long
-_glthread_GetID(void);
-
-#endif /* THREADS_H */
+#endif /* GLTHREAD_H */