st/mesa: call pipe_context::draw_arrays/elements_instanced()
authorBrian Paul <brianp@vmware.com>
Mon, 5 Apr 2010 00:22:46 +0000 (18:22 -0600)
committerBrian Paul <brianp@vmware.com>
Mon, 5 Apr 2010 01:05:39 +0000 (19:05 -0600)
src/mesa/state_tracker/st_draw.c

index 7f45e3f5484c2832808e4c7491df4ecd99ccf4f6..e0bb1a0af523bc597dbc6ca2188c5ab5f052b285 100644 (file)
@@ -669,9 +669,17 @@ st_draw_vbo(GLcontext *ctx,
          for (i = 0; i < nr_prims; i++) {
             prim = translate_prim( ctx, prims[i].mode );
             
-            pipe->draw_elements(pipe, indexBuf, indexSize,
-                                prim,
-                                prims[i].start + indexOffset, prims[i].count);
+            if (prims[i].num_instances == 1) {
+               pipe->draw_elements(pipe, indexBuf, indexSize, prim,
+                                   prims[i].start + indexOffset,
+                                   prims[i].count);
+            }
+            else {
+               pipe->draw_elements_instanced(pipe, indexBuf, indexSize, prim,
+                                             prims[i].start + indexOffset,
+                                             prims[i].count,
+                                             0, prims[i].num_instances);
+            }
          }
       }
 
@@ -685,7 +693,14 @@ st_draw_vbo(GLcontext *ctx,
       for (i = 0; i < nr_prims; i++) {
          prim = translate_prim( ctx, prims[i].mode );
 
-         pipe->draw_arrays(pipe, prim, prims[i].start, prims[i].count);
+         if (prims[i].num_instances == 1) {
+            pipe->draw_arrays(pipe, prim, prims[i].start, prims[i].count);
+         }
+         else {
+            pipe->draw_arrays_instanced(pipe, prim, prims[i].start,
+                                        prims[i].count,
+                                        0, prims[i].num_instances);
+         }
       }
    }