i965: Use the glarray _ElementSize that Mesa tracks for us.
authorEric Anholt <eric@anholt.net>
Wed, 23 Jan 2013 01:14:15 +0000 (17:14 -0800)
committerEric Anholt <eric@anholt.net>
Fri, 25 Jan 2013 17:40:22 +0000 (09:40 -0800)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/brw_draw_upload.c

index f3a3efe..620f09f 100644 (file)
@@ -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;
 };
index 8e1b9bb..06a5886 100644 (file)
@@ -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;