Add two aliases for some PointParameters entrypoints for libglx compatibility.
[mesa.git] / src / glx / x11 / glxclient.h
index d0cc12e5ffe045b2bc6d0046b41c5a0bda6b2772..83e1f27269afebecfb0f773ffd06044e0fd04f12 100644 (file)
 #include "GL/glxproto.h"
 #include "GL/internal/glcore.h"
 #include "glapitable.h"
-#ifdef XTHREADS
-#include "Xthreads.h"
+#include "glxextensions.h"
+#if defined( XTHREADS )
+# include "Xthreads.h"
+#elif defined( PTHREADS )
+# include <pthread.h>
 #endif
 #ifdef GLX_BUILT_IN_XMESA
 #include "realglx.h"  /* just silences prototype warnings */
@@ -220,110 +223,29 @@ typedef struct __GLXattributeRecDEPRECATED {
        __GLXvertArrayStateDEPRECATED vertArray;
 } __GLXattributeDEPRECATED;
 
-typedef struct __GLXvertexArrayPointerStateRec {
-    void (*proc)(const void *);
-    void (*mtex_proc)(GLenum, const void *);
-    const GLubyte *ptr;
-    GLsizei skip;
-    GLint size;
-    GLenum type;
-    GLsizei stride;
-} __GLXvertexArrayPointerState;
 
-/**
- * Define which entries of \c __GLXvertArrayState::arrays match which
- * vertex arrays in the client-state vector.  These are only the one-of
- * arrays.  See the \c __GLXvertArrayState::arrays documentation for more
- * details.
- * 
- * \sa __GLXvertArrayState
- */
-enum {
-    edgeFlag_ARRAY,       /**< \c GL_EDGE_FLAG_ARRAY */
-    index_ARRAY,          /**< \c GL_INDEX_ARRAY */
-    fogCoord_ARRAY,       /**< \c GL_FOG_COORD_ARRAY */
-    secondaryColor_ARRAY, /**< \c GL_SECONDARY_COLOR_ARRAY */
-    color_ARRAY,          /**< \c GL_COLOR_ARRAY */
-    normal_ARRAY,         /**< \c GL_NORMAL_ARRAY */
-       
-    /**
-     * \c GL_VERTEX_ARRAY \b must be last!  All of the code for emitting arrays
-     * and array elements is written based on the assumption that the vertex
-     * array is last.
-     */
-    vertex_ARRAY,
-
-    __GLX_MAX_ARRAYS      /**< Place holder entry. */
-};
-
-#define ENABLE_ARRAY(state,a) \
-    do { (state)->vertArray.enables |=  (1U << (a ## _ARRAY)); } while( 0 )
-#define DISABLE_ARRAY(state,a) \
-    do { (state)->vertArray.enables &= ~(1U << (a ## _ARRAY)); } while( 0 )
-#define IS_ARRAY_ENABLED_BY_INDEX(state, i) \
-    (((state)->vertArray.enables & (1U << (i))) != 0)
-#define IS_ARRAY_ENABLED(state, a) \
-    IS_ARRAY_ENABLED_BY_INDEX(state, a ## _ARRAY)
-
-#define ENABLE_TEXARRAY(state,a) \
-    do { (state)->vertArray.texture_enables |=  (1U << a); } while( 0 )
-#define DISABLE_TEXARRAY(state,a) \
-    do { (state)->vertArray.texture_enables &= ~(1U << a); } while( 0 )
-#define IS_TEXARRAY_ENABLED(state, a) \
-    (((state)->vertArray.texture_enables & (1U << a)) != 0)
+typedef struct __GLXattributeRec {
+    GLuint mask;
 
-/**
- * Client-side vertex array state.
- */
-typedef struct __GLXvertArrayStateRec {
     /**
-     * Which client-side arrays are enabled?  These are the flag bits for
-     * all of the non-texture coordinate arrays.
+     * Pixel storage state.  Most of the pixel store mode state is kept
+     * here and used by the client code to manage the packing and
+     * unpacking of data sent to/received from the server.
      */
-    GLuint enables;
+    __GLXpixelStoreMode storePack, storeUnpack;
 
     /**
-     * Which of the texture coordinate arrays are enabled?
+     * Is EXT_vertex_array / GL 1.1 DrawArrays protocol specifically
+     * disabled?
      */
-    GLuint texture_enables;
-
+    GLboolean NoDrawArraysProtocol;
+    
     /**
-     * State for "one-of" arrays.  These are the arrays, such as
-     * GL_COLOR_ARRAY or GL_FOG_COORD_ARRAY for which there is only one
-     * array.  There are also "many-of" arrays, such as
-     * GL_TEXTURE_COORD_ARRAY.
+     * Vertex Array storage state.  The vertex array component
+     * state is stored here and is used to manage the packing of
+     * DrawArrays data sent to the server.
      */
-    __GLXvertexArrayPointerState arrays[__GLX_MAX_ARRAYS];
-
-    __GLXvertexArrayPointerState texCoord[__GLX_MAX_TEXTURE_UNITS];
-
-    GLint maxElementsVertices;
-    GLint maxElementsIndices;
-    GLint activeTexture;
-} __GLXvertArrayState;
-
-typedef struct __GLXattributeRec {
-       GLuint mask;
-
-       /*
-       ** Pixel storage state.  Most of the pixel store mode state is kept
-       ** here and used by the client code to manage the packing and
-       ** unpacking of data sent to/received from the server.
-       */
-       __GLXpixelStoreMode storePack, storeUnpack;
-
-       /*
-       ** Vertex Array storage state.  The vertex array component
-       ** state is stored here and is used to manage the packing of
-       ** DrawArrays data sent to the server.
-       */
-       __GLXvertArrayState vertArray;
-
-       /**
-        * Is EXT_vertex_array / GL 1.1 DrawArrays protocol specifically
-        * disabled?
-        */
-       GLboolean NoDrawArraysProtocol;
+    struct array_state_vector * array_state;
 } __GLXattribute;
 
 typedef struct __GLXattributeMachineRec {
@@ -529,7 +451,7 @@ struct __GLXcontextRec {
     * drivers should NEVER use this data or even care that it exists.
     */
    void * client_state_private;
-   
+
    /**
     * Stored value for \c glXQueryContext attribute \c GLX_RENDER_TYPE.
     */
@@ -546,6 +468,8 @@ struct __GLXcontextRec {
    int server_major;        /**< Major version number. */
    int server_minor;        /**< Minor version number. */
     /*@}*/
+
+    char gl_extension_bits[ __GL_EXT_BYTES ];
 };
 
 #define __glXSetError(gc,code) \
@@ -703,24 +627,44 @@ extern __GLXdisplayPrivate *__glXInitialize(Display*);
 extern int __glXDebug;
 
 /* This is per-thread storage in an MT environment */
-#if defined(GLX_DIRECT_RENDERING) && defined(XTHREADS)
-extern __GLXcontext *__glXGetCurrentContext(void);
+#if defined( XTHREADS ) || defined( PTHREADS )
+
 extern void __glXSetCurrentContext(__GLXcontext *c);
+
+# if defined( GLX_USE_TLS )
+
+extern __thread void * __glX_tls_Context
+    __attribute__((tls_model("initial-exec")));
+
+#  define __glXGetCurrentContext()     __glX_tls_Context
+
+# else
+
+extern __GLXcontext *__glXGetCurrentContext(void);
+
+# endif /* defined( GLX_USE_TLS ) */
+
 #else
+
 extern __GLXcontext *__glXcurrentContext;
 #define __glXGetCurrentContext()       __glXcurrentContext
 #define __glXSetCurrentContext(gc)     __glXcurrentContext = gc
-#endif
+
+#endif /* defined( XTHREADS ) || defined( PTHREADS ) */
 
 
 /*
 ** Global lock for all threads in this address space using the GLX
 ** extension
 */
-#if defined(GLX_DIRECT_RENDERING) && defined(XTHREADS)
+#if defined( XTHREADS )
 extern xmutex_rec __glXmutex;
 #define __glXLock()    xmutex_lock(&__glXmutex)
 #define __glXUnlock()  xmutex_unlock(&__glXmutex)
+#elif defined( PTHREADS )
+extern pthread_mutex_t __glXmutex;
+#define __glXLock()    pthread_mutex_lock(&__glXmutex)
+#define __glXUnlock()  pthread_mutex_unlock(&__glXmutex)
 #else
 #define __glXLock()
 #define __glXUnlock()