Module: Mesa
Branch: master
Commit: 8c990de0d682bbedfd7e1988d4f8948ea99b0cc3
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8c990de0d682bbedfd7e1988d4f8948ea99b0cc3

Author: Marek Olšák <mar...@gmail.com>
Date:   Mon Apr 16 16:35:58 2012 +0200

vbo: remove vbo_context::generic_currval

Reviewed-by: Brian Paul <bri...@vmware.com>
Reviewed-by: Mathias Fröhlich <mathias.froehl...@web.de>

---

 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 2b31b62..33bd4f3 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 77010b8..b9d0086 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 8a16804..3f95410 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 7278c39..60e18db 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 96ff224..570323a 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 dbe99ed..040c9b7 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 669023c..4eac65a 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;
 

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to