Mesa (master): draw: Implement draw_arrays() in terms of draw_arrays_instanced().

Michał Król michal at kemper.freedesktop.org
Thu Jan 14 09:56:08 PST 2010


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

Author: Michal Krol <michal at vmware.com>
Date:   Wed Dec 30 18:54:04 2009 +0100

draw: Implement draw_arrays() in terms of draw_arrays_instanced().

---

 src/gallium/auxiliary/draw/draw_pt.c |   44 ++++++++++++++--------------------
 1 files changed, 18 insertions(+), 26 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c
index 1217b9e..a5ddec5 100644
--- a/src/gallium/auxiliary/draw/draw_pt.c
+++ b/src/gallium/auxiliary/draw/draw_pt.c
@@ -280,20 +280,33 @@ void
 draw_arrays(struct draw_context *draw, unsigned prim,
             unsigned start, unsigned count)
 {
-   unsigned reduced_prim = u_reduced_prim(prim);
+   draw_arrays_instanced(draw, prim, start, count, 0, 1);
+}
+
+void
+draw_arrays_instanced(struct draw_context *draw,
+                      unsigned mode,
+                      unsigned start,
+                      unsigned count,
+                      unsigned startInstance,
+                      unsigned instanceCount)
+{
+   unsigned reduced_prim = u_reduced_prim(mode);
+   unsigned instance;
+
    if (reduced_prim != draw->reduced_prim) {
-      draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE );
+      draw_do_flush(draw, DRAW_FLUSH_STATE_CHANGE);
       draw->reduced_prim = reduced_prim;
    }
 
    if (0)
-      draw_print_arrays(draw, prim, start, MIN2(count, 20));
+      draw_print_arrays(draw, mode, start, MIN2(count, 20));
 
 #if 0
    {
       int i;
-      debug_printf("draw_arrays(prim=%u start=%u count=%u):\n",
-                   prim, start, count);
+      debug_printf("draw_arrays(mode=%u start=%u count=%u):\n",
+                   mode, start, count);
       tgsi_dump(draw->vs.vertex_shader->state.tokens, 0);
       debug_printf("Elements:\n");
       for (i = 0; i < draw->pt.nr_vertex_elements; i++) {
@@ -311,27 +324,6 @@ draw_arrays(struct draw_context *draw, unsigned prim,
    }
 #endif
 
-   /* drawing done here: */
-   draw->instance_id = 0;
-   draw_pt_arrays(draw, prim, start, count);
-}
-
-void
-draw_arrays_instanced(struct draw_context *draw,
-                      unsigned mode,
-                      unsigned start,
-                      unsigned count,
-                      unsigned startInstance,
-                      unsigned instanceCount)
-{
-   unsigned reduced_prim = u_reduced_prim(mode);
-   unsigned instance;
-
-   if (reduced_prim != draw->reduced_prim) {
-      draw_do_flush(draw, DRAW_FLUSH_STATE_CHANGE);
-      draw->reduced_prim = reduced_prim;
-   }
-
    for (instance = 0; instance < instanceCount; instance++) {
       draw->instance_id = instance + startInstance;
       draw_pt_arrays(draw, mode, start, count);



More information about the mesa-commit mailing list