r300g: fix fallback for misaligned ushort indices with num vertices >= 65535
authorMarek Olšák <maraeo@gmail.com>
Mon, 14 Feb 2011 09:05:52 +0000 (10:05 +0100)
committerMarek Olšák <maraeo@gmail.com>
Mon, 14 Feb 2011 10:43:14 +0000 (11:43 +0100)
src/gallium/drivers/r300/r300_render.c

index fddabee7b24fca299c5231ed579ef24340be99fd..051f434d428c221bd75c20eaeac239dad2ab69ef 100644 (file)
@@ -615,7 +615,11 @@ static void r300_draw_range_elements(struct pipe_context* pipe,
                                minIndex, maxIndex, mode, start, count, indices3);
     } else {
         do {
-            short_count = MIN2(count, 65534);
+            if (indexSize == 2 && (start & 1))
+                short_count = MIN2(count, 65535);
+            else
+                short_count = MIN2(count, 65534);
+
             r300_emit_draw_elements(r300, indexBuffer, indexSize,
                                      minIndex, maxIndex,
                                      mode, start, short_count, indices3);