Merge branch 'mesa_7_5_branch'
[mesa.git] / src / mesa / vbo / vbo_context.c
index bbf745b0c629bf1f25b5b1350ffd755545851d3e..75c32e0b9bedb89c58454ee0984986804af66998 100644 (file)
@@ -28,6 +28,8 @@
 #include "main/imports.h"
 #include "main/mtypes.h"
 #include "main/api_arrayelt.h"
+#include "main/bufferobj.h"
+#include "math/m_eval.h"
 #include "vbo.h"
 #include "vbo_context.h"
 
@@ -78,8 +80,10 @@ static void init_legacy_currval(GLcontext *ctx)
       cl->StrideB = 0;
       cl->Enabled = 1;
       cl->Type = GL_FLOAT;
+      cl->Format = GL_RGBA;
       cl->Ptr = (const void *)ctx->Current.Attrib[i];
-      cl->BufferObj = ctx->Array.NullBufferObj;
+      _mesa_reference_buffer_object(ctx, &cl->BufferObj,
+                                    ctx->Shared->NullBufferObj);
    }
 }
 
@@ -99,11 +103,13 @@ static void init_generic_currval(GLcontext *ctx)
        */
       cl->Size = 1;
       cl->Type = GL_FLOAT;
+      cl->Format = GL_RGBA;
       cl->Ptr = (const void *)ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + i];
       cl->Stride = 0;
       cl->StrideB = 0;
       cl->Enabled = 1;
-      cl->BufferObj = ctx->Array.NullBufferObj;
+      _mesa_reference_buffer_object(ctx, &cl->BufferObj,
+                                    ctx->Shared->NullBufferObj);
    }
 }
 
@@ -143,10 +149,12 @@ static void init_mat_currval(GLcontext *ctx)
 
       cl->Ptr = (const void *)ctx->Light.Material.Attrib[i];
       cl->Type = GL_FLOAT;
+      cl->Format = GL_RGBA;
       cl->Stride = 0;
       cl->StrideB = 0;
       cl->Enabled = 1;
-      cl->BufferObj = ctx->Array.NullBufferObj;
+      _mesa_reference_buffer_object(ctx, &cl->BufferObj,
+                                    ctx->Shared->NullBufferObj);
    }
 }
 
@@ -207,7 +215,7 @@ GLboolean _vbo_CreateContext( GLcontext *ctx )
       for (i = 0; i < 4; i++)
         vbo->map_vp_none[28+i] = i;    
       
-      for (i = 0; i < VERT_ATTRIB_MAX; i++)
+      for (i = 0; i < Elements(vbo->map_vp_arb); i++)
         vbo->map_vp_arb[i] = i;
    }
 
@@ -227,6 +235,8 @@ GLboolean _vbo_CreateContext( GLcontext *ctx )
    vbo_save_init( ctx );
 #endif
 
+   _math_init_eval();
+
    return GL_TRUE;
 }