Merge branch 'llvm-cliptest-viewport'
[mesa.git] / src / mesa / main / api_arrayelt.c
index f5b7d1e1385051e76067b2bf8a00dc4850bfb412..172c33b47bf2ae8333b71f1d155005cb34443bf8 100644 (file)
 
 #include "glheader.h"
 #include "api_arrayelt.h"
+#include "bufferobj.h"
 #include "context.h"
 #include "imports.h"
 #include "macros.h"
-#include "glapi/glapioffsets.h"
-#include "glapi/dispatch.h"
+#include "main/dispatch.h"
 
 typedef void (GLAPIENTRY *array_func)( const void * );
 
@@ -70,6 +70,10 @@ typedef struct {
  */
 #define TYPE_IDX(t) ( (t) == GL_DOUBLE ? 7 : (t) & 7 )
 
+
+#if FEATURE_arrayelt
+
+
 static const int ColorFuncs[2][8] = {
    {
       _gloffset_Color3bv,
@@ -1027,7 +1031,7 @@ static attrib_func AttribFuncsARB[2][4][8] = {
 /**********************************************************************/
 
 
-GLboolean _ae_create_context( GLcontext *ctx )
+GLboolean _ae_create_context( struct gl_context *ctx )
 {
    if (ctx->aelt_context)
       return GL_TRUE;
@@ -1060,7 +1064,7 @@ GLboolean _ae_create_context( GLcontext *ctx )
 }
 
 
-void _ae_destroy_context( GLcontext *ctx )
+void _ae_destroy_context( struct gl_context *ctx )
 {
    if ( AE_CONTEXT( ctx ) ) {
       FREE( ctx->aelt_context );
@@ -1071,7 +1075,7 @@ void _ae_destroy_context( GLcontext *ctx )
 static void check_vbo( AEcontext *actx,
                       struct gl_buffer_object *vbo )
 {
-   if (vbo->Name && !vbo->Pointer) {
+   if (_mesa_is_bufferobj(vbo) && !_mesa_bufferobj_mapped(vbo)) {
       GLuint i;
       for (i = 0; i < actx->nr_vbos; i++)
         if (actx->vbo[i] == vbo)
@@ -1088,7 +1092,7 @@ static void check_vbo( AEcontext *actx,
  * etc).
  * Note: this may be called during display list construction.
  */
-static void _ae_update_state( GLcontext *ctx )
+static void _ae_update_state( struct gl_context *ctx )
 {
    AEcontext *actx = AE_CONTEXT(ctx);
    AEarray *aa = actx->arrays;
@@ -1159,7 +1163,7 @@ static void _ae_update_state( GLcontext *ctx )
          at->array = attribArray;
          /* Note: we can't grab the _glapi_Dispatch->VertexAttrib1fvNV
           * function pointer here (for float arrays) since the pointer may
-          * change from one execution of _ae_loopback_array_elt() to
+          * change from one execution of _ae_ArrayElement() to
           * the next.  Doing so caused UT to break.
           */
          if (ctx->VertexProgram._Enabled
@@ -1207,7 +1211,7 @@ static void _ae_update_state( GLcontext *ctx )
    actx->NewState = 0;
 }
 
-void _ae_map_vbos( GLcontext *ctx )
+void _ae_map_vbos( struct gl_context *ctx )
 {
    AEcontext *actx = AE_CONTEXT(ctx);
    GLuint i;
@@ -1228,7 +1232,7 @@ void _ae_map_vbos( GLcontext *ctx )
       actx->mapped_vbos = GL_TRUE;
 }
 
-void _ae_unmap_vbos( GLcontext *ctx )
+void _ae_unmap_vbos( struct gl_context *ctx )
 {
    AEcontext *actx = AE_CONTEXT(ctx);
    GLuint i;
@@ -1253,7 +1257,7 @@ void _ae_unmap_vbos( GLcontext *ctx )
  * for all enabled vertex arrays (for elt-th element).
  * Note: this may be called during display list construction.
  */
-void GLAPIENTRY _ae_loopback_array_elt( GLint elt )
+void GLAPIENTRY _ae_ArrayElement( GLint elt )
 {
    GET_CURRENT_CONTEXT(ctx);
    const AEcontext *actx = AE_CONTEXT(ctx);
@@ -1296,7 +1300,7 @@ void GLAPIENTRY _ae_loopback_array_elt( GLint elt )
 }
 
 
-void _ae_invalidate_state( GLcontext *ctx, GLuint new_state )
+void _ae_invalidate_state( struct gl_context *ctx, GLuint new_state )
 {
    AEcontext *actx = AE_CONTEXT(ctx);
 
@@ -1316,3 +1320,13 @@ void _ae_invalidate_state( GLcontext *ctx, GLuint new_state )
       actx->NewState |= new_state;
    }
 }
+
+
+void _mesa_install_arrayelt_vtxfmt(struct _glapi_table *disp,
+                                   const GLvertexformat *vfmt)
+{
+   SET_ArrayElement(disp, vfmt->ArrayElement);
+}
+
+
+#endif /* FEATURE_arrayelt */