From: Marek Olšák Date: Mon, 16 Apr 2012 14:24:39 +0000 (+0200) Subject: vbo: remove vbo_context::legacy_currval X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fa48137f292bbf8cbcd65e9caf33633cddc96600;p=mesa.git vbo: remove vbo_context::legacy_currval It's not nice when you have several variables pointing to the same array and you wanna ask your editor "where is this used" and you only get an answer for one of the four currval, legacy_currval, generic_currval, mat_currval, which is quite useless, because you never see the whole picture. Let's get rid of the additional pointers. Reviewed-by: Brian Paul Reviewed-by: Mathias Fröhlich --- diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c index d83f2fd23a5..2b31b622204 100644 --- a/src/mesa/vbo/vbo_context.c +++ b/src/mesa/vbo/vbo_context.c @@ -47,7 +47,7 @@ static GLuint check_size( const GLfloat *attr ) static void init_legacy_currval(struct gl_context *ctx) { struct vbo_context *vbo = vbo_context(ctx); - struct gl_client_array *arrays = vbo->legacy_currval; + struct gl_client_array *arrays = &vbo->currval[VBO_ATTRIB_POS]; GLuint i; memset(arrays, 0, sizeof(*arrays) * VERT_ATTRIB_FF_MAX); @@ -162,7 +162,6 @@ GLboolean _vbo_CreateContext( struct gl_context *ctx ) /* TODO: remove these pointers. */ - vbo->legacy_currval = &vbo->currval[VBO_ATTRIB_POS]; vbo->generic_currval = &vbo->currval[VBO_ATTRIB_GENERIC0]; vbo->mat_currval = &vbo->currval[VBO_ATTRIB_MAT_FRONT_AMBIENT]; diff --git a/src/mesa/vbo/vbo_context.h b/src/mesa/vbo/vbo_context.h index cae2407c4b8..77010b8b163 100644 --- a/src/mesa/vbo/vbo_context.h +++ b/src/mesa/vbo/vbo_context.h @@ -61,9 +61,8 @@ struct vbo_context { struct gl_client_array currval[VBO_ATTRIB_MAX]; - /* These point into the above. TODO: remove. + /* These point into the above. TODO: remove. */ - struct gl_client_array *legacy_currval; struct gl_client_array *generic_currval; struct gl_client_array *mat_currval; diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index 30619906706..8a168043936 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -1089,14 +1089,14 @@ void vbo_exec_vtx_init( struct vbo_exec_context *exec ) struct gl_client_array *arrays = exec->vtx.arrays; unsigned i; - memcpy(arrays, vbo->legacy_currval, + memcpy(arrays, &vbo->currval[VBO_ATTRIB_POS], VERT_ATTRIB_FF_MAX * sizeof(arrays[0])); for (i = 0; i < VERT_ATTRIB_FF_MAX; ++i) { struct gl_client_array *array; array = &arrays[VERT_ATTRIB_FF(i)]; array->BufferObj = NULL; _mesa_reference_buffer_object(ctx, &arrays->BufferObj, - vbo->legacy_currval[i].BufferObj); + vbo->currval[VBO_ATTRIB_POS+i].BufferObj); } memcpy(arrays + VERT_ATTRIB_GENERIC(0), vbo->generic_currval, diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 30a954a813d..7278c39fa4b 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -420,7 +420,7 @@ recalculate_input_bindings(struct gl_context *ctx) if (vertexAttrib[VERT_ATTRIB_FF(i)].Enabled) inputs[i] = &vertexAttrib[VERT_ATTRIB_FF(i)]; else { - inputs[i] = &vbo->legacy_currval[i]; + inputs[i] = &vbo->currval[VBO_ATTRIB_POS+i]; const_inputs |= VERT_BIT(i); } } @@ -459,7 +459,7 @@ recalculate_input_bindings(struct gl_context *ctx) else if (vertexAttrib[VERT_ATTRIB_FF(i)].Enabled) inputs[i] = &vertexAttrib[VERT_ATTRIB_FF(i)]; else { - inputs[i] = &vbo->legacy_currval[i]; + inputs[i] = &vbo->currval[VBO_ATTRIB_POS+i]; const_inputs |= VERT_BIT_FF(i); } } @@ -488,7 +488,7 @@ recalculate_input_bindings(struct gl_context *ctx) else if (vertexAttrib[VERT_ATTRIB_POS].Enabled) inputs[0] = &vertexAttrib[VERT_ATTRIB_POS]; else { - inputs[0] = &vbo->legacy_currval[0]; + inputs[0] = &vbo->currval[VBO_ATTRIB_POS]; const_inputs |= VERT_BIT_POS; } @@ -496,7 +496,7 @@ recalculate_input_bindings(struct gl_context *ctx) if (vertexAttrib[VERT_ATTRIB_FF(i)].Enabled) inputs[i] = &vertexAttrib[VERT_ATTRIB_FF(i)]; else { - inputs[i] = &vbo->legacy_currval[i]; + inputs[i] = &vbo->currval[VBO_ATTRIB_POS+i]; const_inputs |= VERT_BIT_FF(i); } } diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c index a1d329f944e..96ff2241ac4 100644 --- a/src/mesa/vbo/vbo_exec_draw.c +++ b/src/mesa/vbo/vbo_exec_draw.c @@ -174,7 +174,7 @@ vbo_exec_bind_arrays( struct gl_context *ctx ) switch (get_program_mode(exec->ctx)) { case VP_NONE: for (attr = 0; attr < VERT_ATTRIB_FF_MAX; attr++) { - exec->vtx.inputs[attr] = &vbo->legacy_currval[attr]; + exec->vtx.inputs[attr] = &vbo->currval[VBO_ATTRIB_POS+attr]; } for (attr = 0; attr < MAT_ATTRIB_MAX; attr++) { ASSERT(VERT_ATTRIB_GENERIC(attr) < Elements(exec->vtx.inputs)); @@ -189,7 +189,7 @@ vbo_exec_bind_arrays( struct gl_context *ctx ) * nor attributes greater than VERT_ATTRIB_TEX7. */ for (attr = 0; attr < VERT_ATTRIB_FF_MAX; attr++) { - exec->vtx.inputs[attr] = &vbo->legacy_currval[attr]; + exec->vtx.inputs[attr] = &vbo->currval[VBO_ATTRIB_POS+attr]; } for (attr = 0; attr < VERT_ATTRIB_GENERIC_MAX; attr++) { ASSERT(VERT_ATTRIB_GENERIC(attr) < Elements(exec->vtx.inputs)); diff --git a/src/mesa/vbo/vbo_save.c b/src/mesa/vbo/vbo_save.c index e0270619118..dbe99edde05 100644 --- a/src/mesa/vbo/vbo_save.c +++ b/src/mesa/vbo/vbo_save.c @@ -63,14 +63,14 @@ void vbo_save_init( struct gl_context *ctx ) struct gl_client_array *arrays = save->arrays; unsigned i; - memcpy(arrays, vbo->legacy_currval, + memcpy(arrays, &vbo->currval[VBO_ATTRIB_POS], VERT_ATTRIB_FF_MAX * sizeof(arrays[0])); for (i = 0; i < VERT_ATTRIB_FF_MAX; ++i) { struct gl_client_array *array; array = &arrays[VERT_ATTRIB_FF(i)]; array->BufferObj = NULL; _mesa_reference_buffer_object(ctx, &arrays->BufferObj, - vbo->legacy_currval[i].BufferObj); + vbo->currval[VBO_ATTRIB_POS+i].BufferObj); } memcpy(arrays + VERT_ATTRIB_GENERIC(0), vbo->generic_currval, diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c index b8e1e7883e8..669023cf061 100644 --- a/src/mesa/vbo/vbo_save_draw.c +++ b/src/mesa/vbo/vbo_save_draw.c @@ -147,7 +147,7 @@ static void vbo_bind_vertex_list(struct gl_context *ctx, switch (get_program_mode(ctx)) { case VP_NONE: for (attr = 0; attr < VERT_ATTRIB_FF_MAX; attr++) { - save->inputs[attr] = &vbo->legacy_currval[attr]; + save->inputs[attr] = &vbo->currval[VBO_ATTRIB_POS+attr]; } for (attr = 0; attr < MAT_ATTRIB_MAX; attr++) { save->inputs[VERT_ATTRIB_GENERIC(attr)] = &vbo->mat_currval[attr]; @@ -161,7 +161,7 @@ static void vbo_bind_vertex_list(struct gl_context *ctx, * nor attributes greater than VERT_ATTRIB_TEX7. */ for (attr = 0; attr < VERT_ATTRIB_FF_MAX; attr++) { - save->inputs[attr] = &vbo->legacy_currval[attr]; + save->inputs[attr] = &vbo->currval[VBO_ATTRIB_POS+attr]; } for (attr = 0; attr < VERT_ATTRIB_GENERIC_MAX; attr++) { save->inputs[VERT_ATTRIB_GENERIC(attr)] = &vbo->generic_currval[attr];