From 8c990de0d682bbedfd7e1988d4f8948ea99b0cc3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 16 Apr 2012 16:35:58 +0200 Subject: [PATCH] vbo: remove vbo_context::generic_currval MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Paul Reviewed-by: Mathias Fröhlich --- src/mesa/vbo/vbo_context.c | 3 +-- src/mesa/vbo/vbo_context.h | 1 - src/mesa/vbo/vbo_exec_api.c | 6 ++++-- src/mesa/vbo/vbo_exec_array.c | 6 +++--- src/mesa/vbo/vbo_exec_draw.c | 3 ++- src/mesa/vbo/vbo_save.c | 6 ++++-- src/mesa/vbo/vbo_save_draw.c | 3 ++- 7 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c index 2b31b622204..33bd4f3eb74 100644 --- a/src/mesa/vbo/vbo_context.c +++ b/src/mesa/vbo/vbo_context.c @@ -77,7 +77,7 @@ static void init_legacy_currval(struct gl_context *ctx) static void init_generic_currval(struct gl_context *ctx) { struct vbo_context *vbo = vbo_context(ctx); - struct gl_client_array *arrays = vbo->generic_currval; + struct gl_client_array *arrays = &vbo->currval[VBO_ATTRIB_GENERIC0]; GLuint i; memset(arrays, 0, sizeof(*arrays) * VERT_ATTRIB_GENERIC_MAX); @@ -162,7 +162,6 @@ GLboolean _vbo_CreateContext( struct gl_context *ctx ) /* TODO: remove these pointers. */ - vbo->generic_currval = &vbo->currval[VBO_ATTRIB_GENERIC0]; vbo->mat_currval = &vbo->currval[VBO_ATTRIB_MAT_FRONT_AMBIENT]; init_legacy_currval( ctx ); diff --git a/src/mesa/vbo/vbo_context.h b/src/mesa/vbo/vbo_context.h index 77010b8b163..b9d00863f27 100644 --- a/src/mesa/vbo/vbo_context.h +++ b/src/mesa/vbo/vbo_context.h @@ -63,7 +63,6 @@ struct vbo_context { /* These point into the above. TODO: remove. */ - struct gl_client_array *generic_currval; struct gl_client_array *mat_currval; /** Map VERT_ATTRIB_x to VBO_ATTRIB_y */ diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index 8a168043936..3f95410892e 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -1099,14 +1099,16 @@ void vbo_exec_vtx_init( struct vbo_exec_context *exec ) vbo->currval[VBO_ATTRIB_POS+i].BufferObj); } - memcpy(arrays + VERT_ATTRIB_GENERIC(0), vbo->generic_currval, + memcpy(arrays + VERT_ATTRIB_GENERIC(0), + &vbo->currval[VBO_ATTRIB_GENERIC0], VERT_ATTRIB_GENERIC_MAX * sizeof(arrays[0])); + for (i = 0; i < VERT_ATTRIB_GENERIC_MAX; ++i) { struct gl_client_array *array; array = &arrays[VERT_ATTRIB_GENERIC(i)]; array->BufferObj = NULL; _mesa_reference_buffer_object(ctx, &array->BufferObj, - vbo->generic_currval[i].BufferObj); + vbo->currval[VBO_ATTRIB_GENERIC0+i].BufferObj); } } diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 7278c39fa4b..60e18dbba58 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -434,7 +434,7 @@ recalculate_input_bindings(struct gl_context *ctx) * slots: */ for (i = MAT_ATTRIB_MAX; i < VERT_ATTRIB_GENERIC_MAX; i++) { - inputs[VERT_ATTRIB_GENERIC(i)] = &vbo->generic_currval[i]; + inputs[VERT_ATTRIB_GENERIC(i)] = &vbo->currval[VBO_ATTRIB_GENERIC0+i]; const_inputs |= VERT_BIT_GENERIC(i); } @@ -468,7 +468,7 @@ recalculate_input_bindings(struct gl_context *ctx) * slots: */ for (i = 0; i < VERT_ATTRIB_GENERIC_MAX; i++) { - inputs[VERT_ATTRIB_GENERIC(i)] = &vbo->generic_currval[i]; + inputs[VERT_ATTRIB_GENERIC(i)] = &vbo->currval[VBO_ATTRIB_GENERIC0+i]; const_inputs |= VERT_BIT_GENERIC(i); } @@ -505,7 +505,7 @@ recalculate_input_bindings(struct gl_context *ctx) if (vertexAttrib[VERT_ATTRIB_GENERIC(i)].Enabled) inputs[VERT_ATTRIB_GENERIC(i)] = &vertexAttrib[VERT_ATTRIB_GENERIC(i)]; else { - inputs[VERT_ATTRIB_GENERIC(i)] = &vbo->generic_currval[i]; + inputs[VERT_ATTRIB_GENERIC(i)] = &vbo->currval[VBO_ATTRIB_GENERIC0+i]; const_inputs |= VERT_BIT_GENERIC(i); } } diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c index 96ff2241ac4..570323a8f06 100644 --- a/src/mesa/vbo/vbo_exec_draw.c +++ b/src/mesa/vbo/vbo_exec_draw.c @@ -193,7 +193,8 @@ vbo_exec_bind_arrays( struct gl_context *ctx ) } for (attr = 0; attr < VERT_ATTRIB_GENERIC_MAX; attr++) { ASSERT(VERT_ATTRIB_GENERIC(attr) < Elements(exec->vtx.inputs)); - exec->vtx.inputs[VERT_ATTRIB_GENERIC(attr)] = &vbo->generic_currval[attr]; + exec->vtx.inputs[VERT_ATTRIB_GENERIC(attr)] = + &vbo->currval[VBO_ATTRIB_GENERIC0+attr]; } map = vbo->map_vp_arb; diff --git a/src/mesa/vbo/vbo_save.c b/src/mesa/vbo/vbo_save.c index dbe99edde05..040c9b7a95a 100644 --- a/src/mesa/vbo/vbo_save.c +++ b/src/mesa/vbo/vbo_save.c @@ -73,14 +73,16 @@ void vbo_save_init( struct gl_context *ctx ) vbo->currval[VBO_ATTRIB_POS+i].BufferObj); } - memcpy(arrays + VERT_ATTRIB_GENERIC(0), vbo->generic_currval, + memcpy(arrays + VERT_ATTRIB_GENERIC(0), + &vbo->currval[VBO_ATTRIB_GENERIC0], VERT_ATTRIB_GENERIC_MAX * sizeof(arrays[0])); + for (i = 0; i < VERT_ATTRIB_GENERIC_MAX; ++i) { struct gl_client_array *array; array = &arrays[VERT_ATTRIB_GENERIC(i)]; array->BufferObj = NULL; _mesa_reference_buffer_object(ctx, &array->BufferObj, - vbo->generic_currval[i].BufferObj); + vbo->currval[VBO_ATTRIB_GENERIC0+i].BufferObj); } } diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c index 669023cf061..4eac65a8fda 100644 --- a/src/mesa/vbo/vbo_save_draw.c +++ b/src/mesa/vbo/vbo_save_draw.c @@ -164,7 +164,8 @@ static void vbo_bind_vertex_list(struct gl_context *ctx, 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]; + save->inputs[VERT_ATTRIB_GENERIC(attr)] = + &vbo->currval[VBO_ATTRIB_GENERIC0+attr]; } map = vbo->map_vp_arb; -- 2.30.2