[Mesa-dev] [PATCH 1/8] i965: Use the glarray _ElementSize that Mesa tracks for us.

Eric Anholt eric at anholt.net
Wed Jan 23 11:17:43 PST 2013


---
 src/mesa/drivers/dri/i965/brw_context.h     |    2 --
 src/mesa/drivers/dri/i965/brw_draw_upload.c |   10 ++++------
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index f3a3efe..620f09f 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -715,8 +715,6 @@ struct brw_vertex_element {
 
    /** The corresponding Mesa vertex attribute */
    gl_vert_attrib attrib;
-   /** Size of a complete element */
-   GLuint element_size;
    /** Offset of the first element within the buffer object */
    unsigned int offset;
 };
diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index 8e1b9bb..06a5886 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -380,8 +380,8 @@ copy_array_to_vbo_array(struct brw_context *brw,
     */
    if (src_stride == 0) {
       intel_upload_data(&brw->intel, element->glarray->Ptr,
-                        element->element_size,
-                        element->element_size,
+                        element->glarray->_ElementSize,
+                        element->glarray->_ElementSize,
 			&buffer->bo, &buffer->offset);
 
       buffer->stride = 0;
@@ -464,8 +464,6 @@ static void brw_prepare_vertices(struct brw_context *brw)
       const struct gl_client_array *glarray = input->glarray;
       int type_size = get_size(glarray->Type);
 
-      input->element_size = type_size * glarray->Size;
-
       if (_mesa_is_bufferobj(glarray->BufferObj)) {
 	 struct intel_buffer_object *intel_buffer =
 	    intel_buffer_object(glarray->BufferObj);
@@ -579,7 +577,7 @@ static void brw_prepare_vertices(struct brw_context *brw)
       struct brw_vertex_buffer *buffer = &brw->vb.buffers[j];
       if (upload[i]->glarray->InstanceDivisor == 0) {
          copy_array_to_vbo_array(brw, upload[i], min_index, max_index,
-                                 buffer, upload[i]->element_size);
+                                 buffer, upload[i]->glarray->_ElementSize);
       } else {
          /* This is an instanced attribute, since its InstanceDivisor
           * is not zero. Therefore, its data will be stepped after the
@@ -588,7 +586,7 @@ static void brw_prepare_vertices(struct brw_context *brw)
          uint32_t instanced_attr_max_index =
             (brw->num_instances - 1) / upload[i]->glarray->InstanceDivisor;
          copy_array_to_vbo_array(brw, upload[i], 0, instanced_attr_max_index,
-                                 buffer, upload[i]->element_size);
+                                 buffer, upload[i]->glarray->_ElementSize);
       }
       buffer->offset -= delta * buffer->stride;
       buffer->step_rate = upload[i]->glarray->InstanceDivisor;
-- 
1.7.10.4



More information about the mesa-dev mailing list