Hi,

while playing with r300 driver I've stumbled upon a problem with splitting 
vertexes.

Let's say we get rendering operation where number of indexes in index buffer 
is 80000 and max_index is 20000. We are calling vbo_split_prims because number 
of indexes exceeds hw limit.
In flush_vertex (vbo_split_inplace.c) function the split->ib is not null, so 
the max_index (20000) won't be changed. In the end the draw_prims functions 
will be called with inappropriate max_index number.

I'm seeing this behaviour with UT2004 demo on current r300 driver.

I think the solution would be to always calculate min/max_index numbers just 
like in the !split->ib path but I want to be sure before I commit the patch.

Any comments?

Regards,
Maciej Cencora
diff --git a/src/mesa/vbo/vbo_split_inplace.c b/src/mesa/vbo/vbo_split_inplace.c
index 3ed6b34..f51e40c 100644
--- a/src/mesa/vbo/vbo_split_inplace.c
+++ b/src/mesa/vbo/vbo_split_inplace.c
@@ -1,4 +1,3 @@
-
 /*
  * Mesa 3-D graphics library
  * Version:  6.5
@@ -63,35 +62,23 @@ static void flush_vertex( struct split_context *split )
    if (!split->dstprim_nr) 
       return;
 
-   if (split->ib) {
-      /* This should basically be multipass rendering over the same
-       * unchanging set of VBO's.  Would like the driver not to
-       * re-upload the data, or swtnl not to re-transform the
-       * vertices.
-       */
-      assert(split->max_index - split->min_index < split->limits->max_verts);
-      min_index = split->min_index;
-      max_index = split->max_index;
-   }
-   else {
-      /* Non-indexed rendering.  Cannot assume that the primitives are
-       * ordered by increasing vertex, because of entrypoints like
-       * MultiDrawArrays.
-       */
-      GLuint i;
-      min_index = split->dstprim[0].start;
-      max_index = min_index + split->dstprim[0].count - 1;
+   /* Non-indexed rendering.  Cannot assume that the primitives are
+    * ordered by increasing vertex, because of entrypoints like
+    * MultiDrawArrays.
+    */
+   GLuint i;
+   min_index = split->dstprim[0].start;
+   max_index = min_index + split->dstprim[0].count - 1;
 
-      for (i = 1; i < split->dstprim_nr; i++) {
-	 GLuint tmp_min = split->dstprim[i].start;
-	 GLuint tmp_max = tmp_min + split->dstprim[i].count - 1;
+   for (i = 1; i < split->dstprim_nr; i++) {
+      GLuint tmp_min = split->dstprim[i].start;
+      GLuint tmp_max = tmp_min + split->dstprim[i].count - 1;
 
-	 if (tmp_min < min_index) 
-	    min_index = tmp_min;
+      if (tmp_min < min_index)
+	 min_index = tmp_min;
 
-	 if (tmp_max > max_index) 
-	    max_index = tmp_max;
-      }
+      if (tmp_max > max_index)
+	 max_index = tmp_max;
    }
 
    assert(max_index >= min_index);
------------------------------------------------------------------------------
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to