From 8fa0cb2b422abaeee1b69f82ca7e9f02dc8393b9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 21 May 2009 10:15:18 -0600 Subject: [PATCH] mesa: added gl_array_object::Weight array field We don't really implement vertex weights but in the VBO code this fixes and odd case for the legacy_array[] setup. Before, the vbo->draw_prims() call was always indicating that the vertex weight array was present/enabled when it really wasn't. --- src/mesa/main/arrayobj.c | 3 +++ src/mesa/main/mtypes.h | 1 + src/mesa/vbo/vbo_exec_array.c | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index 8973c3cb37d..f9b11ee244a 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -81,6 +81,7 @@ unbind_array_object_vbos(GLcontext *ctx, struct gl_array_object *obj) GLuint i; _mesa_reference_buffer_object(ctx, &obj->Vertex.BufferObj, NULL); + _mesa_reference_buffer_object(ctx, &obj->Weight.BufferObj, NULL); _mesa_reference_buffer_object(ctx, &obj->Normal.BufferObj, NULL); _mesa_reference_buffer_object(ctx, &obj->Color.BufferObj, NULL); _mesa_reference_buffer_object(ctx, &obj->SecondaryColor.BufferObj, NULL); @@ -223,6 +224,7 @@ _mesa_initialize_array_object( GLcontext *ctx, /* Init the individual arrays */ init_array(ctx, &obj->Vertex, 4, GL_FLOAT); + init_array(ctx, &obj->Weight, 1, GL_FLOAT); init_array(ctx, &obj->Normal, 3, GL_FLOAT); init_array(ctx, &obj->Color, 4, GL_FLOAT); init_array(ctx, &obj->SecondaryColor, 4, GL_FLOAT); @@ -326,6 +328,7 @@ _mesa_update_array_object_max_element(GLcontext *ctx, GLuint i, min = ~0; min = update_min(min, &arrayObj->Vertex); + min = update_min(min, &arrayObj->Weight); min = update_min(min, &arrayObj->Normal); min = update_min(min, &arrayObj->Color); min = update_min(min, &arrayObj->SecondaryColor); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 2708678e64c..55bfa2bf411 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1563,6 +1563,7 @@ struct gl_array_object /** Conventional vertex arrays */ /*@{*/ struct gl_client_array Vertex; + struct gl_client_array Weight; struct gl_client_array Normal; struct gl_client_array Color; struct gl_client_array SecondaryColor; diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index a4c67c1de15..c33d557e926 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -103,7 +103,7 @@ static void bind_array_obj( GLcontext *ctx ) * go away. */ exec->array.legacy_array[VERT_ATTRIB_POS] = &arrayObj->Vertex; - exec->array.legacy_array[VERT_ATTRIB_WEIGHT] = &vbo->legacy_currval[VERT_ATTRIB_WEIGHT]; + exec->array.legacy_array[VERT_ATTRIB_WEIGHT] = &arrayObj->Weight; exec->array.legacy_array[VERT_ATTRIB_NORMAL] = &arrayObj->Normal; exec->array.legacy_array[VERT_ATTRIB_COLOR0] = &arrayObj->Color; exec->array.legacy_array[VERT_ATTRIB_COLOR1] = &arrayObj->SecondaryColor; -- 2.30.2