From 528d100b80f0aaa5f4480c3e42004158763612e9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 4 Apr 2010 18:22:46 -0600 Subject: [PATCH] st/mesa: call pipe_context::draw_arrays/elements_instanced() --- src/mesa/state_tracker/st_draw.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index 7f45e3f5484..e0bb1a0af52 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -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); + } } } -- 2.30.2