summaryrefslogtreecommitdiff
path: root/src/mesa/main/api_arrayelt.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/api_arrayelt.c')
-rw-r--r--src/mesa/main/api_arrayelt.c60
1 files changed, 38 insertions, 22 deletions
diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c
index d124c724c9..a058227110 100644
--- a/src/mesa/main/api_arrayelt.c
+++ b/src/mesa/main/api_arrayelt.c
@@ -28,6 +28,7 @@
#include "glheader.h"
#include "api_arrayelt.h"
+#include "bufferobj.h"
#include "context.h"
#include "imports.h"
#include "macros.h"
@@ -70,6 +71,10 @@ typedef struct {
*/
#define TYPE_IDX(t) ( (t) == GL_DOUBLE ? 7 : (t) & 7 )
+
+#if FEATURE_arrayelt
+
+
static const int ColorFuncs[2][8] = {
{
_gloffset_Color3bv,
@@ -1071,7 +1076,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)
@@ -1094,48 +1099,49 @@ static void _ae_update_state( GLcontext *ctx )
AEarray *aa = actx->arrays;
AEattrib *at = actx->attribs;
GLuint i;
+ struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
actx->nr_vbos = 0;
/* conventional vertex arrays */
- if (ctx->Array.ArrayObj->Index.Enabled) {
- aa->array = &ctx->Array.ArrayObj->Index;
+ if (arrayObj->Index.Enabled) {
+ aa->array = &arrayObj->Index;
aa->offset = IndexFuncs[TYPE_IDX(aa->array->Type)];
check_vbo(actx, aa->array->BufferObj);
aa++;
}
- if (ctx->Array.ArrayObj->EdgeFlag.Enabled) {
- aa->array = &ctx->Array.ArrayObj->EdgeFlag;
+ if (arrayObj->EdgeFlag.Enabled) {
+ aa->array = &arrayObj->EdgeFlag;
aa->offset = _gloffset_EdgeFlagv;
check_vbo(actx, aa->array->BufferObj);
aa++;
}
- if (ctx->Array.ArrayObj->Normal.Enabled) {
- aa->array = &ctx->Array.ArrayObj->Normal;
+ if (arrayObj->Normal.Enabled) {
+ aa->array = &arrayObj->Normal;
aa->offset = NormalFuncs[TYPE_IDX(aa->array->Type)];
check_vbo(actx, aa->array->BufferObj);
aa++;
}
- if (ctx->Array.ArrayObj->Color.Enabled) {
- aa->array = &ctx->Array.ArrayObj->Color;
+ if (arrayObj->Color.Enabled) {
+ aa->array = &arrayObj->Color;
aa->offset = ColorFuncs[aa->array->Size-3][TYPE_IDX(aa->array->Type)];
check_vbo(actx, aa->array->BufferObj);
aa++;
}
- if (ctx->Array.ArrayObj->SecondaryColor.Enabled) {
- aa->array = &ctx->Array.ArrayObj->SecondaryColor;
+ if (arrayObj->SecondaryColor.Enabled) {
+ aa->array = &arrayObj->SecondaryColor;
aa->offset = SecondaryColorFuncs[TYPE_IDX(aa->array->Type)];
check_vbo(actx, aa->array->BufferObj);
aa++;
}
- if (ctx->Array.ArrayObj->FogCoord.Enabled) {
- aa->array = &ctx->Array.ArrayObj->FogCoord;
+ if (arrayObj->FogCoord.Enabled) {
+ aa->array = &arrayObj->FogCoord;
aa->offset = FogCoordFuncs[TYPE_IDX(aa->array->Type)];
check_vbo(actx, aa->array->BufferObj);
aa++;
}
for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
- struct gl_client_array *attribArray = &ctx->Array.ArrayObj->TexCoord[i];
+ struct gl_client_array *attribArray = &arrayObj->TexCoord[i];
if (attribArray->Enabled) {
/* NOTE: we use generic glVertexAttribNV functions here.
* If we ever remove GL_NV_vertex_program this will have to change.
@@ -1152,13 +1158,13 @@ static void _ae_update_state( GLcontext *ctx )
}
/* generic vertex attribute arrays */
- for (i = 1; i < VERT_ATTRIB_MAX; i++) { /* skip zero! */
- struct gl_client_array *attribArray = &ctx->Array.ArrayObj->VertexAttrib[i];
+ for (i = 1; i < Elements(arrayObj->VertexAttrib); i++) { /* skip zero! */
+ struct gl_client_array *attribArray = &arrayObj->VertexAttrib[i];
if (attribArray->Enabled) {
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
@@ -1179,18 +1185,18 @@ static void _ae_update_state( GLcontext *ctx )
}
/* finally, vertex position */
- if (ctx->Array.ArrayObj->VertexAttrib[0].Enabled) {
+ if (arrayObj->VertexAttrib[0].Enabled) {
/* Use glVertex(v) instead of glVertexAttrib(0, v) to be sure it's
* issued as the last (provoking) attribute).
*/
- aa->array = &ctx->Array.ArrayObj->VertexAttrib[0];
+ aa->array = &arrayObj->VertexAttrib[0];
assert(aa->array->Size >= 2); /* XXX fix someday? */
aa->offset = VertexFuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)];
check_vbo(actx, aa->array->BufferObj);
aa++;
}
- else if (ctx->Array.ArrayObj->Vertex.Enabled) {
- aa->array = &ctx->Array.ArrayObj->Vertex;
+ else if (arrayObj->Vertex.Enabled) {
+ aa->array = &arrayObj->Vertex;
aa->offset = VertexFuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)];
check_vbo(actx, aa->array->BufferObj);
aa++;
@@ -1252,7 +1258,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);
@@ -1315,3 +1321,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 */