Mesa (master): i965: Use _MaxElement instead of index-calculated min/ max for VBO bounds.

Eric Anholt anholt at kemper.freedesktop.org
Wed Aug 12 18:31:51 UTC 2009


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

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Aug 11 12:59:09 2009 -0700

i965: Use _MaxElement instead of index-calculated min/max for VBO bounds.

---

 src/mesa/drivers/dri/i965/brw_draw_upload.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index 760b22f..4bdb373 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -383,7 +383,6 @@ static void brw_prepare_vertices(struct brw_context *brw)
       struct brw_vertex_element *input = brw->vb.enabled[i];
 
       input->element_size = get_size(input->glarray->Type) * input->glarray->Size;
-      input->count = input->glarray->StrideB ? max_index + 1 - min_index : 1;
 
       if (input->glarray->BufferObj->Name != 0) {
 	 struct intel_buffer_object *intel_buffer =
@@ -396,6 +395,7 @@ static void brw_prepare_vertices(struct brw_context *brw)
 	 dri_bo_reference(input->bo);
 	 input->offset = (unsigned long)input->glarray->Ptr;
 	 input->stride = input->glarray->StrideB;
+	 input->count = input->glarray->_MaxElement;
 
 	 /* This is a common place to reach if the user mistakenly supplies
 	  * a pointer in place of a VBO offset.  If we just let it go through,
@@ -411,6 +411,7 @@ static void brw_prepare_vertices(struct brw_context *brw)
 	  */
 	 assert(input->offset < input->bo->size);
       } else {
+	 input->count = input->glarray->StrideB ? max_index + 1 - min_index : 1;
 	 if (input->bo != NULL) {
 	    /* Already-uploaded vertex data is present from a previous
 	     * prepare_vertices, but we had to re-validate state due to
@@ -546,7 +547,7 @@ static void brw_emit_vertices(struct brw_context *brw)
                         input->offset + input->element_size);
           }
       } else
-          OUT_BATCH(brw->vb.max_index);
+          OUT_BATCH(input->count);
       OUT_BATCH(0); /* Instance data step rate */
    }
    ADVANCE_BATCH();




More information about the mesa-commit mailing list